Commit ab49aac 1 parent 712b8b3 commit ab49aac Copy full SHA for ab49aac
File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 10
10
# },
11
11
# }
12
12
#
13
+ # @example Create an iptables rule that allows outbound traffic that matches the ipset `internet`
14
+ # ferm::ipset { 'allow_outbound_ipsets':
15
+ # table => 'OUTPUT',
16
+ # match => 'dst',
17
+ # sets => {
18
+ # 'internet' => 'ACCEPT'
19
+ # },
20
+ # }
21
+ #
13
22
# @example create two matches for IPv6, both at the end of the `INPUT` chain. Explicitly mention the `filter` table.
14
23
# ferm::ipset { 'INPUT':
15
24
# prepend_to_chain => false,
35
44
# @param prepend_to_chain
36
45
# By default, ipset rules are added to the top of the chain. Set this to false to append them to the end instead.
37
46
#
47
+ # @param match
48
+ # Define if 'sets' should match for 'src' or 'dst'. Default: 'src'
49
+ #
38
50
define ferm::ipset (
39
51
Hash[String[1], Ferm::Actions] $sets ,
40
52
String[1] $chain = $name,
41
53
Ferm::Tables $table = ' filter' ,
42
54
Enum['ip','ip6'] $ip_version = ' ip' ,
43
55
Boolean $prepend_to_chain = true ,
56
+ Enum['dst', 'src'] $match = ' src' ,
44
57
) {
45
58
$suffix = $prepend_to_chain ? {
46
59
true => ' aaa' ,
56
69
' table' => $table ,
57
70
' chain' => $chain ,
58
71
' sets' => $sets ,
72
+ ' match' => $match ,
59
73
}
60
74
),
61
75
order => " ${table} -${chain} -${suffix} " ,
Original file line number Diff line number Diff line change 2
2
Ferm::Tables $table,
3
3
String[1] $chain,
4
4
Hash[String[1], Ferm::Actions] $sets,
5
+ Enum['dst', 'src'] $match,
5
6
| -%>
6
7
7
8
domain (<%= $ip %>) table <%= $table %> {
8
9
chain <%= $chain %> {
9
10
<%- $sets.each |$ipset, $action| { -%>
10
- mod set set <%= $ipset %> src <%= $action %>;
11
+ mod set set <%= $ipset %> <%= $match %> <%= $action %>;
11
12
<%- } -%>
12
13
}
13
14
}
You can’t perform that action at this time.
0 commit comments