From c62e88f29f23c01efb0603c91ec1de105a4ef019 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 18 Nov 2016 14:52:53 +0000 Subject: [PATCH] Handle fail2ban logging --- src/freedombone-logging | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/freedombone-logging b/src/freedombone-logging index e8b1a0cd..a740faff 100755 --- a/src/freedombone-logging +++ b/src/freedombone-logging @@ -40,6 +40,10 @@ if [ ! "$1" ]; then fi if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then + if [ -f /etc/fail2ban/fail2ban.conf ]; then + sed -i 's|loglevel.*|loglevel = 3|g' /etc/fail2ban/fail2ban.conf + sed -i 's|logtarget.*|logtarget = /var/log/fail2ban.log|g' /etc/fail2ban/fail2ban.conf + fi if [ -d /etc/tor ]; then sed -i 's|#Log notice file.*|Log notice file /var/log/tor.log|g' /etc/tor/torrc sed -i 's|Log notice file.*|Log notice file /var/log/tor.log|g' /etc/tor/torrc @@ -149,6 +153,10 @@ else fi sed -i 's|log_error =.*|log_error = /dev/null|g' /etc/mysql/my.cnf fi + if [ -f /etc/fail2ban/fail2ban.conf ]; then + sed -i 's|loglevel.*|loglevel = 1|g' /etc/fail2ban/fail2ban.conf + sed -i 's|logtarget.*|logtarget = /dev/null|g' /etc/fail2ban/fail2ban.conf + fi fi if [ -d /etc/nginx ]; then @@ -176,5 +184,8 @@ fi if [ -d /var/www/radicale ]; then systemctl restart radicale fi +if [ -d /etc/fail2ban ]; then + systemctl restart fail2ban +fi exit 0