make it a setting to switch between ACME v1 and v2

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p) 2018-01-09 14:50:52 +01:00
parent 9aaadb1f8b
commit d40d1f30b6
5 changed files with 33 additions and 4 deletions

View File

@ -100,6 +100,19 @@ return array(
'cronmodule' => 'froxlor/letsencrypt',
'save_method' => 'storeSettingField'
),
'system_leapiversion' => array(
'label' => $lng['serversettings']['leapiversion'],
'settinggroup' => 'system',
'varname' => 'leapiversion',
'type' => 'option',
'default' => '1',
'option_mode' => 'one',
'option_options' => array(
'1' => 'ACME v1',
'2' => 'ACME v2'
),
'save_method' => 'storeSettingField'
),
'system_letsencryptacmeconf' => array(
'label' => $lng['serversettings']['letsencryptacmeconf'],
'settinggroup' => 'system',
@ -117,8 +130,8 @@ return array(
'default' => 'testing',
'option_mode' => 'one',
'option_options' => array(
'testing' => 'https://acme-staging.api.letsencrypt.org (Test)',
'production' => 'https://acme-v01.api.letsencrypt.org (Live)'
'testing' => 'https://acme-staging'.(Settings::Get('system.leapiversion') == '2' ? '-v02' : '').'.api.letsencrypt.org (Test)',
'production' => 'https://acme-v0'.Settings::Get('system.leapiversion').'.api.letsencrypt.org (Live)'
),
'save_method' => 'storeSettingField'
),

View File

@ -534,6 +534,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('system', 'letsencryptkeysize', '4096'),
('system', 'letsencryptreuseold', 0),
('system', 'leenabled', '0'),
('system', 'leapiversion', '1'),
('system', 'backupenabled', '0'),
('system', 'dnsenabled', '0'),
('system', 'dns_server', 'bind'),
@ -588,7 +589,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('panel', 'password_special_char', '!?<>§$%+#=@'),
('panel', 'customer_hide_options', ''),
('panel', 'version', '0.9.38.8'),
('panel', 'db_version', '201801080');
('panel', 'db_version', '201801090');
DROP TABLE IF EXISTS `panel_tasks`;

View File

@ -3725,3 +3725,12 @@ if (isDatabaseVersion('201801070')) {
updateToDbVersion('201801080');
}
if (isDatabaseVersion('201801080')) {
showUpdateStep("Adding new setting for Let's Encrypt ACME version");
Settings::AddNew('system.leapiversion', '1');
lastStepStatus(0);
updateToDbVersion('201801090');
}

View File

@ -19,7 +19,7 @@
$version = '0.9.38.8';
// Database version (YYYYMMDDC where C is a daily counter)
$dbversion = '201801080';
$dbversion = '201801090';
// Distribution branding-tag (used for Debian etc.)
$branding = '';

View File

@ -20,6 +20,12 @@ if (! defined('MASTER_CRONJOB'))
*
*/
if (Settings::Get('system.leapiversion') == '2') {
// use ACME v2 is specified
require_once __DIR__ . '/cron_letsencrypt_v2.php';
exit;
}
$cronlog->logAction(CRON_ACTION, LOG_INFO, "Updating Let's Encrypt certificates");
if (! extension_loaded('curl')) {