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.41 a 2.49

verzia 2.41, 2006/03/04 02:43:23 verzia 2.49, 2006/10/04 09:23:25
Riadok 9 
Riadok 9 
 # 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.30 2005/11/01 00:36:24 rajo Exp $  # $Platon: scripts/shell/firewall/fw-universal.sh,v 2.48 2006-09-30 21:55:28 rajo Exp $
 #  #
 # Changelog:  # Changelog:
 # 2003-10-24 - created  # 2003-10-24 - created
Riadok 57  AWK="${AWK:=/usr/bin/awk}"
Riadok 57  AWK="${AWK:=/usr/bin/awk}"
   
 # loopback interface  # loopback interface
 LO_IFACE="${LO_IFACE:=lo}"  LO_IFACE="${LO_IFACE:=lo}"
   # Hide NAT clients behind firewall
   NAT_SET_TTL="${NAT_SET_TTL:=no}"
   
 #  #
 # CONSTANTS - Do not edit  # CONSTANTS - Do not edit
Riadok 108  load_cache()
Riadok 110  load_cache()
                 mkdir -p "$DEFAULT_CACHE_DIR";                  mkdir -p "$DEFAULT_CACHE_DIR";
         fi          fi
   
         config=`cat $DEFAULT_FIREWALL_CONFIG`;          config=`cat $DEFAULT_FIREWALL_CONFIG $0`; # config file and firewalling script
         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 430  masquerade()
Riadok 432  masquerade()
   
                 # hide NAT clients behind firewall: - set TTL                  # hide NAT clients behind firewall: - set TTL
                 # XXX: warning: this breaks traceroute !!!                  # XXX: warning: this breaks traceroute !!!
                 if [ "e$NAT_SET_TTL" = "eyes" ]; then                  if [ ! "a$NAT_SET_TTL" = "ano" ]; then
                         echo "NAT: clients hidden behind firewall - setting TTL"                          echo "NAT: clients hidden behind firewall - setting TTL to $NAT_SET_TTL"
                         $IPTABLES -t mangle -A POSTROUTING -o $NAT_LAN_IFACE -j TTL --ttl-set 64                          $IPTABLES -t mangle -A POSTROUTING -o $NAT_LAN_IFACE -j TTL --ttl-set $NAT_SET_TTL
                 fi                  fi
   
   
Riadok 535  allow_input()
Riadok 537  allow_input()
                         $IPTABLES -A INPUT -s $client_ip -i $NAT_SUBNET_IFACE -j DROP                          $IPTABLES -A INPUT -s $client_ip -i $NAT_SUBNET_IFACE -j DROP
                 done                  done
         fi          fi
           if [ ! -z "$ALL_DROP_INPUT_TCP" ]; then
                   echo -en "Drop ALL INPUT TCP connections on ports:"
                   for port in $ALL_DROP_INPUT_TCP; do
                           for iface in $INTERFACES; do
                                   echo -en " $port($iface)"
                                   $IPTABLES -A INPUT -i $iface -p TCP --dport $port -j DROP
                           done
                   done
                   echo " done."
           fi
           if [ ! -z "$ALL_DROP_INPUT_UDP" ]; then
                   echo -en "Drop ALL INPUT UDP connections on ports:"
                   for port in $ALL_DROP_INPUT_UDP; do
                           for iface in $INTERFACES; do
                                   echo -en " $port($iface)"
                                   $IPTABLES -A INPUT -i $iface -p UDP --dport $port -j DROP
                           done
                   done
                   echo " done."
           fi
         if [ ! -z "$ALL_ACCEPT_INPUT_TCP" ]; then          if [ ! -z "$ALL_ACCEPT_INPUT_TCP" ]; then
                 echo -en "Accepting ALL INPUT TCP connections on ports:"                  echo -en "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=""
                           eval `echo $port | awk -v FS=: '/:/ { printf "src_ip=\"%s\"; port=\"%s\";", $1, $2; }'`
                         for iface in $INTERFACES; do                          for iface in $INTERFACES; do
                                 echo -en " $port($iface)"                                  echo -en " $port($iface)"`[ ! -z $src_ip ] && echo "[$src_ip]"`
                                 IPS="IP_$iface";                                  IPS="IP_$iface";
                                 for ip in ${!IPS}; do                                  for ip in ${!IPS}; do
                                         $IPTABLES -A INPUT -i $iface -d $ip -p TCP --dport $port -j ACCEPT                                          if [ -z "$src_ip" ]; then
                                                   $IPTABLES -A INPUT -i $iface -d $ip -p TCP --dport $port -j ACCEPT
                                           else
                                                   $IPTABLES -A INPUT -i $iface -s $src_ip -d $ip -p TCP --dport $port -j ACCEPT
                                           fi
                                 done                                  done
                         done                          done
                 done                  done
Riadok 551  allow_input()
Riadok 579  allow_input()
         if [ ! -z "$ALL_ACCEPT_INPUT_UDP" ]; then          if [ ! -z "$ALL_ACCEPT_INPUT_UDP" ]; then
                 echo -en "Accepting ALL INPUT UDP connections on ports:"                  echo -en "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=""
                           eval `echo $port | awk -v FS=: '/:/ { printf "src_ip=\"%s\"; port=\"%s\";", $1, $2; }'`
                         for iface in $INTERFACES; do                          for iface in $INTERFACES; do
                                 echo -en " $port($iface)"                                  echo -en " $port($iface)"`[ ! -z $src_ip ] && echo "[$src_ip]"`
                                 IPS="IP_$iface";                                  IPS="IP_$iface";
                                 for ip in ${!IPS}; do                                  for ip in ${!IPS}; do
                                         $IPTABLES -A INPUT -i $iface -d $ip -p UDP --dport $port -j ACCEPT                                          if [ -z "$src_ip" ]; then
                                                   $IPTABLES -A INPUT -i $iface -d $ip -p UDP --dport $port -j ACCEPT
                                           else
                                                   $IPTABLES -A INPUT -i $iface -s $src_ip -d $ip -p UDP --dport $port -j ACCEPT
                                           fi
                                 done                                  done
                         done                          done
                 done                  done
Riadok 606  allow_input()
Riadok 640  allow_input()
                 if [ ! -z "$ACCEPT_INPUT_TCP" ]; then                  if [ ! -z "$ACCEPT_INPUT_TCP" ]; then
                         echo -en "$iface: Accepting INPUT TCP connections on ports:"                          echo -en "$iface: Accepting INPUT TCP connections on ports:"
                         for port in $ACCEPT_INPUT_TCP; do                          for port in $ACCEPT_INPUT_TCP; do
                                 echo -en " $port"                                  src_ip=""
                                   eval `echo $port | awk -v FS=: '/:/ { printf "src_ip=\"%s\"; port=\"%s\";", $1, $2; }'`
                                   echo -en " $port"`[ ! -z $src_ip ] && echo "[$src_ip]"`
                                 for ip in ${!IPS}; do                                  for ip in ${!IPS}; do
                                         $IPTABLES -A INPUT -i $iface -d $ip -p TCP --dport $port -j ACCEPT                                          if [ -z $src_ip ]; then
                                                   $IPTABLES -A INPUT -i $iface -d $ip -p TCP --dport $port -j ACCEPT
                                           else
                                                   $IPTABLES -A INPUT -i $iface -s $src_ip -d $ip -p TCP --dport $port -j ACCEPT
                                           fi
                                 done                                  done
                         done                          done
                         echo " done."                          echo " done."
Riadok 617  allow_input()
Riadok 657  allow_input()
                 if [ ! -z "$ACCEPT_INPUT_UDP" ]; then                  if [ ! -z "$ACCEPT_INPUT_UDP" ]; then
                         echo -en "$iface: Accepting INPUT UDP connections on ports:"                          echo -en "$iface: Accepting INPUT UDP connections on ports:"
                         for port in $ACCEPT_INPUT_UDP; do                          for port in $ACCEPT_INPUT_UDP; do
                                 echo -en " $port"                                  src_ip=""
                                   eval `echo $port | awk -v FS=: '/:/ { printf "src_ip=\"%s\"; port=\"%s\";", $1, $2; }'`
                                   echo -en " $port"`[ ! -z $src_ip ] && echo "[$src_ip]"`
                                 #$IPTABLES -A INPUT -i $iface -d ${!INET_IP} -p UDP --dport $port -j ACCEPT                                  #$IPTABLES -A INPUT -i $iface -d ${!INET_IP} -p UDP --dport $port -j ACCEPT
                                 #$IPTABLES -A INPUT -i $iface --source 192.168.1.0/16 -p UDP --dport $port -j ACCEPT                                  #$IPTABLES -A INPUT -i $iface --source 192.168.1.0/16 -p UDP --dport $port -j ACCEPT
                                 for ip in ${!IPS}; do                                  for ip in ${!IPS}; do
                                         $IPTABLES -A INPUT -i $iface -d $ip -p UDP --dport $port -j ACCEPT                                          if [ -z $src_ip ]; then
                                                   $IPTABLES -A INPUT -i $iface -d $ip -p UDP --dport $port -j ACCEPT
                                           else
                                                   $IPTABLES -A INPUT -i $iface -s $src_ip -d $ip -p UDP --dport $port -j ACCEPT
                                           fi
                                 done                                  done
                         done                          done
                         echo " done."                          echo " done."
Riadok 721  log_forward_drop()
Riadok 767  log_forward_drop()
   
 } # }}}  } # }}}
   
   configure_special_rules()
   { # {{{
   
           echo -en "Loading special rules: "
           ##
           ## for DSL from Slovanet (Slovak DSL provider) and DSL modem DLINK DSL-360T you must add following rule for proper ssh connect to your machine
           ##
           # echo -en "slovanet "
           # $IPTABLES -t mangle -A OUTPUT -s 0/0 -j DSCP --set-dscp 0
   
           echo " done.";
   
   } # }}}
   
 do_ip_accounting()  do_ip_accounting()
 { # {{{  { # {{{
   
Riadok 953  case "$1" in
Riadok 1013  case "$1" in
                 nmap_scan_filter                  nmap_scan_filter
                 invalid_packet_filter                  invalid_packet_filter
                 anti_spoof_filter                  anti_spoof_filter
                 syn_flood                  #syn_flood
                 mangle_prerouting                  mangle_prerouting
                 mangle_output                  mangle_output
                 accept_related                  accept_related
Riadok 969  case "$1" in
Riadok 1029  case "$1" in
                 log_forward_drop                  log_forward_drop
                 forward_on                  forward_on
                 do_ip_accounting                  do_ip_accounting
                   configure_special_rules
                 $IPTABLES_SAVE -c > $CACHE_FILE                  $IPTABLES_SAVE -c > $CACHE_FILE
                 ;;                  ;;
   

Legend:
Odstranené z verzie2.41  
zmenené riadky
  Pridané vo verzii2.49

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