firewall.conf 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/sh
  2. # firewall command
  3. FwCMD="/sbin/ipfw -q"
  4. ${FwCMD} -f flush
  5. # Networks define
  6. ${FwCMD} table 2 add INTERNAL_NETWORK
  7. #NAT
  8. ${FwCMD} nat 1 config log if EXTERNAL_INTERFACE reset same_ports
  9. ${FwCMD} add 6000 nat 1 ip from table\(2\) to not table\(9\) out xmit EXTERNAL_INTERFACE
  10. ${FwCMD} add 6001 nat 1 ip from any to me in recv EXTERNAL_INTERFACE
  11. #Shape
  12. ${FwCMD} add 12001 pipe tablearg ip from any to table\(4\) via INTERNAL_INTERFACE out
  13. ${FwCMD} add 12000 pipe tablearg ip from table\(3\) to any via INTERNAL_INTERFACE in
  14. #security
  15. ${FwCMD} add 3 deny ip6 from any to any
  16. ${FwCMD} add 4 deny ip from table\(42\) to any
  17. ${FwCMD} add 4 deny ip from any to table\(42\)
  18. ${FwCMD} add 101 allow all from DB_HOST to any
  19. ${FwCMD} add 101 allow all from any to DB_HOST
  20. #access for our site and other things
  21. ${FwCMD} add 62100 allow ip from table\(2\) to table\(17\)
  22. ${FwCMD} add 62100 allow ip from table\(17\) to table\(2\)
  23. # allow access to my http for all
  24. ${FwCMD} add 62000 allow tcp from any to me dst-port 80
  25. ${FwCMD} add 62000 allow tcp from me to any src-port 80
  26. # default block policy
  27. ${FwCMD} add 65533 deny all from table\(2\) to any via INTERNAL_INTERFACE
  28. ${FwCMD} add 65534 deny all from any to table\(2\) via INTERNAL_INTERFACE
  29. ${FwCMD} add 65535 allow all from any to any
  30. # netflow stats
  31. /usr/local/bin/softflowd -i INTERNAL_INTERFACE -n NF_HOST