Topic: FreeBSD in PF
Pozdravljeni!
Pred nekaj dnevi sem se odločil, da spišem svoja pravila(jih preuredim) v PFju. Ker sem bolj ko ne nov v PFju bi vas prosil, če bi lahko na hitro preverili ali je vse ok oz. kaj manjka, kaj bi bilo pametno dodati. (Do zdaj sem pa uporabljal ipfw)
### macros name for external interface
ext_if = "bge0"
### all incoming traffic on external interface is normalized and fragmented
### packets are reassembled
scrub in on $ext_if all fragment reassemble
### set a default deny everything policy.
set skip on lo0
block log all
antispoof for $ext_if inet
### block anything coming from sources that we have no back routes for.
block in from no-route to any
### block packets that fail a reverse path check. we look up the routing
### table, check to make sure that the outbound is the same as the source
### it came in on. if not, it is probably source address spoofed.
block in from urpf-failed to any
### drop broadcast requests quietly.
# block in quick on $ext_if from any to 255.255.255.255
### block packets claiming to come from reserved internal address blocks, as
### they are obviously forged and cannot be contacted from the outside world.
block in log quick on $ext_if from { 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 255.255.255.255/32 } to any
### keep state on any outbound tcp, udp or icmp traffic. modulate the isn of
### outgoing packets. (initial sequence number) broken operating systems
### sometimes don't randomize this number, making it guessable.
pass out on $ext_if proto { tcp, udp, icmp } from any to any modulate state
### spodnji ipji pridejo cez firewall
# pass quick in on $ext_if from XXX.XXX.XXX.XXX to any keep state
### spodaj navedeni porti ostanejo odprti (21,22,25,80,...)
pass in quick on $ext_if proto tcp from any to ($ext_if) port 22 flags S/SA keep state
### crna lista ip naslovov
table <blockedips> persist file "/etc/pf.blocked.ip.conf"
block drop in log (all) quick on $ext_if from <blockedips> to anySama pravila bolj ko ne delujejo... razen tale tale vrstica ne deluje ok:
### spodaj navedeni porti ostanejo odprti (21,22,25,80,...)
pass in quick on $ext_if proto tcp from any to ($ext_if) port 22 flags S/SA keep stateZa vaše odgovore se vam že v naprej zahvaljujem.