Skip to content

Add Debian 12 (Bookworm) support alongside Debian 11 (Bullseye) - #6

Open
nonholamilza wants to merge 9 commits into
programmer-ke:masterfrom
nonholamilza:master
Open

Add Debian 12 (Bookworm) support alongside Debian 11 (Bullseye)#6
nonholamilza wants to merge 9 commits into
programmer-ke:masterfrom
nonholamilza:master

Conversation

@nonholamilza

Copy link
Copy Markdown
Contributor

With Debian 11 reaching end of life on August 31, 2026, I upgraded my production server to Bookworm and found a few incompatibilities. This PR fixes them while keeping Bullseye working, using conditionals on ansible_distribution_major_version.

SpamAssassin service renamed
On Bookworm the systemd unit is spamd.service instead of spamassassin.service, and the defaults file moved from /etc/default/spamassassin to /etc/default/spamd. Both are now resolved via a set_fact so the playbook works on either release. The apt package name is unchanged.

Nightly rule updates
The CRON=1 setting is no longer read on Bookworm — rule updates are handled by spamassassin-maintenance.timer, which ships disabled. The playbook now enables the timer on Bookworm and keeps CRON=1 on Bullseye.

Services not reloaded after config changes
This one was subtle. On a clean install, Dovecot was running from before /etc/dovecot/passwd was written, so every IMAP login failed. Postfix wasn't listening on 465/587 despite a correct master.cf, and nginx wasn't listening on 443. A manual systemctl reload fixed all three. The handlers have been adjusted so services pick up the configuration the playbook just wrote.

bcrypt salts were not random
Two different passwords in /etc/dovecot/passwd produced hashes sharing the same 29-character salt prefix. bcrypt salts must be randomly generated per hash.

mydestination contained unrelated domains
A fresh install had mydestination including myplatform.dataengineering.co.ke and localhost.dataengineering.co.ke. Now parameterized.

DNS records for the server hostname
generate_txt_records.yml only covered domains in mail_domains, but the server hostname also sends mail and receives the postmaster@ and dmarc-reports@ aliases, so it needs SPF and DKIM too. The DKIM key was already being generated — only the record export was missing. Added a companion task that also emits MX and A/AAAA records.

Testing
Verified on a clean Debian 12 VPS and on an in-place Bullseye → Bookworm upgrade of a production mail server hosting five domains. Mail delivery confirmed in both directions, with SPF, DKIM and DMARC all passing at Gmail.

Let's Encrypt stopped including OCSP responder URLs in their certificates starting in May 2025, and shut down their OCSP responders permanently on August 6, 2025.

With current Let's Encrypt certificates, nginx emits a warning on every reload: "ssl_stapling" ignored, no OCSP responder URL in the certificate
   
Since OCSP stapling no longer works with Let's Encrypt, this commit removes the related directives (ssl_stapling, ssl_stapling_verify, ssl_trusted_certificate, and the resolver line used only by stapling).
   
Browsers will rely on CRLite/CRLSets for revocation checking instead.
   
References:
- https://letsencrypt.org/2024/12/05/ending-ocsp/
- https://bugs.debian.org/1126960 (related)
- Detect SpamAssassin's systemd unit name (spamd on Bookworm,
  spamassassin on Bullseye) and use it consistently for the service,
  the /etc/default/ config path, and the certbot restart hook
- Enable spamassassin-maintenance.timer on Bookworm since CRON= in
  /etc/default/spamassassin no longer triggers nightly rule updates
  there; keep CRON=1 on Bullseye
- Fix missing notify on the dovecot passwd template so IMAP auth
  changes actually get reloaded; add force_handlers so a later task
  failure can't silently discard already-queued reload/restart
  handlers
- Generate a random bcrypt salt per password instead of a
  hostname-derived one that produced identical salts across accounts
- Replace hardcoded author domains in postfix mydestination with
  postfix's own $mydomain
- Generate SPF/DKIM/A/AAAA records for server_hostname and MX records
  for each mail domain in generate_txt_records.yml
Moved "Migrate to Debian 12 (Bookworm)" into Done
@programmer-ke

Copy link
Copy Markdown
Owner

Great! Thanks for this. I got swamped by other work and I was worried of the looming Debian 11 EOL.

I'll check this out and do some testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants