Projet

Général

Profil

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

root / manifests / rules / icmp.pp @ b9785000

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 11bf7237 Steve Traylen
      nftables::rule {
9 79e9a23f Nacho Barrientos
        "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 11bf7237 Steve Traylen
    nftables::rule {
16 79e9a23f Nacho Barrientos
      'default_in-accept_icmpv4':
17
        content => 'ip protocol icmp accept',
18
        order   => $order,
19 11bf7237 Steve Traylen
    }
20 79e9a23f Nacho Barrientos
  }
21
22
  if $v6_types {
23
    $v6_types.each | String $icmp_type | {
24 11bf7237 Steve Traylen
      nftables::rule {
25 79e9a23f Nacho Barrientos
        "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 11bf7237 Steve Traylen
    nftables::rule {
32 79e9a23f Nacho Barrientos
      'default_in-accept_icmpv6':
33
        content => 'ip6 nexthdr ipv6-icmp accept',
34
        order   => $order,
35 11bf7237 Steve Traylen
    }
36 79e9a23f Nacho Barrientos
  }
37
}