feat(mail): add stunnel support for Dovecot and Postfix with configuration and certificate management

This commit is contained in:
2025-05-10 15:37:00 +02:00
parent a0ac55e746
commit 5d2f50feb9
10 changed files with 168 additions and 20 deletions
@@ -140,13 +140,13 @@ auth_mechanisms = plain login
service auth {
inet_listener auth {
port = 31000
port = 33100
}
}
# LMTP service to store sent emails
service lmtp {
inet_listener auth {
inet_listener lmtp {
port = 31024
}
mail_plugins {
@@ -0,0 +1,7 @@
foreground = yes
[dovecot-auth]
accept = 0.0.0.0:31000
connect = 127.0.0.1:33100
cert = /etc/ssl/certs/private/tls.crt
key = /etc/ssl/certs/private/tls.key
@@ -15,14 +15,6 @@ if [ -z "$SMTP_PASSWORD" ]; then
echo "SMTP_PASSWORD is required"
exit 1
fi
if [ -z "$DOVECOT_AUTH_ADDRESS" ]; then
echo "DOVECOT_AUTH_ADDRESS is required"
exit 1
fi
if [ -z "$DOVECOT_AUTH_PORT" ]; then
echo "DOVECOT_AUTH_PORT is required"
exit 1
fi
postconf -e "myhostname=$MAILNAME"
postconf -e "mydomain=$MY_PRIMARY_DOMAIN"
@@ -41,7 +33,7 @@ postconf -e "smtp_tls_CAfile=/etc/ssl/certs/ca-certificates.crt"
# SASL configuration
postconf -e "smtpd_sasl_type=dovecot"
postconf -e "smtpd_sasl_path=inet:$DOVECOT_AUTH_ADDRESS:$DOVECOT_AUTH_PORT"
postconf -e "smtpd_sasl_path=inet:localhost:31000"
postconf -e "smtpd_sasl_auth_enable=yes"
postconf -e "smtpd_sasl_security_options=noanonymous"
postconf -e "smtpd_recipient_restrictions=permit_sasl_authenticated, reject"
@@ -0,0 +1,7 @@
foreground = yes
[dovecot-auth]
client = yes
accept = 127.0.0.1:31000
connect = dovecot-auth.mail.svc.cluster.local:31000
CAfile = /etc/ssl/certs/ca.pem