File tree 2 files changed +41
-1
lines changed
2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change 51
51
# [*enable_v6*]
52
52
# Use this module with IPv6. Defaults to false.
53
53
#
54
+ # [*failsafe_ssh*]
55
+ # Bool. Insert a rule allowing iptables at all cost. This is to prevent accidental
56
+ # lockouts when implementing this module. You may want to disable this, and add
57
+ # the desired rules yourself (allowing to implement specific white- and blacklists,
58
+ # as well as blocking bruteforce attacks).
59
+ #
54
60
# [*template*]
55
61
# The template file to use when config=file
56
62
#
149
155
$default_order = 5000,
150
156
$enable_v4 = $iptables::params::enable_v4,
151
157
$enable_v6 = $iptables::params::enable_v6,
158
+ $failsafe_ssh = true ,
152
159
$template = ' ' ,
153
160
$mode = ' concat' ,
154
161
$version = ' present' ,
266
273
267
274
include iptables::ruleset::default_action
268
275
include iptables::ruleset::loopback
276
+
277
+ if any2bool($failsafe_ssh ) {
278
+ include iptables::ruleset::failsafe_ssh
279
+ }
269
280
270
- # Todo: For now this always evaluates to false, no service is getting restarted
271
281
if ! $bool_service_override_restart {
272
282
service { 'iptables' :
273
283
ensure => $iptables::manage_service_ensure ,
Original file line number Diff line number Diff line change
1
+
2
+ class iptables::ruleset::failsafe_ssh (
3
+ $chains = [ ' INPUT' , ' OUTPUT' ],
4
+ $target = ' ACCEPT' ,
5
+ $order = 11,
6
+ $port = 22,
7
+ $log = false ,
8
+ $log_prefix = $iptables::log_prefix,
9
+ $log_limit_burst = $iptables::log_limit_burst,
10
+ $log_limit = $iptables::log_limit,
11
+ $log_level = $iptables::log_level,
12
+ ) {
13
+
14
+ $discard = iptables_declare_multiple(' iptables::rule' ,
15
+ $chains , ' example42-failsafe-ssh-###name###' ,
16
+ {
17
+ table => ' filter' ,
18
+ chain => ' ###name###' ,
19
+ target => $target ,
20
+ protocol => ' tcp' ,
21
+ port => $port ,
22
+ order => $order ,
23
+ log => $log ,
24
+ log_prefix => $log_prefix ,
25
+ log_limit_burst => $log_limit_burst ,
26
+ log_limit => $log_limit ,
27
+ log_level => $log_level
28
+ })
29
+
30
+ }
You can’t perform that action at this time.
0 commit comments