Configure Exim TLS and authenticated message submission
Install a trusted certificate, separate port 587 policy, require encryption before AUTH, integrate an authenticator, rate-limit abuse, and test relay boundaries.
Let authenticated users submit mail securely without weakening the public port 25 relay policy.
- Exim 4.98+
- Authoritative DNS and stable identity Control forward and reverse DNS, choose the canonical mail hostname and domains, and verify the host is not behind an outbound SMTP-blocking network.
hostname -f; getent ahosts $(hostname -f); dig +short -x {{publicIp}} - Recovery and queue safety Keep console access, back up active configuration, and record queue state before changing routing, authentication, filters, or mailbox delivery.
- Abuse and deliverability plan Define relay boundaries, account owners, rate limits, bounce handling, postmaster address, monitoring, and how compromised credentials will be revoked.
OneLiners never runs these steps or stores secrets. Review placeholders, versions, current state, and change-control requirements before using a command.
Full guide
What you will build
- A production Exim implementation of “Configure Exim TLS and authenticated message submission” with explicit SMTP/IMAP boundaries, identity, durable state and observable delivery evidence.
- A read-only baseline, staged candidate and end-to-end canary covering DNS, TLS, authentication, recipient or route policy, queue/mailbox state and logs.
- A security and rollback procedure that avoids open relay, backscatter, plaintext credentials, world-readable keys/mail and unreviewed bulk queue actions.
- Let authenticated users submit mail securely without weakening the public port 25 relay policy. The intended success path is visible in native status, protocol transcript, headers or mailbox evidence.
- Expected unauthorized relay, unknown-recipient, wrong-sender, invalid-authentication or wrong-certificate tests fail at the declared boundary without harming unrelated mail.
Architecture
How the parts fit together
A dedicated submission listener on port 587 requires STARTTLS and SASL authentication before accepting client mail. It overrides client-controlled sender and relay policy with authenticated identity rules, while public port 25 remains unauthenticated server-to-server SMTP. Certificates bind the advertised mail hostname, secrets remain in the authentication backend, and a controlled SMTP transcript proves encryption, authentication, sender policy and final queue acceptance.
- Inventory hostname/DNS, listeners, certificates, identities, recipient/relay maps, queue/mailbox state, logs and a recoverable configuration/data baseline.
- Prepare the submission candidate with official Exim syntax, protected secrets and one explicit service/data boundary at a time.
- Run native configuration validation and immediate read-only checkpoint before reload or acceptance of new messages.
- Use controlled local and external canaries plus an expected-denial test, preserve message identifiers/headers, and retain the prior configuration for rollback.
Assumptions
- The public mail hostname, forward/reverse DNS ownership, supported package version and responsibility for ports 25/587/993 are known.
- A maintenance or canary window, console recovery and current protected backup of configuration, keys, identity mappings and relevant mailbox/queue data exist.
- Test sender and recipient addresses are owned by the operator; no unsolicited or third-party traffic is generated during verification.
- Secrets and private keys are delivered outside shell history and have narrowly defined service ownership and rotation plans.
Key concepts
- envelope identity
- SMTP sender and recipient used for routing, delivery status and SPF; it is distinct from visible message headers.
- open relay
- An MTA that accepts unauthorized third-party sender-to-recipient forwarding, enabling abuse and reputation damage.
- backscatter
- A later non-delivery report sent to a forged sender because an invalid recipient was accepted instead of rejected during SMTP.
- alignment
- DMARC relationship between visible From domain and authenticated SPF or DKIM domain.
- Maildir
- A mailbox format storing messages as individual files in cur/new/tmp directories with strict ownership.
Before you copy
Values used in this guide
{{certFile}}Operator-reviewed value used by this tutorial for certFile; derive it from the target environment and never from untrusted request data.
Example: /etc/letsencrypt/live/mail.example.com/fullchain.pem{{from}}Operator-reviewed value used by this tutorial for from; derive it from the target environment and never from untrusted request data.
Example: operator@example.com{{keyFile}}Operator-reviewed value used by this tutorial for keyFile; derive it from the target environment and never from untrusted request data.
Example: /etc/letsencrypt/live/mail.example.com/privkey.pem{{mailHost}}Operator-reviewed value used by this tutorial for mailHost; derive it from the target environment and never from untrusted request data.
Example: mail.example.com{{protectedSecret}}Operator-reviewed value used by this tutorial for protectedSecret; derive it from the target environment and never from untrusted request data.
Example: secret-manager-reference{{recipient}}Operator-reviewed value used by this tutorial for recipient; derive it from the target environment and never from untrusted request data.
Example: owned-test@example.net{{user}}Operator-reviewed value used by this tutorial for user; derive it from the target environment and never from untrusted request data.
Example: alice@example.comSecurity and production boundaries
- Never weaken relay/recipient checks, publish private DKIM/TLS keys, enable plaintext authentication, or expose web/IMAP administration broadly to make a test pass.
- Mail content, credentials, queues, logs and backups contain personal or confidential data; restrict, encrypt, minimize and retain them under an explicit policy.
- Use dedicated service identities and root-readable credential maps; verify logs and configuration output are redacted before sharing.
Stop before continuing if
- Stop if a test permits unauthorized relay, accepts unknown recipients for later bounce, sends credentials without verified TLS, or exposes private keys/mailbox files.
- Do not continue when hostname/PTR ownership, package/config version, recipient map, route, queue, mailbox ownership or rollback backup is ambiguous.
- Immediately quarantine the candidate when unrelated mail is rerouted, deleted, multiply delivered, signed by the wrong domain, or inaccessible after reload.
instruction
Verify certificate identity and renewal ownership
Use a certificate whose SAN includes the SMTP hostname, protect its key, and ensure Exim reloads after renewal.
Why this step matters
Verify certificate identity and renewal ownership is a separate checkpoint because it establishes one auditable part of let authenticated users submit mail securely without weakening the public port 25 relay policy. Performing it independently keeps a failed prerequisite, syntax error, or compatibility mismatch from being hidden by later actions.
What to understand
Use a certificate whose SAN includes the SMTP hostname, protect its key, and ensure Exim reloads after renewal. Read the complete command or configuration before execution, replace the documented placeholders, and compare the target host with the supported environments listed at the beginning of this tutorial.
Capture the before-state and the exact output in the change record. If this step modifies a file or service, validate the candidate with its native checker before any reload; a successful process exit alone does not prove that the application uses the intended value.
Use a representative staging or canary host first. Repeat the stated checkpoint immediately, because proceeding with ambiguous evidence makes the later end-to-end verification and rollback materially harder.
System changes
- This step may affect the files, packages, identities, services, or runtime policy named in “Verify certificate identity and renewal ownership”. The scope must remain limited to the selected application and supported host.
Syntax explained
openssl- Invokes the principal tool or configuration operation for “Verify certificate identity and renewal ownership”; confirm that it resolves to the expected packaged executable or file before using elevated privileges.
{{…}}- Marks an operator-supplied value. Replace every placeholder deliberately; do not paste untrusted text or leave braces in the production command.
Values stay on this page and are never sent or saved.
sudo openssl x509 -in {{certFile}} -noout -subject -issuer -dates -ext subjectAltName; sudo stat -c '%a %U:%G %n' {{keyFile}}The certificate covers the mail hostname and the key is not world-readable.
Checkpoint: Checkpoint: Verify certificate identity and renewal ownership
Continue whenThe certificate covers the mail hostname and the key is not world-readable. Treat this concrete evidence as the minimum success signal and also confirm that unrelated services and the previous healthy path remain unchanged.
Stop whenStop before the next step when openssl reports an error, the output differs materially from the example, an unexpected package/service/path is affected, or the required before-state and rollback artifact are missing.
If this step fails
The command for “Verify certificate identity and renewal ownership” fails, produces no useful evidence, or the expected service/configuration state is absent.
Likely causeA placeholder targets the wrong environment, the installed version uses another path or unit name, permissions are insufficient, or an earlier prerequisite was not satisfied.
command -v openssl 2>/dev/null || truesystemctl --failed --no-pager 2>/dev/null || truejournalctl -p warning -n 50 --no-pager 2>/dev/null || true
ResolutionDo not improvise a privileged workaround. Re-read the environment and variable table, inspect the official source for the installed version, restore the candidate file if necessary, and repeat only this checkpoint.
Security notes
- Keep secrets out of shell history, process arguments, screenshots, logs, and tutorial placeholders. Elevate only the narrow command that requires it and preserve package signature and TLS verification.
Alternatives
- When the host layout or software version differs, use the vendor-supported equivalent in a disposable staging environment and document the mapping before touching production.
Stop conditions
- Stop if the action broadens network exposure, permissions, package sources, writable paths, or service privileges beyond the tutorial's declared architecture.
config
Configure Exim TLS paths and protocol policy
Set tls_certificate, tls_privatekey, trusted CA path, and current protocol/cipher policy through the Debian local macros or split configuration.
Why this step matters
Configure Exim TLS paths and protocol policy is a separate checkpoint because it establishes one auditable part of let authenticated users submit mail securely without weakening the public port 25 relay policy. Performing it independently keeps a failed prerequisite, syntax error, or compatibility mismatch from being hidden by later actions.
What to understand
Set tls_certificate, tls_privatekey, trusted CA path, and current protocol/cipher policy through the Debian local macros or split configuration. Read the complete command or configuration before execution, replace the documented placeholders, and compare the target host with the supported environments listed at the beginning of this tutorial.
Capture the before-state and the exact output in the change record. If this step modifies a file or service, validate the candidate with its native checker before any reload; a successful process exit alone does not prove that the application uses the intended value.
Use a representative staging or canary host first. Repeat the stated checkpoint immediately, because proceeding with ambiguous evidence makes the later end-to-end verification and rollback materially harder.
System changes
- This step may affect the files, packages, identities, services, or runtime policy named in “Configure Exim TLS paths and protocol policy”. The scope must remain limited to the selected application and supported host.
Syntax explained
sudoedit- Invokes the principal tool or configuration operation for “Configure Exim TLS paths and protocol policy”; confirm that it resolves to the expected packaged executable or file before using elevated privileges.
/etc/exim4/exim4.conf.localmacros- Is the persistent configuration boundary changed by this step. Keep an attributable backup and validate the consumer before reload.
/etc/exim4/exim4.conf.localmacrossudoedit /etc/exim4/exim4.conf.localmacros; sudo update-exim4.conf; sudo exim -bP tls_certificate tls_privatekey openssl_optionsExim resolves the intended certificate, key, and TLS policy.
Checkpoint: Checkpoint: Configure Exim TLS paths and protocol policy
Continue whenExim resolves the intended certificate, key, and TLS policy. Treat this concrete evidence as the minimum success signal and also confirm that unrelated services and the previous healthy path remain unchanged.
Stop whenStop before the next step when sudoedit reports an error, the output differs materially from the example, an unexpected package/service/path is affected, or the required before-state and rollback artifact are missing.
If this step fails
The command for “Configure Exim TLS paths and protocol policy” fails, produces no useful evidence, or the expected service/configuration state is absent.
Likely causeA placeholder targets the wrong environment, the installed version uses another path or unit name, permissions are insufficient, or an earlier prerequisite was not satisfied.
command -v sudoedit 2>/dev/null || truesystemctl --failed --no-pager 2>/dev/null || truejournalctl -p warning -n 50 --no-pager 2>/dev/null || true
ResolutionDo not improvise a privileged workaround. Re-read the environment and variable table, inspect the official source for the installed version, restore the candidate file if necessary, and repeat only this checkpoint.
Security notes
- Keep secrets out of shell history, process arguments, screenshots, logs, and tutorial placeholders. Elevate only the narrow command that requires it and preserve package signature and TLS verification.
Alternatives
- When the host layout or software version differs, use the vendor-supported equivalent in a disposable staging environment and document the mapping before touching production.
Stop conditions
- Stop if the action broadens network exposure, permissions, package sources, writable paths, or service privileges beyond the tutorial's declared architecture.
config
Enable a distinct port 587 listener
Add daemon_smtp_ports=25:587 while keeping submission-specific behavior in ACL conditions based on received_port.
Why this step matters
Enable a distinct port 587 listener is a separate checkpoint because it establishes one auditable part of let authenticated users submit mail securely without weakening the public port 25 relay policy. Performing it independently keeps a failed prerequisite, syntax error, or compatibility mismatch from being hidden by later actions.
What to understand
Add daemon_smtp_ports=25:587 while keeping submission-specific behavior in ACL conditions based on received_port. Read the complete command or configuration before execution, replace the documented placeholders, and compare the target host with the supported environments listed at the beginning of this tutorial.
Capture the before-state and the exact output in the change record. If this step modifies a file or service, validate the candidate with its native checker before any reload; a successful process exit alone does not prove that the application uses the intended value.
Use a representative staging or canary host first. Repeat the stated checkpoint immediately, because proceeding with ambiguous evidence makes the later end-to-end verification and rollback materially harder.
System changes
- This step may affect the files, packages, identities, services, or runtime policy named in “Enable a distinct port 587 listener”. The scope must remain limited to the selected application and supported host.
Syntax explained
exim- Invokes the principal tool or configuration operation for “Enable a distinct port 587 listener”; confirm that it resolves to the expected packaged executable or file before using elevated privileges.
|- Passes standard output to the next read-only inspection stage; review each stage separately if the combined result is surprising.
configuration file- Is the persistent configuration boundary changed by this step. Keep an attributable backup and validate the consumer before reload.
sudo exim -bP daemon_smtp_ports; sudo ss -lntp | grep -E ':(25|587)'Exim listens on 25 and 587 with distinguishable policy.
Checkpoint: Checkpoint: Enable a distinct port 587 listener
Continue whenExim listens on 25 and 587 with distinguishable policy. Treat this concrete evidence as the minimum success signal and also confirm that unrelated services and the previous healthy path remain unchanged.
Stop whenStop before the next step when exim reports an error, the output differs materially from the example, an unexpected package/service/path is affected, or the required before-state and rollback artifact are missing.
If this step fails
The command for “Enable a distinct port 587 listener” fails, produces no useful evidence, or the expected service/configuration state is absent.
Likely causeA placeholder targets the wrong environment, the installed version uses another path or unit name, permissions are insufficient, or an earlier prerequisite was not satisfied.
command -v exim 2>/dev/null || truesystemctl --failed --no-pager 2>/dev/null || truejournalctl -p warning -n 50 --no-pager 2>/dev/null || true
ResolutionDo not improvise a privileged workaround. Re-read the environment and variable table, inspect the official source for the installed version, restore the candidate file if necessary, and repeat only this checkpoint.
Security notes
- Keep secrets out of shell history, process arguments, screenshots, logs, and tutorial placeholders. Elevate only the narrow command that requires it and preserve package signature and TLS verification.
Alternatives
- When the host layout or software version differs, use the vendor-supported equivalent in a disposable staging environment and document the mapping before touching production.
Stop conditions
- Stop if the action broadens network exposure, permissions, package sources, writable paths, or service privileges beyond the tutorial's declared architecture.
config
Configure a supported authentication backend
Use Dovecot SASL, PAM, LDAP, or another reviewed backend; avoid plaintext password files and advertise PLAIN/LOGIN only after TLS.
Why this step matters
Configure a supported authentication backend is a separate checkpoint because it establishes one auditable part of let authenticated users submit mail securely without weakening the public port 25 relay policy. Performing it independently keeps a failed prerequisite, syntax error, or compatibility mismatch from being hidden by later actions.
What to understand
Use Dovecot SASL, PAM, LDAP, or another reviewed backend; avoid plaintext password files and advertise PLAIN/LOGIN only after TLS. Read the complete command or configuration before execution, replace the documented placeholders, and compare the target host with the supported environments listed at the beginning of this tutorial.
Capture the before-state and the exact output in the change record. If this step modifies a file or service, validate the candidate with its native checker before any reload; a successful process exit alone does not prove that the application uses the intended value.
Use a representative staging or canary host first. Repeat the stated checkpoint immediately, because proceeding with ambiguous evidence makes the later end-to-end verification and rollback materially harder.
System changes
- This step may affect the files, packages, identities, services, or runtime policy named in “Configure a supported authentication backend”. The scope must remain limited to the selected application and supported host.
Syntax explained
exim- Invokes the principal tool or configuration operation for “Configure a supported authentication backend”; confirm that it resolves to the expected packaged executable or file before using elevated privileges.
configuration file- Is the persistent configuration boundary changed by this step. Keep an attributable backup and validate the consumer before reload.
sudo exim -bP authenticators; sudo exim -bP auth_advertise_hostsAuthenticators are present and AUTH is advertised only on encrypted connections.
Checkpoint: Checkpoint: Configure a supported authentication backend
Continue whenAuthenticators are present and AUTH is advertised only on encrypted connections. Treat this concrete evidence as the minimum success signal and also confirm that unrelated services and the previous healthy path remain unchanged.
Stop whenStop before the next step when exim reports an error, the output differs materially from the example, an unexpected package/service/path is affected, or the required before-state and rollback artifact are missing.
If this step fails
The command for “Configure a supported authentication backend” fails, produces no useful evidence, or the expected service/configuration state is absent.
Likely causeA placeholder targets the wrong environment, the installed version uses another path or unit name, permissions are insufficient, or an earlier prerequisite was not satisfied.
command -v exim 2>/dev/null || truesystemctl --failed --no-pager 2>/dev/null || truejournalctl -p warning -n 50 --no-pager 2>/dev/null || true
ResolutionDo not improvise a privileged workaround. Re-read the environment and variable table, inspect the official source for the installed version, restore the candidate file if necessary, and repeat only this checkpoint.
Security notes
- Keep secrets out of shell history, process arguments, screenshots, logs, and tutorial placeholders. Elevate only the narrow command that requires it and preserve package signature and TLS verification.
Alternatives
- When the host layout or software version differs, use the vendor-supported equivalent in a disposable staging environment and document the mapping before touching production.
Stop conditions
- Stop if the action broadens network exposure, permissions, package sources, writable paths, or service privileges beyond the tutorial's declared architecture.
config
Separate submission relay policy from inbound SMTP
Require TLS and successful authentication for non-local relay on 587; keep port 25 inbound MX behavior and anti-relay checks unchanged.
Why this step matters
Separate submission relay policy from inbound SMTP is a separate checkpoint because it establishes one auditable part of let authenticated users submit mail securely without weakening the public port 25 relay policy. Performing it independently keeps a failed prerequisite, syntax error, or compatibility mismatch from being hidden by later actions.
What to understand
Require TLS and successful authentication for non-local relay on 587; keep port 25 inbound MX behavior and anti-relay checks unchanged. Read the complete command or configuration before execution, replace the documented placeholders, and compare the target host with the supported environments listed at the beginning of this tutorial.
Capture the before-state and the exact output in the change record. If this step modifies a file or service, validate the candidate with its native checker before any reload; a successful process exit alone does not prove that the application uses the intended value.
Use a representative staging or canary host first. Repeat the stated checkpoint immediately, because proceeding with ambiguous evidence makes the later end-to-end verification and rollback materially harder.
System changes
- This step may affect the files, packages, identities, services, or runtime policy named in “Separate submission relay policy from inbound SMTP”. The scope must remain limited to the selected application and supported host.
Syntax explained
exim- Invokes the principal tool or configuration operation for “Separate submission relay policy from inbound SMTP”; confirm that it resolves to the expected packaged executable or file before using elevated privileges.
|- Passes standard output to the next read-only inspection stage; review each stage separately if the combined result is surprising.
configuration file- Is the persistent configuration boundary changed by this step. Keep an attributable backup and validate the consumer before reload.
sudo exim -bP acl_smtp_rcpt; sudo grep -R --line-number -E 'received_port|authenticated|encrypted' /etc/exim4/conf.d /etc/exim4/exim4.conf.localmacrosPort 587 relay requires authenticated TLS and port 25 remains non-relaying.
Checkpoint: Checkpoint: Separate submission relay policy from inbound SMTP
Continue whenPort 587 relay requires authenticated TLS and port 25 remains non-relaying. Treat this concrete evidence as the minimum success signal and also confirm that unrelated services and the previous healthy path remain unchanged.
Stop whenStop before the next step when exim reports an error, the output differs materially from the example, an unexpected package/service/path is affected, or the required before-state and rollback artifact are missing.
If this step fails
The command for “Separate submission relay policy from inbound SMTP” fails, produces no useful evidence, or the expected service/configuration state is absent.
Likely causeA placeholder targets the wrong environment, the installed version uses another path or unit name, permissions are insufficient, or an earlier prerequisite was not satisfied.
command -v exim 2>/dev/null || truesystemctl --failed --no-pager 2>/dev/null || truejournalctl -p warning -n 50 --no-pager 2>/dev/null || true
ResolutionDo not improvise a privileged workaround. Re-read the environment and variable table, inspect the official source for the installed version, restore the candidate file if necessary, and repeat only this checkpoint.
Security notes
- Keep secrets out of shell history, process arguments, screenshots, logs, and tutorial placeholders. Elevate only the narrow command that requires it and preserve package signature and TLS verification.
Alternatives
- When the host layout or software version differs, use the vendor-supported equivalent in a disposable staging environment and document the mapping before touching production.
Stop conditions
- Stop if the action broadens network exposure, permissions, package sources, writable paths, or service privileges beyond the tutorial's declared architecture.
config
Add submission rate and recipient limits
Bound messages, recipients, connections, and authentication failures per account or source; feed repeated failures into monitoring without logging secrets.
Why this step matters
Add submission rate and recipient limits is a separate checkpoint because it establishes one auditable part of let authenticated users submit mail securely without weakening the public port 25 relay policy. Performing it independently keeps a failed prerequisite, syntax error, or compatibility mismatch from being hidden by later actions.
What to understand
Bound messages, recipients, connections, and authentication failures per account or source; feed repeated failures into monitoring without logging secrets. Read the complete command or configuration before execution, replace the documented placeholders, and compare the target host with the supported environments listed at the beginning of this tutorial.
Capture the before-state and the exact output in the change record. If this step modifies a file or service, validate the candidate with its native checker before any reload; a successful process exit alone does not prove that the application uses the intended value.
Use a representative staging or canary host first. Repeat the stated checkpoint immediately, because proceeding with ambiguous evidence makes the later end-to-end verification and rollback materially harder.
System changes
- This step may affect the files, packages, identities, services, or runtime policy named in “Add submission rate and recipient limits”. The scope must remain limited to the selected application and supported host.
Syntax explained
grep- Invokes the principal tool or configuration operation for “Add submission rate and recipient limits”; confirm that it resolves to the expected packaged executable or file before using elevated privileges.
|- Passes standard output to the next read-only inspection stage; review each stage separately if the combined result is surprising.
configuration file- Is the persistent configuration boundary changed by this step. Keep an attributable backup and validate the consumer before reload.
sudo grep -R --line-number -E 'ratelimit|recipients_max|smtp_accept_max|authentication' /etc/exim4/conf.dExplicit submission abuse limits and alert thresholds exist.
Checkpoint: Checkpoint: Add submission rate and recipient limits
Continue whenExplicit submission abuse limits and alert thresholds exist. Treat this concrete evidence as the minimum success signal and also confirm that unrelated services and the previous healthy path remain unchanged.
Stop whenStop before the next step when grep reports an error, the output differs materially from the example, an unexpected package/service/path is affected, or the required before-state and rollback artifact are missing.
If this step fails
The command for “Add submission rate and recipient limits” fails, produces no useful evidence, or the expected service/configuration state is absent.
Likely causeA placeholder targets the wrong environment, the installed version uses another path or unit name, permissions are insufficient, or an earlier prerequisite was not satisfied.
command -v grep 2>/dev/null || truesystemctl --failed --no-pager 2>/dev/null || truejournalctl -p warning -n 50 --no-pager 2>/dev/null || true
ResolutionDo not improvise a privileged workaround. Re-read the environment and variable table, inspect the official source for the installed version, restore the candidate file if necessary, and repeat only this checkpoint.
Security notes
- Keep secrets out of shell history, process arguments, screenshots, logs, and tutorial placeholders. Elevate only the narrow command that requires it and preserve package signature and TLS verification.
Alternatives
- When the host layout or software version differs, use the vendor-supported equivalent in a disposable staging environment and document the mapping before touching production.
Stop conditions
- Stop if the action broadens network exposure, permissions, package sources, writable paths, or service privileges beyond the tutorial's declared architecture.
verification
Validate, restart, and inspect advertised capabilities
Build configuration, restart, then compare EHLO before and after STARTTLS on ports 25 and 587.
Why this step matters
Validate, restart, and inspect advertised capabilities is a separate checkpoint because it establishes one auditable part of let authenticated users submit mail securely without weakening the public port 25 relay policy. Performing it independently keeps a failed prerequisite, syntax error, or compatibility mismatch from being hidden by later actions.
What to understand
Build configuration, restart, then compare EHLO before and after STARTTLS on ports 25 and 587. Read the complete command or configuration before execution, replace the documented placeholders, and compare the target host with the supported environments listed at the beginning of this tutorial.
Capture the before-state and the exact output in the change record. If this step modifies a file or service, validate the candidate with its native checker before any reload; a successful process exit alone does not prove that the application uses the intended value.
Use a representative staging or canary host first. Repeat the stated checkpoint immediately, because proceeding with ambiguous evidence makes the later end-to-end verification and rollback materially harder.
System changes
- This step may affect the files, packages, identities, services, or runtime policy named in “Validate, restart, and inspect advertised capabilities”. The scope must remain limited to the selected application and supported host.
Syntax explained
update-exim4.conf- Invokes the principal tool or configuration operation for “Validate, restart, and inspect advertised capabilities”; confirm that it resolves to the expected packaged executable or file before using elevated privileges.
{{…}}- Marks an operator-supplied value. Replace every placeholder deliberately; do not paste untrusted text or leave braces in the production command.
Values stay on this page and are never sent or saved.
sudo update-exim4.conf; sudo systemctl restart exim4; swaks --server {{mailHost}} --port 587 --quit-after EHLO; swaks --server {{mailHost}} --port 587 --tls --quit-after EHLOSTARTTLS is advertised; AUTH appears only after TLS on submission.
Checkpoint: Checkpoint: Validate, restart, and inspect advertised capabilities
Continue whenSTARTTLS is advertised; AUTH appears only after TLS on submission. Treat this concrete evidence as the minimum success signal and also confirm that unrelated services and the previous healthy path remain unchanged.
Stop whenStop before the next step when update-exim4.conf reports an error, the output differs materially from the example, an unexpected package/service/path is affected, or the required before-state and rollback artifact are missing.
If this step fails
The command for “Validate, restart, and inspect advertised capabilities” fails, produces no useful evidence, or the expected service/configuration state is absent.
Likely causeA placeholder targets the wrong environment, the installed version uses another path or unit name, permissions are insufficient, or an earlier prerequisite was not satisfied.
command -v update-exim4.conf 2>/dev/null || truesystemctl --failed --no-pager 2>/dev/null || truejournalctl -p warning -n 50 --no-pager 2>/dev/null || true
ResolutionDo not improvise a privileged workaround. Re-read the environment and variable table, inspect the official source for the installed version, restore the candidate file if necessary, and repeat only this checkpoint.
Security notes
- Keep secrets out of shell history, process arguments, screenshots, logs, and tutorial placeholders. Elevate only the narrow command that requires it and preserve package signature and TLS verification.
Alternatives
- When the host layout or software version differs, use the vendor-supported equivalent in a disposable staging environment and document the mapping before touching production.
Stop conditions
- Stop if the action broadens network exposure, permissions, package sources, writable paths, or service privileges beyond the tutorial's declared architecture.
verification
Test valid submission and all denial paths
Prove valid authenticated TLS relay, wrong password denial, plaintext AUTH absence, unauthenticated relay denial, and certificate hostname verification.
Why this step matters
Test valid submission and all denial paths is a separate checkpoint because it establishes one auditable part of let authenticated users submit mail securely without weakening the public port 25 relay policy. Performing it independently keeps a failed prerequisite, syntax error, or compatibility mismatch from being hidden by later actions.
What to understand
Prove valid authenticated TLS relay, wrong password denial, plaintext AUTH absence, unauthenticated relay denial, and certificate hostname verification. Read the complete command or configuration before execution, replace the documented placeholders, and compare the target host with the supported environments listed at the beginning of this tutorial.
Capture the before-state and the exact output in the change record. If this step modifies a file or service, validate the candidate with its native checker before any reload; a successful process exit alone does not prove that the application uses the intended value.
Use a representative staging or canary host first. Repeat the stated checkpoint immediately, because proceeding with ambiguous evidence makes the later end-to-end verification and rollback materially harder.
System changes
- This step may affect the files, packages, identities, services, or runtime policy named in “Test valid submission and all denial paths”. The scope must remain limited to the selected application and supported host.
Syntax explained
swaks- Invokes the principal tool or configuration operation for “Test valid submission and all denial paths”; confirm that it resolves to the expected packaged executable or file before using elevated privileges.
{{…}}- Marks an operator-supplied value. Replace every placeholder deliberately; do not paste untrusted text or leave braces in the production command.
Values stay on this page and are never sent or saved.
swaks --server {{mailHost}} --port 587 --tls --tls-verify --auth --auth-user {{user}} --auth-password '{{protectedSecret}}' --from {{from}} --to {{recipient}}Valid submission queues once; every unsafe or invalid path is rejected.
Checkpoint: Checkpoint: Test valid submission and all denial paths
Continue whenValid submission queues once; every unsafe or invalid path is rejected. Treat this concrete evidence as the minimum success signal and also confirm that unrelated services and the previous healthy path remain unchanged.
Stop whenStop before the next step when swaks reports an error, the output differs materially from the example, an unexpected package/service/path is affected, or the required before-state and rollback artifact are missing.
If this step fails
The command for “Test valid submission and all denial paths” fails, produces no useful evidence, or the expected service/configuration state is absent.
Likely causeA placeholder targets the wrong environment, the installed version uses another path or unit name, permissions are insufficient, or an earlier prerequisite was not satisfied.
command -v swaks 2>/dev/null || truesystemctl --failed --no-pager 2>/dev/null || truejournalctl -p warning -n 50 --no-pager 2>/dev/null || true
ResolutionDo not improvise a privileged workaround. Re-read the environment and variable table, inspect the official source for the installed version, restore the candidate file if necessary, and repeat only this checkpoint.
Security notes
- Keep secrets out of shell history, process arguments, screenshots, logs, and tutorial placeholders. Elevate only the narrow command that requires it and preserve package signature and TLS verification.
Alternatives
- When the host layout or software version differs, use the vendor-supported equivalent in a disposable staging environment and document the mapping before touching production.
Stop conditions
- Stop if the action broadens network exposure, permissions, package sources, writable paths, or service privileges beyond the tutorial's declared architecture.
Finish line
Verification checklist
openssl s_client -starttls smtp -connect {{mailHost}}:587 -servername {{mailHost}} -verify_return_error </dev/nullCertificate chain and hostname validate.swaks --server {{mailHost}} --port 587 --quit-after EHLOAUTH mechanisms are absent before STARTTLS.Recovery guidance
Common problems and safe checks
A message remains queued or the remote server returns a temporary 4xx response.
Likely causeDNS/MX resolution, routing, network reachability, TLS negotiation, remote greylisting/rate limits, reputation or recipient policy prevents delivery.
exim -bp 2>/dev/null || postqueue -pdig +short MX example.netjournalctl -u exim4 -u postfix --since '-30 min' --no-pager
ResolutionInspect one message's recorded diagnostic and route first, fix the evidenced dependency, then retry only that message; do not force an undiagnosed bulk queue.
SMTP accepts a recipient, but the mailbox is absent, unreadable or never visible over IMAP.
Likely causeRecipient maps, LMTP/LDA route, virtual UID/GID, Maildir path, quota, Dovecot namespace or filesystem permissions disagree.
doveconf -ndoveadm user user@example.comdoveadm mailbox list -u user@example.com
ResolutionTrace the exact address through recipient validation, delivery socket and resolved mailbox path; correct the narrow mapping/ownership mismatch before accepting more mail.
Authentication or TLS fails despite apparently correct credentials and certificate files.
Likely causeThe listener uses another configuration, hostname/SAN does not match, chain/key permissions are wrong, authentication is attempted without TLS, or the identity backend maps another username.
openssl s_client -connect mail.example.com:587 -starttls smtp -servername mail.example.com </dev/nullopenssl s_client -connect mail.example.com:993 -servername mail.example.com </dev/nulljournalctl -u dovecot -u postfix -u exim4 -p warning -n 100 --no-pager
ResolutionVerify the advertised hostname, chain, listener and mapped user independently; never disable certificate verification or enable plaintext authentication to bypass the failure.
Reference
Frequently asked questions
Why is one successful test email insufficient?
It may bypass the actual external DNS, authentication, recipient, DKIM, queue retry or IMAP path. Test each boundary and preserve protocol/header evidence.
Can TLS be tested by checking that encryption is present?
No. Verify the chain and hostname and ensure authentication is unavailable before STARTTLS; encryption to an unverified endpoint is not server authentication.
Should a stuck queue be forced immediately?
No. Read one message's diagnostic and fix the dependency first. Bulk retries can amplify rate limits, duplicates or reputation damage.
Recovery
Rollback
Disable port 587 and the new authenticator while retaining public port 25 service and queued mail.
- Restore prior macros/ACLs, rebuild configuration, and restart Exim.
- Remove the submission firewall rule after confirming no client depends on it.
- Revoke test credentials and preserve authentication logs for review.
Evidence