From 3ff5d8a7dd802a0f3139ecf6fa4ed14b9180c549 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Mon, 9 Nov 2020 10:52:24 +0100 Subject: [PATCH] bundles/postfix: add alias database --- bundles/postfix/files/aliases | 5 +++++ bundles/postfix/files/main.cf | 1 + bundles/postfix/items.py | 13 +++++++++++++ bundles/rspamd/metadata.py | 7 +++++++ 4 files changed, 26 insertions(+) create mode 100644 bundles/postfix/files/aliases diff --git a/bundles/postfix/files/aliases b/bundles/postfix/files/aliases new file mode 100644 index 0000000..31983d8 --- /dev/null +++ b/bundles/postfix/files/aliases @@ -0,0 +1,5 @@ +root: hostmaster@kunbox.net + +% for source, target in node.metadata.get('postfix', {}).get('aliases', {}).items(): +${source}: ${', '.join(sorted(target))} +% endfor diff --git a/bundles/postfix/files/main.cf b/bundles/postfix/files/main.cf index 30eff4a..3f9fe84 100644 --- a/bundles/postfix/files/main.cf +++ b/bundles/postfix/files/main.cf @@ -11,6 +11,7 @@ mailbox_size_limit = 0 recipient_delimiter = + inet_protocols = all message_size_limit = ${node.metadata.get('postfix', {}).get('message_size_limit_mb', 10)*1024*1024} +alias_database = hash:/etc/aliases % if node.has_bundle('postfixadmin'): inet_interfaces = all diff --git a/bundles/postfix/items.py b/bundles/postfix/items.py index 56e2ac5..11aa735 100644 --- a/bundles/postfix/items.py +++ b/bundles/postfix/items.py @@ -8,6 +8,12 @@ files = { 'svc_systemd:postfix:restart', }, }, + '/etc/aliases': { + 'content_type': 'mako', + 'triggers': { + 'action:postfix_newaliases', + }, + }, '/etc/postfix/master.cf': { 'content_type': 'mako', 'triggers': { @@ -22,6 +28,13 @@ files = { }, } +actions = { + 'postfix_newaliases': { + 'command': 'newaliases', + 'triggered': True, + }, +} + svc_systemd = { 'postfix': { 'needs': { diff --git a/bundles/rspamd/metadata.py b/bundles/rspamd/metadata.py index d5e8b6e..65cf06a 100644 --- a/bundles/rspamd/metadata.py +++ b/bundles/rspamd/metadata.py @@ -19,6 +19,13 @@ defaults = { 'cron': { 'clamav-unofficial-sigs': f'{node.magic_number%60} */4 * * * clamav /usr/sbin/clamav-unofficial-sigs >/dev/null 2>&1', }, + 'postfix': { + 'aliases': { + 'clamav': { + 'root', + }, + }, + }, }