Révision 316bc3f8
Allow IPv4 and IPv6 only rules
templates/simplerule.epp | ||
---|---|---|
3 | 3 |
Optional[Variant[Array[Stdlib::Port, 1], Stdlib::Port, String]] $dport, |
4 | 4 |
Optional[String] $proto, |
5 | 5 |
| -%> |
6 |
<%- if $proto { |
|
7 |
$_proto = $proto ? { |
|
8 |
/tcp(4|6)?/ => 'tcp', |
|
9 |
/udp(4|6)?/ => 'udp', |
|
10 |
} |
|
11 |
$_ip_version_filter = $proto ? { |
|
12 |
/(tcp4|udp4)/ => 'ip version 4', |
|
13 |
/(tcp6|udp6)/ => 'ip version 6', |
|
14 |
default => undef, |
|
15 |
} |
|
16 |
} else { |
|
17 |
$_ip_version_filter = undef |
|
18 |
} -%> |
|
6 | 19 |
<%- if $proto and $dport { |
7 | 20 |
if $dport =~ Array { |
8 |
$_destination = "${proto} dport {${dport.join(', ')}}" |
|
21 |
$_destination = "${_proto} dport {${dport.join(', ')}}"
|
|
9 | 22 |
} else { |
10 |
$_destination = "${proto} dport $dport" |
|
23 |
$_destination = "${_proto} dport $dport"
|
|
11 | 24 |
} |
12 | 25 |
} else { |
13 | 26 |
$_destination = undef |
... | ... | |
17 | 30 |
} else { |
18 | 31 |
$_comment = undef |
19 | 32 |
} -%> |
20 |
<%= regsubst(strip([$_destination, $_comment, $action].join(' ')), '\s+', ' ', 'G') -%> |
|
33 |
<%= regsubst(strip([$_ip_version_filter, $_destination, $_comment, $action].join(' ')), '\s+', ' ', 'G') -%> |
Formats disponibles : Unified diff