Skip to content

Commit

Permalink
provide an option to disable logging rejected packets
Browse files Browse the repository at this point in the history
  • Loading branch information
vchepkov committed Oct 23, 2023
1 parent 34cbd61 commit b638634
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
30 changes: 21 additions & 9 deletions manifests/inet_filter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@
'INPUT-jump_global':
order => '04',
content => 'jump global';
'INPUT-log_discarded':
order => '97',
content => sprintf($_reject_rule, { 'chain' => 'INPUT' }),
}
if $nftables::log_discarded {
nftables::rule {
'INPUT-log_discarded':
order => '97',
content => sprintf($_reject_rule, { 'chain' => 'INPUT' }),
}
}
if $nftables::reject_with {
nftables::rule {
Expand All @@ -74,9 +78,13 @@
'OUTPUT-jump_global':
order => '04',
content => 'jump global';
'OUTPUT-log_discarded':
order => '97',
content => sprintf($_reject_rule, { 'chain' => 'OUTPUT' }),
}
if $nftables::log_discarded {
nftables::rule {
'OUTPUT-log_discarded':
order => '97',
content => sprintf($_reject_rule, { 'chain' => 'OUTPUT' }),
}
}
if $nftables::reject_with {
nftables::rule {
Expand All @@ -100,9 +108,13 @@
'FORWARD-jump_global':
order => '03',
content => 'jump global';
'FORWARD-log_discarded':
order => '97',
content => sprintf($_reject_rule, { 'chain' => 'FORWARD' });
}
if $nftables::log_discarded {
nftables::rule {
'FORWARD-log_discarded':
order => '97',
content => sprintf($_reject_rule, { 'chain' => 'FORWARD' });
}
}
if $nftables::reject_with {
nftables::rule {
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
Hash $sets = {},
String $log_prefix = '[nftables] %<chain>s %<comment>s',
String[1] $nat_table_name = 'nat',
Boolean $log_discarded = true,
Variant[Boolean[false], String] $log_limit = '3/minute burst 5 packets',
Variant[Boolean[false], Pattern[/icmp(v6|x)? type .+|tcp reset/]] $reject_with = 'icmpx type port-unreachable',
Variant[Boolean[false], Enum['mask']] $firewalld_enable = 'mask',
Expand Down

0 comments on commit b638634

Please sign in to comment.