inital fail2ban addition

This commit is contained in:
2020-07-31 11:54:42 +02:00
parent 3b8c214dec
commit 1171e84177
20 changed files with 131 additions and 53 deletions

View File

@@ -1 +1 @@
mailutils htop ufw nload
mailutils htop ufw nload fail2ban

View File

@@ -13,24 +13,6 @@ root: $email
EOF
newaliases
##------------##
# Fail2Ban #
##------------##
##Disabled
#sed -i 's/root@localhost/'$email'/g' /etc/fail2ban/jail.conf
#wget -q -t7 "$repo"/raw/branch/"$branch"/config/fail2ban/sshd.local -O /etc/fail2ban/jail.d/sshd.local
#if [[ $CMS == "Nextcloud" ]]; then
#wget -q -t7 "$repo"/raw/branch/"$branch"/config/fail2ban/nextcloud.conf -O /etc/fail2ban/filter.d/nextcloud.conf
#wget -q -t7 "$repo"/raw/branch/"$branch"/config/fail2ban/nextcloud.local -O /etc/fail2ban/jail.d/nextcloud.local
#fi
#if [[ $CMS == "Wordpress" ]]; then
#wget -q -t7 "$repo"/raw/branch/"$branch"/config/fail2ban/wordpress.conf -O /etc/fail2ban/filter.d/wordpress.conf
#wget -q -t7 "$repo"/raw/branch/"$branch"/config/fail2ban/wordpress.local -O /etc/fail2ban/jail.d/wordpress.local
#fi
##-------##
# UFW #
##-------##
@@ -41,4 +23,21 @@ ufw default allow outgoing > $OUTPUT 2>&1
ufw allow 80/tcp > $OUTPUT 2>&1
ufw allow 443/tcp > $OUTPUT 2>&1
ufw limit 4242/tcp > $OUTPUT 2>&1
echo "y" | ufw enable > $OUTPUT 2>&1
echo "y" | ufw enable > $OUTPUT 2>&1
##------------##
# Fail2Ban #
##------------##
#General config
wget -q -t7 "$repo"/raw/branch/"$branch"/config/fail2ban/jail.local -O /etc/fail2ban/jail.local
#Custom Fiters
wget -q -t7 "$repo"/raw/branch/"$branch"/config/fail2ban/Filters/nextcloud.filter -O /etc/fail2ban/filter.d/nextcloud.local
wget -q -t7 "$repo"/raw/branch/"$branch"/config/fail2ban/Filters/phpmyadmin-authlog.filter -O /etc/fail2ban/filter.d/phpmyadmin-authlog.local
wget -q -t7 https://plugins.svn.wordpress.org/wp-fail2ban/trunk/filters.d/wordpress-hard.conf -O /etc/fail2ban/filter.d/wordpress-hard.local
wget -q -t7 https://plugins.svn.wordpress.org/wp-fail2ban/trunk/filters.d/wordpress-soft.conf -O /etc/fail2ban/filter.d/wordpress-soft.local
#General jails
wget -q -t7 "$repo"/raw/branch/"$branch"/config/fail2ban/sshd.jail -O /etc/fail2ban/jail.d/sshd.local
wget -q -t7 "$repo"/raw/branch/"$branch"/config/fail2ban/phpmyadmin.jail -O /etc/fail2ban/jail.d/phpmyadmin.local