From 9318cb8ec1dc6c025d266b6f64423a30367639aa Mon Sep 17 00:00:00 2001 From: Sylvain Manceau Date: Fri, 9 Sep 2022 06:39:02 +0000 Subject: [PATCH] Rspamd domain filtering enhancements --- config/mail/rspamd/ecloud/blacklist.sender.domain.map | 1 + config/mail/rspamd/multimap.conf | 9 ++++++++- scripts/init-repo.sh | 6 +++++- templates/docker-compose/docker-compose.yml | 2 +- templates/mail/rspamd/ecloud/whitelist.sender.domain.map | 1 + templates/mail/rspamd/whitelist.sender.domain.map | 1 - 6 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 config/mail/rspamd/ecloud/blacklist.sender.domain.map create mode 100644 templates/mail/rspamd/ecloud/whitelist.sender.domain.map delete mode 100644 templates/mail/rspamd/whitelist.sender.domain.map diff --git a/config/mail/rspamd/ecloud/blacklist.sender.domain.map b/config/mail/rspamd/ecloud/blacklist.sender.domain.map new file mode 100644 index 0000000..50f1275 --- /dev/null +++ b/config/mail/rspamd/ecloud/blacklist.sender.domain.map @@ -0,0 +1 @@ +# Blacklisted sender domains, one per line diff --git a/config/mail/rspamd/multimap.conf b/config/mail/rspamd/multimap.conf index cb8ca45..5483e9a 100644 --- a/config/mail/rspamd/multimap.conf +++ b/config/mail/rspamd/multimap.conf @@ -1,6 +1,13 @@ WHITELIST_SENDER_DOMAIN { type = "from"; filter = "email:domain"; - map = "/etc/rspamd/local.d/whitelist.sender.domain.map"; + map = "/etc/rspamd/local.d/ecloud/whitelist.sender.domain.map"; score = -6.0 } + +BLACKLIST_SENDER_DOMAIN { + type = "from"; + filter = "email:domain"; + map = "/etc/rspamd/local.d/ecloud/blacklist.sender.domain.map"; + score = 99.0 +} diff --git a/scripts/init-repo.sh b/scripts/init-repo.sh index 0e81f2a..d4bbbdc 100755 --- a/scripts/init-repo.sh +++ b/scripts/init-repo.sh @@ -83,7 +83,11 @@ cat templates/automx/automx.conf | sed "s/@@@DOMAIN@@@/$DOMAIN/g" > "config/auto chown www-data:www-data "config/automx/automx.conf" # Configure rspamd whitelist -cat templates/mail/rspamd/whitelist.sender.domain.map | sed "s/@@@DOMAIN@@@/$DOMAIN/g" > "config/mail/rspamd/whitelist.sender.domain.map" +cat templates/mail/rspamd/ecloud/whitelist.sender.domain.map | sed "s/@@@DOMAIN@@@/$DOMAIN/g" > "config/mail/rspamd/ecloud/whitelist.sender.domain.map" + +# Allow white/black lists editing +chown -R 107:109 "config/mail/rspamd/ecloud/" + # Configure nginx vhost diff --git a/templates/docker-compose/docker-compose.yml b/templates/docker-compose/docker-compose.yml index aae05aa..d049c89 100644 --- a/templates/docker-compose/docker-compose.yml +++ b/templates/docker-compose/docker-compose.yml @@ -33,7 +33,7 @@ services: - /mnt/repo-base/config/mail/dovecot/90-quota.conf:/etc/dovecot/conf.d/90-quota.conf - /mnt/repo-base/config/mail/dovecot/90-sieve.conf:/etc/dovecot/conf.d/90-sieve.conf - /mnt/repo-base/config/mail/rspamd/multimap.conf:/etc/rspamd/local.d/multimap.conf - - /mnt/repo-base/config/mail/rspamd/whitelist.sender.domain.map:/etc/rspamd/local.d/whitelist.sender.domain.map + - /mnt/repo-base/config/mail/rspamd/ecloud:/etc/rspamd/local.d/ecloud - /mnt/repo-base/config/mail/rspamd/ratelimit.conf:/etc/rspamd/local.d/ratelimit.conf - /mnt/repo-base/config/mail/clamav/freshclam.conf:/etc/clamav/freshclam.conf depends_on: diff --git a/templates/mail/rspamd/ecloud/whitelist.sender.domain.map b/templates/mail/rspamd/ecloud/whitelist.sender.domain.map new file mode 100644 index 0000000..87b60c4 --- /dev/null +++ b/templates/mail/rspamd/ecloud/whitelist.sender.domain.map @@ -0,0 +1 @@ +@@@DOMAIN@@@ diff --git a/templates/mail/rspamd/whitelist.sender.domain.map b/templates/mail/rspamd/whitelist.sender.domain.map deleted file mode 100644 index 2eb784d..0000000 --- a/templates/mail/rspamd/whitelist.sender.domain.map +++ /dev/null @@ -1 +0,0 @@ -@@@DOMAIN@@@ \ No newline at end of file -- GitLab