At 12:11 AM +0300 4/30/02, Gatis Gailis wrote:
>#/bin/sh!
>ifconfig ed0 | grep "inet " | awk '{ print $2 }' /var/run/dynip
>
>3) executes a script that overwrites your dynamic address in ipf.rules with
>the contents of that dynip file and then 4) initializes ipfilter things.
Thanks for all the help everybody. It looks like something similar
to this is certainly the way to go. Probably grab the ip address and
use SED to swap it into my filter file and pipe it into ipf.
Thanks,
Rog
P.S.
For anybody interested, here are my plans for my filter rules.
I'm guessing that I'll have to initially load a basic set that allows
DHCP to pass, then once I have an address, I can load the rest of the
rules and allow everything else. right???
NetBSD 1.5.2
DHCP with dynamic DNS.
Hosting WWW and SMTP, and NAT'ing my home LAN.
# file /etc/ipf.conf
#
# Default policy Deny
block in on ne1
# Anti-Spoofing
block in log quick on ne1 from 192.168.0.0/16 to any # Private net
block in log quick on ne1 from 172.16.0.0/12 to any # Private net
block in log quick on ne1 from 10.0.0.0/8 to any # Private net
block in log quick on ne1 from 127.0.0.0/8 to any # Local net
block in log quick on ne1 from 0.0.0.0/8 to any # Unused
block in log quick on ne1 from 169.254.0.0/16 to any # Autoconfig systems
block in log quick on ne1 from 192.0.2.0/24 to any # Reserved
example IP block
block in log quick on ne1 from 204.152.64.0/23 to any # Reserved by Sun
block in log quick on ne1 from 224.0.0.0/3 to any # Class
D&E Multicast
# Give internal net full access
pass out quick on ne1 proto tcp/udp from 192.168.0.0/24 to
any keep state
pass out quick on ne1 proto icmp from 192.168.0.0/24 to
any keep state
# Uncomment to allow a subset of ICMP requests
# pass in quick on ne1 proto icmp from any to $myip icmp-type
0 # echo reply (ping)
# pass in quick on ne1 proto icmp from any to $myip icmp-type
3 # destination unreachable
# pass in quick on ne1 proto icmp from any to $myip icmp-type
4 # source quench
# pass in quick on ne1 proto icmp from any to $myip icmp-type
5 # redirect message
# pass in quick on ne1 proto icmp from any to $myip icmp-type
8 # echo request (ping)
# pass in quick on ne1 proto icmp from any to $myip icmp-type
11 # time exceeded (traceroute)
# Otherwise, block all icmp.
block in log quick on ne1 proto icmp from any to any
# Finally, allow access to our SSH, SMTP and HTTP Servers
pass in quick on ne1 proto tcp from $ok-host to $myip port
= 22 flags S keep state
pass in quick on ne1 proto tcp from any to $myip port
= 25 flags S keep state
pass in quick on ne1 proto tcp from any to $myip port
= 80 flags S keep state
# Do I need to allow 67/68 since I allow full internal access first?
# pass in log quick on ne1 proto udp from $dhcpserver port = 67
to any port = 68 keep state
# Throw off casual snoopers.
block return-rst in log proto tcp from any to $myip port = 21
block return-rst in log proto tcp from any to $myip port = 22
block return-rst in log proto tcp from any to $myip port = 23
block return-rst in log proto tcp from any to $myip port = 53
block return-rst in log proto tcp from any to $myip port = 443
block return-rst in log proto tcp from any to $myip port = 445
block return-rst in log proto tcp from any to $myip port = 515
# Maybe I can replace the above rules with this one?
# block return-rst in log on ne1 proto tcp all flags S/SA #does this work?
# block return-icmp-as-dest(port-unr) in log quick on ne1 proto udp
from any to $myip port = 111
# block return-icmp-as-dest(port-unr) in log on ne1 proto udp all
# block return-icmp-as-dest(port-unr) in log on ne1 proto icmp all