correction to mail for/to external

This commit is contained in:
Emmanuel Garette 2022-03-15 22:25:05 +01:00
parent ac338c6067
commit e233dc1ffe
4 changed files with 21 additions and 5 deletions

View file

@ -11,7 +11,7 @@
<file engine="none">/etc/postfix/master.cf</file> <file engine="none">/etc/postfix/master.cf</file>
<file>/etc/pki/ca-trust/source/anchors/ca_MailServer.crt</file> <file>/etc/pki/ca-trust/source/anchors/ca_MailServer.crt</file>
<file>/etc/pki/tls/certs/postfix.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> <file owner="root" group="postfix" mode="440">/etc/pki/tls/private/postfix.key</file>
</service> </service>
<service name="saslauthd"> <service name="saslauthd">
@ -32,6 +32,9 @@
</service> </service>
</services> </services>
<variables> <variables>
<variable name="external_ports" redefine="True">
<value>25</value>
</variable>
<family name="postfix" description="Postfix mail server"> <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_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"/> <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): def get_dkim_key(domain_name_eth0, domain):
dkim_dir = _join(_DKIM_DIR, 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_key = _join(dkim_dir, f'{domain}.key')
dkim_file = _join(dkim_dir, f'{domain}.dns') dkim_file = _join(dkim_dir, f'{domain}.dns')
if not _isfile(dkim_file): if not _isfile(dkim_file):
if _isdir(dkim_dir): if _isdir(dkim_dir):
_rmtree(dkim_dir) _rmtree(dkim_dir)
_makedirs(dkim_dir) _makedirs(dkim_dir)
priv_key = _dknewkey.GenEd25519Keys(dkim_file_src) priv_key = _dknewkey.GenRSAKeys(dkim_file_key)
_dknewkey.ExtractEd25519PublicKey(dkim_file_key, priv_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: with open(dkim_file_key, 'r') as fh:
return fh.read().strip() return fh.read().strip()

View file

@ -24,5 +24,5 @@
#example.com default._domainkey.example.com #example.com default._domainkey.example.com
%for %%domain in %%postfix_relay_domains %for %%domain in %%postfix_relay_domains
%%domain default._domainkey.%%domain *@%%domain default._domainkey.%%domain
%end for %end for

View file

@ -350,6 +350,17 @@ mynetworks = 172.0.0.0/8
# #
#relay_domains = $mydestination #relay_domains = $mydestination
#>GNUNUX #>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 %if %%lmtp.server_lmtp
transport_maps = hash:/etc/postfix/lmtp transport_maps = hash:/etc/postfix/lmtp
%end if %end if