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 81c186b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
9 changes: 9 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ The following parameters are available in the `nftables` class:
* [`nft_path`](#-nftables--nft_path)
* [`echo`](#-nftables--echo)
* [`default_config_mode`](#-nftables--default_config_mode)
* [`log_discarded`](#-nftables--log_discarded)

##### <a name="-nftables--out_all"></a>`out_all`

Expand Down Expand Up @@ -370,6 +371,14 @@ Data type: `Stdlib::Filemode`
The default file & dir mode for configuration files and directories. The
default varies depending on the system, and is set in the module's data.

##### <a name="-nftables--log_discarded"></a>`log_discarded`

Data type: `Boolean`



Default value: `true`

### <a name="nftables--bridges"></a>`nftables::bridges`

allow forwarding traffic on bridges
Expand Down
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,

Check warning on line 124 in manifests/init.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

missing documentation for class parameter nftables::log_discarded (check: parameter_documentation)
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 81c186b

Please sign in to comment.