nftables.conf 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. flush ruleset
  2. table inet my_table {
  3. set LANv4 {
  4. type ipv4_addr
  5. flags interval
  6. elements = { 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16 }
  7. }
  8. set LANv6 {
  9. type ipv6_addr
  10. flags interval
  11. elements = { fd00::/8, fe80::/10 }
  12. }
  13. chain my_input_lan {
  14. # accept Accept NFS
  15. # meta l4proto { tcp, udp } th dport 2049
  16. # accept PXE
  17. # udp sport { bootpc, 4011 } udp dport { bootps, 4011 } accept
  18. # accept tftp
  19. # udp dport tftp accept
  20. }
  21. chain my_input {
  22. type filter hook input priority filter; policy drop;
  23. # accept localhost traffic
  24. iif lo accept
  25. # drop invalid connections
  26. ct state invalid drop
  27. # accept traffic originated from us
  28. ct state established,related accept
  29. # accept ICMPv6
  30. meta l4proto ipv6-icmp accept
  31. # accept ICMP
  32. meta l4proto icmp accept
  33. # accept igmp
  34. ip protocol igmp accept
  35. # accept mdns
  36. udp dport mdns ip6 daddr ff02::fb accept
  37. # accept mdns
  38. udp dport mdns ip daddr 224.0.0.251 accept
  39. # accept private ip ranges
  40. ip6 saddr @LANv6 jump my_input_lan
  41. ip saddr @LANv4 jump my_input_lan
  42. # allow ssh access
  43. tcp dport ssh accept
  44. # allow IPP/IPPs whatever that is
  45. # tcp dport ipp accept
  46. # allow http and https
  47. tcp dport { http, https, 8008, 8080 } accept
  48. # Accept DHCPDISCOVER (for DHCP-Proxy)
  49. udp sport bootpc udp dport bootps ip saddr 0.0.0.0 ip daddr 255.255.255.255 accept
  50. }
  51. chain my_forward {
  52. type filter hook forward priority filter; policy drop;
  53. # Drop everything forwarded to us. We do not forward. That is routers job.
  54. }
  55. chain my_output {
  56. type filter hook output priority filter; policy accept;
  57. # Accept every outbound connection
  58. }
  59. }