From a907fe4cac1d50f9d4271312d846d98e086088a4 Mon Sep 17 00:00:00 2001 From: Michael Wyraz Date: Sat, 12 Oct 2019 01:01:35 +0200 Subject: [PATCH] Split HOST_ANTISPAM in HOST_ANTISPAM_MILTER and HOST_ANTISPAM_WEBUI --- core/admin/mailu/configuration.py | 4 ---- core/dovecot/conf/ham.script | 4 ++-- core/dovecot/conf/spam.script | 4 ++-- core/dovecot/start.py | 2 +- core/nginx/conf/nginx.conf | 2 +- core/nginx/config.py | 2 +- core/postfix/conf/main.cf | 2 +- core/postfix/start.py | 2 +- docs/configuration.rst | 3 ++- docs/kubernetes/mailu/configmap.yaml | 3 ++- towncrier/newsfragments/1190.fix | 1 + 11 files changed, 14 insertions(+), 15 deletions(-) create mode 100644 towncrier/newsfragments/1190.fix diff --git a/core/admin/mailu/configuration.py b/core/admin/mailu/configuration.py index 05fad173..c7c695f1 100644 --- a/core/admin/mailu/configuration.py +++ b/core/admin/mailu/configuration.py @@ -60,8 +60,6 @@ DEFAULT_CONFIG = { 'HOST_SMTP': 'smtp', 'HOST_AUTHSMTP': 'smtp', 'HOST_ADMIN': 'admin', - 'ANTISPAM': 'none', - 'HOST_ANTISPAM': 'antispam:11334', 'WEBMAIL': 'none', 'HOST_WEBMAIL': 'webmail', 'HOST_WEBDAV': 'webdav:5232', @@ -99,8 +97,6 @@ class ConfigManager(dict): self.config["REDIS_ADDRESS"] = self.get_host_address("REDIS") if self.config["WEBMAIL"] != "none": self.config["WEBMAIL_ADDRESS"] = self.get_host_address("WEBMAIL") - if self.config["ANTISPAM"] != "none": - self.config["ANTISPAM_ADDRESS"] = self.get_host_address("ANTISPAM") def __coerce_value(self, value): if isinstance(value, str) and value.lower() in ('true','yes'): diff --git a/core/dovecot/conf/ham.script b/core/dovecot/conf/ham.script index f1dfc409..e4b8d496 100755 --- a/core/dovecot/conf/ham.script +++ b/core/dovecot/conf/ham.script @@ -1,4 +1,4 @@ #!/bin/bash -tee >(rspamc -h {{ ANTISPAM_ADDRESS }} -P mailu learn_ham /dev/stdin) \ - | rspamc -h {{ ANTISPAM_ADDRESS }} -P mailu -f 13 fuzzy_add /dev/stdin +tee >(rspamc -h {{ ANTISPAM_WEBUI_ADDRESS }} -P mailu learn_ham /dev/stdin) \ + | rspamc -h {{ ANTISPAM_WEBUI_ADDRESS }} -P mailu -f 13 fuzzy_add /dev/stdin diff --git a/core/dovecot/conf/spam.script b/core/dovecot/conf/spam.script index c711be0a..b888a01b 100755 --- a/core/dovecot/conf/spam.script +++ b/core/dovecot/conf/spam.script @@ -1,4 +1,4 @@ #!/bin/bash -tee >(rspamc -h {{ ANTISPAM_ADDRESS }} -P mailu learn_spam /dev/stdin) \ - >(rspamc -h {{ ANTISPAM_ADDRESS }} -P mailu -f 11 fuzzy_add /dev/stdin) +tee >(rspamc -h {{ ANTISPAM_WEBUI_ADDRESS }} -P mailu learn_spam /dev/stdin) \ + >(rspamc -h {{ ANTISPAM_WEBUI_ADDRESS }} -P mailu -f 11 fuzzy_add /dev/stdin) diff --git a/core/dovecot/start.py b/core/dovecot/start.py index b8ad1699..559baf6e 100755 --- a/core/dovecot/start.py +++ b/core/dovecot/start.py @@ -25,7 +25,7 @@ def start_podop(): os.environ["FRONT_ADDRESS"] = system.get_host_address_from_environment("FRONT", "front") os.environ["REDIS_ADDRESS"] = system.get_host_address_from_environment("REDIS", "redis") os.environ["ADMIN_ADDRESS"] = system.get_host_address_from_environment("ADMIN", "admin") -os.environ["ANTISPAM_ADDRESS"] = system.get_host_address_from_environment("ANTISPAM", "antispam:11334") +os.environ["ANTISPAM_WEBUI_ADDRESS"] = system.get_host_address_from_environment("ANTISPAM_WEBUI", "antispam:11334") if os.environ["WEBMAIL"] != "none": os.environ["WEBMAIL_ADDRESS"] = system.get_host_address_from_environment("WEBMAIL", "webmail") diff --git a/core/nginx/conf/nginx.conf b/core/nginx/conf/nginx.conf index 85853faa..67384edf 100644 --- a/core/nginx/conf/nginx.conf +++ b/core/nginx/conf/nginx.conf @@ -40,7 +40,7 @@ http { root /static; # Variables for proxifying set $admin {{ ADMIN_ADDRESS }}; - set $antispam {{ ANTISPAM_ADDRESS }}; + set $antispam {{ ANTISPAM_WEBUI_ADDRESS }}; {% if WEBMAIL_ADDRESS %} set $webmail {{ WEBMAIL_ADDRESS }}; {% endif %} diff --git a/core/nginx/config.py b/core/nginx/config.py index 65beeb6a..6fc9c082 100755 --- a/core/nginx/config.py +++ b/core/nginx/config.py @@ -15,7 +15,7 @@ with open("/etc/resolv.conf") as handle: args["RESOLVER"] = content[content.index("nameserver") + 1] args["ADMIN_ADDRESS"] = system.get_host_address_from_environment("ADMIN", "admin") -args["ANTISPAM_ADDRESS"] = system.get_host_address_from_environment("ANTISPAM", "antispam:11334") +args["ANTISPAM_WEBUI_ADDRESS"] = system.get_host_address_from_environment("ANTISPAM_WEBUI", "antispam:11334") if args["WEBMAIL"] != "none": args["WEBMAIL_ADDRESS"] = system.get_host_address_from_environment("WEBMAIL", "webmail") if args["WEBDAV"] != "none": diff --git a/core/postfix/conf/main.cf b/core/postfix/conf/main.cf index 49d7d4b7..0790946d 100644 --- a/core/postfix/conf/main.cf +++ b/core/postfix/conf/main.cf @@ -112,7 +112,7 @@ unverified_recipient_reject_reason = Address lookup failure # Milter ############### -smtpd_milters = inet:{{ ANTISPAM_ADDRESS }} +smtpd_milters = inet:{{ ANTISPAM_MILTER_ADDRESS }} milter_protocol = 6 milter_mail_macros = i {mail_addr} {client_addr} {client_name} {auth_authen} milter_default_action = tempfail diff --git a/core/postfix/start.py b/core/postfix/start.py index 4df5a3d4..7523bb4d 100755 --- a/core/postfix/start.py +++ b/core/postfix/start.py @@ -28,7 +28,7 @@ def start_podop(): # Actual startup script os.environ["FRONT_ADDRESS"] = system.get_host_address_from_environment("FRONT", "front") os.environ["ADMIN_ADDRESS"] = system.get_host_address_from_environment("ADMIN", "admin") -os.environ["ANTISPAM_ADDRESS"] = system.get_host_address_from_environment("ANTISPAM", "antispam:11332") +os.environ["ANTISPAM_MILTER_ADDRESS"] = system.get_host_address_from_environment("ANTISPAM_MILTER", "antispam:11332") os.environ["LMTP_ADDRESS"] = system.get_host_address_from_environment("LMTP", "imap:2525") for postfix_file in glob.glob("/conf/*.cf"): diff --git a/docs/configuration.rst b/docs/configuration.rst index 02931d35..a536c700 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -146,7 +146,8 @@ optional port number. Those variables are: - ``HOST_SMTP``: the container that is running the SMTP server (default: ``smtp``, port 25) - ``HOST_AUTHSMTP``: the container that is running the authenticated SMTP server for the webnmail (default: ``smtp``, port 10025) - ``HOST_ADMIN``: the container that is running the admin interface (default: ``admin``) -- ``HOST_ANTISPAM``: the container that is running the antispam service (default: ``antispam:11334``) +- ``HOST_ANTISPAM_MILTER``: the container that is running the antispam milter service (default: ``antispam:11332``) +- ``HOST_ANTISPAM_WEBUI``: the container that is running the antispam webui service (default: ``antispam:11334``) - ``HOST_ANTIVIRUS``: the container that is running the antivirus service (default: ``antivirus:3310``) - ``HOST_WEBMAIL``: the container that is running the webmail (default: ``webmail``) - ``HOST_WEBDAV``: the container that is running the webdav server (default: ``webdav:5232``) diff --git a/docs/kubernetes/mailu/configmap.yaml b/docs/kubernetes/mailu/configmap.yaml index a950c732..c9905256 100644 --- a/docs/kubernetes/mailu/configmap.yaml +++ b/docs/kubernetes/mailu/configmap.yaml @@ -164,6 +164,7 @@ HOST_WEBMAIL: "webmail.mailu-mailserver.svc.cluster.local" HOST_ADMIN: "admin.mailu-mailserver.svc.cluster.local" HOST_WEBDAV: "webdav.mailu-mailserver.svc.cluster.local:5232" - HOST_ANTISPAM: "antispam.mailu-mailserver.svc.cluster.local:11332" + HOST_ANTISPAM_MILTER: "antispam.mailu-mailserver.svc.cluster.local:11332" + HOST_ANTISPAM_WEBUI: "antispam.mailu-mailserver.svc.cluster.local:11334" HOST_ANTIVIRUS: "antivirus.mailu-mailserver.svc.cluster.local:3310" HOST_REDIS: "redis.mailu-mailserver.svc.cluster.local" diff --git a/towncrier/newsfragments/1190.fix b/towncrier/newsfragments/1190.fix new file mode 100644 index 00000000..fe365de9 --- /dev/null +++ b/towncrier/newsfragments/1190.fix @@ -0,0 +1 @@ +Separate HOST_ANTISPAM in HOST_ANTISPAM_MILTER and HOST_ANTISPAM_WEBUI because of different ports \ No newline at end of file