Fix service status refresh, DNS zones, Docker page, SSL manager, input styling, updates

- Service status: data-svc-status/data-svc-dot attrs + refreshSvcStatus() updates in-place after restart/stop/start
- svc-check endpoint: lightweight is-active poll for single service
- Docker page: fix function signature (was docker(el), now returns HTML)
- DNS zones: fix records response (array not object), fix add-record content field, fix delete-zone accept zone_id
- DNS create-zone: allow admin to create zones without account_id
- SSL manager: add Generate CSR modal (openssl req), Upload Custom SSL modal, explain both options
- nova.css: add input:not([type]), date/search/tel/time types, .form-control to styling selector; fix date picker icon
- Updates: fix panel-up check (was fsockopen on HTTPS port, now curl -sk); add set_time_limit(180/300)
- apply-os-update: set_time_limit(300)
- DB engine manager: fix duplicate INSERT line

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-08 11:56:14 +00:00
parent 5ef458dfb0
commit 99eb8ede67
5 changed files with 196 additions and 66 deletions
+28
View File
@@ -31,6 +31,34 @@ match ($action) {
Response::success($result, "SSL certificate issued for $domain");
})(),
'generate-csr' => (function() use ($body, $accountId) {
$domain = preg_replace('/[^a-zA-Z0-9\-\.]/', '', trim($body['domain'] ?? ''));
$country = preg_replace('/[^A-Z]/', '', strtoupper(substr(trim($body['country'] ?? 'US'), 0, 2)));
$state = substr(trim($body['state'] ?? 'State'), 0, 64);
$city = substr(trim($body['city'] ?? 'City'), 0, 64);
$org = substr(trim($body['org'] ?? 'Organization'), 0, 64);
if (!$domain) Response::error("Domain required");
$keyFile = tempnam('/tmp', 'ncpx_key_');
$csrFile = tempnam('/tmp', 'ncpx_csr_');
$subj = "/C={$country}/ST={$state}/L={$city}/O={$org}/CN={$domain}";
$sanConf = "[req]\ndistinguished_name=req\n[san]\nsubjectAltName=DNS:{$domain},DNS:www.{$domain}";
$confFile = tempnam('/tmp', 'ncpx_conf_');
file_put_contents($confFile, $sanConf);
shell_exec("openssl req -newkey rsa:2048 -nodes -keyout " . escapeshellarg($keyFile)
. " -out " . escapeshellarg($csrFile)
. " -subj " . escapeshellarg($subj)
. " -reqexts san -config " . escapeshellarg($confFile) . " 2>/dev/null");
$csr = file_exists($csrFile) ? trim(file_get_contents($csrFile)) : '';
$key = file_exists($keyFile) ? trim(file_get_contents($keyFile)) : '';
foreach ([$keyFile, $csrFile, $confFile] as $f) { @unlink($f); }
if (!$csr || !$key) Response::error("OpenSSL CSR generation failed — is openssl installed?");
Response::success(['csr' => $csr, 'private_key' => $key, 'domain' => $domain], 'CSR generated');
})(),
'install-custom' => (function() use ($body, $accountId) {
$domain = trim($body['domain'] ?? '');
$cert = trim($body['cert'] ?? '');