Enabling PQC when using Caddy on Debian

On December 06, 2026 by Sosthène Guédon

Recent events have made support for Post-Quantum key exchanges (PQC) in TLS more pressing. Browsers have widespread support for the hybrid x25519mlkem768. The Caddy webserver that is packaged on Debian is old and doesn't support it. Here's a path to update, assuming you're on Debian 13 (trixie).

Enabling Debian Backports

First, enable trixie-backports. This is a repo maintained by Debian that allows you to opt in to more recent updates for some specific packages. Enabling it does nothing by default, unless you specify using them for a specific package, as we will do for Caddy. The Debian docs give you the way to do it manually, here's also an Ansible task that does it:

  - name: Add Backports
    ansible.builtin.apt_repository:
      repo: deb http://deb.debian.org/debian {{ ansible_facts["distribution_release"] }}-backports main
      state: present
      filename: backports
      update_cache: yes

Updating Caddy

Then, you can update Caddy:

apt install -t trixie-backports caddy

Or through Ansible again:

    - name: "Install caddy"
      ansible.builtin.apt:
        name:
          - caddy
        state: latest
        default_release: '{{ ansible_facts["distribution_release"] }}-backports'

Enabling ML-KEM

Based on the available documentation, you'd expect Caddy to now use ML-KEM, but no. Caddy in trixie-backports is built with DefaultGODEBUG=tlsmlkem=0 (this is a backwards-compatibility mechanism). You now need to set GODEBUG=tlsmlkem=1 in Caddy's environment variable. If you're using the default systemd unit provided by Debian for that, you can use systemctl edit caddy, or add manually a file in /etc/systemd/system/caddy.service.d/override.conf with the following:

[Service]
Environment=GODEBUG=tlsmlkem=1

Bonus, switching future certificates to use P-384

While it's not as pressing, using P-384 instead of P-256 for new certificates is recommended by Let’s Encrypt. With the updated Caddy version you now have, it's possible to specify your preferred key type. In the global options of your Caddyfile, set the key_type value to p384:

{
	key_type p384
}

It is not necessary to do so, but it's possible to force caddy to re-request all certificates by deleting everything in /var/lib/caddy/.local/share/caddy/certificates/, and restarting Caddy.