attachment:initd_iptables.txt of DynamicFirewall


Attachment 'initd_iptables.txt'

Download

Toggle line numbers
   1 #!/bin/sh -e
   2 ### BEGIN INIT INFO
   3 # Provides:          iptables
   4 # Required-Start:    mountvirtfs ifupdown $local_fs
   5 # Default-Start:     S
   6 # Default-Stop:      0 6
   7 ### END INIT INFO
   8 
   9 # July 9, 2007
  10 # James B. Crocker <ubuntu@james.crocker.name>
  11 # Creative Commons Attribution - Share Alike 3.0 License (BY,SA)
  12 # Script to load/unload/save iptables firewall settings.
  13 
  14 PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
  15 
  16 IPTABLES=/sbin/iptables
  17 IPTABLES_SAVE=/sbin/iptables-save
  18 IPTABLES_RESTORE=/sbin/iptables-restore
  19 
  20 IPTABLES_CONFIG=/etc/iptables.conf
  21 
  22 [ -x $IPTABLES ] || exit 0
  23 
  24 . /lib/lsb/init-functions
  25 
  26 
  27 case "$1" in
  28 start)
  29 	log_action_begin_msg "Starting firewall"
  30         type usplash_write >/dev/null 2>/dev/null && usplash_write "TIMEOUT 120" || true
  31 	if $IPTABLES_RESTORE < $IPTABLES_CONFIG ; then
  32 		log_action_end_msg $?
  33 	else
  34 		log_action_end_msg $?
  35 	fi
  36         type usplash_write >/dev/null 2>/dev/null && usplash_write "TIMEOUT 15" || true
  37 	;;
  38 
  39 stop)
  40 	log_action_begin_msg "Saving current firewall configuration"
  41 	if $IPTABLES_SAVE > $IPTABLES_CONFIG ; then
  42 		log_action_end_msg $?
  43 	else
  44 		log_action_end_msg $?
  45 	fi
  46 	log_action_begin_msg "Flushing ALL firewall rules from chains!"
  47 	if $IPTABLES -F ; then
  48 		log_action_end_msg $?
  49 	else
  50 		log_action_end_msg $?
  51 	fi
  52 	log_action_begin_msg "Deleting ALL firewall chains [Warning: ACCEPTING ALL PORT SERVICES!]"
  53 	if $IPTABLES -X ; then
  54 		$IPTABLES -P INPUT ACCEPT
  55 		$IPTABLES -P FORWARD ACCEPT
  56 		$IPTABLES -P OUTPUT ACCEPT
  57 		log_action_end_msg $?
  58 	else
  59 		log_action_end_msg $?
  60 	fi
  61 	;;
  62 
  63 save)
  64 	log_action_begin_msg "Saving current firewall configuration"
  65 	if $IPTABLES_SAVE > $IPTABLES_CONFIG ; then
  66 		log_action_end_msg $?
  67 	else
  68 		log_action_end_msg $?
  69 	fi
  70 	;;
  71 
  72 force-reload|restart)
  73 	log_action_begin_msg "Reloading firewall configuration [Warning: POTENTIAL NETWORK INSECURITY DURING RELOAD]"
  74 	$IPTABLES -F
  75 	$IPTABLES -X
  76 	if $IPTABLES_RESTORE < $IPTABLES_CONFIG ; then
  77 		log_action_end_msg $?
  78 	else
  79 		log_action_end_msg $?
  80 	fi
  81 	;;
  82 
  83 *)
  84 	echo "Usage: /etc/init.d/iptables {start|stop|save|restart|force-reload}"
  85 	exit 1
  86 	;;
  87 esac
  88 
  89 exit 0

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2007-07-09 20:45:59, 67.4 KB) [[attachment:attachment_fwbuilder_mod_hosttemplate.png]]
  • [get | view] (2007-07-09 22:48:32, 55.6 KB) [[attachment:fwbuilder_addinterface.png]]
  • [get | view] (2007-07-09 19:05:58, 72.9 KB) [[attachment:fwbuilder_hosttemplate]]
  • [get | view] (2007-07-09 19:08:49, 72.9 KB) [[attachment:fwbuilder_hosttemplate.png]]
  • [get | view] (2007-07-09 20:46:22, 67.4 KB) [[attachment:fwbuilder_mod_hosttemplate.png]]
  • [get | view] (2007-07-09 22:59:26, 2.1 KB) [[attachment:initd_iptables.txt]]
  • [get | view] (2007-07-09 21:48:29, 2.1 KB) [[attachment:initrd_iptables.txt]]
 All files | Selected Files: delete move to page

You are not allowed to attach a file to this page.