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

Rozdiely pre scripts/shell/firewall/fw-universal.sh medzi verziami 2.74 a 2.77

verzia 2.74, 2010/08/08 23:34:25 verzia 2.77, 2011/01/24 20:26:04
Riadok 1 
Riadok 1 
 #!/bin/bash  #!/bin/bash
   
   ### BEGIN INIT INFO
   # Provides:             firewall
   # Required-Start:       networking
   # Required-Stop:
   # Default-Start:        S
   # Default-Stop:
   # Short-Description:    firewalling rules
   ### END INIT INFO
   
 #  #
 # This will be universal firewalling script for Linux kernel (iptables) in near future  # This will be universal firewalling script for Linux kernel (iptables) in near future
 # 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-2009 Platon Group, http://platon.sk/  # Copyright (c) 2003-2011 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.73 2010-06-21 21:52:16 nepto Exp $  # $Platon: scripts/shell/firewall/fw-universal.sh,v 2.76 2011-01-16 12:18:14 nepto Exp $
 #  #
 # Changelog:  # Changelog:
 # 2003-10-24 - created  # 2003-10-24 - created
 #  #
   
   ### BEGIN INIT INFO
   # Provides:          firewall
   # Required-Start:    $network $remote_fs
   # Required-Stop:     $network $remote_fs
   # Default-Start:     2 3 4 5
   # Default-Stop:      0 1 6
   # Short-Description: Starts firewall
   # Description:       Handle universal firewall script by Platon Group
   #                    http://platon.sk/cvs/cvs.php/scripts/shell/firewall/
   # Author:            Lubomir Host <rajo@platon.sk>
   # Copyright:         (c) 2003-2011 Platon Group
   ### END INIT INFO
   
 umask 077 # security  umask 077 # security
   
 DESC="firewall"  DESC="firewall"
Riadok 452  masquerade()
Riadok 474  masquerade()
                         if [ "x$NAT_FORWARD_MICROSOFT" = "xno" ]; then                          if [ "x$NAT_FORWARD_MICROSOFT" = "xno" ]; then
                                 $IPTABLES -A FORWARD -p TCP ! --syn -m state --state NEW -j DROP                                  $IPTABLES -A FORWARD -p TCP ! --syn -m state --state NEW -j DROP
   
                                 for port in 69 135 445 1434 6667; do                                  for port in 67 68 69 135 445 1434 6667; do
                                         $IPTABLES -A FORWARD -p TCP --dport $port -j DROP                                          $IPTABLES -A FORWARD -p TCP --dport $port -j DROP
                                         $IPTABLES -A FORWARD -p UDP --dport $port -j DROP                                          $IPTABLES -A FORWARD -p UDP --dport $port -j DROP
                                 done                                  done
Riadok 477  masquerade()
Riadok 499  masquerade()
                         print_info " done."                          print_info " done."
                 fi                  fi
   
                   # NAT_FORWARD_TCP_HOSTS {{{
                   if [ ! -z "$NAT_FORWARD_TCP_HOSTS" ]; then
                           print_info -en "\tAccepting FORWARD TCP hosts:"
                           for host in $NAT_FORWARD_TCP_HOSTS; do
                                   print_info -en " $host"
                                   $IPTABLES -A FORWARD -p TCP -d $host -m state --state NEW -j ACCEPT
                           done
                           print_info " done."
                   fi
                   # }}}
   
                   # NAT_FORWARD_UDP_HOSTS {{{
                   if [ ! -z "$NAT_FORWARD_UDP_HOSTS" ]; then
                           print_info -en "\tAccepting FORWARD UDP hosts:"
                           for host in $NAT_FORWARD_UDP_HOSTS; do
                                   print_info -en " $host"
                                   $IPTABLES -A FORWARD -p UDP -d $host -m state --state NEW -j ACCEPT
                           done
                           print_info " done."
                   fi
                   # }}}
   
                   # NAT_FORWARD_TCP_CLIENTS {{{
                   if [ ! -z "$NAT_FORWARD_TCP_CLIENTS" ]; then
                           print_info -en "\tAccepting FORWARD TCP clients:"
                           for client in $NAT_FORWARD_TCP_CLIENTS; do
                                   print_info -en " $client"
                                   $IPTABLES -A FORWARD -p TCP -s $client -m state --state NEW -j ACCEPT
                           done
                           print_info " done."
                   fi
                   # }}}
   
                   # NAT_FORWARD_UDP_CLIENTS {{{
                   if [ ! -z "$NAT_FORWARD_UDP_CLIENTS" ]; then
                           print_info -en "\tAccepting FORWARD UDP clients:"
                           for client in $NAT_FORWARD_UDP_CLIENTS; do
                                   print_info -en " $client"
                                   $IPTABLES -A FORWARD -p UDP -s $client -m state --state NEW -j ACCEPT
                           done
                           print_info " done."
                   fi
                   # }}}
   
                 print_info -en "\tAccepting ICMP packets:"                  print_info -en "\tAccepting ICMP packets:"
                 for type in $ACCEPT_ICMP_PACKETS; do                  for type in $ACCEPT_ICMP_PACKETS; do
                         print_info -en " $type"                          print_info -en " $type"
Riadok 743  allow_input()
Riadok 809  allow_input()
                                 riface="IFname_$iface";                                  riface="IFname_$iface";
                                 print_info -en " $port($iface)"`[ ! -z $src_ip ] && echo "[$src_ip]"`                                  print_info -en " $port($iface)"`[ ! -z $src_ip ] && echo "[$src_ip]"`
                                 IPS="IP_$iface";                                  IPS="IP_$iface";
                                 for ip in ${!IPS}; do                                  if [ "$port" -eq 67 ]; then # DHCP requests doesn't have destination IP specified
                                         if [ -z "$src_ip" ]; then                                          $IPTABLES -A INPUT -i ${!riface} -p UDP --dport $port -j ACCEPT
                                                 $IPTABLES -A INPUT -i ${!riface} -d $ip -p UDP --dport $port -j ACCEPT                                  else
                                         else                                          for ip in ${!IPS}; do
                                                 $IPTABLES -A INPUT -i ${!riface} -s $src_ip -d $ip -p UDP --dport $port -j ACCEPT                                                  if [ -z "$src_ip" ]; then
                                         fi                                                          $IPTABLES -A INPUT -i ${!riface} -d $ip -p UDP --dport $port -j ACCEPT
                                 done                                                  else
                                                           $IPTABLES -A INPUT -i ${!riface} -s $src_ip -d $ip -p UDP --dport $port -j ACCEPT
                                                   fi
                                           done
                                   fi
                         done                          done
                 done                  done
                 print_info " done."                  print_info " done."
Riadok 903  allow_input()
Riadok 973  allow_input()
                                 print_info -en " $port"`[ ! -z $src_ip ] && echo "[$src_ip]"`                                  print_info -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                                  if [ "$port" -eq 67 ]; then # DHCP requests doesn't have destination IP specified
                                         if [ -z $src_ip ]; then                                          $IPTABLES -A INPUT -i ${!riface} -p UDP --dport $port -j ACCEPT
                                                 $IPTABLES -A INPUT -i ${!riface} -d $ip -p UDP --dport $port -j ACCEPT                                  else
                                         else                                          for ip in ${!IPS}; do
                                                 if [ "$port" = "ALL" ]; then                                                  if [ -z $src_ip ]; then
                                                         $IPTABLES -A INPUT -i ${!riface} -s $src_ip -d $ip -p UDP -j ACCEPT                                                          $IPTABLES -A INPUT -i ${!riface} -d $ip -p UDP --dport $port -j ACCEPT
                                                 else                                                  else
                                                         $IPTABLES -A INPUT -i ${!riface} -s $src_ip -d $ip -p UDP --dport $port -j ACCEPT                                                          if [ "$port" = "ALL" ]; then
                                                                   $IPTABLES -A INPUT -i ${!riface} -s $src_ip -d $ip -p UDP -j ACCEPT
                                                           else
                                                                   $IPTABLES -A INPUT -i ${!riface} -s $src_ip -d $ip -p UDP --dport $port -j ACCEPT
                                                           fi
                                                 fi                                                  fi
                                         fi                                          done
                                 done                                  fi
                         done                          done
                         print_info " done."                          print_info " done."
                 fi                  fi
Riadok 1035  custom_rules()
Riadok 1109  custom_rules()
                         if [ -z "${!varname}" ]; then                          if [ -z "${!varname}" ]; then
                                 break;                                  break;
                         fi                          fi
                         echo -n "#$i";                          print_info -n "#$i";
                         $IPTABLES ${!varname};                          $IPTABLES ${!varname};
                         rc="$?";                          rc="$?";
                         if [ "$rc" -eq 0 ]; then                          if [ "$rc" -eq 0 ]; then
                                 echo -n "[OK] ";                                  print_info -n "[OK] ";
                         else                          else
                                 echo -n "[rc:$?] ";                                  print_info -n "[rc:$?] ";
                         fi;                          fi;
                         initialized="yes";                          initialized="yes";
                 done                  done

Legend:
Odstranené z verzie2.74  
zmenené riadky
  Pridané vo verzii2.77

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