Skip to content

Commit e2fe842

Browse files
committed
Implement recidive jail and add it during upgrade.
1 parent 7e1755d commit e2fe842

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

func/upgrade.sh

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ upgrade_start_routine() {
123123

124124
upgrade_phpmyadmin() {
125125
# Check if MariaDB/MySQL is installed on the server before attempting to install or upgrade phpMyAdmin
126-
if [ $DB_SYSTEM = "mysql" ]; then
126+
if [ "$DB_SYSTEM" = "mysql" ]; then
127127
# Define version check function
128128
function version_ge(){ test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" -o ! -z "$1" -a "$1" = "$2"; }
129129

@@ -178,41 +178,44 @@ upgrade_set_version() {
178178
upgrade_rebuild_users() {
179179
for user in `ls /usr/local/hestia/data/users/`; do
180180
echo "(*) Rebuilding domains and account for user: $user..."
181-
if [ ! -z $WEB_SYSTEM ]; then
181+
if [ ! -z "$WEB_SYSTEM" ]; then
182182
$BIN/v-rebuild-web-domains $user >/dev/null 2>&1
183183
fi
184-
if [ ! -z $DNS_SYSTEM ]; then
184+
if [ ! -z "$DNS_SYSTEM" ]; then
185185
$BIN/v-rebuild-dns-domains $user >/dev/null 2>&1
186186
fi
187-
if [ ! -z $MAIL_SYSTEM ]; then
187+
if [ ! -z "$MAIL_SYSTEM" ]; then
188188
$BIN/v-rebuild-mail-domains $user >/dev/null 2>&1
189189
fi
190190
done
191191
}
192192

193193
upgrade_restart_services() {
194194
echo "(*) Restarting services..."
195-
if [ ! -z $MAIL_SYSTEM ]; then
195+
if [ ! -z "$MAIL_SYSTEM" ]; then
196196
$BIN/v-restart-mail $restart
197197
fi
198-
if [ ! -z $IMAP_SYSTEM ]; then
198+
if [ ! -z "$IMAP_SYSTEM" ]; then
199199
$BIN/v-restart-service $IMAP_SYSTEM $restart
200200
fi
201-
if [ ! -z $WEB_SYSTEM ]; then
201+
if [ ! -z "$WEB_SYSTEM" ]; then
202202
$BIN/v-restart-web $restart
203203
$BIN/v-restart-proxy $restart
204204
fi
205-
if [ ! -z $DNS_SYSTEM ]; then
205+
if [ ! -z "$DNS_SYSTEM" ]; then
206206
$BIN/v-restart-dns $restart
207207
fi
208208
for v in `ls /etc/php/`; do
209209
if [ -e /etc/php/$v/fpm ]; then
210210
$BIN/v-restart-service php$v-fpm $restart
211211
fi
212212
done
213-
if [ ! -z $FTP_SYSTEM ]; then
213+
if [ ! -z "$FTP_SYSTEM" ]; then
214214
$BIN/v-restart-ftp $restart
215215
fi
216+
if [ ! -z "$FIREWALL_EXTENSION" ]; then
217+
$BIN/v-restart-service $FIREWALL_EXTENSION yes
218+
fi
216219

217220
# Restart SSH daemon and Hestia Control Panel service
218221
$BIN/v-restart-service ssh $restart

install/upgrade/versions/latest.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,11 @@ fi
6262
if [ -f "/etc/nginx/conf.d/hestia.conf" ]; then
6363
echo "(*) Removing old NGINX configuration file from previous version of Hestia Control Panel..."
6464
rm -f /etc/nginx/conf.d/hestia.conf
65+
fi
66+
67+
# Implement recidive jail for fail2ban
68+
if [ ! -z "$FIREWALL_EXTENSION" ]; then
69+
if ! cat /etc/fail2ban/jail.local | grep -q "recidive"; then
70+
echo -e "\n\n[recidive]\nenabled = true\nmaxretry = 3\nfindtime = 86400\nbantime = 864000" >> /etc/fail2ban/jail.local
71+
fi
6572
fi

0 commit comments

Comments
 (0)