Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Štvrtok, 28. marec 2024

Rozdiely pre scripts/shell/firewall/fw-universal.sh medzi verziami 2.104 a 2.115

verzia 2.104, 2015/10/12 22:41:24 verzia 2.115, 2018/06/28 22:46:00
Riadok 4 
Riadok 4 
 # Provides:          firewall  # Provides:          firewall
 # Required-Start:    $network  # Required-Start:    $network
 # Required-Stop:     $remote_fs  # Required-Stop:     $remote_fs
 # Default-Start:     S  # Default-Start:     2 3 4 5
 # Default-Stop:      0 6  # Default-Stop:      0 6
 # Short-Description: Starts firewall  # Short-Description: Starts firewall
 # Description:       Handle universal firewall script by Platon Group  # Description:       Handle universal firewall script by Platon Group
 #                    http://platon.sk/cvs/cvs.php/scripts/shell/firewall/  #                    http://platon.sk/cvs/cvs.php/scripts/shell/firewall/
 # Author:            Lubomir Host <rajo@platon.sk>  # Author:            Lubomir Host <rajo@platon.sk>
 # Copyright:         (c) 2003-2011 Platon Group  # Copyright:         (c) 2003-2018 Platon Group
 ### END INIT INFO  ### END INIT INFO
   
 #  #
Riadok 18 
Riadok 18 
 # Can be started by init or by hand.  # Can be started by init or by hand.
 #  #
 # Developed by Lubomir Host 'rajo' <rajo AT platon.sk>  # Developed by Lubomir Host 'rajo' <rajo AT platon.sk>
 # Copyright (c) 2003-2011 Platon Group, http://platon.sk/  # Copyright (c) 2003-2018 Platon Group, http://platon.sk/
 # Licensed under terms of GNU General Public License.  # Licensed under terms of GNU General Public License.
 # All rights reserved.  # All rights reserved.
 #  #
 # $Platon: scripts/shell/firewall/fw-universal.sh,v 2.103 2014-04-29 23:22:55 nepto Exp $  # $Platon: scripts/shell/firewall/fw-universal.sh,v 2.114 2018/06/28 16:50:18 nepto Exp $
 #  #
 # Changelog:  # Changelog:
 # 2003-10-24 - created  # 2003-10-24 - created
 # 2011-07-20 - implemented XEN_MODE  # 2011-07-20 - implemented XEN_MODE
   # 2018-03-01 - fixed Default-Start for SystemD on Stretch (nepto)
 #  #
   
   
Riadok 39  DEFAULT_FIREWALL_CONFIG="${DEFAULT_FIREW
Riadok 40  DEFAULT_FIREWALL_CONFIG="${DEFAULT_FIREW
 DEFAULT_FIREWALL_CONFIG_DIR="${DEFAULT_FIREWALL_CONFIG_DIR:=/etc/default/firewall.d}"  DEFAULT_FIREWALL_CONFIG_DIR="${DEFAULT_FIREWALL_CONFIG_DIR:=/etc/default/firewall.d}"
 DEFAULT_CACHE_DIR="${DEFAULT_CACHE_DIR:=/var/cache/firewall}"  DEFAULT_CACHE_DIR="${DEFAULT_CACHE_DIR:=/var/cache/firewall}"
   
   DIST_FIREWALL_CONFIG_DIR="${DIST_FIREWALL_CONFIG_DIR:=/etc/firewall/firewall.d}"
   
 # quiet output? {{{  # quiet output? {{{
 if [ "x$1" = "xblock" ] || [ "x$QUIET" = "xyes" ]; then  if [ "x$1" = "xblock" ] || [ "x$QUIET" = "xyes" ]; then
         print_info()          print_info()
Riadok 53  else
Riadok 56  else
 fi  fi
 # }}}  # }}}
   
   # Define function which can be used in config file
   # Usage:
   #   load_subnets eth0_ACCEPT_INPUT_TCP Slovakia.txt 22
   load_subnets()
   { # {{{
           cfgvar="$1";
           cfgfile="$2";
           port="$3";
   
           print_info "LOAD_SUBNETS: $*";
   
           if [ -f "$DEFAULT_FIREWALL_CONFIG_DIR/subnets/$cfgfile" ]; then
                   cfgfound="$DEFAULT_FIREWALL_CONFIG_DIR/subnets/$cfgfile";
           else if [ -f "$DIST_FIREWALL_CONFIG_DIR/subnets/$cfgfile" ]; then
                   cfgfound="$DIST_FIREWALL_CONFIG_DIR/subnets/$cfgfile";
           else
                   print_info "LOAD_SUBNETS: config file not found: $cfgfile";
                   return 1
           fi fi
           LOADED_CONFIG_FILES="$LOADED_CONFIG_FILES $cfgfound";
   
           print_info "LOAD_SUBNETS: found $cfgfile: $cfgfound";
           print_info "LOAD_SUBNETS: mapping $cfgfile to $cfgvar, port $port"
   
           lines=0;
           while read subnet ; do
                   case "$subnet" in
                           ""|\#*)
                                   continue
                                   ;;
                   esac
                   eval "$cfgvar=\"\$$cfgvar $subnet:$port\"";
                   lines=$(($lines + 1));
           done < $cfgfound
           print_info "LOAD_SUBNETS: $lines subnets loaded from $cfgfile"
   } # }}}
   
 if [ -f "$DEFAULT_FIREWALL_CONFIG" ]; then  if [ -f "$DEFAULT_FIREWALL_CONFIG" ]; then
         print_info "Reading config file $DEFAULT_FIREWALL_CONFIG"          print_info "Reading config file $DEFAULT_FIREWALL_CONFIG"
         . $DEFAULT_FIREWALL_CONFIG          . $DEFAULT_FIREWALL_CONFIG
Riadok 177  load_cache()
Riadok 217  load_cache()
   
         config="";          config="";
         if [ -r "$DEFAULT_FIREWALL_CONFIG" ]; then          if [ -r "$DEFAULT_FIREWALL_CONFIG" ]; then
                 config="$config ` cat \"$DEFAULT_FIREWALL_CONFIG\" `";                  config="$config ` md5sum \"$DEFAULT_FIREWALL_CONFIG\" `";
         fi          fi
         if [ -r "$0" ]; then          if [ -r "$0" ]; then
                 config="$config ` cat \"$0\" `";                  config="$config ` md5sum \"$0\" `";
         fi          fi
         if [ -r "$DEFAULT_FIREWALL_CONFIG_DIR/deploy-servers.list" ]; then          if [ -r "$DEFAULT_FIREWALL_CONFIG_DIR/deploy-servers.list" ]; then
                 config="$config ` cat \"$DEFAULT_FIREWALL_CONFIG_DIR/deploy-servers.list\" `";                  config="$config ` md5sum \"$DEFAULT_FIREWALL_CONFIG_DIR/deploy-servers.list\" `";
         fi          fi
         if [ -r "$DEFAULT_FIREWALL_CONFIG_DIR/BANNED_IP.conf" ]; then          if [ -r "$DEFAULT_FIREWALL_CONFIG_DIR/BANNED_IP.conf" ]; then
                 config="$config ` cat \"$DEFAULT_FIREWALL_CONFIG_DIR/BANNED_IP.conf\" `";                  config="$config ` md5sum \"$DEFAULT_FIREWALL_CONFIG_DIR/BANNED_IP.conf\" `";
         fi          fi
           for lc in $LOADED_CONFIG_FILES; do
                   echo "CHECKSUM $lc";
                   config="$config ` md5sum \"$lc\" `";
           done
         md5key=`echo "config='$config' parsed_interfaces='$parsed_interfaces' parsed_routes='$parsed_routes'" | md5sum | $AWK '{print $1;}'`;          md5key=`echo "config='$config' parsed_interfaces='$parsed_interfaces' parsed_routes='$parsed_routes'" | md5sum | $AWK '{print $1;}'`;
         CACHE_FILE="$DEFAULT_CACHE_DIR/$md5key"          CACHE_FILE="$DEFAULT_CACHE_DIR/$md5key"
   
Riadok 910  reject_input()
Riadok 954  reject_input()
 allow_input()  allow_input()
 { # {{{  { # {{{
         if [ ! -z "$ALL_ACCEPT_INPUT_TCP" ]; then          if [ ! -z "$ALL_ACCEPT_INPUT_TCP" ]; then
                 print_info -en "Accepting ALL INPUT TCP connections on ports:"                  print_info -e "Accepting ALL INPUT TCP connections on ports:"
                 for port in $ALL_ACCEPT_INPUT_TCP; do                  for port in $ALL_ACCEPT_INPUT_TCP; do
                         src_ip=""                          src_ip=""
                         eval `echo $port | awk -v FS=: '/:/ { printf "src_ip=\"%s\"; port=\"%s\";", $1, $2; }'`                          eval `echo $port | awk -v FS=: '/:/ { printf "src_ip=\"%s\"; port=\"%s\";", $1, $2; }'`
Riadok 923  allow_input()
Riadok 967  allow_input()
                         fi                          fi
                         for iface in $INTERFACES; do                          for iface in $INTERFACES; do
                                 riface="IFname_$iface";                                  riface="IFname_$iface";
                                   if [ "$last_port" != "$port" -a -n "$src_ip" ]; then counter=0; print_info ""; fi
                                 print_info -en " $port($iface)"`[ ! -z "$src_ip" ] && echo "[$src_ip]"`                                  print_info -en " $port($iface)"`[ ! -z "$src_ip" ] && echo "[$src_ip]"`
                                   if [ $(( ++counter )) -ge 5 ]; then counter=0; print_info ""; fi;
                                   last_port="$port";
                                 IPS="IP_$iface";                                  IPS="IP_$iface";
                                 for ip in ${!IPS}; do                                  for ip in ${!IPS}; do
                                         if [ -z "$src_ip" ]; then                                          if [ -z "$src_ip" ]; then
Riadok 937  allow_input()
Riadok 984  allow_input()
                 print_info " done."                  print_info " done."
         fi          fi
         if [ ! -z "$ALL_ACCEPT_INPUT_UDP" ]; then          if [ ! -z "$ALL_ACCEPT_INPUT_UDP" ]; then
                 print_info -en "Accepting ALL INPUT UDP connections on ports:"                  print_info -e "Accepting ALL INPUT UDP connections on ports:"
                 for port in $ALL_ACCEPT_INPUT_UDP; do                  for port in $ALL_ACCEPT_INPUT_UDP; do
                         src_ip=""                          src_ip=""
                         eval `echo $port | awk -v FS=: '/:/ { printf "src_ip=\"%s\"; port=\"%s\";", $1, $2; }'`                          eval `echo $port | awk -v FS=: '/:/ { printf "src_ip=\"%s\"; port=\"%s\";", $1, $2; }'`
Riadok 950  allow_input()
Riadok 997  allow_input()
                         fi                          fi
                         for iface in $INTERFACES; do                          for iface in $INTERFACES; do
                                 riface="IFname_$iface";                                  riface="IFname_$iface";
                                   if [ "$last_port" != "$port" -a -n "$src_ip" ]; then counter=0; print_info ""; fi
                                 print_info -en " $port($iface)"`[ ! -z "$src_ip" ] && echo "[$src_ip]"`                                  print_info -en " $port($iface)"`[ ! -z "$src_ip" ] && echo "[$src_ip]"`
                                   if [ $(( ++counter )) -ge 5 ]; then counter=0; print_info ""; fi;
                                   last_port="$port";
                                 IPS="IP_$iface";                                  IPS="IP_$iface";
                                 if [ "x$port" = "x67" ]; then # DHCP requests doesn't have destination IP specified                                  if [ "x$port" = "x67" ]; then # DHCP requests doesn't have destination IP specified
                                         $IPTABLES -A INPUT -i ${!riface} -p UDP --dport $port -j ACCEPT                                          $IPTABLES -A INPUT -i ${!riface} -p UDP --dport $port -j ACCEPT
Riadok 969  allow_input()
Riadok 1019  allow_input()
         fi          fi
   
         if [ ! -z "$REAL_ACCEPT_INPUT_TCP" ]; then          if [ ! -z "$REAL_ACCEPT_INPUT_TCP" ]; then
                 print_info -en "Accepting REAL all INPUT TCP connections for ALL interfaces on ports:"                  print_info -e "Accepting REAL all INPUT TCP connections for ALL interfaces on ports:"
                 for port in $REAL_ACCEPT_INPUT_TCP; do                  for port in $REAL_ACCEPT_INPUT_TCP; do
                         src_ip=""                          src_ip=""
                         eval `echo $port | awk -v FS=: '/:/ { printf "src_ip=\"%s\"; port=\"%s\";", $1, $2; }'`                          eval `echo $port | awk -v FS=: '/:/ { printf "src_ip=\"%s\"; port=\"%s\";", $1, $2; }'`
                           if [ "$last_port" != "$port" -a -n "$src_ip" ]; then counter=0; print_info ""; fi
                         print_info -en " $port(ALL)"`[ ! -z "$src_ip" ] && echo "[$src_ip]"`                          print_info -en " $port(ALL)"`[ ! -z "$src_ip" ] && echo "[$src_ip]"`
                           if [ $(( ++counter )) -ge 5 ]; then counter=0; print_info ""; fi;
                           last_port="$port";
                         echo $port | grep -q ,                          echo $port | grep -q ,
                         multiport="$?";                          multiport="$?";
                         if [ "$multiport" -eq 0 ]; then                          if [ "$multiport" -eq 0 ]; then
Riadok 990  allow_input()
Riadok 1043  allow_input()
                 print_info " done."                  print_info " done."
         fi          fi
         if [ ! -z "$REAL_ACCEPT_INPUT_UDP" ]; then          if [ ! -z "$REAL_ACCEPT_INPUT_UDP" ]; then
                 print_info -en "Accepting REAL all INPUT UDP connections for ALL interfaces on ports:"                  print_info -e "Accepting REAL all INPUT UDP connections for ALL interfaces on ports:"
                 for port in $REAL_ACCEPT_INPUT_UDP; do                  for port in $REAL_ACCEPT_INPUT_UDP; do
                         src_ip=""                          src_ip=""
                         eval `echo $port | awk -v FS=: '/:/ { printf "src_ip=\"%s\"; port=\"%s\";", $1, $2; }'`                          eval `echo $port | awk -v FS=: '/:/ { printf "src_ip=\"%s\"; port=\"%s\";", $1, $2; }'`
                           if [ "$last_port" != "$port" -a -n "$src_ip" ]; then counter=0; print_info ""; fi
                         print_info -en " $port(ALL)"`[ ! -z "$src_ip" ] && echo "[$src_ip]"`                          print_info -en " $port(ALL)"`[ ! -z "$src_ip" ] && echo "[$src_ip]"`
                           if [ $(( ++counter )) -ge 5 ]; then counter=0; print_info ""; fi;
                           last_port="$port";
                         echo $port | grep -q ,                          echo $port | grep -q ,
                         multiport="$?";                          multiport="$?";
                         if [ "$multiport" -eq 0 ]; then                          if [ "$multiport" -eq 0 ]; then
Riadok 1011  allow_input()
Riadok 1067  allow_input()
                 print_info " done."                  print_info " done."
         fi          fi
   
         for iface in $INTERFACES; do          # We are using INTERFACES + lo instead of INTERFACES here, because we want
           # to do redirects for "lo" interface as well. However for "lo" it is done
           # quite differently. See http://ix.sk/0WY2j for more information on this.
           #   -- Nepto [2015-10-19]
           for iface in lo $INTERFACES; do
                 riface="IFname_$iface";                  riface="IFname_$iface";
                 IPS="IP_$iface";                  IPS="IP_$iface";
   
Riadok 1039  allow_input()
Riadok 1099  allow_input()
                                                                         (NF == 3) { remote_ip = $1;          from_port = $2; to_port = $3; } \                                                                          (NF == 3) { remote_ip = $1;          from_port = $2; to_port = $3; } \
                                                                         END { printf "remote_ip=%s; from_port=%s; to_port=%s;", remote_ip, from_port, to_port; }'`                                                                          END { printf "remote_ip=%s; from_port=%s; to_port=%s;", remote_ip, from_port, to_port; }'`
                                 print_info -en " $remote_ip:$from_port->$to_port"                                  print_info -en " $remote_ip:$from_port->$to_port"
                                 $IPTABLES -t nat -A PREROUTING -p TCP -i ${!riface} -s $remote_ip -d $ip --dport $from_port -j REDIRECT --to-port $to_port                                  if [ "X$iface" = "Xlo" ]; then
                                           $IPTABLES -t nat -A OUTPUT -p TCP -s $remote_ip -d $ip --dport $from_port -j REDIRECT --to-port $to_port
                                   else
                                           $IPTABLES -t nat -A PREROUTING -p TCP -i ${!riface} -s $remote_ip -d $ip --dport $from_port -j REDIRECT --to-port $to_port
                                   fi
                         done                          done
                         print_info " done."                          print_info " done."
                 fi                  fi
Riadok 1053  allow_input()
Riadok 1117  allow_input()
                                                                         (NF == 3) { remote_ip = $1;          from_port = $2; to_port = $3; } \                                                                          (NF == 3) { remote_ip = $1;          from_port = $2; to_port = $3; } \
                                                                         END { printf "remote_ip=%s; from_port=%s; to_port=%s;", remote_ip, from_port, to_port; }'`                                                                          END { printf "remote_ip=%s; from_port=%s; to_port=%s;", remote_ip, from_port, to_port; }'`
                                 print_info -en " $remote_ip:$from_port->$to_port"                                  print_info -en " $remote_ip:$from_port->$to_port"
                                 $IPTABLES -t nat -A PREROUTING -p UDP -i ${!riface} -s $remote_ip -d $ip --dport $from_port -j REDIRECT --to-port $to_port                                  if [ "X$iface" = "Xlo" ]; then
                                           $IPTABLES -t nat -A OUTPUT -p UDP -s $remote_ip -d $ip --dport $from_port -j REDIRECT --to-port $to_port
                                   else
                                           $IPTABLES -t nat -A PREROUTING -p UDP -i ${!riface} -s $remote_ip -d $ip --dport $from_port -j REDIRECT --to-port $to_port
                                   fi
                         done                          done
                         print_info " done."                          print_info " done."
                 fi                  fi
Riadok 1110  allow_input()
Riadok 1178  allow_input()
   
                 # ACCEPT {{{                  # ACCEPT {{{
                 if [ ! -z "$ACCEPT_INPUT_TCP" ]; then                  if [ ! -z "$ACCEPT_INPUT_TCP" ]; then
                         print_info -en "$iface: Accepting INPUT TCP connections on ports:"                          print_info -e "$iface: Accepting INPUT TCP connections on ports:"
                         counter=0;                          counter=0;
                         for port in $ACCEPT_INPUT_TCP; do                          for port in $ACCEPT_INPUT_TCP; do
                                 src_ip=""                                  src_ip=""
Riadok 1118  allow_input()
Riadok 1186  allow_input()
                                 if [ -n "$src_ip" -a "$port" = "0" ]; then                                  if [ -n "$src_ip" -a "$port" = "0" ]; then
                                         port="ALL";                                          port="ALL";
                                 fi                                  fi
                                   if [ "$last_port" != "$port" -a -n "$src_ip" ]; then counter=0; print_info ""; fi
                                 print_info -en " $port"`[ ! -z "$src_ip" ] && echo "[$src_ip]"`                                  print_info -en " $port"`[ ! -z "$src_ip" ] && echo "[$src_ip]"`
                                 if [ $(( ++counter )) -ge 5 -o "x$port" = "x10050" ]; then counter=0; print_info ""; fi;                                  if [ $(( ++counter )) -ge 5 ]; then counter=0; print_info ""; fi;
                                   last_port="$port";
                                 echo $port | grep -q ,                                  echo $port | grep -q ,
                                 multiport="$?";                                  multiport="$?";
                                 if [ "$multiport" -eq 0 ]; then                                  if [ "$multiport" -eq 0 ]; then
Riadok 1222  allow_output()
Riadok 1292  allow_output()
                 accept_output_udp="${iface}_ACCEPT_OUTPUT_UDP"                  accept_output_udp="${iface}_ACCEPT_OUTPUT_UDP"
                 ACCEPT_OUTPUT_UDP="${!accept_output_udp}"                  ACCEPT_OUTPUT_UDP="${!accept_output_udp}"
   
                   # UDP *must* go before TCP
                   #
                   # Reason: we need to have working DNS resolving, which works over
                   # port 53/UDP. Resolving is required for those rules, which use
                   # hostname instead of IP address, for example cvs.platon.sk:2401.
   
                 # TCP                  # UDP
                 if [ -z "$ACCEPT_OUTPUT_TCP" ]; then                  if [ -z "$ACCEPT_OUTPUT_UDP" ]; then
                         if [ -n "${!gateway}" ]; then                          if [ -n "${!gateway}" ]; then
                                 for ip in ${!IPS}; do                                  for ip in ${!IPS}; do
                                         output_tcp_str="$output_tcp_str $ip:${!riface}:${!gateway}";                                          output_udp_str="$output_udp_str $ip:${!riface}:${!gateway}";
                                         $IPTABLES -A OUTPUT -p TCP -o ${!riface} -s $ip -j ACCEPT                                          $IPTABLES -A OUTPUT -p UDP -o ${!riface} -s $ip -j ACCEPT
                                 done                                  done
                         fi                          fi
                 else                  else
                         print_info -en "$iface: Accepting OUTPUT TCP connections to ports:"                          print_info -en "$iface: Accepting OUTPUT UDP connections to ports:"
                         for port in $ACCEPT_OUTPUT_TCP; do                          for port in $ACCEPT_OUTPUT_UDP; do
                                 dest_ip=""                                  dest_ip=""
                                 eval `echo $port | awk -v FS=: '/:/ { printf "dest_ip=\"%s\"; port=\"%s\";", $1, $2; }'`                                  eval `echo $port | awk -v FS=: '/:/ { printf "dest_ip=\"%s\"; port=\"%s\";", $1, $2; }'`
                                 if [ -n "$dest_ip" -a "$port" = "0" ]; then                                  if [ -n "$dest_ip" -a "$port" = "0" ]; then
Riadok 1241  allow_output()
Riadok 1316  allow_output()
                                 fi                                  fi
                                 print_info -en " $port"`[ ! -z "$dest_ip" ] && echo "[$dest_ip]"`                                  print_info -en " $port"`[ ! -z "$dest_ip" ] && echo "[$dest_ip]"`
                                 if [ -z "$dest_ip" ]; then                                  if [ -z "$dest_ip" ]; then
                                         $IPTABLES -A OUTPUT -o ${!riface} -p TCP --dport $port -j ACCEPT                                          $IPTABLES -A OUTPUT -o ${!riface} -p UDP --dport $port -j ACCEPT
                                 else                                  else
                                         if [ "$port" = "ALL" ]; then                                          if [ "$port" = "ALL" ]; then
                                                 $IPTABLES -A OUTPUT -o ${!riface} -d $dest_ip -p TCP -j ACCEPT                                                  $IPTABLES -A OUTPUT -o ${!riface} -d $dest_ip -p UDP -j ACCEPT
                                         else                                          else
                                                 $IPTABLES -A OUTPUT -o ${!riface} -d $dest_ip -p TCP --dport $port -j ACCEPT                                                  $IPTABLES -A OUTPUT -o ${!riface} -d $dest_ip -p UDP --dport $port -j ACCEPT
                                         fi                                          fi
                                 fi                                  fi
                         done                          done
                         print_info " done."                          print_info " done."
                 fi                  fi
   
                 # UDP                  # TCP
                 if [ -z "$ACCEPT_OUTPUT_UDP" ]; then                  if [ -z "$ACCEPT_OUTPUT_TCP" ]; then
                         if [ -n "${!gateway}" ]; then                          if [ -n "${!gateway}" ]; then
                                 for ip in ${!IPS}; do                                  for ip in ${!IPS}; do
                                         output_udp_str="$output_udp_str $ip:${!riface}:${!gateway}";                                          output_tcp_str="$output_tcp_str $ip:${!riface}:${!gateway}";
                                         $IPTABLES -A OUTPUT -p UDP -o ${!riface} -s $ip -j ACCEPT                                          $IPTABLES -A OUTPUT -p TCP -o ${!riface} -s $ip -j ACCEPT
                                 done                                  done
                         fi                          fi
                 else                  else
                         print_info -en "$iface: Accepting OUTPUT UDP connections to ports:"                          print_info -en "$iface: Accepting OUTPUT TCP connections to ports:"
                         for port in $ACCEPT_OUTPUT_UDP; do                          for port in $ACCEPT_OUTPUT_TCP; do
                                 dest_ip=""                                  dest_ip=""
                                 eval `echo $port | awk -v FS=: '/:/ { printf "dest_ip=\"%s\"; port=\"%s\";", $1, $2; }'`                                  eval `echo $port | awk -v FS=: '/:/ { printf "dest_ip=\"%s\"; port=\"%s\";", $1, $2; }'`
                                 if [ -n "$dest_ip" -a "$port" = "0" ]; then                                  if [ -n "$dest_ip" -a "$port" = "0" ]; then
Riadok 1271  allow_output()
Riadok 1346  allow_output()
                                 fi                                  fi
                                 print_info -en " $port"`[ ! -z "$dest_ip" ] && echo "[$dest_ip]"`                                  print_info -en " $port"`[ ! -z "$dest_ip" ] && echo "[$dest_ip]"`
                                 if [ -z "$dest_ip" ]; then                                  if [ -z "$dest_ip" ]; then
                                         $IPTABLES -A OUTPUT -o ${!riface} -p UDP --dport $port -j ACCEPT                                          $IPTABLES -A OUTPUT -o ${!riface} -p TCP --dport $port -j ACCEPT
                                 else                                  else
                                         if [ "$port" = "ALL" ]; then                                          if [ "$port" = "ALL" ]; then
                                                 $IPTABLES -A OUTPUT -o ${!riface} -d $dest_ip -p UDP -j ACCEPT                                                  $IPTABLES -A OUTPUT -o ${!riface} -d $dest_ip -p TCP -j ACCEPT
                                         else                                          else
                                                 $IPTABLES -A OUTPUT -o ${!riface} -d $dest_ip -p UDP --dport $port -j ACCEPT                                                  $IPTABLES -A OUTPUT -o ${!riface} -d $dest_ip -p TCP --dport $port -j ACCEPT
                                         fi                                          fi
                                 fi                                  fi
                         done                          done
Riadok 1543  shaping_status()
Riadok 1618  shaping_status()
   
 add_banned_ip()  add_banned_ip()
 { # {{{  { # {{{
         echo "# `date '+%Y-%m-%d %X' `" >> $DEFAULT_FIREWALL_CONFIG_DIR/BANNED_IP.conf          echo "# `date '+%F %T'`" >> $DEFAULT_FIREWALL_CONFIG_DIR/BANNED_IP.conf
         TMPFILE=`mktemp -t fw-universal.sh-XXXXXX` || exit 1          TMPFILE=`mktemp -t fw-universal.sh-XXXXXX` || exit 1
         trap 'rm -f $TMPFILE' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15          trap 'rm -f $TMPFILE' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
         if [ -z "$*" ]; then          if [ -z "$*" ]; then
Riadok 1834  case "$1" in
Riadok 1909  case "$1" in
                 mangle_prerouting                  mangle_prerouting
                 mangle_output                  mangle_output
                 accept_related                  accept_related
                   accept_loopback
                 log_new_connections                  log_new_connections
                 drop_output                  drop_output
                   allow_output
                   allow_icmp
                   print_info "----[ INCOMMING TRAFFIC ]------------------------------------------------"
                 drop_input                  drop_input
                 reject_input                  reject_input
                 allow_input                  allow_input
                 allow_output  
                 allow_icmp  
                 accept_loopback  
                 masquerade                  masquerade
                 forward_on                  forward_on
                 log_input_drop                  log_input_drop

Legend:
Odstranené z verzie2.104  
zmenené riadky
  Pridané vo verzii2.115

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok