From 2c7471382aeae224ef94ba6f197af71dcd314107 Mon Sep 17 00:00:00 2001 From: Hj Ahmad Rasyid Hj Ismail Date: Thu, 26 Oct 2023 06:59:09 +0000 Subject: [PATCH 1/5] Update elfinder_install_update.sh to use apps.vhost port for both apache2 and nginx. Fix also minor spelling mistakes. --- elfinder_install_update.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/elfinder_install_update.sh b/elfinder_install_update.sh index 69123e9..2a54ad2 100644 --- a/elfinder_install_update.sh +++ b/elfinder_install_update.sh @@ -3,7 +3,7 @@ # Description: Setup or update elFinder File Manager in ISPConfig web server. # Author: Hj Ahmad Rasyid bin Hj Ismail # BSD 3 License -# Updated on 20230919-103405 +# Updated on 202310126145805 # Should work on systems that were installed according to HowToForge's Perfect Server guides for auto/manual install @@ -163,7 +163,7 @@ set_nginx_conf () { rewrite ^/* /filemanager last; } - ## ELFINDER FILE MANAGER CONFIG STARTS ## + ## ELFINDER FILE MANAGER CONFIG ENDS ## EOT @@ -236,7 +236,7 @@ write_nginx_vhost () { set_apache_conf () { tee $ef_temp_conf >/dev/null << END -## ELFINDER FILE MANAGER ## +## ELFINDER FILE MANAGER CONFIG STARTS ## @@ -247,6 +247,8 @@ set_apache_conf () { +## ELFINDER FILE MANAGER CONFIG ENDS ## + END } @@ -255,12 +257,14 @@ END set_apache_vhost () { tee $ef_temp_conf >/dev/null << END -## ELFINDER FILE MANAGER ## +## ELFINDER FILE MANAGER CONFIG STARTS ## Require all granted +## ELFINDER FILE MANAGER CONFIG ENDS ## + END } @@ -272,7 +276,7 @@ set_elfinder_conf () { ef_enabl_dir=/etc/apache2/conf-enabled ef_fm_conf=$ef_word.conf tee $ef_avail_dir/$ef_fm_conf >/dev/null << END -# elFinder default Apache configuration +## ELFINDER FILE MANAGER CONFIG STARTS ## Alias /filemanager /usr/share/filemanager @@ -338,6 +342,8 @@ Alias /filemanager /usr/share/filemanager SSLStaplingCache shmcb:/var/run/ocsp(128000) + +## ELFINDER FILE MANAGER CONFIG ENDS ## END if [ ! -f $ef_enabl_dir/$ef_fm_conf ]; then a2enconf $ef_word; fi @@ -349,7 +355,8 @@ write_apache_vhost () { master_vhost=apache_ispconfig.conf.master target_vhost=/etc/apache2/sites-available/ispconfig.conf target_base=$(basename $target_vhost) - ef_port=$(grep -i "\*:" $target_vhost | cut -d : -f 2,3 | cut -d " " -f1) + appsvhost=/etc/apache2/sites-available/apps.vhost + ef_port=$(grep -i "\*:" $appsvhost | cut -d : -f 2,3 | cut -d " " -f1) sm_search="\/squirrelmail" # Run custom conf function @@ -366,8 +373,6 @@ write_apache_vhost () { set_elfinder_conf # Reload apache2 if all good and report result - ispcvhost=/etc/apache2/sites-available/ispconfig.vhost - ef_port=$(grep -i "\*:" $ispcvhost | cut -d : -f 2,3 | cut -d " " -f1) if AOUTPUT=$(/usr/sbin/apache2ctl -t 2>&1); then systemctl reload apache2 echo -e "Apache2 "$ef_reload"\n\n"$ef_browse""$ef_port"/$ef_word\n" -- GitLab From 4ed159e9608ddc4e044142b58f868761a31396d2 Mon Sep 17 00:00:00 2001 From: Hj Ahmad Rasyid Hj Ismail Date: Thu, 26 Oct 2023 07:00:43 +0000 Subject: [PATCH 2/5] Update elfinder_install_update.sh --- elfinder_install_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elfinder_install_update.sh b/elfinder_install_update.sh index 2a54ad2..df30ebc 100644 --- a/elfinder_install_update.sh +++ b/elfinder_install_update.sh @@ -3,7 +3,7 @@ # Description: Setup or update elFinder File Manager in ISPConfig web server. # Author: Hj Ahmad Rasyid bin Hj Ismail # BSD 3 License -# Updated on 202310126145805 +# Updated on 20231026150035 # Should work on systems that were installed according to HowToForge's Perfect Server guides for auto/manual install -- GitLab From 7e7b32c61a61e64fc5071a500b0765a6768496d4 Mon Sep 17 00:00:00 2001 From: Hj Ahmad Rasyid Hj Ismail Date: Thu, 26 Oct 2023 07:28:53 +0000 Subject: [PATCH 3/5] Update elfinder_install_update.sh --- elfinder_install_update.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/elfinder_install_update.sh b/elfinder_install_update.sh index df30ebc..cdba76c 100644 --- a/elfinder_install_update.sh +++ b/elfinder_install_update.sh @@ -3,7 +3,7 @@ # Description: Setup or update elFinder File Manager in ISPConfig web server. # Author: Hj Ahmad Rasyid bin Hj Ismail # BSD 3 License -# Updated on 20231026150035 +# Updated on 20231026152845 # Should work on systems that were installed according to HowToForge's Perfect Server guides for auto/manual install @@ -388,7 +388,7 @@ if apt-get -v >/dev/null 2>&1; then # If web server is nginx, check and modify apps vhost accordingly if [ $(dpkg-query -W -f='${Status}' nginx 2>/dev/null | grep -c "ok installed") -eq 1 ]; then write_nginx_vhost - # If web server is apache2, check and modify ispconfig vhost accordingly + # If web server is apache2, also check and modify apps vhost accordingly elif [ $(dpkg-query -W -f='${Status}' apache2 2>/dev/null | grep -c "ok installed") -eq 1 ]; then write_apache_vhost fi @@ -397,7 +397,7 @@ elif which yum &> /dev/null 2>&1; then # If web server is nginx, check and modify apps vhost accordingly if ( rpm -q nginx ); then write_nginx_vhost - # If web server is apache2, check and modify ispconfig vhost accordingly + # If web server is apache2, also check and modify apps vhost accordingly elif ( rpm -q httpd ); then write_apache_vhost fi -- GitLab From 1812b7dd6273e2edb9e7b34f51131bea1ff096bf Mon Sep 17 00:00:00 2001 From: Hj Ahmad Rasyid Hj Ismail Date: Fri, 27 Oct 2023 11:08:44 +0000 Subject: [PATCH 4/5] Update elfinder_install_update.sh to add alternative name for apache2 etc folder, since it could be httpd in rhel, centos and their derivatives --- elfinder_install_update.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/elfinder_install_update.sh b/elfinder_install_update.sh index cdba76c..2fb8b3d 100644 --- a/elfinder_install_update.sh +++ b/elfinder_install_update.sh @@ -269,11 +269,15 @@ set_apache_vhost () { END } +# Alternative apache2 etc folder, since it could be httpd in rhel, centos and their derivatives +ef_apache2_dir=/etc/apache2 +if [ ! -d "$ef_apache2_dir" ]; then ef_apache2_dir=/etc/httpd; fi + # Function to download and extract latest elFinder set_elfinder_conf () { # Create basic filemanager config.file - ef_avail_dir=/etc/apache2/conf-available - ef_enabl_dir=/etc/apache2/conf-enabled + ef_avail_dir=$ef_apache2_dir/conf-available + ef_enabl_dir=$ef_apache2_dir/conf-enabled ef_fm_conf=$ef_word.conf tee $ef_avail_dir/$ef_fm_conf >/dev/null << END ## ELFINDER FILE MANAGER CONFIG STARTS ## @@ -353,9 +357,9 @@ END write_apache_vhost () { # Define custom and ispconfig vhost files master_vhost=apache_ispconfig.conf.master - target_vhost=/etc/apache2/sites-available/ispconfig.conf + target_vhost=$ef_apache2_dir/sites-available/ispconfig.conf target_base=$(basename $target_vhost) - appsvhost=/etc/apache2/sites-available/apps.vhost + appsvhost=$ef_apache2_dir/sites-available/apps.vhost ef_port=$(grep -i "\*:" $appsvhost | cut -d : -f 2,3 | cut -d " " -f1) sm_search="\/squirrelmail" -- GitLab From 0efaa5fb8ea673406fb719272b7eb9b5cf18ae34 Mon Sep 17 00:00:00 2001 From: Hj Ahmad Rasyid Hj Ismail Date: Fri, 27 Oct 2023 11:14:11 +0000 Subject: [PATCH 5/5] Update elfinder_install_update.sh --- elfinder_install_update.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/elfinder_install_update.sh b/elfinder_install_update.sh index 2fb8b3d..65a67a7 100644 --- a/elfinder_install_update.sh +++ b/elfinder_install_update.sh @@ -3,7 +3,7 @@ # Description: Setup or update elFinder File Manager in ISPConfig web server. # Author: Hj Ahmad Rasyid bin Hj Ismail # BSD 3 License -# Updated on 20231026152845 +# Updated on 20231027191348 # Should work on systems that were installed according to HowToForge's Perfect Server guides for auto/manual install @@ -359,8 +359,8 @@ write_apache_vhost () { master_vhost=apache_ispconfig.conf.master target_vhost=$ef_apache2_dir/sites-available/ispconfig.conf target_base=$(basename $target_vhost) - appsvhost=$ef_apache2_dir/sites-available/apps.vhost - ef_port=$(grep -i "\*:" $appsvhost | cut -d : -f 2,3 | cut -d " " -f1) + apps_vhost=$ef_apache2_dir/sites-available/apps.vhost + ef_port=$(grep -i "\*:" $apps_vhost | cut -d : -f 2,3 | cut -d " " -f1) sm_search="\/squirrelmail" # Run custom conf function -- GitLab