Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Thursday, March 28, 2024

Diff for scripts/shell/firewall/fw-universal.sh between version 2.12 and 2.15

version 2.12, 2005/01/16 10:55:39 version 2.15, 2005/01/16 12:13:32
Line 9 
Line 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.11 2005/01/13 13:31:54 rajo Exp $  # $Platon: scripts/shell/firewall/fw-universal.sh,v 2.14 2005/01/16 11:06:46 rajo Exp $
 #  #
 # Changelog:  # Changelog:
 # 2003-10-24 - created  # 2003-10-24 - created
Line 37  LOG_LIMIT="${LOG_LIMIT:=-m limit --limit
Line 37  LOG_LIMIT="${LOG_LIMIT:=-m limit --limit
   
 # Paths:  # Paths:
 #IPTABLES=":" # for testing only - does nothing  #IPTABLES=":" # for testing only - does nothing
 IPTABLES="${IPTABLES:=/sbin/iptables}"  IPTABLES="${IPTABLES:=$DEBUG/sbin/iptables}"
 IFCONFIG="${IFCONFIG:=/sbin/ifconfig}"  IFCONFIG="${IFCONFIG:=/sbin/ifconfig}"
 DEPMOD="${DEPMOD:=/sbin/depmod}"  DEPMOD="${DEPMOD:=/sbin/depmod}"
 MODPROBE="${MODPROBE:=/sbin/modprobe}"  MODPROBE="${MODPROBE:=/sbin/modprobe}"
Line 48  AWK="${AWK:=/usr/bin/awk}"
Line 48  AWK="${AWK:=/usr/bin/awk}"
 LO_IFACE="${LO_IFACE:=lo}"  LO_IFACE="${LO_IFACE:=lo}"
 LO_IP="IP_$LO_IFACE"  LO_IP="IP_$LO_IFACE"
   
 # Which ports will be allowed on INPUT (TCP connections)  
 ALL_ACCEPT_INPUT_TCP="${ALL_ACCEPT_INPUT_TCP:=}"  
 # interface eth0  
 eth0_ACCEPT_INPUT_TCP="${eth0_ACCEPT_INPUT_TCP:=}"  
 # interface ppp0  
 ppp0_ACCEPT_INPUT_TCP="${ppp0_ACCEPT_INPUT_TCP:=}"  
   
 # Which ports will be allowed on INPUT (UDP connections)  
 # interface eth0  
 eth0_ACCEPT_INPUT_UDP="${eth0_ACCEPT_INPUT_UDP:=}"  
 # interface ppp0  
 ppp0_ACCEPT_INPUT_UDP="${ppp0_ACCEPT_INPUT_UDP:=}"  
   
 # allow some ICMP packets - needed for ping etc.  # allow some ICMP packets - needed for ping etc.
 ACCEPT_ICMP_PACKETS="${ACCEPT_ICMP_PACKETS:=echo-reply destination-unreachable echo-request time-exceeded}"  ACCEPT_ICMP_PACKETS="${ACCEPT_ICMP_PACKETS:=echo-reply destination-unreachable echo-request time-exceeded}"
   
Line 124  remove_chains()
Line 111  remove_chains()
   
 } # }}}  } # }}}
   
 # all packets on loopback are accpted  
 set_loopback()  
 { # {{{  
         $IPTABLES -A INPUT  -j ACCEPT -i $LO_IFACE  
         $IPTABLES -A OUTPUT -j ACCEPT -o $LO_IFACE  
 } # }}}  
   
 # DROP packages from nmap(1)  # DROP packages from nmap(1)
 nmap_scan_filter()  nmap_scan_filter()
 { # {{{  { # {{{
Line 392  drop_output()
Line 372  drop_output()
   
 } # }}}  } # }}}
   
 allow_input()  allow_accept_all()
 { # {{{  { # {{{
   
         if [ ! -z "$IFACE_ACCEPT_ALL" ]; then          if [ ! -z "$IFACE_ACCEPT_ALL" ]; then
                 echo -en "Accepting ALL packets on interfaces:"                  echo -en "Accepting ALL packets on interfaces:"
                 for iface in $IFACE_ACCEPT_ALL; do                  for iface in $IFACE_ACCEPT_ALL; do
Line 405  allow_input()
Line 384  allow_input()
                 done                  done
                 echo " done."                  echo " done."
         fi          fi
   } # }}}
   
   allow_input()
   { # {{{
   
         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:"
Line 594  parse_ifconfig()
Line 577  parse_ifconfig()
 parse_ifconfig  parse_ifconfig
 print_iface_status  print_iface_status
   
 # $interfaces - all interfaces  #
   # Split interfaces into 2 groups:
   #
   # $INTERFACES_ACCEPT_ALL - interfaces withouth restrictions
   #
 # $INTERFACES - all interfaces withouth loopback  # $INTERFACES - all interfaces withouth loopback
   #               and devices without restrictions (e.g. tun0 tun1 tap0 ...)
   #
   # list of all interfaces is in $interfaces variable
   #
 INTERFACES=""  INTERFACES=""
   INTERFACES_ACCEPT_ALL=""
   regexp='^\('`echo $IFACE_ACCEPT_ALL | sed 's/ /\\\|/g; s/+/.*/g;'`'\)$'
 for iface in $interfaces; do  for iface in $interfaces; do
         if [ "o$iface" = "olo" ]; then continue; fi          #if [ "o$iface" = "olo" ]; then continue; fi
         INTERFACES="$INTERFACES $iface";          echo $iface | grep -q -e "$regexp"
           if [ $? = 0 ] || [ "o$iface" = "olo" ]; then # lo interface is always here
                   INTERFACES_ACCEPT_ALL="$INTERFACES_ACCEPT_ALL $iface";
           else
                   INTERFACES="$INTERFACES $iface";
           fi
 done  done
   
   
Line 614  case "$1" in
Line 612  case "$1" in
                 #                  #
                 # (un)commnet next lines as needed                  # (un)commnet next lines as needed
                 #                  #
                 set_loopback                  allow_accept_all
                 nmap_scan_filter                  nmap_scan_filter
                 invalid_packet_filter                  invalid_packet_filter
                 anti_spoof_filter                  anti_spoof_filter

Legend:
Removed from v.2.12  
changed lines
  Added in v.2.15

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top