From 3fcd81960ef4a16f6635fa686bb9de7e1b72e40e Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Mon, 15 Mar 2021 11:41:35 +0100 Subject: [PATCH] bundles/postfix: allow configuring mynetworks --- bundles/postfix/files/main.cf | 4 ++-- bundles/postfix/metadata.py | 7 +++++++ nodes/home/router.py | 5 +++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/bundles/postfix/files/main.cf b/bundles/postfix/files/main.cf index ec16d2a..44c5750 100644 --- a/bundles/postfix/files/main.cf +++ b/bundles/postfix/files/main.cf @@ -6,7 +6,7 @@ compatibility_level = 2 myhostname = ${node.metadata.get('postfix/myhostname', node.metadata['hostname'])} myorigin = /etc/mailname mydestination = $myhostname, localhost -mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 +mynetworks = ${' '.join(sorted(node.metadata.get('postfix/mynetworks')))} mailbox_size_limit = 0 recipient_delimiter = + inet_protocols = all @@ -18,7 +18,7 @@ alias_maps = hash:/etc/aliases relayhost = ${node.metadata['postfix']['relayhost']} % endif -% if node.has_bundle('postfixadmin'): +% if node.has_bundle('postfixadmin') or node.has_bundle('iptables'): inet_interfaces = all % else: inet_interfaces = 127.0.0.1 diff --git a/bundles/postfix/metadata.py b/bundles/postfix/metadata.py index 9899988..19fd1a7 100644 --- a/bundles/postfix/metadata.py +++ b/bundles/postfix/metadata.py @@ -16,6 +16,13 @@ defaults = { }, }, }, + 'postfix': { + 'mynetworks': { + '127.0.0.0/8', + '[::ffff:127.0.0.0]/104', + '[::1]/128', + }, + }, } if node.has_bundle('postfixadmin'): diff --git a/nodes/home/router.py b/nodes/home/router.py index ff91820..f8cad90 100644 --- a/nodes/home/router.py +++ b/nodes/home/router.py @@ -125,6 +125,11 @@ nodes['home.router'] = { 'enp1s0.42': {}, }, }, + 'postfix': { + 'mynetworks': { + '172.19.138.0/24', + }, + }, 'pppd': { 'username': vault.decrypt('encrypt$gAAAAABfruZ5AZbgJ3mfMLWqIMx8o4bBRMJsDPD1jElh-vWN_gnhiuZVjrQ1-7Y6zDXNkxXiyhx8rxc2enmvo26axd7EBI8FqknCptXAPruVtDZrBCis4TE='), 'password': vault.decrypt('encrypt$gAAAAABfruaXEDkaFksFMU8g97ydWyJF8p2KcSDJJBlzaOLDsLL6oCDYjG1kMPVESOzqjn8ThtSht1uZDuMCstA-sATmLS-EWQ=='),