Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / manifests / rules / icmp.pp @ ea29e235

Historique | Voir | Annoter | Télécharger (1,09 ko)

1
class nftables::rules::icmp (
2
  # lint:ignore:parameter_documentation
3
  Optional[Array[String]] $v4_types = undef,
4
  Optional[Array[String]] $v6_types = undef,
5
  String $order                     = '10',
6
  # lint:endignore
7
) {
8
  if $v4_types {
9
    $v4_types.each | String $icmp_type | {
10
      nftables::rule {
11
        "default_in-accept_icmpv4_${regsubst(split($icmp_type, ' ')[0], '-', '_', 'G')}":
12
          content => "ip protocol icmp icmp type ${icmp_type} accept",
13
          order   => $order,
14
      }
15
    }
16
  } else {
17
    nftables::rule {
18
      'default_in-accept_icmpv4':
19
        content => 'ip protocol icmp accept',
20
        order   => $order,
21
    }
22
  }
23

    
24
  if $v6_types {
25
    $v6_types.each | String $icmp_type | {
26
      nftables::rule {
27
        "default_in-accept_icmpv6_${regsubst(split($icmp_type, ' ')[0], '-', '_', 'G')}":
28
          content => "ip6 nexthdr ipv6-icmp icmpv6 type ${icmp_type} accept",
29
          order   => $order,
30
      }
31
    }
32
  } else {
33
    nftables::rule {
34
      'default_in-accept_icmpv6':
35
        content => 'ip6 nexthdr ipv6-icmp accept',
36
        order   => $order,
37
    }
38
  }
39
}