Firewall StartupItem part 2

| No TrackBacks

One thing that's very important when setting up a new StartupItem like I did with my Firewall script is to make sure that the privledges are set correctly so that it actually runs at startup... The acticle I referenced didn't include this, but the reader comments at the end did. Specifically, the folder and enclosed items should be owned by root with group wheel with privs 755.

I had one question regarding the script and how I references the set of rules I wrote, the original article had these saved in /etc, which to me seemed a bit silly, having them in the same folder as the Startup script seemed much more logical. Here is my working script for this:


#!/bin/sh

##
# Firewall
##

. /etc/rc.common

StartService ()
{
if [ "${FIREWALL:=-NO-}" = "-YES-" ]
then
ConsoleMessage "Starting Firewall"
sh /Library/StartupItems/Firewall/fw.rules > /dev/null
fi
}

StopService ()
{
ConsoleMessage "Stopping Firewall"
/sbin/ipfw -f -q flush
}

RestartService ()
{
StopService
StartService
}

RunService "$1"

No TrackBacks

TrackBack URL: http://www.wrightthisway.com/cgi-bin/mt/mt-tb.cgi/385

November 2010

Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        

About this Entry

This page contains a single entry by Jim published on April 15, 2007 9:55 PM.

OS X Firewall was the previous entry in this blog.

New Router is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 5.031