Projet

Général

Profil

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

root / manifests / rules / icmp.pp @ 8b131276

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

1 79e9a23f Nacho Barrientos
class nftables::rules::icmp (
2 09cba182 Steve Traylen
  # lint:ignore:parameter_documentation
3 79e9a23f Nacho Barrientos
  Optional[Array[String]] $v4_types = undef,
4
  Optional[Array[String]] $v6_types = undef,
5
  String $order                     = '10',
6 09cba182 Steve Traylen
  # lint:endignore
7 79e9a23f Nacho Barrientos
) {
8
  if $v4_types {
9
    $v4_types.each | String $icmp_type | {
10 11bf7237 Steve Traylen
      nftables::rule {
11 79e9a23f Nacho Barrientos
        "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 11bf7237 Steve Traylen
    nftables::rule {
18 79e9a23f Nacho Barrientos
      'default_in-accept_icmpv4':
19
        content => 'ip protocol icmp accept',
20
        order   => $order,
21 11bf7237 Steve Traylen
    }
22 79e9a23f Nacho Barrientos
  }
23
24
  if $v6_types {
25
    $v6_types.each | String $icmp_type | {
26 11bf7237 Steve Traylen
      nftables::rule {
27 79e9a23f Nacho Barrientos
        "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 11bf7237 Steve Traylen
    nftables::rule {
34 79e9a23f Nacho Barrientos
      'default_in-accept_icmpv6':
35
        content => 'ip6 nexthdr ipv6-icmp accept',
36
        order   => $order,
37 11bf7237 Steve Traylen
    }
38 79e9a23f Nacho Barrientos
  }
39
}