File tree Expand file tree Collapse file tree 2 files changed +20
-12
lines changed
lib/Virtualmin/Config/Plugin Expand file tree Collapse file tree 2 files changed +20
-12
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ sub actions {
47
47
init::enable_at_boot(' fail2ban' );
48
48
49
49
# Create a jail.local with some basic config
50
- create_fail2ban_jail();
50
+ create_fail2ban_jail($self );
51
51
create_fail2ban_firewalld();
52
52
53
53
# Switch backend to use systemd to avoid failure on
@@ -79,7 +79,7 @@ sub actions {
79
79
}
80
80
81
81
sub create_fail2ban_jail {
82
-
82
+ my $self = shift ;
83
83
# Postfix addendum
84
84
my $postfix_jail_extra = " " ;
85
85
@@ -119,6 +119,13 @@ sub create_fail2ban_jail {
119
119
$proftpd_jail_extra
120
120
.= ' \(\S+\[<HOST>\]\)[: -]+ Maximum login attempts \(\d+\) exceeded\s+$' ;
121
121
}
122
+ my $mini_stack =
123
+ (defined $self -> bundle() && $self -> bundle() =~ / mini/i ) ?
124
+ ($self -> bundle() =~ / LEMP/i ? ' LEMP' : ' LAMP' ) : 0;
125
+ my $proftpd_block = $mini_stack ? ' ' :
126
+ " [proftpd]\n " .
127
+ " enabled = true$proftpd_jail_extra \n\n " ;
128
+
122
129
open (my $JAIL_LOCAL , ' >' , ' /etc/fail2ban/jail.local' );
123
130
print $JAIL_LOCAL <<EOF ;
124
131
[dovecot]
@@ -130,10 +137,7 @@ enabled = true
130
137
[postfix-sasl]
131
138
enabled = true$postfix_jail_extra
132
139
133
- [proftpd]
134
- enabled = true$proftpd_jail_extra
135
-
136
- [sshd]
140
+ ${proftpd_block} [sshd]
137
141
enabled = true
138
142
139
143
[webmin-auth]
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ sub actions {
53
53
init::enable_at_boot(' fail2ban' );
54
54
55
55
# Create a jail.local with some basic config
56
- create_fail2ban_jail();
56
+ create_fail2ban_jail($self );
57
57
create_fail2ban_firewalld();
58
58
59
59
# Switch backend to use systemd to avoid failure on
@@ -85,7 +85,7 @@ sub actions {
85
85
}
86
86
87
87
sub create_fail2ban_jail {
88
-
88
+ my $self = shift ;
89
89
# Postfix addendum
90
90
my $postfix_jail_extra = " " ;
91
91
@@ -125,6 +125,13 @@ sub create_fail2ban_jail {
125
125
$proftpd_jail_extra
126
126
.= ' \(\S+\[<HOST>\]\)[: -]+ Maximum login attempts \(\d+\) exceeded\s+$' ;
127
127
}
128
+ my $mini_stack =
129
+ (defined $self -> bundle() && $self -> bundle() =~ / mini/i ) ?
130
+ ($self -> bundle() =~ / LEMP/i ? ' LEMP' : ' LAMP' ) : 0;
131
+ my $proftpd_block = $mini_stack ? ' ' :
132
+ " [proftpd]\n " .
133
+ " enabled = true$proftpd_jail_extra \n\n " ;
134
+
128
135
open (my $JAIL_LOCAL , ' >' , ' /etc/fail2ban/jail.local' );
129
136
print $JAIL_LOCAL <<EOF ;
130
137
[dovecot]
@@ -136,10 +143,7 @@ enabled = true
136
143
[postfix-sasl]
137
144
enabled = true$postfix_jail_extra
138
145
139
- [proftpd]
140
- enabled = true$proftpd_jail_extra
141
-
142
- [sshd]
146
+ ${proftpd_block} [sshd]
143
147
enabled = true
144
148
145
149
[webmin-auth]
You can’t perform that action at this time.
0 commit comments