Guest User

Untitled

a guest
Jan 13th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. #!/usr/sbin/nft -f
  2.  
  3. flush ruleset
  4.  
  5. table inet filter {
  6. chain base_checks {
  7. # allow established connections
  8. ct state {established, related} accept
  9.  
  10. # early drop of invalid connections
  11. ct state invalid drop
  12. }
  13. chain input {
  14. type filter hook input priority 0; policy drop
  15.  
  16. jump base_checks
  17.  
  18. # allow from loopback
  19. iifname lo accept
  20.  
  21. # accept traffic originated from us
  22. ct state related,established counter accept
  23.  
  24. # activate the following line to accept common local services
  25. tcp dport { 22, 80, 443 } ct state new accept
  26. # strongswan vpn
  27. udp dport { 500,4500} counter accept
  28.  
  29. #allow icmp
  30. ip protocol icmp icmp type {echo-request, echo-reply, time-exceeded, parameter-problem, destination-unreachable } accept
  31. # accept neighbour discovery otherwise IPv6 connectivity breaks.
  32. #ip6 nexthdr icmpv6 icmpv6 type { nd-neighbor-solicit, nd-router-advert, nd-neighbor-advert } accept
  33.  
  34. # allow encapsulated trafic
  35. iifname eth0 ip protocol {ah, esp} accept
  36. # count and drop any other traffic
  37. reject with icmpx type port-unreachable
  38. }
  39.  
  40.  
  41. chain forward {
  42. type filter hook forward priority 0; policy drop
  43. jump base_checks
  44.  
  45. ## allow comming out of the vpn
  46. ip saddr 172.16.252.0/24 accept
  47. }
  48. chain output {
  49. type filter hook output priority 0; policy accept;
  50. oifname eth0 ip protocol {ah, esp} accept
  51. }
  52. }
  53.  
  54. table ip nat {
  55. chain prerouting {
  56. type nat hook prerouting priority 0; policy accept;
  57. #tcp dport dnat
  58. #udp dport dnat
  59. }
  60. chain postrouting {
  61. type nat hook postrouting priority 100; policy accept;
  62. #oifname eth0 ip daddr 10.10.10.0/24 accept
  63. ip saddr 172.16.252.0/24 oif eth0 masquerade
  64. #masquerade
  65. }
  66. }
  67. include "/etc/nftables/fail2ban.conf"
Add Comment
Please, Sign In to add comment