root / manifests / rules / icmp.pp @ 82d10659
Historique | Voir | Annoter | Télécharger (1,03 ko)
1 | 79e9a23f | Nacho Barrientos | class nftables::rules::icmp ( |
---|---|---|---|
2 | Optional[Array[String]] $v4_types = undef, |
||
3 | Optional[Array[String]] $v6_types = undef, |
||
4 | String $order = '10', |
||
5 | ) { |
||
6 | if $v4_types { |
||
7 | $v4_types.each | String $icmp_type | { |
||
8 | nftables::rule{ |
||
9 | "default_in-accept_icmpv4_${regsubst(split($icmp_type, ' ')[0], '-', '_', 'G')}": |
||
10 | content => "ip protocol icmp icmp type ${icmp_type} accept", |
||
11 | order => $order, |
||
12 | } |
||
13 | } |
||
14 | } else { |
||
15 | nftables::rule{ |
||
16 | 'default_in-accept_icmpv4': |
||
17 | content => 'ip protocol icmp accept', |
||
18 | order => $order, |
||
19 | } |
||
20 | } |
||
21 | |||
22 | if $v6_types { |
||
23 | $v6_types.each | String $icmp_type | { |
||
24 | nftables::rule{ |
||
25 | "default_in-accept_icmpv6_${regsubst(split($icmp_type, ' ')[0], '-', '_', 'G')}": |
||
26 | content => "ip6 nexthdr ipv6-icmp icmpv6 type ${icmp_type} accept", |
||
27 | order => $order, |
||
28 | } |
||
29 | } |
||
30 | } else { |
||
31 | nftables::rule{ |
||
32 | 'default_in-accept_icmpv6': |
||
33 | content => 'ip6 nexthdr ipv6-icmp accept', |
||
34 | order => $order, |
||
35 | } |
||
36 | } |
||
37 | } |