From 75bc2d6f2173ce2f9a126b116df31218272c15e2 Mon Sep 17 00:00:00 2001 From: Hj Ahmad Rasyid Hj Ismail Date: Sat, 30 May 2020 11:56:51 +0200 Subject: [PATCH 1/5] Update letsencrypt_renew_hook.sh as dovecot-imapd is just dovecot in Red Hat / Centos as advised in https://git.ispconfig.org/ms217. --- server/scripts/letsencrypt_renew_hook.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/scripts/letsencrypt_renew_hook.sh b/server/scripts/letsencrypt_renew_hook.sh index 927ea59697..07881fda03 100644 --- a/server/scripts/letsencrypt_renew_hook.sh +++ b/server/scripts/letsencrypt_renew_hook.sh @@ -20,7 +20,7 @@ lelive=/etc/letsencrypt/live/$(hostname -f); if [ -d "$lelive" ]; then if [ rpm -q pure-ftpd-mysql ]; then service pure-ftpd-mysql restart; fi if [ rpm -q monit ]; then service monit restart; fi if [ rpm -q postfix ]; then service postfix restart; fi - if [ rpm -q dovecot-imapd ]; then service dovecot restart; fi + if [ rpm -q dovecot ]; then service dovecot restart; fi if [ rpm -q mysql ]; then service mysql restart; fi if [ rpm -q mariadb ]; then service mysql restart; fi if [ rpm -q nginx ]; then service nginx restart; fi -- GitLab From cb56b2ce8ce4a84a62c50baf12e432c1c3a5a293 Mon Sep 17 00:00:00 2001 From: Hj Ahmad Rasyid Hj Ismail Date: Sat, 30 May 2020 12:32:41 +0200 Subject: [PATCH 2/5] Update installer_base.lib.php as ISPConfig can be installed from various position and not limited to /tmp/ as advised in https://git.ispconfig.org/ispconfig/ispconfig3/-/merge_requests/904/#note_72907 --- install/lib/installer_base.lib.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index b18f5baf2b..8312f0d1a3 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -2083,12 +2083,12 @@ class installer_base { // This script is needed earlier to check and open http port 80 or standalone might fail // Make executable and temporary symlink latest letsencrypt pre, post and renew hook script before install - if (file_exists('/tmp/ispconfig3_install/server/scripts/letsencrypt_pre_hook.sh')) - symlink('/tmp/ispconfig3_install/server/scripts/letsencrypt_pre_hook.sh', '/usr/local/bin/letsencrypt_pre_hook.sh'); - if (file_exists('/tmp/ispconfig3_install/server/scripts/letsencrypt_post_hook.sh')) - symlink('/tmp/ispconfig3_install/server/scripts/letsencrypt_post_hook.sh', '/usr/local/bin/letsencrypt_post_hook.sh'); - if (file_exists('/tmp/ispconfig3_install/server/scripts/letsencrypt_renew_hook.sh')) - symlink('/tmp/ispconfig3_install/server/scripts/letsencrypt_renew_hook.sh', '/usr/local/bin/letsencrypt_renew_hook.sh'); + if (file_exists($conf['ispconfig_install_dir'].'/server/scripts/letsencrypt_pre_hook.sh')) + symlink($conf['ispconfig_install_dir'].'/server/scripts/letsencrypt_pre_hook.sh', '/usr/local/bin/letsencrypt_pre_hook.sh'); + if (file_exists($conf['ispconfig_install_dir'].'/server/scripts/letsencrypt_post_hook.sh')) + symlink($conf['ispconfig_install_dir'].'/server/scripts/letsencrypt_post_hook.sh', '/usr/local/bin/letsencrypt_post_hook.sh'); + if (file_exists($conf['ispconfig_install_dir'].'/server/scripts/letsencrypt_renew_hook.sh')) + symlink($conf['ispconfig_install_dir'].'/server/scripts/letsencrypt_renew_hook.sh', '/usr/local/bin/letsencrypt_renew_hook.sh'); chown('/usr/local/bin/letsencrypt_pre_hook.sh', 'root'); chown('/usr/local/bin/letsencrypt_post_hook.sh', 'root'); chown('/usr/local/bin/letsencrypt_renew_hook.sh', 'root'); -- GitLab From b6830ef1e12f00468fc312519ffd17ecf0baac19 Mon Sep 17 00:00:00 2001 From: Hj Ahmad Rasyid Hj Ismail Date: Sun, 31 May 2020 07:19:05 +0200 Subject: [PATCH 3/5] Update installer_base.lib.php as $conf['ispconfig_install_dir'] is not the install directory and will only be available after install. I changed it with dirname(getcwd()) which should get the ISPCOnfig main install directory. --- install/lib/installer_base.lib.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index 8312f0d1a3..b961726ecf 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -2083,12 +2083,12 @@ class installer_base { // This script is needed earlier to check and open http port 80 or standalone might fail // Make executable and temporary symlink latest letsencrypt pre, post and renew hook script before install - if (file_exists($conf['ispconfig_install_dir'].'/server/scripts/letsencrypt_pre_hook.sh')) - symlink($conf['ispconfig_install_dir'].'/server/scripts/letsencrypt_pre_hook.sh', '/usr/local/bin/letsencrypt_pre_hook.sh'); - if (file_exists($conf['ispconfig_install_dir'].'/server/scripts/letsencrypt_post_hook.sh')) - symlink($conf['ispconfig_install_dir'].'/server/scripts/letsencrypt_post_hook.sh', '/usr/local/bin/letsencrypt_post_hook.sh'); - if (file_exists($conf['ispconfig_install_dir'].'/server/scripts/letsencrypt_renew_hook.sh')) - symlink($conf['ispconfig_install_dir'].'/server/scripts/letsencrypt_renew_hook.sh', '/usr/local/bin/letsencrypt_renew_hook.sh'); + if (file_exists(dirname(getcwd()) . '/server/scripts/letsencrypt_pre_hook.sh')) + symlink(dirname(getcwd()) . '/server/scripts/letsencrypt_pre_hook.sh', '/usr/local/bin/letsencrypt_pre_hook.sh'); + if (file_exists(dirname(getcwd()) . '/server/scripts/letsencrypt_post_hook.sh')) + symlink(dirname(getcwd()) . '/server/scripts/letsencrypt_post_hook.sh', '/usr/local/bin/letsencrypt_post_hook.sh'); + if (file_exists(dirname(getcwd()) . '/server/scripts/letsencrypt_renew_hook.sh')) + symlink(dirname(getcwd()) . '/server/scripts/letsencrypt_renew_hook.sh', '/usr/local/bin/letsencrypt_renew_hook.sh'); chown('/usr/local/bin/letsencrypt_pre_hook.sh', 'root'); chown('/usr/local/bin/letsencrypt_post_hook.sh', 'root'); chown('/usr/local/bin/letsencrypt_renew_hook.sh', 'root'); -- GitLab From 2c289209088a15f1a30fbcdf3a447a7d9bcea8e5 Mon Sep 17 00:00:00 2001 From: Hj Ahmad Rasyid Hj Ismail Date: Sun, 31 May 2020 08:19:07 +0200 Subject: [PATCH 4/5] Update uninstall.php to remove (unlink) all letsencrypt post, pre and renew hook script from /usr/local/bin. This is important so the future reinstallation of the scripts via ISPConfig will work. While at these I found two other ISPConfig scripts (ispconfig_patch and ispconfig_update_from_dev.sh) not removed but I won't add them here as I think they have a different function and I am not sure whether they should be removed (unlink). --- install/uninstall.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/install/uninstall.php b/install/uninstall.php index c565d4653d..6ff695decc 100644 --- a/install/uninstall.php +++ b/install/uninstall.php @@ -88,6 +88,9 @@ if($do_uninstall == 'yes') { exec('rm -rf /usr/local/ispconfig'); // Delete various other files + @unlink("/usr/local/bin/letsencrypt_post_hook.sh"); + @unlink("/usr/local/bin/letsencrypt_pre_hook.sh"); + @unlink("/usr/local/bin/letsencrypt_renew_hook.sh"); @unlink("/usr/local/bin/ispconfig_update.sh"); @unlink("/usr/local/bin/ispconfig_update_from_svn.sh"); @unlink("/var/spool/mail/ispconfig"); -- GitLab From a9bffd38c3708ccfc71409830d674df5ffdd9e02 Mon Sep 17 00:00:00 2001 From: Hj Ahmad Rasyid Hj Ismail Date: Tue, 2 Jun 2020 15:10:04 +0200 Subject: [PATCH 5/5] Update letsencrypt_renew_hook.sh to make adjustments / fixes for RHEL and Centos as advised in https://git.ispconfig.org/ispconfig/ispconfig3/-/merge_requests/911#note_73115 --- server/scripts/letsencrypt_renew_hook.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/scripts/letsencrypt_renew_hook.sh b/server/scripts/letsencrypt_renew_hook.sh index 07881fda03..768cba70e9 100644 --- a/server/scripts/letsencrypt_renew_hook.sh +++ b/server/scripts/letsencrypt_renew_hook.sh @@ -17,14 +17,15 @@ lelive=/etc/letsencrypt/live/$(hostname -f); if [ -d "$lelive" ]; then pureftpdpem=/etc/ssl/private/pure-ftpd.pem; if [ -e "$pureftpdpem" ]; then chmod 600 $pureftpdpem; fi # For Red Hat, Centos or derivatives if which yum &> /dev/null 2>&1 ; then - if [ rpm -q pure-ftpd-mysql ]; then service pure-ftpd-mysql restart; fi + if [ rpm -q pure-ftpd ]; then service pure-ftpd restart; fi if [ rpm -q monit ]; then service monit restart; fi if [ rpm -q postfix ]; then service postfix restart; fi if [ rpm -q dovecot ]; then service dovecot restart; fi - if [ rpm -q mysql ]; then service mysql restart; fi - if [ rpm -q mariadb ]; then service mysql restart; fi + if [ rpm -q mysql-server ]; then service mysqld restart; fi + if [ rpm -q mariadb-server ]; then service mariadb restart; fi + if [ rpm -q MariaDB-server ]; then service mysql restart; fi if [ rpm -q nginx ]; then service nginx restart; fi - if [ rpm -q apache2 ]; then service apache2 restart; fi + if [ rpm -q httpd ]; then service httpd restart; fi # For Debian, Ubuntu or derivatives elif apt-get -v >/dev/null 2>&1 ; then if [ $(dpkg-query -W -f='${Status}' pure-ftpd-mysql 2>/dev/null | grep -c "ok installed") -eq 1 ]; then service pure-ftpd-mysql restart; fi -- GitLab