Révision c8092701
Split init class
manifests/init.pp | ||
---|---|---|
33 | 33 |
enable => true, |
34 | 34 |
} |
35 | 35 |
|
36 |
nftables::config{ |
|
37 |
'inet-filter': |
|
38 |
source => 'puppet:///modules/nftables/config/puppet-filter.nft'; |
|
39 |
'ip-nat': |
|
40 |
source => 'puppet:///modules/nftables/config/puppet-ip-nat.nft'; |
|
41 |
} |
|
42 |
|
|
43 |
nftables::chain{ |
|
44 |
[ |
|
45 |
'INPUT', |
|
46 |
'OUTPUT', |
|
47 |
'FORWARD', |
|
48 |
]:; |
|
49 |
} |
|
50 |
|
|
51 |
nftables::chain{ |
|
52 |
[ |
|
53 |
'PREROUTING', |
|
54 |
'POSTROUTING', |
|
55 |
]: |
|
56 |
table => 'ip-nat'; |
|
57 |
} |
|
58 |
|
|
59 |
nftables::chain{ |
|
60 |
'default_in': |
|
61 |
inject => '10-INPUT'; |
|
62 |
'default_out': |
|
63 |
inject => '10-OUTPUT'; |
|
64 |
'default_fwd': |
|
65 |
inject => '10-FORWARD'; |
|
66 |
} |
|
67 |
|
|
68 |
# inet-filter-chain-INPUT |
|
69 |
nftables::rule{ |
|
70 |
'INPUT-type': |
|
71 |
order => '01', |
|
72 |
content => 'type filter hook input priority 0'; |
|
73 |
'INPUT-policy': |
|
74 |
order => '02', |
|
75 |
content => 'policy drop'; |
|
76 |
'INPUT-lo': |
|
77 |
order => '03', |
|
78 |
content => 'iifname lo accept'; |
|
79 |
'INPUT-jump_global': |
|
80 |
order => '04', |
|
81 |
content => 'jump global'; |
|
82 |
'INPUT-log_rejected': |
|
83 |
order => '98', |
|
84 |
content => 'log prefix "[nftables] INPUT Rejected: " flags all counter reject with icmpx type port-unreachable'; |
|
85 |
} |
|
86 |
|
|
87 |
# inet-filter-chain-OUTPUT |
|
88 |
nftables::rule{ |
|
89 |
'OUTPUT-type': |
|
90 |
order => '01', |
|
91 |
content => 'type filter hook output priority 0'; |
|
92 |
'OUTPUT-policy': |
|
93 |
order => '02', |
|
94 |
content => 'policy drop'; |
|
95 |
'OUTPUT-lo': |
|
96 |
order => '03', |
|
97 |
content => 'oifname lo accept'; |
|
98 |
'OUTPUT-jump_global': |
|
99 |
order => '04', |
|
100 |
content => 'jump global'; |
|
101 |
'OUTPUT-log_rejected': |
|
102 |
order => '98', |
|
103 |
content => 'log prefix "[nftables] OUTPUT Rejected: " flags all counter reject with icmpx type port-unreachable'; |
|
104 |
} |
|
105 |
|
|
106 |
# inet-filter-chain-FORWARD |
|
107 |
nftables::rule{ |
|
108 |
'FORWARD-type': |
|
109 |
order => '01', |
|
110 |
content => 'type filter hook forward priority 0'; |
|
111 |
'FORWARD-policy': |
|
112 |
order => '02', |
|
113 |
content => 'policy drop'; |
|
114 |
'FORWARD-jump_global': |
|
115 |
order => '03', |
|
116 |
content => 'jump global'; |
|
117 |
'FORWARD-log_rejected': |
|
118 |
order => '98', |
|
119 |
content => 'log prefix "[nftables] FORWARD Rejected: " flags all counter reject with icmpx type port-unreachable'; |
|
120 |
} |
|
121 |
|
|
122 |
# ip-nat-chain-PREROUTING |
|
123 |
nftables::rule{ |
|
124 |
default: |
|
125 |
table => 'ip-nat'; |
|
126 |
'PREROUTING-type': |
|
127 |
order => '01', |
|
128 |
content => 'type nat hook prerouting priority -100'; |
|
129 |
'PREROUTING-policy': |
|
130 |
order => '02', |
|
131 |
content => 'policy accept'; |
|
132 |
} |
|
133 |
|
|
134 |
# ip-nat-chain-POSTROUTING |
|
135 |
nftables::rule{ |
|
136 |
default: |
|
137 |
table => 'ip-nat'; |
|
138 |
'POSTROUTING-type': |
|
139 |
order => '01', |
|
140 |
content => 'type nat hook postrouting priority 100'; |
|
141 |
'POSTROUTING-policy': |
|
142 |
order => '02', |
|
143 |
content => 'policy accept'; |
|
144 |
} |
|
145 |
|
|
146 |
# basic ingoing rules |
|
147 |
if $in_ssh { |
|
148 |
include nftables::rules::ssh |
|
149 |
} |
|
150 |
|
|
151 |
# basic outgoing rules |
|
152 |
if $out_ntp { |
|
153 |
include nftables::rules::out::chrony |
|
154 |
} |
|
155 |
if $out_dns { |
|
156 |
include nftables::rules::out::dns |
|
157 |
} |
|
158 |
if $out_http { |
|
159 |
include nftables::rules::out::http |
|
160 |
} |
|
161 |
if $out_https { |
|
162 |
include nftables::rules::out::https |
|
163 |
} |
|
36 |
include nftables::inet_filter |
|
37 |
include nftables::ip_nat |
|
164 | 38 |
} |
Formats disponibles : Unified diff