From 12d787ea871b91a52a82b00711143933f41105fd Mon Sep 17 00:00:00 2001 From: Alexey Berezhok Date: Wed, 12 Jun 2024 15:58:13 +0300 Subject: [PATCH] AFixd applying nopublick option --- bin/v-update-sys-ip | 15 ++++++++++----- func/rebuild.sh | 7 ++++++- func/upgrade.sh | 10 +++++++--- install/hst-install-rhel.sh | 3 +++ 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/bin/v-update-sys-ip b/bin/v-update-sys-ip index 6d39ce2..1f3ee00 100755 --- a/bin/v-update-sys-ip +++ b/bin/v-update-sys-ip @@ -167,11 +167,16 @@ for ip in $ips; do done # Updating NAT -pub_ipv4="$(curl -fsLm5 --retry 2 --ipv4 https://ip.hestiacp.com/)" -if [ ! -e "$HESTIA/data/ips/$pub_ipv4" ]; then - if [ -z "$(grep -R "$pub_ipv4" $HESTIA/data/ips/)" ]; then - ip="$(ls -t $HESTIA/data/ips/ | head -n1)" - $BIN/v-change-sys-ip-nat "$ip" "$pub_ipv4" +if [ -e $HESTIA/conf/nopublickip ]; then + ip="$(ls -t $HESTIA/data/ips/ | head -n1)" + $BIN/v-change-sys-ip-nat "$ip" "$ip" +else + pub_ipv4="$(curl -fsLm5 --retry 2 --ipv4 https://ip.hestiacp.com/)" + if [ ! -e "$HESTIA/data/ips/$pub_ipv4" ]; then + if [ -z "$(grep -R "$pub_ipv4" $HESTIA/data/ips/)" ]; then + ip="$(ls -t $HESTIA/data/ips/ | head -n1)" + $BIN/v-change-sys-ip-nat "$ip" "$pub_ipv4" + fi fi fi diff --git a/func/rebuild.sh b/func/rebuild.sh index b2c1644..6455206 100644 --- a/func/rebuild.sh +++ b/func/rebuild.sh @@ -221,6 +221,11 @@ rebuild_user_conf() { # WEB domain rebuild rebuild_web_domain_conf() { + WWW_USER="www-data" + if [ -f /etc/redhat-release ]; then + WWW_USER="apache" + fi + if [ "$WEB_SYSTEM" = "httpd" ]; then confd="conf.h.d" else @@ -478,7 +483,7 @@ rebuild_web_domain_conf() { $HOMEDIR/$user/web/$domain/document_errors chmod 640 /var/log/$WEB_SYSTEM/domains/$domain.* - chown --no-dereference $user:www-data $HOMEDIR/$user/web/$domain/public_*html + chown --no-dereference $user:$WWW_USER $HOMEDIR/$user/web/$domain/public_*html } # DNS domain rebuild rebuild_dns_domain_conf() { diff --git a/func/upgrade.sh b/func/upgrade.sh index ee7a4cf..d69d71c 100644 --- a/func/upgrade.sh +++ b/func/upgrade.sh @@ -606,6 +606,10 @@ upgrade_phppgadmin() { } upgrade_phpmyadmin() { + WWW_USER="www-data" + if [ -f /etc/redhat-release ]; then + WWW_USER="apache" + fi # Check if MariaDB/MySQL is installed on the server before attempting to install or upgrade phpMyAdmin if [ -n "$(echo $DB_SYSTEM | grep -w 'mysql')" ]; then pma_version=$(jq -r .version /usr/share/phpmyadmin/package.json) @@ -613,7 +617,7 @@ upgrade_phpmyadmin() { echo "[ * ] phpMyAdmin is up to date (${pma_version})..." # Update permissions if [ -e /var/lib/phpmyadmin/blowfish_secret.inc.php ]; then - chown root:www-data /var/lib/phpmyadmin/blowfish_secret.inc.php + chown root:$WWW_USER /var/lib/phpmyadmin/blowfish_secret.inc.php chmod 0640 /var/lib/phpmyadmin/blowfish_secret.inc.php fi else @@ -639,13 +643,13 @@ upgrade_phpmyadmin() { # Create temporary folder and change permissions if [ ! -d /usr/share/phpmyadmin/tmp ]; then mkdir /usr/share/phpmyadmin/tmp - chown root:www-data /usr/share/phpmyadmin/tmp + chown root:$WWW_USER /usr/share/phpmyadmin/tmp chmod 0770 /usr/share/phpmyadmin/tmp fi if [ -e /var/lib/phpmyadmin/blowfish_secret.inc.php ]; then - chown root:www-data /var/lib/phpmyadmin/blowfish_secret.inc.php + chown root:$WWW_USER /var/lib/phpmyadmin/blowfish_secret.inc.php chmod 0640 /var/lib/phpmyadmin/blowfish_secret.inc.php fi diff --git a/install/hst-install-rhel.sh b/install/hst-install-rhel.sh index 5796707..01118c9 100755 --- a/install/hst-install-rhel.sh +++ b/install/hst-install-rhel.sh @@ -1859,6 +1859,9 @@ curl -s https://rclone.org/install.sh | bash > /dev/null 2>&1 # Configuring system IPs echo "[ * ] Configuring System IP..." +if [ "$nopublicip" = 'yes' ]; then + touch $HESTIA/conf/nopublickip +fi $HESTIA/bin/v-update-sys-ip > /dev/null 2>&1 # Get primary IP