Browse Source

Merge pull request #1384 from hestiacp/staging/fixes

Staging/fixes
Raphael Schneeberger 5 years ago
parent
commit
377f968007

+ 4 - 0
bin/v-add-firewall-ban

@@ -24,6 +24,7 @@ iptables="/sbin/iptables"
 
 # Includes
 source $HESTIA/func/main.sh
+source $HESTIA/func/firewall.sh
 source $HESTIA/conf/hestia.conf
 
 
@@ -43,6 +44,9 @@ check_hestia_demo_mode
 #                       Action                             #
 #----------------------------------------------------------#
 
+# Self heal iptables links
+heal_iptables_links
+
 # Checking server ip
 if [ -e "$HESTIA/data/ips/$ip" ] || [ "$ip" = '127.0.0.1' ]; then
     exit

+ 4 - 0
bin/v-add-firewall-chain

@@ -32,6 +32,7 @@ fi
 
 # Includes
 source $HESTIA/func/main.sh
+source $HESTIA/func/firewall.sh
 source $HESTIA/conf/hestia.conf
 
 
@@ -50,6 +51,9 @@ check_hestia_demo_mode
 #                       Action                             #
 #----------------------------------------------------------#
 
+# Self heal iptables links
+heal_iptables_links
+
 # Checking known chains
 case $chain in
     SSH)        # Get ssh port by reading ssh config file.

+ 4 - 0
bin/v-delete-firewall-ban

@@ -24,6 +24,7 @@ iptables="/sbin/iptables"
 
 # Includes
 source $HESTIA/func/main.sh
+source $HESTIA/func/firewall.sh
 source $HESTIA/conf/hestia.conf
 
 
@@ -43,6 +44,9 @@ check_hestia_demo_mode
 #                       Action                             #
 #----------------------------------------------------------#
 
+# Self heal iptables links
+heal_iptables_links
+
 # Checking ip in banlist
 conf="$HESTIA/data/firewall/banlist.conf"
 check_ip=$(grep "IP='$ip' CHAIN='$chain'" $conf 2>/dev/null)

+ 4 - 0
bin/v-delete-firewall-chain

@@ -23,6 +23,7 @@ iptables="/sbin/iptables"
 
 # Includes
 source $HESTIA/func/main.sh
+source $HESTIA/func/firewall.sh
 source $HESTIA/conf/hestia.conf
 
 
@@ -42,6 +43,9 @@ check_hestia_demo_mode
 #                       Action                             #
 #----------------------------------------------------------#
 
+# Self heal iptables links
+heal_iptables_links
+
 # Deleting chain
 chains=$HESTIA/data/firewall/chains.conf
 banlist=$HESTIA/data/firewall/banlist.conf

+ 4 - 0
bin/v-stop-firewall

@@ -19,6 +19,7 @@ modprobe="/sbin/modprobe"
 # Includes
 source /etc/profile.d/hestia.sh
 source $HESTIA/func/main.sh
+source $HESTIA/func/firewall.sh
 source $HESTIA/conf/hestia.conf
 
 
@@ -36,6 +37,9 @@ check_hestia_demo_mode
 #                       Action                             #
 #----------------------------------------------------------#
 
+# Self heal iptables links
+heal_iptables_links
+
 # Creating temporary file
 tmp=$(mktemp)
 

+ 3 - 0
bin/v-unsuspend-cron-job

@@ -32,6 +32,9 @@ is_object_valid 'user' 'USER' "$user"
 is_object_valid 'cron' 'JOB' "$job"
 is_object_suspended 'cron' 'JOB' "$job"
 
+# Perform verification if read-only mode is enabled
+check_hestia_demo_mode
+
 
 #----------------------------------------------------------#
 #                       Action                             #

+ 3 - 0
bin/v-unsuspend-cron-jobs

@@ -29,6 +29,9 @@ check_args '1' "$#" 'USER [RESTART]'
 is_format_valid 'user'
 is_object_valid 'user' 'USER' "$user"
 
+# Perform verification if read-only mode is enabled
+check_hestia_demo_mode
+
 
 #----------------------------------------------------------#
 #                       Action                             #

+ 4 - 0
bin/v-update-firewall

@@ -20,6 +20,7 @@ sysctl="/sbin/sysctl"
 # Includes
 source /etc/profile.d/hestia.sh
 source $HESTIA/func/main.sh
+source $HESTIA/func/firewall.sh
 source $HESTIA/conf/hestia.conf
 
 
@@ -34,6 +35,9 @@ is_system_enabled "$FIREWALL_SYSTEM" 'FIREWALL_SYSTEM'
 #                       Action                             #
 #----------------------------------------------------------#
 
+# Self heal iptables links
+heal_iptables_links
+
 # Checking local IPv4 rules
 rules="$HESTIA/data/firewall/rules.conf"
 

+ 18 - 0
func/firewall.sh

@@ -0,0 +1,18 @@
+
+heal_iptables_links() {
+    packages="iptables iptables-save iptables-restore"
+    for package in $packages; do
+        if [ ! -e "/sbin/${package}" ]; then
+            if which ${package}; then
+                ln -s "$(which ${package})" /sbin/${package}
+            elif [ -e "/usr/sbin/${package}" ]; then
+                ln -s /usr/sbin/${package} /sbin/${package}
+            elif whereis -B /bin /sbin /usr/bin /usr/sbin -f -b ${package}; then
+                autoiptables=$(whereis -B /bin /sbin /usr/bin /usr/sbin -f -b ${package} | cut -d '' -f 2)
+                if [ -x "$autoiptables" ]; then
+                    ln -s "$autoiptables" /sbin/${package}
+                fi
+            fi
+        fi
+    done
+}

+ 1 - 1
src/deb/php/control

@@ -1,7 +1,7 @@
 Source: hestia-php
 Package: hestia-php
 Priority: optional
-Version: 7.4.12-1
+Version: 7.4.12
 Section: admin
 Maintainer: HestaCP <info@hestiacp.com>
 Homepage: https://www.hestiacp.com

+ 4 - 2
src/hst_autocompile.sh

@@ -75,8 +75,12 @@ fi
 # Set Version for compiling
 if [ -f "$SRC_DIR/src/deb/hestia/control" ] && [ "$branch" = '~localsrc' ]; then
   BUILD_VER=$(cat $SRC_DIR/src/deb/hestia/control |grep "Version:" |cut -d' ' -f2)
+  NGINX_V=$(cat $SRC_DIR/src/deb/nginx/control |grep "Version:" |cut -d' ' -f2)
+  PHP_V=$(cat $SRC_DIR/src/deb/php/control |grep "Version:" |cut -d' ' -f2)
 else
   BUILD_VER=$(curl -s https://raw.githubusercontent.com/hestiacp/hestiacp/$branch/src/deb/hestia/control |grep "Version:" |cut -d' ' -f2)
+  NGINX_V=$(curl -s https://raw.githubusercontent.com/hestiacp/hestiacp/$branch/src/deb/nginx/control |grep "Version:" |cut -d' ' -f2)
+  PHP_V=$(curl -s https://raw.githubusercontent.com/hestiacp/hestiacp/$branch/src/deb/php/control |grep "Version:" |cut -d' ' -f2)
 fi
 
 if [ -z "$BUILD_VER" ]; then
@@ -86,11 +90,9 @@ fi
 
 BUILD_ARCH='amd64'
 HESTIA_V="${BUILD_VER}_${BUILD_ARCH}"
-NGINX_V=$(curl -s https://raw.githubusercontent.com/hestiacp/hestiacp/$branch/src/deb/nginx/control |grep "Version:" |cut -d' ' -f2)
 OPENSSL_V='1.1.1g'
 PCRE_V='8.44'
 ZLIB_V='1.2.11'
-PHP_V=$(curl -s https://raw.githubusercontent.com/hestiacp/hestiacp/$branch/src/deb/php/control |grep "Version:" |cut -d' ' -f2)
 
 # Create build directories
 rm -rf $BUILD_DIR