Skip to content

Commit

Permalink
Do not drop in case of accept
Browse files Browse the repository at this point in the history
  • Loading branch information
majst01 committed Jan 22, 2024
1 parent 442cb28 commit 99b8a18
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 9 deletions.
3 changes: 2 additions & 1 deletion pkg/netconf/testdata/nftrules
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ table inet metal {
chain forward {
type filter hook forward priority 0; policy drop;
ct state invalid counter drop comment "drop invalid packets from forwarding to prevent malicious activity"
counter jump refuse
tcp dport bgp ct state new counter jump refuse comment "block bgp forward to machines"
limit rate 2/minute counter log prefix "nftables-metal-dropped: "
}
chain output {
type filter hook output priority 0; policy accept;
Expand Down
3 changes: 2 additions & 1 deletion pkg/netconf/testdata/nftrules_accept_forwarding
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ table inet metal {
chain forward {
type filter hook forward priority 0; policy accept;
ct state invalid counter drop comment "drop invalid packets from forwarding to prevent malicious activity"
counter jump refuse
tcp dport bgp ct state new counter jump refuse comment "block bgp forward to machines"

}
chain output {
type filter hook output priority 0; policy accept;
Expand Down
3 changes: 2 additions & 1 deletion pkg/netconf/testdata/nftrules_dmz
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ table inet metal {
chain forward {
type filter hook forward priority 0; policy drop;
ct state invalid counter drop comment "drop invalid packets from forwarding to prevent malicious activity"
counter jump refuse
tcp dport bgp ct state new counter jump refuse comment "block bgp forward to machines"
limit rate 2/minute counter log prefix "nftables-metal-dropped: "
}
chain output {
type filter hook output priority 0; policy accept;
Expand Down
3 changes: 2 additions & 1 deletion pkg/netconf/testdata/nftrules_dmz_app
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ table inet metal {
chain forward {
type filter hook forward priority 0; policy drop;
ct state invalid counter drop comment "drop invalid packets from forwarding to prevent malicious activity"
counter jump refuse
tcp dport bgp ct state new counter jump refuse comment "block bgp forward to machines"
limit rate 2/minute counter log prefix "nftables-metal-dropped: "
}
chain output {
type filter hook output priority 0; policy accept;
Expand Down
3 changes: 2 additions & 1 deletion pkg/netconf/testdata/nftrules_ipv6
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ table inet metal {
chain forward {
type filter hook forward priority 0; policy drop;
ct state invalid counter drop comment "drop invalid packets from forwarding to prevent malicious activity"
counter jump refuse
tcp dport bgp ct state new counter jump refuse comment "block bgp forward to machines"
limit rate 2/minute counter log prefix "nftables-metal-dropped: "
}
chain output {
type filter hook output priority 0; policy accept;
Expand Down
3 changes: 2 additions & 1 deletion pkg/netconf/testdata/nftrules_shared
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ table inet metal {
chain forward {
type filter hook forward priority 0; policy drop;
ct state invalid counter drop comment "drop invalid packets from forwarding to prevent malicious activity"
counter jump refuse
tcp dport bgp ct state new counter jump refuse comment "block bgp forward to machines"
limit rate 2/minute counter log prefix "nftables-metal-dropped: "
}
chain output {
type filter hook output priority 0; policy accept;
Expand Down
3 changes: 2 additions & 1 deletion pkg/netconf/testdata/nftrules_vpn
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ table inet metal {
chain forward {
type filter hook forward priority 0; policy drop;
ct state invalid counter drop comment "drop invalid packets from forwarding to prevent malicious activity"
counter jump refuse
tcp dport bgp ct state new counter jump refuse comment "block bgp forward to machines"
limit rate 2/minute counter log prefix "nftables-metal-dropped: "
}
chain output {
type filter hook output priority 0; policy accept;
Expand Down
7 changes: 5 additions & 2 deletions pkg/netconf/tpl/nftrules.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ table inet metal {
counter jump refuse
}
chain forward {
type filter hook forward priority 0; policy {{.ForwardPolicy}};
type filter hook forward priority 0; policy {{ .ForwardPolicy }};
ct state invalid counter drop comment "drop invalid packets from forwarding to prevent malicious activity"
counter jump refuse
tcp dport bgp ct state new counter jump refuse comment "block bgp forward to machines"
{{ if eq .ForwardPolicy "drop" -}}
limit rate 2/minute counter log prefix "nftables-metal-dropped: "
{{- end }}
}
chain output {
type filter hook output priority 0; policy accept;
Expand Down

0 comments on commit 99b8a18

Please sign in to comment.