correction to mail for/to external #4

Merged
gnunux merged 1 commit from gnunux/dataset:issue/mail into main 2022-03-15 22:26:28 +01:00
4 changed files with 21 additions and 5 deletions

View file

@ -11,7 +11,7 @@
<file engine="none">/etc/postfix/master.cf</file>
<file>/etc/pki/ca-trust/source/anchors/ca_MailServer.crt</file>
<file>/etc/pki/tls/certs/postfix.crt</file>
<file source="sni.pem" file_type="variable" mode="400" owner="postfix" variable="domain_name_eth">postfix_pem_files</file>
<file source="sni.pem" file_type="variable" mode="400" variable="domain_name_eth">postfix_pem_files</file>
<file owner="root" group="postfix" mode="440">/etc/pki/tls/private/postfix.key</file>
</service>
<service name="saslauthd">
@ -32,6 +32,9 @@
</service>
</services>
<variables>
<variable name="external_ports" redefine="True">
<value>25</value>
</variable>
<family name="postfix" description="Postfix mail server">
<variable name="postfix_mail_hostname" type="domainname" description="Nom de domaine extérieur du serveur de courriel" mandatory="True"/>
<variable name="postfix_relay_domains" type="domainname" description="Domaine de courriel généré localement" multi="True"/>

View file

@ -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()

View file

@ -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

View file

@ -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