mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Add DKIM DNS record in domain_dns_conf (close #198)
This commit is contained in:
parent
95b7dd5f93
commit
8d520762e6
1 changed files with 18 additions and 0 deletions
|
@ -255,4 +255,22 @@ def domain_dns_conf(domain, ttl=None):
|
|||
else:
|
||||
result += '@ {ttl} IN TXT "v=spf1 a mx ip4:{ip4} ip6:{ip6} -all"\n'.format(ttl=ttl, ip4=ip4, ip6=ip6)
|
||||
|
||||
try:
|
||||
with open('/etc/dkim/{domain}.mail.txt'.format(domain=domain)) as f:
|
||||
dkim_content = f.read()
|
||||
except IOError:
|
||||
pass
|
||||
else:
|
||||
dkim = re.match((
|
||||
r'^(?P<domain>[a-z_\-\.]+)[\s]+([0-9]+[\s]+)?IN[\s]+TXT[\s]+[^"]*'
|
||||
'(?=.*(;[\s]*|")v=(?P<v>[^";]+))'
|
||||
'(?=.*(;[\s]*|")k=(?P<k>[^";]+))'
|
||||
'(?=.*(;[\s]*|")p=(?P<p>[^";]+))'), dkim_content, re.M|re.S
|
||||
)
|
||||
if dkim:
|
||||
result += '{domain} {ttl} IN TXT "v={v}; k={k}; p={p}"'.format(
|
||||
domain=dkim.group('domain'), ttl=ttl,
|
||||
v=dkim.group('v'), k=dkim.group('k'), p=dkim.group('p')
|
||||
)
|
||||
|
||||
return result
|
||||
|
|
Loading…
Add table
Reference in a new issue