From e08928d2b7d9ca1fd93bad8975189bba2abf55c3 Mon Sep 17 00:00:00 2001 From: Marius Burkard Date: Wed, 31 Mar 2021 10:48:50 +0200 Subject: [PATCH 1/3] - enable acme.sh upgrade / set default server to letsencrypt --- install/lib/installer_base.lib.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index 42a3b1792a..8d9ee9bf7e 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -51,6 +51,21 @@ class installer_base { return ($val == 0 ? true : false); } + private function update_acme() { + $acme = explode("\n", shell_exec('which /usr/local/ispconfig/server/scripts/acme.sh /root/.acme.sh/acme.sh')); + $acme = reset($acme); + $val = 0; + + if($acme) { + $cmd = $acme . ' --upgrade --auto-upgrade ; ' . $acme . ' --set-default-ca --server letsencrypt'; + $ret = null; + $val = 0; + exec($cmd. ' 2>&1', $ret, $val); + } + + return ($val == 0 ? true : false); + } + //: TODO Implement the translation function and language files for the installer. public function lng($text) { return $text; @@ -2923,6 +2938,11 @@ class installer_base { } } + if($acme && is_executable($acme)) { + // we do this even on install to enable automatic updates + $this->update_acme(); + } + $restore_conf_symlink = false; // we only need this for apache, so use fixed conf index -- GitLab From 30c922c3d5c286260d5dd5c94ea29a3e8d15f922 Mon Sep 17 00:00:00 2001 From: Marius Burkard Date: Wed, 31 Mar 2021 10:53:20 +0200 Subject: [PATCH 2/3] - update for acme.sh if installed (also if not re-creating cert for ispc) --- install/install.php | 3 +++ install/lib/installer_base.lib.php | 10 ++++------ install/update.php | 3 +++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/install/install.php b/install/install.php index 7bc3836223..a5233744c8 100644 --- a/install/install.php +++ b/install/install.php @@ -597,6 +597,9 @@ if(!$issue_asked) { } } +// update acme.sh if installed +$inst->update_acme(); + if($conf['services']['web'] == true) { //** Configure apps vhost swriteln('Configuring Apps vhost'); diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index 8d9ee9bf7e..1664ddc210 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -56,7 +56,7 @@ class installer_base { $acme = reset($acme); $val = 0; - if($acme) { + if($acme && is_executable($acme)) { $cmd = $acme . ' --upgrade --auto-upgrade ; ' . $acme . ' --set-default-ca --server letsencrypt'; $ret = null; $val = 0; @@ -2932,17 +2932,15 @@ class installer_base { $acme = reset($acme); if($acme && is_executable($acme)) { swriteln('Installed acme.sh and using it for certificate creation during install.'); + + // we do this even on install to enable automatic updates + $this->update_acme(); } else { swriteln('Failed installing acme.sh. Will not be able to issue certificate during install.'); } } } - if($acme && is_executable($acme)) { - // we do this even on install to enable automatic updates - $this->update_acme(); - } - $restore_conf_symlink = false; // we only need this for apache, so use fixed conf index diff --git a/install/update.php b/install/update.php index e821eac203..0122f27678 100644 --- a/install/update.php +++ b/install/update.php @@ -566,6 +566,9 @@ if(!$issue_asked) { } } +// update acme.sh if installed +$inst->update_acme(); + $inst->install_ispconfig(); // Cleanup -- GitLab From fcff3cd195ad9ac917bf5b050413647ecca4b3da Mon Sep 17 00:00:00 2001 From: Marius Burkard Date: Wed, 31 Mar 2021 17:50:24 +0000 Subject: [PATCH 3/3] Apply 1 suggestion(s) to 1 file(s) --- install/lib/installer_base.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index 1664ddc210..ae2b288cdb 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -51,7 +51,7 @@ class installer_base { return ($val == 0 ? true : false); } - private function update_acme() { + public function update_acme() { $acme = explode("\n", shell_exec('which /usr/local/ispconfig/server/scripts/acme.sh /root/.acme.sh/acme.sh')); $acme = reset($acme); $val = 0; -- GitLab