Prevented escaped chars

Some of strings can escape with chars like ( ! ), causing break in code. 
Using ' instead of " will prevent exiting from command
This commit is contained in:
Simone Frassinelli 2021-09-17 18:54:25 +02:00 committed by GitHub
parent 4847043384
commit 58799452e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,10 +74,10 @@ postconf -e "smtp_tls_security_level = may"
postconf -e "smtpd_tls_auth_only = yes" postconf -e "smtpd_tls_auth_only = yes"
# Exclude obsolete, insecure and obsolete encryption protocols. # Exclude obsolete, insecure and obsolete encryption protocols.
postconf -e "smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1" postconf -e 'smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1'
postconf -e "smtp_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1" postconf -e 'smtp_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1'
postconf -e "smtpd_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1" postconf -e 'smtpd_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1'
postconf -e "smtp_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1" postconf -e 'smtp_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1'
# Exclude suboptimal ciphers. # Exclude suboptimal ciphers.
postconf -e "tls_preempt_cipherlist = yes" postconf -e "tls_preempt_cipherlist = yes"
@ -102,7 +102,7 @@ postconf -e "home_mailbox = Mail/Inbox/"
# master.cf # master.cf
echo "Configuring Postfix's master.cf..." echo "Configuring Postfix's master.cf..."
sed -i "/^\s*-o/d;/^\s*submission/d;/^\s*smtp/d" /etc/postfix/master.cf sed -i '/^\s*-o/d;/^\s*submission/d;/^\s*smtp/d' /etc/postfix/master.cf
echo "smtp unix - - n - - smtp echo "smtp unix - - n - - smtp
smtp inet n - y - - smtpd smtp inet n - y - - smtpd
@ -215,7 +215,7 @@ plugin {
# If using an old version of Dovecot, remove the ssl_dl line. # If using an old version of Dovecot, remove the ssl_dl line.
case "$(dovecot --version)" in case "$(dovecot --version)" in
1|2.1*|2.2*) sed -i "/^ssl_dh/d" /etc/dovecot/dovecot.conf ;; 1|2.1*|2.2*) sed -i '/^ssl_dh/d' /etc/dovecot/dovecot.conf ;;
esac esac
mkdir /var/lib/dovecot/sieve/ mkdir /var/lib/dovecot/sieve/
@ -274,10 +274,10 @@ sed -i '/^#Canonicalization/s/simple/relaxed\/simple/' /etc/opendkim.conf
sed -i '/^#Canonicalization/s/^#//' /etc/opendkim.conf sed -i '/^#Canonicalization/s/^#//' /etc/opendkim.conf
sed -i '/Socket/s/^#*/#/' /etc/opendkim.conf sed -i '/Socket/s/^#*/#/' /etc/opendkim.conf
grep -q "^Socket\s*inet:12301@localhost" /etc/opendkim.conf || echo "Socket inet:12301@localhost" >> /etc/opendkim.conf grep -q '^Socket\s*inet:12301@localhost' /etc/opendkim.conf || echo "Socket inet:12301@localhost" >> /etc/opendkim.conf
# OpenDKIM daemon settings, removing previously activated socket. # OpenDKIM daemon settings, removing previously activated socket.
sed -i "/^SOCKET/d" /etc/default/opendkim && echo "SOCKET=\"inet:12301@localhost\"" >> /etc/default/opendkim sed -i '/^SOCKET/d' /etc/default/opendkim && echo "SOCKET=\"inet:12301@localhost\"" >> /etc/default/opendkim
# 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..."
@ -302,7 +302,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/$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="@ TXT v=spf1 mx a:$maildomain -all" spfentry="@ TXT v=spf1 mx a:$maildomain -all"