From c32e406b3cb1a5bd9ce6df933d970d5a413c8081 Mon Sep 17 00:00:00 2001 From: weyne85 Date: Wed, 22 May 2024 08:10:00 +0200 Subject: [PATCH] Create ips.sh --- ips.sh | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 ips.sh diff --git a/ips.sh b/ips.sh new file mode 100644 index 0000000..cce684a --- /dev/null +++ b/ips.sh @@ -0,0 +1,59 @@ +#!/bin/bash +########################################################################################## +# CROWDSEC INSTALLATION +########################################################################################## +# Debian 12 / Ubuntu 22.04+ LTS x86_64 +# Carsten Rieger IT-Services (https://www.c-rieger.de) +########################################################################################## +clear +if [ "$USER" != "root" ] +then + echo "" + echo " » KEINE ROOT-BERECHTIGUNGEN | NO ROOT PERMISSIONS" + echo "" + echo "----------------------------------------------------------" + echo " » Bitte starten Sie das Skript als root: 'sudo ./ips.sh'" + echo " » Please run this script as root using: 'sudo ./ips.sh'" + echo "----------------------------------------------------------" + echo "" + exit 1 +fi +echo "" +echo " » fail2ban wird entfernt // remove fail2ban" +echo "" +sleep 2 +systemctl stop fail2ban.service +systemctl disable fail2ban.service +systemctl mask fail2ban.service +apt remove fail2ban --purge -y +clear +echo "" +echo " » fail2ban entfernt // removed [OK]" +echo " » Crowdsec wird heruntergeladen+installiert // crowdsec will be downloaded+installed" +echo "" +sleep 2 +curl -s https://packagecloud.io/install/repositories/crowdsec/crowdsec/script.deb.sh | sudo bash +apt install crowdsec -y +apt install crowdsec-firewall-bouncer-nftables -y +systemctl enable --now crowdsec.service +cscli collections install crowdsecurity/nextcloud +cscli collections install crowdsecurity/nginx +cscli collections install crowdsecurity/sshd +systemctl reload crowdsec && systemctl restart crowdsec +cp /etc/crowdsec/acquis.yaml /etc/crowdsec/acquis.yaml.bak +cat <>/etc/crowdsec/acquis.yaml +#Nextcloud by c-rieger.de +filenames: + - /var/log/nextcloud/nextcloud.log +labels: + type: Nextcloud +--- +EOF +systemctl reload crowdsec && systemctl restart crowdsec.service crowdsec-firewall-bouncer.service +clear +echo "" +echo " » fail2ban entfernt // removed [OK]" +echo " » crowdsec installiert // installed [OK]" +echo " » Carsten Rieger IT-Services, https://www.c-rieger.de" +echo "" +exit 0