fuckit756
July 7th, 2003, 16:52
Hello everyone. Excuse my bad english, I'm French. I want to setup an OpenBSD firewall for my LAN, behind an ADSL (512/128) router. In my LAN, I have a webserver. These rules work fine, but i want to know if I can optimize it. This is my network :
[Internet]---[Router]---[OBSD Firewall]---[Private LAN + Webserver]
10.0.0.0 192.168.1.0
My rules are :
### VARIABLES ###
Ext = "ne4" # Router-OBSD
Int = "ne3" # OBSD-LAN
IntNet = "192.168.1.0/24"
RouterIP = "192.168.1.1"
Loop = "lo0"
ServWeb = "192.168.1.2"
InServicesTCP = "{ ftp, auth, http, ssh }"
table <spammers> persist
### OPTIONS ###
set loginterface $Ext
set limit { states 10000, frags 5000 }
set optimization aggressive
scrub in on $Ext all fragment reassemble
scrub out on $Ext all random-id max-mss 1440
### ALTQ ###
altq on $Ext priq bandwidth 100Kb queue { q_pri, q_def }
queue q_pri priority 7
queue q_def priority 1 priq(default)
### NAT & FORWARD ###
nat on $Ext from $IntNet to any -> $Ext static-port
rdr on $Int proto tcp from !$RouterIP to !$IntNet port 21 -> 127.0.0.1 port 8081
rdr on $Ext proto tcp from any to any port 80 -> $ServWeb
rdr on $Ext proto tcp from any to any port 757 -> $ServWeb
rdr-anchor redirect
### FILTER ###
block log on $Ext
block return log on $Ext
block log quick inet6
block in log quick on $Ext inet proto tcp from any to any flags FUP/FUP
block in log quick on $Ext inet proto tcp from any to any flags SF/SFRA
block in log quick on $Ext inet proto tcp from any to any flags /SFRA
block in log quick on $Ext inet proto tcp from any to any flags F/SFRA
block in log quick on $Ext inet proto tcp from any to any flags U/SFRAU
antispoof log quick for $Ext inet
antispoof log quick for $Int inet
antispoof log quick for $Loop inet
block log quick on $Ext from <spammers> to any
pass quick on $Loop
pass in quick on $Ext inet proto tcp from any to any port > 49151 user proxy flags S/SAFR keep state queue (q_def, q_pri)
pass in quick on $Ext inet proto icmp all icmp-type 8 code 0 keep state
pass in quick on $Ext inet proto tcp from any to any port $InServicesTCP flags S/SAFR keep state label ServicesTCP queue (q_def, q_pri)
anchor passin
pass out on $Ext proto tcp all flags S/SA modulate state queue (q_def, q_pri)
pass out on $Ext proto { udp, icmp } all keep state
[Internet]---[Router]---[OBSD Firewall]---[Private LAN + Webserver]
10.0.0.0 192.168.1.0
My rules are :
### VARIABLES ###
Ext = "ne4" # Router-OBSD
Int = "ne3" # OBSD-LAN
IntNet = "192.168.1.0/24"
RouterIP = "192.168.1.1"
Loop = "lo0"
ServWeb = "192.168.1.2"
InServicesTCP = "{ ftp, auth, http, ssh }"
table <spammers> persist
### OPTIONS ###
set loginterface $Ext
set limit { states 10000, frags 5000 }
set optimization aggressive
scrub in on $Ext all fragment reassemble
scrub out on $Ext all random-id max-mss 1440
### ALTQ ###
altq on $Ext priq bandwidth 100Kb queue { q_pri, q_def }
queue q_pri priority 7
queue q_def priority 1 priq(default)
### NAT & FORWARD ###
nat on $Ext from $IntNet to any -> $Ext static-port
rdr on $Int proto tcp from !$RouterIP to !$IntNet port 21 -> 127.0.0.1 port 8081
rdr on $Ext proto tcp from any to any port 80 -> $ServWeb
rdr on $Ext proto tcp from any to any port 757 -> $ServWeb
rdr-anchor redirect
### FILTER ###
block log on $Ext
block return log on $Ext
block log quick inet6
block in log quick on $Ext inet proto tcp from any to any flags FUP/FUP
block in log quick on $Ext inet proto tcp from any to any flags SF/SFRA
block in log quick on $Ext inet proto tcp from any to any flags /SFRA
block in log quick on $Ext inet proto tcp from any to any flags F/SFRA
block in log quick on $Ext inet proto tcp from any to any flags U/SFRAU
antispoof log quick for $Ext inet
antispoof log quick for $Int inet
antispoof log quick for $Loop inet
block log quick on $Ext from <spammers> to any
pass quick on $Loop
pass in quick on $Ext inet proto tcp from any to any port > 49151 user proxy flags S/SAFR keep state queue (q_def, q_pri)
pass in quick on $Ext inet proto icmp all icmp-type 8 code 0 keep state
pass in quick on $Ext inet proto tcp from any to any port $InServicesTCP flags S/SAFR keep state label ServicesTCP queue (q_def, q_pri)
anchor passin
pass out on $Ext proto tcp all flags S/SA modulate state queue (q_def, q_pri)
pass out on $Ext proto { udp, icmp } all keep state