Listing 8: add.output
#!/bin/sh
IPFW="/sbin/ipfwadm"
# Assume eth0 is our trusted interface
TRUSTIF=`/sbin/ifconfig eth0|sed -n -e "s/^[ ]*inet addr\:\([0-
9\.]*\).*$/\1/p"`
if [ -x $IPFW ]; then
# Add output rule for me -> nameserver
$IPFW -O -a accept -P udp -V $TRUSTIF -S 193.78.174.33 -D 193.78.174.34 53
# Add output rule for nameserver -> Internet
$IPFW -O -a accept -P udp -S 194.109.13.150 -D 0.0.0.0/0 53
# Add output rule for Internet -> nameserver (masqueraded)
$IPFW -O -a accept -P udp -V $TRUSTIF -S 0.0.0.0/0 53 -D 193.78.174.34 53
# Add output rule for local -> Internet
$IPFW -O -a accept -P tcp -S 194.109.13.150 -D 0.0.0.0/0
# Add output rules for FTP data connection
$IPFW -O -a accept -P tcp -S 0.0.0.0/0 20 -D 193.78.174.34 1024:65535
$IPFW -O -a accept -P tcp -S 0.0.0.0/0 20 -D 193.78.174.35 1024:65535
# Add output rules for Internet -> clients, ACK only !! (masqueraded)
$IPFW -O -a accept -P tcp -k -S 0.0.0.0/0 -D 193.78.174.34
$IPFW -O -a accept -P tcp -k -S 0.0.0.0/0 -D 193.78.174.35
fi
|