diff options
author | tfasano1 <54379134+tfasano1@users.noreply.github.com> | 2024-01-17 22:48:14 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-17 22:48:14 -0500 |
commit | bda15800886db4947b3f92d285e7fc5e46928134 (patch) | |
tree | c6117a80f6829b069d0326b9dbf24f295a53c9e2 /emailwiz.sh | |
parent | 0aa7a8df389ea4474f5cd97c6604133c5222edf1 (diff) |
add ipv6 mechanism
Diffstat (limited to 'emailwiz.sh')
-rw-r--r-- | emailwiz.sh | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/emailwiz.sh b/emailwiz.sh index 3b1ee89..e3a3ed8 100644 --- a/emailwiz.sh +++ b/emailwiz.sh @@ -347,14 +347,14 @@ for x in opendkim dovecot postfix fail2ban; do systemctl enable "$x" done -# In some cases, big name email services favor an spf record with certain mechanisms included. -# See http://www.open-spf.org/SPF_Record_Syntax -mailip=$(ping -c 1 $domain | grep -m1 -Eo '([0-9]+\.){3}[0-9]+') +# Generate spf mechanisms +mailip4=$(host "$domain" | grep -m1 -Eo '([0-9]+\.){3}[0-9]+') +mailip6=$(host "$domain" | grep "IPv6" | awk '{print $NF}') 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" dmarcentry="_dmarc.$domain TXT v=DMARC1; p=reject; rua=mailto:dmarc@$domain; fo=1" -spfentry="$domain TXT v=spf1 mx a:$maildomain ip4:$mailip -all" +spfentry="$domain TXT v=spf1 mx a:$maildomain ip4:$mailip4 ip6:$mailip6 -all" mxentry="$domain MX 10 $maildomain 300" useradd -m -G mail dmarc |