@@ -291,7 +291,7 @@ def has_rec(qname, rtype, prefix=None):
291
291
292
292
# Append the DKIM TXT record to the zone as generated by OpenDKIM.
293
293
# Skip if the user has set a DKIM record already.
294
- opendkim_record_file = os .path .join (env ['STORAGE_ROOT' ], 'mail/dkim/mail .txt' )
294
+ opendkim_record_file = os .path .join (env ['STORAGE_ROOT' ], 'mail/dkim/' + env [ 'DKIM_SELECTOR' ] + ' .txt' )
295
295
with open (opendkim_record_file , encoding = "utf-8" ) as orf :
296
296
m = re .match (r'(\S+)\s+IN\s+TXT\s+\( ((?:"[^"]+"\s+)+)\)' , orf .read (), re .S )
297
297
val = "" .join (re .findall (r'"([^"]+)"' , m .group (2 )))
@@ -752,12 +752,13 @@ def write_opendkim_tables(domains, env):
752
752
# Append a record to OpenDKIM's KeyTable and SigningTable for each domain
753
753
# that we send mail from (zones and all subdomains).
754
754
755
- opendkim_key_file = os .path .join (env ['STORAGE_ROOT' ], 'mail/dkim/mail .private' )
755
+ opendkim_key_file = os .path .join (env ['STORAGE_ROOT' ], 'mail/dkim/' + env [ 'DKIM_SELECTOR' ] + ' .private' )
756
756
757
757
if not os .path .exists (opendkim_key_file ):
758
758
# Looks like OpenDKIM is not installed.
759
759
return False
760
760
761
+ selector = env ['DKIM_SELECTOR' ]
761
762
config = {
762
763
# The SigningTable maps email addresses to a key in the KeyTable that
763
764
# specifies signing information for matching email addresses. Here we
@@ -777,7 +778,7 @@ def write_opendkim_tables(domains, env):
777
778
# signing domain must match the sender's From: domain.
778
779
"KeyTable" :
779
780
"" .join (
780
- f"{ domain } { domain } :mail :{ opendkim_key_file } \n "
781
+ f"{ domain } { domain } :{ selector } :{ opendkim_key_file } \n "
781
782
for domain in domains
782
783
),
783
784
}
0 commit comments