From 2e8619e5e6982b26b028005700cd4c55c8601e7d Mon Sep 17 00:00:00 2001 From: William Hirigoyen Date: Wed, 8 Nov 2023 12:03:14 +0100 Subject: [PATCH 1/9] Add sendmail_path and open_basedir in LXC PHP pool configs --- CHANGELOG.md | 2 ++ scripts/web-add.sh | 3 +++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fb25fd..0a0592b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ The **patch** part changes is incremented if multiple releases happen the same m ### Changed +* Add sendmail_path and open_basedir in LXC PHP pool configs + ### Fixed ### Removed diff --git a/scripts/web-add.sh b/scripts/web-add.sh index ae1a152..f1703e7 100755 --- a/scripts/web-add.sh +++ b/scripts/web-add.sh @@ -23,6 +23,7 @@ LOCAL_SCRIPT="$SCRIPTS_PATH/web-add.local.sh" PRE_LOCAL_SCRIPT="$SCRIPTS_PATH/web-add.pre-local.sh" TPL_AWSTATS="$SCRIPTS_PATH/awstats.XXX.conf" SSH_GROUP="evolinux-ssh" +HOST="$(hostname -s)" # Set to nginx if you use nginx and not apache WEB_SERVER="apache" @@ -456,6 +457,8 @@ pm.max_children = 10 pm.process_idle_timeout = 10s php_admin_value[error_log] = /home/${in_login}/log/php.log +php_admin_value[sendmail_path] = "/usr/sbin/sendmail -t -i -f www-${in_login}@${HOST}" +php_admin_value[open_basedir] = "/usr/share/php:/home/${in_login}:/tmp" EOT step_ok "Création du pool FPM ${php_version}" done From 72e39f297e5cb9c4900f94db11e23d41745497e2 Mon Sep 17 00:00:00 2001 From: William Hirigoyen Date: Thu, 9 Nov 2023 11:31:16 +0100 Subject: [PATCH 2/9] Prevent op_del to fail and able to remove web account when part of it is already removed --- CHANGELOG.md | 2 ++ scripts/web-add.sh | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a0592b..445ceb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ The **patch** part changes is incremented if multiple releases happen the same m ### Added +* Prevent op_del to fail and able to remove web account when part of it is already removed + ### Changed * Add sendmail_path and open_basedir in LXC PHP pool configs diff --git a/scripts/web-add.sh b/scripts/web-add.sh index f1703e7..210d07f 100755 --- a/scripts/web-add.sh +++ b/scripts/web-add.sh @@ -766,8 +766,8 @@ op_del() { # Deactivate web vhost (apache or nginx) if [ "$WEB_SERVER" == "apache" ]; then - a2dissite "${login}.conf" - rm /etc/apache2/sites-available/"$login.conf" + a2dissite "${login}.conf" || true + rm -f /etc/apache2/sites-available/"$login.conf" apache2ctl configtest @@ -794,33 +794,33 @@ op_del() { phpfpm_dir="/etc/php5/fpm/pool.d/" initscript_path="/etc/init.d/php5-fpm" fi - rm /var/lib/lxc/php"${php_version}"/rootfs/${phpfpm_dir}/"${login}".conf + rm -f /var/lib/lxc/php"${php_version}"/rootfs/${phpfpm_dir}/"${login}".conf lxc-attach -n php"${php_version}" -- $initscript_path restart >/dev/null done elif [ "$WEB_SERVER" == "nginx" ]; then - rm /etc/nginx/sites-{available,enabled}/"$login" - rm /etc/munin/plugins/phpfpm_"${in_login}"* + rm -f /etc/nginx/sites-{available,enabled}/"$login" + rm -f /etc/munin/plugins/phpfpm_"${in_login}"* nginx -t fi - rm /etc/awstats/awstats."$login.conf" + rm -f /etc/awstats/awstats."$login.conf" sed -i.bak "/-config=$login /d" /etc/cron.d/awstats if [ "$WEB_SERVER" == "apache" ]; then if id www-"$login" &> /dev/null; then - userdel -f www-"$login" + userdel -f www-"$login" || true fi for php_version in "${PHP_VERSIONS[@]}"; do if lxc-attach -n php"${php_version}" -- id www-"$login" &> /dev/null; then - lxc-attach -n php"${php_version}" -- userdel -f www-"$login" + lxc-attach -n php"${php_version}" -- userdel -f www-"$login" || true fi - lxc-attach -n php"${php_version}" -- userdel -f "$login" + lxc-attach -n php"${php_version}" -- userdel -f "$login" || true done fi - userdel -f "$login" + userdel -f "$login" || true sed -i.bak "/^$login:/d" /etc/aliases if [ "$WEB_SERVER" == "apache" ]; then From 7d8704cd257b32ca4fb1306ec139d53e16742678 Mon Sep 17 00:00:00 2001 From: William Hirigoyen Date: Thu, 9 Nov 2023 12:01:14 +0100 Subject: [PATCH 3/9] Fix sendmail_path hostname (missing domain / FQDN) --- CHANGELOG.md | 2 ++ scripts/web-add.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 445ceb9..5265f29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ The **patch** part changes is incremented if multiple releases happen the same m ### Fixed +* Fix sendmail_path hostname (missing domain / FQDN) + ### Removed ### Security diff --git a/scripts/web-add.sh b/scripts/web-add.sh index 210d07f..2230071 100755 --- a/scripts/web-add.sh +++ b/scripts/web-add.sh @@ -23,7 +23,7 @@ LOCAL_SCRIPT="$SCRIPTS_PATH/web-add.local.sh" PRE_LOCAL_SCRIPT="$SCRIPTS_PATH/web-add.pre-local.sh" TPL_AWSTATS="$SCRIPTS_PATH/awstats.XXX.conf" SSH_GROUP="evolinux-ssh" -HOST="$(hostname -s)" +HOST="$(hostname -f)" # Set to nginx if you use nginx and not apache WEB_SERVER="apache" From 2fd65724f7f316c79b9d376af5ebcb06956963e9 Mon Sep 17 00:00:00 2001 From: William Hirigoyen Date: Thu, 9 Nov 2023 17:08:39 +0100 Subject: [PATCH 4/9] Fix missing ITK admin link for multi PHP --- CHANGELOG.md | 2 ++ tpl/webadmin.tpl.php | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5265f29..7eb54c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # Changelog + All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). @@ -21,6 +22,7 @@ The **patch** part changes is incremented if multiple releases happen the same m ### Fixed * Fix sendmail_path hostname (missing domain / FQDN) +* Fix missing ITK admin link for multi PHP ### Removed diff --git a/tpl/webadmin.tpl.php b/tpl/webadmin.tpl.php index 98b02c8..9861b6c 100755 --- a/tpl/webadmin.tpl.php +++ b/tpl/webadmin.tpl.php @@ -108,8 +108,9 @@ printf('Servername - ', $vhost_info['owner']); if(is_multiphp()) { printf('PHP - ', $vhost_info['owner']); - } else { - printf('ITK - ', $vhost_info['owner']); + } + + printf('ITK - ', $vhost_info['owner']); } printf('Let\'s Encrypt - ', $vhost_info['owner']); printf('Supprimer', $vhost_info['owner']); From c385c102c5fc7de0fe0799b4744803e929ac13fe Mon Sep 17 00:00:00 2001 From: William Hirigoyen Date: Thu, 9 Nov 2023 17:21:33 +0100 Subject: [PATCH 5/9] Remove extra } --- tpl/webadmin.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tpl/webadmin.tpl.php b/tpl/webadmin.tpl.php index 9861b6c..2ca4563 100755 --- a/tpl/webadmin.tpl.php +++ b/tpl/webadmin.tpl.php @@ -111,7 +111,7 @@ } printf('ITK - ', $vhost_info['owner']); - } + printf('Let\'s Encrypt - ', $vhost_info['owner']); printf('Supprimer', $vhost_info['owner']); } else { From 964f710897c51a5294427c1cfd1699a594581043 Mon Sep 17 00:00:00 2001 From: William Hirigoyen Date: Fri, 10 Nov 2023 10:49:16 +0100 Subject: [PATCH 6/9] Revert "Remove extra }" This reverts commit c385c102c5fc7de0fe0799b4744803e929ac13fe. --- tpl/webadmin.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tpl/webadmin.tpl.php b/tpl/webadmin.tpl.php index 2ca4563..9861b6c 100755 --- a/tpl/webadmin.tpl.php +++ b/tpl/webadmin.tpl.php @@ -111,7 +111,7 @@ } printf('ITK - ', $vhost_info['owner']); - + } printf('Let\'s Encrypt - ', $vhost_info['owner']); printf('Supprimer', $vhost_info['owner']); } else { From f5fe462248d8debbb11bf00ab4b1d357c67c75ca Mon Sep 17 00:00:00 2001 From: William Hirigoyen Date: Fri, 10 Nov 2023 10:49:29 +0100 Subject: [PATCH 7/9] Revert "Fix missing ITK admin link for multi PHP" This reverts commit 2fd65724f7f316c79b9d376af5ebcb06956963e9. --- CHANGELOG.md | 2 -- tpl/webadmin.tpl.php | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7eb54c9..5265f29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,4 @@ # Changelog - All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). @@ -22,7 +21,6 @@ The **patch** part changes is incremented if multiple releases happen the same m ### Fixed * Fix sendmail_path hostname (missing domain / FQDN) -* Fix missing ITK admin link for multi PHP ### Removed diff --git a/tpl/webadmin.tpl.php b/tpl/webadmin.tpl.php index 9861b6c..98b02c8 100755 --- a/tpl/webadmin.tpl.php +++ b/tpl/webadmin.tpl.php @@ -108,9 +108,8 @@ printf('Servername - ', $vhost_info['owner']); if(is_multiphp()) { printf('PHP - ', $vhost_info['owner']); - } - - printf('ITK - ', $vhost_info['owner']); + } else { + printf('ITK - ', $vhost_info['owner']); } printf('Let\'s Encrypt - ', $vhost_info['owner']); printf('Supprimer', $vhost_info['owner']); From 8e15676d0519613a84474dd0e6fba110015a60ec Mon Sep 17 00:00:00 2001 From: William Hirigoyen Date: Fri, 10 Nov 2023 11:11:52 +0100 Subject: [PATCH 8/9] Improve op_del improvement --- scripts/web-add.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/web-add.sh b/scripts/web-add.sh index 2230071..224b2b1 100755 --- a/scripts/web-add.sh +++ b/scripts/web-add.sh @@ -766,7 +766,9 @@ op_del() { # Deactivate web vhost (apache or nginx) if [ "$WEB_SERVER" == "apache" ]; then - a2dissite "${login}.conf" || true + if a2query -s test12 >/dev/null 2&>1; then + a2dissite "${login}.conf" + fi rm -f /etc/apache2/sites-available/"$login.conf" apache2ctl configtest @@ -809,18 +811,22 @@ op_del() { if [ "$WEB_SERVER" == "apache" ]; then if id www-"$login" &> /dev/null; then - userdel -f www-"$login" || true + userdel -f www-"$login" fi for php_version in "${PHP_VERSIONS[@]}"; do - if lxc-attach -n php"${php_version}" -- id www-"$login" &> /dev/null; then - lxc-attach -n php"${php_version}" -- userdel -f www-"$login" || true + if lxc-attach -n php"${php_version}" -- getent passwd www-"$login" &> /dev/null; then + lxc-attach -n php"${php_version}" -- userdel -f www-"$login" + fi + if lxc-attach -n php"${php_version}" -- getent passwd "$login" &> /dev/null; then + lxc-attach -n php"${php_version}" -- userdel -f "$login" fi - lxc-attach -n php"${php_version}" -- userdel -f "$login" || true done fi - userdel -f "$login" || true + if getent passwd "$login" &> /dev/null; then + userdel -f "$login" + fi sed -i.bak "/^$login:/d" /etc/aliases if [ "$WEB_SERVER" == "apache" ]; then From 0dfb19faea4ed59741f8fbdba3be305ef1592647 Mon Sep 17 00:00:00 2001 From: William Hirigoyen Date: Mon, 13 Nov 2023 14:29:55 +0100 Subject: [PATCH 9/9] Remove undue commit --- CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5265f29..445ceb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,8 +20,6 @@ The **patch** part changes is incremented if multiple releases happen the same m ### Fixed -* Fix sendmail_path hostname (missing domain / FQDN) - ### Removed ### Security