Kaynağa Gözat

Add SKIP_FAIL2BAN var

andryyy 8 yıl önce
ebeveyn
işleme
e9ea0712f2

+ 6 - 0
data/Dockerfiles/fail2ban/logwatch.py

@@ -1,6 +1,7 @@
 #!/usr/bin/env python2
 #!/usr/bin/env python2
 
 
 import re
 import re
+import os
 import time
 import time
 import atexit
 import atexit
 import signal
 import signal
@@ -12,6 +13,11 @@ import redis
 import time
 import time
 import json
 import json
 
 
+yes_regex = re.compile(r'([yY][eE][sS]|[yY])+$')
+if re.search(yes_regex, os.getenv('SKIP_FAIL2BAN', 0)):
+	print "Skipping Fail2ban container..."
+	raise SystemExit
+
 r = redis.StrictRedis(host='172.22.1.249', decode_responses=True, port=6379, db=0)
 r = redis.StrictRedis(host='172.22.1.249', decode_responses=True, port=6379, db=0)
 RULES = {
 RULES = {
 	'mailcowdockerized_postfix-mailcow_1': 'warning: .*\[([0-9a-f\.:]+)\]: SASL .* authentication failed',
 	'mailcowdockerized_postfix-mailcow_1': 'warning: .*\[([0-9a-f\.:]+)\]: SASL .* authentication failed',

+ 1 - 1
docker-compose.yml

@@ -331,6 +331,7 @@ services:
       privileged: true
       privileged: true
       environment:
       environment:
         - TZ=${TZ}
         - TZ=${TZ}
+        - SKIP_FAIL2BAN=${SKIP_FAIL2BAN:-no}
       network_mode: "host"
       network_mode: "host"
       dns:
       dns:
         - 172.22.1.254
         - 172.22.1.254
@@ -338,7 +339,6 @@ services:
       volumes:
       volumes:
         - /var/run/docker.sock:/var/run/docker.sock:ro
         - /var/run/docker.sock:/var/run/docker.sock:ro
         - /lib/modules:/lib/modules:ro
         - /lib/modules:/lib/modules:ro
-
     ipv6nat:
     ipv6nat:
       image: robbertkl/ipv6nat
       image: robbertkl/ipv6nat
       restart: always
       restart: always

+ 2 - 0
generate_config.sh

@@ -81,6 +81,8 @@ ADDITIONAL_SAN=
 # To never run acme-mailcow for Let's Encrypt, set this to y
 # To never run acme-mailcow for Let's Encrypt, set this to y
 SKIP_LETS_ENCRYPT=n
 SKIP_LETS_ENCRYPT=n
 
 
+# To never run fail2ban-mailcow
+SKIP_FAIL2BAN=n
 
 
 EOF
 EOF