Skip to main content
Home
GrN.dk

Main navigation

  • Articles
  • Cases
  • Services
  • Your Digital Project Manager
  • About Greg Nowak
  • Image Gallery
  • Contact
User account menu
  • Log in

Join my community / free newsletter — sign up here

Breadcrumb

  1. Home

Enable TLS on a Linux Mail Server Without Breaking Delivery

Illustrated infographic summarizing: Enable TLS on a Linux Mail Server Without Breaking Delivery

By Greg Nowak. Updated 1 August 2026.

Mail-server TLS is not a switch you turn on once. Public SMTP, authenticated submission and mailbox access have different security requirements. Apply one strict policy everywhere and legitimate mail may stop arriving; leave everything optional and users or applications may expose credentials.

There is also a business decision to make first. If a server only sends website forms, password resets or application alerts, an established SMTP provider will often be easier to operate than a public mail server. Running your own MX makes more sense when you need direct control of inbound delivery, mailboxes or a specialised routing policy—and can commit to monitoring it.

Choose the TLS policy by service

Service Typical port Recommended posture Main risk
Public SMTP receiver 25 Offer STARTTLS; allow fallback Mandatory TLS can reject legitimate senders
Authenticated submission 587 Require STARTTLS before authentication Credentials exposed by an incorrect AUTH policy
Implicit TLS submission 465 Encrypt from connection start Clients configured for the wrong mode
IMAP mailbox access 993 Require TLS Certificate-name errors and exposed passwords
The safe policy depends on the service. Public server-to-server SMTP cannot be treated like a controlled user login.

Keep public SMTP opportunistic

On a publicly referenced MX, Postfix should advertise STARTTLS without requiring every sending server to use it. The may policy encrypts when the other system supports TLS but preserves delivery compatibility when it does not.

# /etc/postfix/main.cf
smtpd_tls_security_level = may
smtp_tls_security_level = may
smtpd_tls_cert_file = /etc/letsencrypt/live/mail.example.com/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/mail.example.com/privkey.pem

The first setting covers mail arriving at your server. The second enables opportunistic TLS for outbound delivery. If you send through a controlled relay, configure a stricter outbound policy for that destination rather than assuming the open internet can always meet it.

Require encryption on authenticated submission

Port 587 serves users and applications that authenticate. Make TLS mandatory there and do not advertise AUTH before encryption. Keep these overrides in master.cf so the stricter policy does not leak onto port 25.

# /etc/postfix/master.cf
submission inet n - y - - smtpd
  -o smtpd_tls_security_level=encrypt
  -o smtpd_tls_auth_only=yes
  -o smtpd_sasl_auth_enable=yes

The precise service line can differ between Linux packages, so compare it with the distribution’s supplied master.cf. Confirm that SASL is connected to the intended authentication service and that submission is not accidentally configured as an unauthenticated relay.

Match Dovecot configuration to its installed version

Postfix TLS does not protect IMAP or POP logins. For Dovecot 2.4, the relevant server certificate settings are ssl_server_cert_file and ssl_server_key_file:

# Dovecot 2.4
ssl = required
auth_allow_cleartext = no
ssl_server_cert_file = /etc/letsencrypt/live/mail.example.com/fullchain.pem
ssl_server_key_file = /etc/letsencrypt/live/mail.example.com/privkey.pem

Dovecot 2.3 uses different setting names and syntax. Check dovecot --version before copying a configuration block, especially on long-term-support distributions. Then inspect the effective configuration with doveconf -n. Keep the private key readable only by root or the narrowly scoped system group that needs it.

Treat renewal and reload as one operation

A renewed certificate does nothing until Postfix and Dovecot start using the new files. Obtain the certificate with an authenticator appropriate to the host, test renewal, and install an executable deploy hook that reloads both services after a successful renewal.

sudo certbot certonly --webroot -w /var/www/html -d mail.example.com
sudo certbot renew --dry-run --run-deploy-hooks

A deploy-hook script in /etc/letsencrypt/renewal-hooks/deploy/ can contain:

#!/bin/sh
systemctl reload postfix
systemctl reload dovecot

Certbot does not run deploy hooks during a normal dry run unless --run-deploy-hooks is supplied. Test the hook during a controlled change window, confirm both reload commands succeed, and monitor certificate expiry independently so a failed renewal cannot remain invisible.

TLS still needs correct DNS and authentication

TLS encrypts a connection; it does not establish a good sending reputation. The server hostname should resolve to its public IP, and the IP’s PTR record should resolve back to that hostname. Inventory every website, CRM, helpdesk and SaaS platform that sends as the business domain. Configure SPF to cover authorised senders, sign with DKIM, and publish DMARC so receivers can evaluate alignment with the visible From: domain.

Test the external path before closing the change

Validate the effective configuration first, then test each exposed service from outside the server’s network. Using -servername checks the hostname clients actually present:

postfix check
postconf -n
doveconf -n
openssl s_client -starttls smtp -connect mail.example.com:25 -servername mail.example.com
openssl s_client -starttls smtp -connect mail.example.com:587 -servername mail.example.com
openssl s_client -connect mail.example.com:993 -servername mail.example.com
sudo journalctl -u postfix -u dovecot -f

Finally, send inbound and outbound test messages, inspect the queue and confirm that a real mail client can authenticate. Keep the previous configuration available for rollback until those tests pass.

If this server supports customer communication or operational alerts, the valuable work is not merely enabling TLS. It is separating policies correctly, automating renewal, aligning DNS and leaving the team with a testable operating procedure. Contact Greg if you want the configuration reviewed or the change planned and implemented safely.

Related on GrN.dk

  • Sending Mail from a Linux Server with Postfix: A Reliable, Relay-First Setup
  • CodeIgniter Login and Password Resets: Practical Security for Live Projects
  • Sending Mail with Drupal: Reliable Email Setup for Business Sites

Need help with this kind of work?

Discuss your mail-server setup with Greg Get in touch with Greg.

Sources

  • Postfix TLS Support
  • Dovecot CE SSL/TLS configuration
  • Certbot User Guide
  • Email sender guidelines — Gmail Help
Last modified
2026-08-12

Tags

  • Linux
  • Email
  • TLS
  • Postfix
  • Dovecot
  • Log in to post comments

Review Greg on Google

Greg Nowak Google Reviews

 

Written recommendations from Trafik og Veje, Aarhus Municipality (2011) and AgroTech (2010) — read them on LinkedIn.

Illustrated infographic summarizing: Zero Data Retention Is a Workflow Audit, Not a Checkbox
Zero Data Retention Is a Workflow Audit, Not a Checkbox
2026-08-30

Zero Data Retention covers the provider, not every copy in your stack. See how to audit endpoints, logs, storage, deletion and project-level controls.

Illustrated infographic summarizing: MCP 2026-07-28 Is an Auth Migration, Not a Version Bump
MCP 2026-07-28 Is an Auth Migration, Not a Version Bump
2026-08-29

MCP’s July 2026 release removes protocol sessions and tightens OAuth. Here’s a practical plan for migrating clients, servers and enterprise access safely.

Illustrated infographic summarizing: Turn a Technician’s Voice Note into a Work Order—Not Raw Audio
Turn a Technician’s Voice Note into a Work Order—Not Raw Audio
2026-08-28

Voice input can reduce the technician’s documentation burden when hours, materials and status are validated before the information is saved in the work order system.

Illustrated infographic summarizing: ChatGPT Disabled Personal Knowledge Sync. What Broke on Your Team?
ChatGPT Disabled Personal Knowledge Sync. What Broke on Your Team?
2026-08-27

ChatGPT retired personal sync connections for Enterprise and Edu. Here is how to find affected workflows, migrate access, and test permissions.

Illustrated infographic summarizing: Cloudflare’s September Bot Defaults Could Quietly Cut AI Visibility
Cloudflare’s September Bot Defaults Could Quietly Cut AI Visibility
2026-08-26

Cloudflare’s September bot defaults give publishers more control, but one training block could also cut search crawling and AI-driven discovery.

Illustrated infographic summarizing: Does Your AI Chatbot Clearly Identify Itself?
Does Your AI Chatbot Clearly Identify Itself?
2026-08-25

The EU’s transparency requirements for AI chatbots now apply. Here is how to make your bot’s identity clear, limit its system access and provide a genuine route to a member of staff.

Illustrated infographic summarizing: Should publishers add Google’s new Preferred Sources button?
Should publishers add Google’s new Preferred Sources button?
2026-08-24

Google’s Preferred Sources button is worth a controlled test for eligible publishers, with careful choices around placement, performance and measurement.

Illustrated infographic summarizing: Search Console Can See TikTok Now. Your Reporting Has to Catch Up
Search Console Can See TikTok Now. Your Reporting Has to Catch Up
2026-08-23

Google can now report how social profiles appear in Search. Here is how to measure cross-channel discovery without mistaking visibility for business results.

Illustrated infographic summarizing: Your AI workflow has logs. Can they explain one bad decision?
Your AI workflow has logs. Can they explain one bad decision?
2026-08-22

Logs can show that every service worked while leaving a bad AI decision unexplained. See how connected traces and careful redaction close the gap.

Illustrated infographic summarizing: Security Questionnaires Eat Into Selling Time—Let AI Find the Evidence
Security Questionnaires Eat Into Selling Time—Let AI Find the Evidence
2026-08-21

NIS 2 is generating more supplier questionnaires. A controlled AI assistant can find approved answers and sources—and route uncertain cases for review.

More articles

Built by AI — available for your business. The daily articles on this site are researched, written and illustrated by an autonomous AI pipeline. At nowa.dk I install the same kind of AI automation in businesses at fixed prices — site in Danish, English version here, and web/marketing agencies have a dedicated page.

RSS feed

Footer

  • All articles
  • Contact

GrN.dk — AI automation, web platforms, web optimization, data handling and logistics.

© 2026 GrN.dk · LinkedIn · Contact · AI automation in Danish: nowa.dk

Behind GrN.dk: Individual Entrepreneur Codecrafter · Tax ID 305669096 · Bakhtrioni St. 22, 0194 Tbilisi, Georgia · official business register