Révision 925c358d
rules::out::ospf3: Allow filtering on outgoing interfaces
REFERENCE.md | ||
---|---|---|
1116 | 1116 |
|
1117 | 1117 |
manage out ospf3 |
1118 | 1118 |
|
1119 |
#### Parameters |
|
1120 |
|
|
1121 |
The following parameters are available in the `nftables::rules::out::ospf3` class: |
|
1122 |
|
|
1123 |
* [`oifname`](#-nftables--rules--out--ospf3--oifname) |
|
1124 |
|
|
1125 |
##### <a name="-nftables--rules--out--ospf3--oifname"></a>`oifname` |
|
1126 |
|
|
1127 |
Data type: `Array[String[1]]` |
|
1128 |
|
|
1129 |
optional list of outgoing interfaces to filter on |
|
1130 |
|
|
1131 |
Default value: `[]` |
|
1132 |
|
|
1119 | 1133 |
### <a name="nftables--rules--out--pop3"></a>`nftables::rules::out::pop3` |
1120 | 1134 |
|
1121 | 1135 |
allow outgoing pop3 |
manifests/rules/out/ospf3.pp | ||
---|---|---|
1 |
# manage out ospf3 |
|
2 |
class nftables::rules::out::ospf3 { |
|
3 |
nftables::rule { |
|
4 |
'default_out-ospf3': |
|
5 |
content => 'ip6 saddr fe80::/64 ip6 daddr { ff02::5, ff02::6 } meta l4proto 89 accept', |
|
1 |
# |
|
2 |
# @summary manage out ospf3 |
|
3 |
# |
|
4 |
# @param oifname optional list of outgoing interfaces to filter on |
|
5 |
# |
|
6 |
class nftables::rules::out::ospf3 ( |
|
7 |
Array[String[1]] $oifname = [], |
|
8 |
) { |
|
9 |
if empty($oifname) { |
|
10 |
$_oifname = '' |
|
11 |
} else { |
|
12 |
$oifdata = $oifname.map |String[1] $interface| { "\"${interface}\"" }.join(', ') |
|
13 |
$_oifname = "oifname { ${oifdata} } " |
|
14 |
} |
|
15 |
nftables::rule { 'default_out-ospf3': |
|
16 |
content => "${_oifname}ip6 saddr fe80::/64 ip6 daddr { ff02::5, ff02::6 } meta l4proto 89 accept", |
|
6 | 17 |
} |
7 | 18 |
} |
spec/classes/rules/out/ospf3_spec.rb | ||
---|---|---|
1 |
# frozen_string_literal: true |
|
2 |
|
|
3 |
require 'spec_helper' |
|
4 |
|
|
5 |
describe 'nftables::rules::out::ospf3' do |
|
6 |
on_supported_os.each do |os, os_facts| |
|
7 |
context "on #{os}" do |
|
8 |
let :facts do |
|
9 |
os_facts |
|
10 |
end |
|
11 |
|
|
12 |
context 'default options' do |
|
13 |
it { is_expected.to compile.with_all_deps } |
|
14 |
it { is_expected.to contain_nftables__rule('default_out-ospf3').with_content('ip6 saddr fe80::/64 ip6 daddr { ff02::5, ff02::6 } meta l4proto 89 accept') } |
|
15 |
end |
|
16 |
|
|
17 |
context 'with input interfaces set' do |
|
18 |
let :params do |
|
19 |
{ |
|
20 |
oifname: %w[docker0 eth0], |
|
21 |
} |
|
22 |
end |
|
23 |
|
|
24 |
it { is_expected.to compile } |
|
25 |
|
|
26 |
str = 'oifname { "docker0", "eth0" } ip6 saddr fe80::/64 ip6 daddr { ff02::5, ff02::6 } meta l4proto 89 accept' |
|
27 |
it { is_expected.to contain_nftables__rule('default_out-ospf3').with_content(str) } |
|
28 |
end |
|
29 |
end |
|
30 |
end |
|
31 |
end |
Formats disponibles : Unified diff