Add option to disable SSL/STARTTLS for manual provider settings
There are scenarios where setting up SSL for a mail service would not
provide any security benefit, just complicate things or would be
outright impossible. For example, the unofficial emersion/hydroxide
Protonmail bridge is usually ran on your own computer or a home server,
thus it does not bother with implementing encryption. One might also
have a mail server on LAN where getting a cert is difficult, and is
only accessible to trusted machines.
In the manual settings, a prompt is added where the desired enctyption
method can be chosen. For regular users, sensible defaults are provided
both for encryption and ports that can be selected by pressing Enter.
Room for improvement: it's currently assumed that if SMTP has no TLS
support, the PLAIN authentication method is used. This is written out to
`msmtprc`, because by default it disallows sending password data in
cleartext, and fails if the server does not support GSSAPI. Maybe prompt
the user?
This might also be useful for the official Protonmail bridge, but I do
not know how that handles TLS.
# Set because msmtp only uses the most common 'plain' method without TLS if it is explicitly set
for x in "/etc/ssl/certs/ca-certificates.crt" "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" "/etc/ssl/cert.pem" "/usr/local/share/ca-certificates/"
printf "Your email domain is not in mutt-wizard's database yet.\\nmutt-wizard will still autoconfigure everything, but you will have to manually type in your service's IMAP and SMTP server information.\\nYou can usually quickly find this by internet searching for it.\\n"
printf "Insert the IMAP server for your email provider (excluding the port number)\\n\033[36m\t"
read -r imap
printf "\033[0mWhat is your server's IMAP port number? (Usually something like 993)\\n\033[36m\t"
printf "\033[0mWhat is your server's IMAP port number? (default: 993)\\n\033[36m\t"
read -r iport
iport="${iport:-993}"
while : ; do
printf "\033[0mWhich encryption method to use for IMAP? [None/STARTTLS/IMAPS] (default: IMAPS)\\n\033[36m\t"
*) printf 'Please answer None, STARTTLS or SMTPS';;
esac
done
printf "\033[0m\\nGreat! If you want to be helpful, copy the line below and you can add it to the \`domains.csv\` file on Github.\\nThis will make things easier for others who use your email provider.\\n\\n%s,%s,%s,%s,%s\\n\\nAlthough be sure to test to see if these settings work first! ;-)\\n" "$domain" "$imap" "$iport" "$smtp" "$sport"
else
IFS=, read -r service imap iport smtp sport <<EOF
@@ -179,9 +210,9 @@ EOF
printf "\\n\033[3;33mCongrats!\033[0m Server info has automatically been found, so you won't have to look anything up!\\n\t\033[1mIMAP server\033[0m: %s\\n\t\033[1mIMAP port\033[0m: %s\\n\t\033[1mSMTP server\033[0m: %s\\n\t\033[1mSMTP port\033[0m: %s\\nThis data will be used by the wizard.\\n" "$imap" "$iport" "$smtp" "$sport"
case "$service" in
gmail.com) printf "\033[31mREMEMBER: Gmail users must enable \"less secure\" (third-party) applications first for the sync to work:\\nhttps://support.google.com/accounts/answer/6010255\\n\033[0m" ;;
protonmail.ch|protonmail.com|pm.me) printf "\033[31mREMEMBER: Protonmail users must install and configure Protonmail Bridge first for the sync to work:\\nhttps://protonmail.com/bridge/\\n\033[0m" && ssltype="None" ;;
protonmail.ch|protonmail.com|pm.me) printf "\033[31mREMEMBER: Protonmail users must install and configure Protonmail Bridge first for the sync to work:\\nhttps://protonmail.com/bridge/\\n\033[0m" && issl="None" ;;