store dkim keys in subdir for multiple domains
This commit is contained in:
parent
b657e768c9
commit
860185e557
10
emailwiz.sh
10
emailwiz.sh
@ -258,10 +258,10 @@ account required pam_unix.so' >> /etc/pam.d/dovecot
|
|||||||
|
|
||||||
# Create an OpenDKIM key in the proper place with proper permissions.
|
# Create an OpenDKIM key in the proper place with proper permissions.
|
||||||
echo 'Generating OpenDKIM keys...'
|
echo 'Generating OpenDKIM keys...'
|
||||||
mkdir -p /etc/postfix/dkim
|
mkdir -p "/etc/postfix/dkim/$domain"
|
||||||
opendkim-genkey -D /etc/postfix/dkim/ -d "$domain" -s "$subdom"
|
opendkim-genkey -D "/etc/postfix/dkim/$domain" -d "$domain" -s "$subdom"
|
||||||
chgrp opendkim /etc/postfix/dkim/*
|
chgrp -R opendkim /etc/postfix/dkim/*
|
||||||
chmod g+r /etc/postfix/dkim/*
|
chmod -R g+r /etc/postfix/dkim/*
|
||||||
|
|
||||||
# Generate the OpenDKIM info:
|
# Generate the OpenDKIM info:
|
||||||
echo 'Configuring OpenDKIM...'
|
echo 'Configuring OpenDKIM...'
|
||||||
@ -316,7 +316,7 @@ done
|
|||||||
# If ufw is used, enable the mail ports.
|
# If ufw is used, enable the mail ports.
|
||||||
pgrep ufw >/dev/null && { ufw allow 993; ufw allow 465 ; ufw allow 587; ufw allow 25 ;}
|
pgrep ufw >/dev/null && { ufw allow 993; ufw allow 465 ; ufw allow 587; ufw allow 25 ;}
|
||||||
|
|
||||||
pval="$(tr -d '\n' </etc/postfix/dkim/"$subdom".txt | sed 's/k=rsa.* \"p=/k=rsa; p=/;s/\"\s*\"//;s/\"\s*).*//' | grep -o 'p=.*')"
|
pval="$(tr -d '\n' <"/etc/postfix/dkim/$domain/$subdom.txt" | sed 's/k=rsa.* \"p=/k=rsa; p=/;s/\"\s*\"//;s/\"\s*).*//' | grep -o 'p=.*')"
|
||||||
dkimentry="$subdom._domainkey.$domain TXT v=DKIM1; k=rsa; $pval"
|
dkimentry="$subdom._domainkey.$domain TXT v=DKIM1; k=rsa; $pval"
|
||||||
dmarcentry="_dmarc.$domain TXT v=DMARC1; p=reject; rua=mailto:dmarc@$domain; fo=1"
|
dmarcentry="_dmarc.$domain TXT v=DMARC1; p=reject; rua=mailto:dmarc@$domain; fo=1"
|
||||||
spfentry="$domain TXT v=spf1 mx a:$maildomain -all"
|
spfentry="$domain TXT v=spf1 mx a:$maildomain -all"
|
||||||
|
Loading…
Reference in New Issue
Block a user