Browse Source

Handle fail2ban logging

Bob Mottram 8 years ago
parent
commit
c62e88f29f
1 changed files with 11 additions and 0 deletions
  1. 11
    0
      src/freedombone-logging

+ 11
- 0
src/freedombone-logging View File

40
 fi
40
 fi
41
 
41
 
42
 if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then
42
 if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then
43
+    if [ -f /etc/fail2ban/fail2ban.conf ]; then
44
+        sed -i 's|loglevel.*|loglevel = 3|g' /etc/fail2ban/fail2ban.conf
45
+        sed -i 's|logtarget.*|logtarget = /var/log/fail2ban.log|g' /etc/fail2ban/fail2ban.conf
46
+    fi
43
     if [ -d /etc/tor ]; then
47
     if [ -d /etc/tor ]; then
44
         sed -i 's|#Log notice file.*|Log notice file /var/log/tor.log|g' /etc/tor/torrc
48
         sed -i 's|#Log notice file.*|Log notice file /var/log/tor.log|g' /etc/tor/torrc
45
         sed -i 's|Log notice file.*|Log notice file /var/log/tor.log|g' /etc/tor/torrc
49
         sed -i 's|Log notice file.*|Log notice file /var/log/tor.log|g' /etc/tor/torrc
149
         fi
153
         fi
150
         sed -i 's|log_error =.*|log_error = /dev/null|g' /etc/mysql/my.cnf
154
         sed -i 's|log_error =.*|log_error = /dev/null|g' /etc/mysql/my.cnf
151
     fi
155
     fi
156
+    if [ -f /etc/fail2ban/fail2ban.conf ]; then
157
+        sed -i 's|loglevel.*|loglevel = 1|g' /etc/fail2ban/fail2ban.conf
158
+        sed -i 's|logtarget.*|logtarget = /dev/null|g' /etc/fail2ban/fail2ban.conf
159
+    fi
152
 fi
160
 fi
153
 
161
 
154
 if [ -d /etc/nginx ]; then
162
 if [ -d /etc/nginx ]; then
176
 if [ -d /var/www/radicale ]; then
184
 if [ -d /var/www/radicale ]; then
177
     systemctl restart radicale
185
     systemctl restart radicale
178
 fi
186
 fi
187
+if [ -d /etc/fail2ban ]; then
188
+    systemctl restart fail2ban
189
+fi
179
 
190
 
180
 exit 0
191
 exit 0