Handle fail2ban logging

This commit is contained in:
Bob Mottram 2016-11-18 14:52:53 +00:00
parent 23f40d14a1
commit c62e88f29f
1 changed files with 11 additions and 0 deletions

View File

@ -40,6 +40,10 @@ if [ ! "$1" ]; then
fi fi
if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then 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 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
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 fi
sed -i 's|log_error =.*|log_error = /dev/null|g' /etc/mysql/my.cnf sed -i 's|log_error =.*|log_error = /dev/null|g' /etc/mysql/my.cnf
fi 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 fi
if [ -d /etc/nginx ]; then if [ -d /etc/nginx ]; then
@ -176,5 +184,8 @@ fi
if [ -d /var/www/radicale ]; then if [ -d /var/www/radicale ]; then
systemctl restart radicale systemctl restart radicale
fi fi
if [ -d /etc/fail2ban ]; then
systemctl restart fail2ban
fi
exit 0 exit 0