Skip to content

Instantly share code, notes, and snippets.

@megamosk
Created May 24, 2024 08:04
Show Gist options
  • Save megamosk/1d40a3a0ac9551b456d63972aafc841c to your computer and use it in GitHub Desktop.
Save megamosk/1d40a3a0ac9551b456d63972aafc841c to your computer and use it in GitHub Desktop.
Postfix: adding TLS traffic encryption support
#add certificate
openssl req -new -nodes -x509 -out /etc/postfix/smtpd.pem -keyout /etc/postfix/smtpd.pem -days 3650
#/etc/postfix/main.cf
smtp_use_tls = yes
smtpd_use_tls = yes
smtpd_tls_auth_only = yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_key_file = /etc/postfix/smtpd.pem
smtpd_tls_cert_file = /etc/postfix/smtpd.pem
smtpd_tls_CAfile = /etc/postfix/smtpd.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
#uncomment in /etc/postfix/master.cf
#smtps inet n - n - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
#restart postfix
postfix reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment