Update emailwiz.sh

This commit is contained in:
MGislv 2022-01-06 13:31:19 +00:00
parent 5bb573b921
commit 07587ab0b0

View File

@ -219,8 +219,7 @@ plugin {
sieve_default = /var/lib/dovecot/sieve/default.sieve sieve_default = /var/lib/dovecot/sieve/default.sieve
sieve_dir = ~/.sieve sieve_dir = ~/.sieve
sieve_global = /var/lib/dovecot/sieve/ sieve_global = /var/lib/dovecot/sieve/
} }" > /etc/dovecot/dovecot.conf
" > /etc/dovecot/dovecot.conf
mkdir -p /var/lib/dovecot/ mkdir -p /var/lib/dovecot/
mkdir -p /var/lib/dovecot/sieve/ mkdir -p /var/lib/dovecot/sieve/
@ -281,7 +280,7 @@ sed -i '/Socket/s/^#*/#/' /etc/opendkim/opendkim.conf
grep -q '^Socket\s*inet:12301@localhost' /etc/opendkim/opendkim.conf || echo 'Socket inet:12301@localhost' >> /etc/opendkim/opendkim.conf grep -q '^Socket\s*inet:12301@localhost' /etc/opendkim/opendkim.conf || echo 'Socket inet:12301@localhost' >> /etc/opendkim/opendkim.conf
# Here we add to postconf the needed settings for working with OpenDKIM # Here we add to postconf the needed settings for working with OpenDKIM
echo "Configuring Postfix with OpenDKIM settings..." echo 'Configuring Postfix with OpenDKIM settings...'
postconf -e 'smtpd_sasl_security_options = noanonymous, noplaintext' postconf -e 'smtpd_sasl_security_options = noanonymous, noplaintext'
postconf -e 'smtpd_sasl_tls_security_options = noanonymous' postconf -e 'smtpd_sasl_tls_security_options = noanonymous'
postconf -e "myhostname = $domain" postconf -e "myhostname = $domain"
@ -291,18 +290,15 @@ postconf -e 'smtpd_milters = inet:localhost:12301'
postconf -e 'non_smtpd_milters = inet:localhost:12301' postconf -e 'non_smtpd_milters = inet:localhost:12301'
postconf -e 'mailbox_command = /usr/lib/dovecot/deliver' postconf -e 'mailbox_command = /usr/lib/dovecot/deliver'
for x in spamassassin opendkim dovecot postfix; do useradd -mG mail dmarc
printf "Restarting %s..." "$x"
systemctl enable restart "$x" && printf " ...done\\n" systemctl enable --now spamassassin opendkim dovecot postfix
done
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/$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"
useradd -m -G mail dmarc
echo "$dkimentry echo "$dkimentry
$dmarcentry $dmarcentry
$spfentry" > "$HOME/dns_emailwizard" $spfentry" > "$HOME/dns_emailwizard"
@ -331,4 +327,3 @@ Also, these are now saved to \033[34m~/dns_emailwizard\033[0m in case you want t
Once you do that, you're done! Check the README for how to add users/accounts Once you do that, you're done! Check the README for how to add users/accounts
and how to log in. and how to log in.
" "