Skip to content

Commit

Permalink
Add global acme reload command (froxlor#822)
Browse files Browse the repository at this point in the history
  • Loading branch information
FliegenKLATSCH committed Apr 18, 2022
1 parent 989b4fe commit 21ee2d2
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 1 deletion.
8 changes: 8 additions & 0 deletions actions/admin/settings/131.ssl.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@
'default' => '/root/.acme.sh/acme.sh',
'save_method' => 'storeSettingField'
),
'system_acmereloadcmd' => array(
'label' => $lng['serversettings']['acmereloadcmd'],
'settinggroup' => 'system',
'varname' => 'acmereloadcmd',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField'
),
'system_letsencryptacmeconf' => array(
'label' => $lng['serversettings']['letsencryptacmeconf'],
'settinggroup' => 'system',
Expand Down
3 changes: 2 additions & 1 deletion install/froxlor.sql
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ opcache.validate_timestamps'),
('system', 'froxlorusergroup', ''),
('system', 'froxlorusergroup_gid', ''),
('system', 'acmeshpath', '/root/.acme.sh/acme.sh'),
('system', 'acmereloadcmd', ''),
('api', 'enabled', '0'),
('2fa', 'enabled', '1'),
('panel', 'decimal_places', '4'),
Expand Down Expand Up @@ -724,7 +725,7 @@ opcache.validate_timestamps'),
('panel', 'logo_overridetheme', '0'),
('panel', 'logo_overridecustom', '0'),
('panel', 'version', '0.10.34.1'),
('panel', 'db_version', '202112310');
('panel', 'db_version', '202204180');


DROP TABLE IF EXISTS `panel_tasks`;
Expand Down
7 changes: 7 additions & 0 deletions install/updates/froxlor/0.10/update_0.10.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -980,3 +980,10 @@
showUpdateStep("Updating from 0.10.34 to 0.10.34.1", false);
\Froxlor\Froxlor::updateToVersion('0.10.34.1');
}

if (\Froxlor\Froxlor::isDatabaseVersion('202112310')) {
showUpdateStep("Add setting for acme.sh reload command", true);
Settings::AddNew("system.acmereloadcmd", '');
lastStepStatus(0);
\Froxlor\Froxlor::updateToDbVersion('202204180');
}
4 changes: 4 additions & 0 deletions lib/Froxlor/Cron/Http/LetsEncrypt/AcmeSh.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,10 @@ private static function runAcmeSh(array $certrow, array $domains, &$cronlog = nu
if (defined('CRON_DEBUG_FLAG')) {
$acmesh_cmd .= " --debug";
}
$acmeReloadCmd = Settings::Get('system.acmereloadcmd');
if (!empty($acmeReloadCmd)) {
$acmesh_cmd .= " --reloadcmd \"$acmeReloadCmd\"";
}

$acme_result = \Froxlor\FileDir::safe_exec($acmesh_cmd);
// debug output of acme.sh run
Expand Down
2 changes: 2 additions & 0 deletions lng/english.lng.php
Original file line number Diff line number Diff line change
Expand Up @@ -2138,3 +2138,5 @@
$lng['error']['pathmustberelative'] = 'The user does not have the permission to specify directories outside the customers home-directory. Please specify a relative path (no leading /).';
$lng['serversettings']['acmeshpath']['title'] = 'Path to acme.sh';
$lng['serversettings']['acmeshpath']['description'] = 'Set this to where acme.sh is installed to, including the acme.sh script<br>Default is <b>/root/.acme.sh/acme.sh</b>';
$lng['serversettings']['acmereloadcmd']['title'] = 'ACME reload command';
$lng['serversettings']['acmereloadcmd']['description'] = 'The reload command is passed to acme.sh --reloadcmd and called for each received certificate. Example: <i>systemctl reload dovecot.service postfix.service</i>';
2 changes: 2 additions & 0 deletions lng/german.lng.php
Original file line number Diff line number Diff line change
Expand Up @@ -1784,3 +1784,5 @@
$lng['error']['pathmustberelative'] = 'Der Benutzer hat nicht die benötigten Berechtigungen, um Pfade außerhalb des Kunden-Heimatverzeichnisses anzugeben. Bitte einen relativen Pfad angeben (kein führendes /).';
$lng['serversettings']['acmeshpath']['title'] = 'Pfad zu acme.sh';
$lng['serversettings']['acmeshpath']['description'] = 'Installationspfad zu acme.sh, inklusive acme.sh Script<br>Standard ist <b>/root/.acme.sh/acme.sh</b>';
$lng['serversettings']['acmereloadcmd']['title'] = 'ACME Reload Kommando';
$lng['serversettings']['acmereloadcmd']['description'] = 'Das ACME Reload Kommando wird zu acme.sh --reloadcmd weitergegeben und für jedes empfangene Zertifikat ausgeführt. Beispiel: <i>systemctl reload dovecot.service postfix.service</i>';

0 comments on commit 21ee2d2

Please sign in to comment.