inserttask(1) after updating certificates, updated install/update - SQL
Signed-off-by: Florian Aders <eleras@froxlor.org>
This commit is contained in:
@@ -194,8 +194,8 @@ CREATE TABLE `panel_customers` (
|
|||||||
`theme` varchar(255) NOT NULL default 'Sparkle',
|
`theme` varchar(255) NOT NULL default 'Sparkle',
|
||||||
`custom_notes` text,
|
`custom_notes` text,
|
||||||
`custom_notes_show` tinyint(1) NOT NULL default '0',
|
`custom_notes_show` tinyint(1) NOT NULL default '0',
|
||||||
`lepublickey` text DEFAULT NULL,
|
`lepublickey` mediumtext DEFAULT NULL,
|
||||||
`leprivatekey` text DEFAULT NULL,
|
`leprivatekey` mediumtext DEFAULT NULL,
|
||||||
PRIMARY KEY (`customerid`),
|
PRIMARY KEY (`customerid`),
|
||||||
UNIQUE KEY `loginname` (`loginname`)
|
UNIQUE KEY `loginname` (`loginname`)
|
||||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
|
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||||
@@ -249,6 +249,7 @@ CREATE TABLE `panel_domains` (
|
|||||||
`mod_fcgid_starter` int(4) default '-1',
|
`mod_fcgid_starter` int(4) default '-1',
|
||||||
`mod_fcgid_maxrequests` int(4) default '-1',
|
`mod_fcgid_maxrequests` int(4) default '-1',
|
||||||
`ismainbutsubto` int(11) unsigned NOT NULL default '0',
|
`ismainbutsubto` int(11) unsigned NOT NULL default '0',
|
||||||
|
`letsencrypt` tinyint(1) NOT NULL default '0',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `customerid` (`customerid`),
|
KEY `customerid` (`customerid`),
|
||||||
KEY `parentdomain` (`parentdomainid`),
|
KEY `parentdomain` (`parentdomainid`),
|
||||||
@@ -826,7 +827,6 @@ CREATE TABLE IF NOT EXISTS `domain_ssl_settings` (
|
|||||||
`ssl_key_file` mediumtext NOT NULL,
|
`ssl_key_file` mediumtext NOT NULL,
|
||||||
`ssl_ca_file` mediumtext,
|
`ssl_ca_file` mediumtext,
|
||||||
`ssl_cert_chainfile` mediumtext,
|
`ssl_cert_chainfile` mediumtext,
|
||||||
`letsencrypt` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`expirationdate` datetime DEFAULT NULL,
|
`expirationdate` datetime DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
|
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||||
|
|||||||
@@ -3025,12 +3025,11 @@ if (isFroxlorVersion('0.9.34.2')) {
|
|||||||
|
|
||||||
showUpdateStep("Updating from 0.9.34.2 to 0.9.35-dev1");
|
showUpdateStep("Updating from 0.9.34.2 to 0.9.35-dev1");
|
||||||
lastStepStatus(0);
|
lastStepStatus(0);
|
||||||
showUpdateStep("Adding Let's encrypt - certificate fields");
|
showUpdateStep("Adding Let's Encrypt - certificate fields");
|
||||||
Database::query("ALTER TABLE `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."` ADD `letsencrypt` INT NOT NULL DEFAULT '0' AFTER `ssl_cert_chainfile`");
|
Database::query("ALTER TABLE `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."` ADD `expirationdate` DATETIME NULL AFTER `ssl_cert_chainfile`;");
|
||||||
Database::query("ALTER TABLE `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."` ADD `expirationdate` DATETIME NULL AFTER `letsencrypt`;");
|
Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` ADD `lepublickey` MEDIUMTEXT DEFAULT NULL AFTER `custom_notes_show`");
|
||||||
Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` ADD `lepublickey` TEXT DEFAULT NULL AFTER `custom_notes_show`");
|
Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` ADD `leprivatekey` MEDIUMTEXT DEFAULT NULL AFTER `lepublickey`;");
|
||||||
Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` ADD `leprivatekey` TEXT DEFAULT NULL AFTER `lepublickey`;");
|
Database::query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` ADD `letsencrypt` TINYINT(1) NOT NULL DEFAULT '0' AFTER `ismainbutsubto`;");
|
||||||
Database::query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` ADD `letsencrypt` INT NOT NULL DEFAULT '0' AFTER `ismainbutsubto`;");
|
|
||||||
Settings::AddNew("system.leprivatekey", 'unset');
|
Settings::AddNew("system.leprivatekey", 'unset');
|
||||||
Settings::AddNew("system.lepublickey", 'unset');
|
Settings::AddNew("system.lepublickey", 'unset');
|
||||||
lastStepStatus(0);
|
lastStepStatus(0);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ $upd_stmt = Database::prepare("
|
|||||||
UPDATE `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."` SET `ssl_cert_file` = :crt, `ssl_key_file` = :key, `ssl_ca_file` = :ca, expirationdate = :expirationdate WHERE `id` = :id
|
UPDATE `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."` SET `ssl_cert_file` = :crt, `ssl_key_file` = :key, `ssl_ca_file` = :ca, expirationdate = :expirationdate WHERE `id` = :id
|
||||||
");
|
");
|
||||||
|
|
||||||
|
$changedetected = 0;
|
||||||
while ($certrow = $certificates_stmt->fetch(PDO::FETCH_ASSOC)) {
|
while ($certrow = $certificates_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
|
||||||
// Only renew let's encrypt certificate for domains where a documentroot
|
// Only renew let's encrypt certificate for domains where a documentroot
|
||||||
@@ -81,6 +82,9 @@ while ($certrow = $certificates_stmt->fetch(PDO::FETCH_ASSOC)) {
|
|||||||
'expirationdate' => date('Y-m-d H:i:s', $newcert['validTo_time_t']),
|
'expirationdate' => date('Y-m-d H:i:s', $newcert['validTo_time_t']),
|
||||||
'id' => $certrow['id'])
|
'id' => $certrow['id'])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$changedetected = 1;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
fwrite($debugHandler, 'letsencrypt exception: ' . $e->getMessage() . "\n");
|
fwrite($debugHandler, 'letsencrypt exception: ' . $e->getMessage() . "\n");
|
||||||
}
|
}
|
||||||
@@ -88,3 +92,9 @@ while ($certrow = $certificates_stmt->fetch(PDO::FETCH_ASSOC)) {
|
|||||||
fwrite($debugHandler, 'letsencrypt skipped because documentroot ' . $certrow['documentroot'] . ' does not exist' . "\n");
|
fwrite($debugHandler, 'letsencrypt skipped because documentroot ' . $certrow['documentroot'] . ' does not exist' . "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we have a change in a certificate, we need to update the webserver - configs
|
||||||
|
// This is easiest done by just creating a new task ;)
|
||||||
|
if ($changedetected) {
|
||||||
|
inserttask(1);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user