When you run the script to get all emails on production, there's an error related to TLS:
kfike@pop-os:~$ ssh kfike@123.456.789.12 -i ~/.ssh/sage_prod
kfike@prod:~$ sudo su
root@prod:/home/kfike# cd sage
root@prod:/home/kfike/sage# source .venv/bin/activate
(.venv) root@prod:/home/kfike/sage# python3 scripts/get_all_emails.py
FAILED
MAILSERVER ERROR: Failed to connect via IMAP to the inbox of user kfike: Response status "OK" expected, but "NO" received. Data: [b'[PRIVACYREQUIRED] Plaintext authentication disallowed on non-secure (SSL/TLS) connections.']
Solutions
Either disable TLS for local IMAP
# Configures /etc/dovecot/dovecot.conf for production
# Clear the file contents
:> /etc/dovecot/dovecot.conf
cat >> /etc/dovecot/dovecot.conf <<EOF
protocols = "imap"
disable_plaintext_auth = no
mail_privileged_group = mail
mail_location = maildir:~/Maildir
userdb {
driver = passwd
}
passdb {
driver = shadow
}
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0660
user = postfix
}
}
EOF
Problem
When you run the script to get all emails on production, there's an error related to TLS:
Solutions
Either disable TLS for local IMAP
Or use encrypted IMAP.
I decided to disable encrypted IMPA because IMAP is only accessed internally on the host.