root / templates / config / puppet.nft.epp @ master
Historique | Voir | Annoter | Télécharger (1,08 ko)
1 |
<%- | |
---|---|
2 |
Boolean $inet_filter, |
3 |
Boolean $nat, |
4 |
Optional[Array[String[1],1]] $noflush = undef, |
5 |
|-%> |
6 |
<%- |
7 |
if $noflush and $facts['nftables'] and $facts['nftables']['tables'] { |
8 |
$_flush_command = $facts['nftables']['tables'].filter |$_tab| { ! ($_tab in $noflush) }.map |$_table| { |
9 |
[ "table ${regsubst($_table,'-',' ')} {}", "flush table ${regsubst($_table,'-',' ')}" ] |
10 |
}.flatten |
11 |
} else { |
12 |
$_flush_command = ['flush ruleset'] |
13 |
} |
14 |
-%> |
15 |
# puppet-preflight.nft is only used by puppet for validating new configs |
16 |
# puppet.nft is real configuration that the nftables services uses. |
17 |
# To process either the -I flag must be specified. |
18 |
# nft -c -I /etc/nftables/puppet -f /etc/nftables/puppet.nft |
19 |
# nft -c -I /etc/nftables/puppet-preflight -f /etc/nftables/puppet-preflight.nft |
20 |
|
21 |
# drop any existing nftables ruleset, ensure tables are initialized |
22 |
<%= $_flush_command.join("\n") %> |
23 |
|
24 |
include "file-*.nft" |
25 |
include "custom-*.nft" |
26 |
<% if $inet_filter { -%> |
27 |
include "inet-filter.nft" |
28 |
<% } -%> |
29 |
<% if $nat { -%> |
30 |
include "ip-<%= $nftables::nat_table_name %>.nft" |
31 |
include "ip6-<%= $nftables::nat_table_name %>.nft" |
32 |
<% } -%> |