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

Diff for scripts/shell/firewall/fw-universal.sh between version 2.108 and 2.109

version 2.108, 2016/02/26 03:11:01 version 2.109, 2016/02/26 07:01:10
Line 22 
Line 22 
 # 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.107 2016/02/26 02:53:42 nepto Exp $  # $Platon: scripts/shell/firewall/fw-universal.sh,v 2.108 2016/02/26 03:11:01 nepto Exp $
 #  #
 # Changelog:  # Changelog:
 # 2003-10-24 - created  # 2003-10-24 - created
Line 1250  allow_output()
Line 1250  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
Line 1269  allow_output()
Line 1274  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
Line 1299  allow_output()
Line 1304  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

Legend:
Removed from v.2.108  
changed lines
  Added in v.2.109

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