From e233dc1ffe9866853219e3acb76b3fd9b7f8f6a4 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 15 Mar 2022 22:25:05 +0100 Subject: [PATCH] correction to mail for/to external --- .../dictionaries/{20_postfix.xml => 30_postfix.xml} | 5 ++++- .../2022.03.08/postfix-relay/funcs/opendkim.py | 8 +++++--- .../2022.03.08/postfix-relay/templates/SigningTable | 2 +- .../2022.03.08/postfix-relay/templates/main.cf | 11 +++++++++++ 4 files changed, 21 insertions(+), 5 deletions(-) rename seed/applicationservice/2022.03.08/postfix-relay/dictionaries/{20_postfix.xml => 30_postfix.xml} (95%) diff --git a/seed/applicationservice/2022.03.08/postfix-relay/dictionaries/20_postfix.xml b/seed/applicationservice/2022.03.08/postfix-relay/dictionaries/30_postfix.xml similarity index 95% rename from seed/applicationservice/2022.03.08/postfix-relay/dictionaries/20_postfix.xml rename to seed/applicationservice/2022.03.08/postfix-relay/dictionaries/30_postfix.xml index a9ff87f7..72c6201e 100644 --- a/seed/applicationservice/2022.03.08/postfix-relay/dictionaries/20_postfix.xml +++ b/seed/applicationservice/2022.03.08/postfix-relay/dictionaries/30_postfix.xml @@ -11,7 +11,7 @@ /etc/postfix/master.cf /etc/pki/ca-trust/source/anchors/ca_MailServer.crt /etc/pki/tls/certs/postfix.crt - postfix_pem_files + postfix_pem_files /etc/pki/tls/private/postfix.key @@ -32,6 +32,9 @@ + + 25 + diff --git a/seed/applicationservice/2022.03.08/postfix-relay/funcs/opendkim.py b/seed/applicationservice/2022.03.08/postfix-relay/funcs/opendkim.py index d907bf2b..b222ea87 100644 --- a/seed/applicationservice/2022.03.08/postfix-relay/funcs/opendkim.py +++ b/seed/applicationservice/2022.03.08/postfix-relay/funcs/opendkim.py @@ -16,14 +16,16 @@ _DKIM_DIR = _join(_HERE, 'pki/dkim') def get_dkim_key(domain_name_eth0, domain): dkim_dir = _join(_DKIM_DIR, domain_name_eth0, domain) - dkim_file_src = _join(dkim_dir, f'{domain}') +# dkim_file_src = _join(dkim_dir, f'{domain}') dkim_file_key = _join(dkim_dir, f'{domain}.key') dkim_file = _join(dkim_dir, f'{domain}.dns') if not _isfile(dkim_file): if _isdir(dkim_dir): _rmtree(dkim_dir) _makedirs(dkim_dir) - priv_key = _dknewkey.GenEd25519Keys(dkim_file_src) - _dknewkey.ExtractEd25519PublicKey(dkim_file_key, priv_key) + priv_key = _dknewkey.GenRSAKeys(dkim_file_key) + _dknewkey.ExtractRSADnsPublicKey(dkim_file_key, dkim_file) +# priv_key = _dknewkey.GenEd25519Keys(dkim_file_key) +# _dknewkey.ExtractEd25519PublicKey(dkim_file_src, priv_key) with open(dkim_file_key, 'r') as fh: return fh.read().strip() diff --git a/seed/applicationservice/2022.03.08/postfix-relay/templates/SigningTable b/seed/applicationservice/2022.03.08/postfix-relay/templates/SigningTable index bf0df9db..2def8ddc 100644 --- a/seed/applicationservice/2022.03.08/postfix-relay/templates/SigningTable +++ b/seed/applicationservice/2022.03.08/postfix-relay/templates/SigningTable @@ -24,5 +24,5 @@ #example.com default._domainkey.example.com %for %%domain in %%postfix_relay_domains -%%domain default._domainkey.%%domain +*@%%domain default._domainkey.%%domain %end for diff --git a/seed/applicationservice/2022.03.08/postfix-relay/templates/main.cf b/seed/applicationservice/2022.03.08/postfix-relay/templates/main.cf index e383cdaa..070470c1 100644 --- a/seed/applicationservice/2022.03.08/postfix-relay/templates/main.cf +++ b/seed/applicationservice/2022.03.08/postfix-relay/templates/main.cf @@ -350,6 +350,17 @@ mynetworks = 172.0.0.0/8 # #relay_domains = $mydestination #>GNUNUX +%set %%relay = %%set() +%for %%domain in %%lmtp.server_lmtp + %set %%name=%%normalize_family(%%domain) + %for %%lst in %%lmtp['lmtp_' + name]['criteria_' + %%name] + %if '@' in %%lst + %set %%lst = %%lst.split('@')[1] + %end if +%%relay.add(%%lst)%slurp + %end for +%end for +relay_domains = %echo ', '.join(%%relay) %if %%lmtp.server_lmtp transport_maps = hash:/etc/postfix/lmtp %end if -- 2.45.0