Date: Sat, 18 Feb 2006 20:21:29 -0600 From: Vulpes Velox <v.velox@vvelox.net> Cc: freebsd-current@freebsd.org Subject: Re: Changes to IPFW start up scripts. [updated[ Message-ID: <20060218202129.60ce8f9c@vixen42.vulpes> In-Reply-To: <20060218170647.497340e7@vixen42.vulpes> References: <20060218170647.497340e7@vixen42.vulpes>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Sat, 18 Feb 2006 17:06:47 -0600
Vulpes Velox <v.velox@vvelox.net> wrote:
> This adds in the ability to run /etc/rc.d/ipfw save
> or /etc/rc.d/ip6fw save. This saves it to /etc/rc.firewall.save
> or /etc/rc.firewall6.save. By setting the firewall type to LAST it
> the last save will be used.
I have updated them to save to /var/db/ipfw/ as suggested by Sean
Chittenden.
I also fixed the problem with the loopback stuff getting added more
than once.
It will now accept names for the files. ipfw start dog will
use /var/db/ipfw/dog. This applies to save as well.
[-- Attachment #2 --]
17a18,27
> extra_commands="save"
> save_cmd="ipfw_save"
>
> # Gets the name of the save to use.
> if [ ! -z $2 ]; then
> savename="$2"
> usingsave="yes"
> else
> savename="last"
> fi
31a42,48
> ipfw_save()
> {
> # Saves the firewall rules to /var/db/ipfw/$savename
> [ ! -d /var/db/ipfw ] && mkdir /var/db/ipfw && chmod go-rwx /var/db/ipfw
> ipfw list | awk '{print "${fwcmd} add " $0 }' > /var/db/ipfw/$savename.6
> }
>
33a51,58
> # Make sure the save file exists if one is specified.
> if [ ! -z $usingsave ]; then
> if [ ! -f "/var/db/ipfw/$savename.6" ]; then
> echo "Specified save does not exist"
> exit 1
> fi
> fi
>
42c67
< . "${ipv6_firewall_script}"
---
> . "${ipv6_firewall_script}" $savename
[-- Attachment #3 --]
18a19,29
> extra_commands="save"
> save_cmd="ipfw_save"
>
>
> #gets the name of the save to use
> if [ ! -z $2 ]; then
> savename="$2"
> usingsave="yes"
> else
> savename="last"
> fi
31a43,49
> ipfw_save()
> {
> # Saves the firewall rules to /var/db/ipfw/$savename
> [ ! -d /var/db/ipfw ] && mkdir /var/db/ipfw && chmod go-rwx /var/db/ipfw
> ipfw list | awk '{print "${fwcmd} add " $0 }' > /var/db/ipfw/$savename
> }
>
33a52,59
> # Make sure the save file exists if one is specified
> if [ ! -z $usingsave ]; then
> if [ ! -f "/var/db/ipfw/$savename" ]; then
> echo "Specified save does not exist"
> exit 1
> fi
> fi
>
38c64
< . "${firewall_script}"
---
> . "${firewall_script}" $savename
[-- Attachment #4 --]
--- /usr/src/etc/rc.firewall Sun Nov 2 07:31:44 2003
+++ /etc/rc.firewall Sun Feb 19 09:08:52 2006
@@ -143,6 +143,17 @@
setup_loopback
${fwcmd} add 65000 pass all from any to any
;;
+
+[Ll][Aa][Ss][Tt])
+ # Gets the name of the save to use.
+ if [ ! -z $1 ]; then
+ savename="$1"
+ else
+ savename="last"
+ fi
+
+ . /var/db/ipfw/$savename
+ ;;
[Cc][Ll][Ii][Ee][Nn][Tt])
############
[-- Attachment #5 --]
--- /usr/src/etc/rc.firewall6 Sun Dec 4 08:48:05 2005
+++ /etc/rc.firewall6 Sun Feb 19 09:13:20 2006
@@ -105,6 +105,17 @@
${fw6cmd} add 65000 pass all from any to any
;;
+[Ll][Aa][Ss][Tt])
+ # Gets the name of the save to use.
+ if [ ! -z $1 ]; then
+ savename="$1"
+ else
+ savename="last"
+ fi
+
+ . /var/db/ipfw/$savename.6
+ ;;
+
[Cc][Ll][Ii][Ee][Nn][Tt])
############
# This is a prototype setup that will protect your system somewhat
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060218202129.60ce8f9c>
