Browse Source

Adjust first steps to gain ipv6 support for firewall.

Raphael Schneeberger 5 years ago
parent
commit
218c7b14ad
2 changed files with 5 additions and 4 deletions
  1. 3 2
      bin/v-add-firewall-ban
  2. 2 2
      bin/v-add-firewall-chain

+ 3 - 2
bin/v-add-firewall-ban

@@ -18,6 +18,7 @@ chain=$(echo $2|tr '[:lower:]' '[:upper:]')
 
 # Defining absolute path for iptables and modprobe
 iptables="/sbin/iptables"
+ip6tables="/sbin/ip6tables"
 
 # Includes
 source $HESTIA/func/main.sh
@@ -32,16 +33,16 @@ check_args '2' "$#" 'IP CHAIN'
 is_format_valid 'ip' 'chain'
 is_system_enabled "$FIREWALL_SYSTEM" 'FIREWALL_SYSTEM'
 
-
 # Perform verification if read-only mode is enabled
 check_hestia_demo_mode
 
+
 #----------------------------------------------------------#
 #                       Action                             #
 #----------------------------------------------------------#
 
 # Checking server ip
-if [ -e "$HESTIA/data/ips/$ip" ] || [ "$ip" = '127.0.0.1' ]; then
+if [ -e "$HESTIA/data/ips/$ip" ] || [ "$ip" = '127.0.0.1' ] || [ "$ip" = '::1' ]; then
     exit
 fi
 

+ 2 - 2
bin/v-add-firewall-chain

@@ -1,6 +1,6 @@
 #!/bin/bash
 # info: add firewall chain
-# options: CHAIN [PORT] [PROTOCOL] [PROTOCOL]
+# options: CHAIN [PORT] [PROTOCOL]
 #
 # The function adds new rule to system firewall
 
@@ -15,11 +15,11 @@ source /etc/profile
 # Argument definition
 chain=$(echo $1 | tr '[:lower:]' '[:upper:]')
 port=$2
-protocol=${4-TCP}
 protocol=$(echo $protocol|tr '[:lower:]' '[:upper:]')
 
 # Defining absolute path to iptables
 iptables="/sbin/iptables"
+ip6tables="/sbin/ip6tables"
 
 # Get hestia port by reading nginx.conf
 hestiaport=$(grep 'listen' $HESTIA/nginx/conf/nginx.conf | awk '{print $2}' | sed "s|;||")