Discourse: Enabling Safer PQC Ciphers and Switching to P-384 Certificates

December 4, 2026 · Jonah Aragon

Triplebit hosts the Privacy Guides forum as well as our own Discourse forum, and we need to harden the default TLS configuration here. Discourse's default Docker container already supports the algorithms we need.

Note

The context behind this change is that we believe 256-bit ECC to be unsafe, more details in our transition announcement. This guide deals with our webservers specifically, but may be a useful reference for your own.

We will make copies of the existing configurations:

cp templates/web.ssl.template.yml \
	templates/web.ssl.pqc.template.yml

cp templates/web.letsencrypt.ssl.template.yml \
	templates/web.letsencrypt.pqc.template.yml

Configuration

In templates/web.ssl.pqc.template.yml we add the following immediately after the ssl_prefer_server_ciphers directive:

ssl_conf_command Groups SecP384r1MLKEM1024:X25519MLKEM768:SecP256r1MLKEM768/P-384;

Important

As with Mastodon, the / separator is important here. OpenSSL supports separating groups into priority tiers, so this configuration prioritizes hybrid PQC over classical key exchange even if doing so requires an additional handshake round trip.

We then need to switch to a P-384 certificate from Let's Encrypt.

In templates/web.letsencrypt.pqc.template.yml we replace the two instances of ec-256 with ec-384.

Applying Changes

We then edit /var/discourse/containers/app.yml and replace the previous configuration lines:

  - "templates/web.ssl.template.yml"
  - "templates/web.letsencrypt.ssl.template.yml"

With our updated templates:

#  - "templates/web.ssl.template.yml"
#  - "templates/web.letsencrypt.ssl.template.yml"
  - "templates/web.ssl.pqc.template.yml"
  - "templates/web.letsencrypt.pqc.template.yml"

Regenerating Let's Encrypt Certificates

To force-regenerate our ECC certificate, we stop Discourse and back up the certificates:

cd /var/discourse

domain=discuss.privacyguides.net
shared=/var/discourse/shared/standalone
backup=$(mktemp -d /root/discourse-ecc.XXXXXXXX)

./launcher stop app

mv "$shared/letsencrypt/${domain}_ecc" "$backup/"
mv "$shared/ssl/${domain}_ecc.cer" "$backup/"
mv "$shared/ssl/${domain}_ecc.key" "$backup/"

Then run ./launcher rebuild app to start Discourse and generate the new certificates.

Discourse serves both an RSA-4096 certificate and this new P-384 certificate simultaneously, with the user's browser choosing which it prefers. We do not consider this to be a problem at this time.

Testing Our Configuration

We can test our configurations with the following webserver-test.sh script:

#!/bin/bash
for group in X25519MLKEM768 SecP384r1MLKEM1024 P-384 X25519 P-256; do
    echo "Testing $group"
    openssl s_client \
        -connect "$domain:443" \
        -servername "$domain" \
        -tls1_3 \
        -groups "$group" \
        -brief </dev/null
done

When running domain=example.com bash webserver-test.sh (for example) in a terminal, before our changes were applied we would generally see "CONNECTION ESTABLISHED" under four of the five keys, with SecP384r1MLKEM1024 failing to connect.

After the change is applied we will see the connection now establishes with SecP384r1MLKEM1024, and we will no longer see "CONNECTION ESTABLISHED" underneath X25519 and P-256.

To my knowledge, there are no browsers which support X25519 but do not support P-384, so this change should not introduce compatibility issues. For performance reasons, browsers will typically prefer X25519 to P-384 when both are offered, so disabling X25519 explicitly will therefore improve security.

Future Work

In the future, the forums will be behind a separate Caddy reverse proxy that our other websites use, allowing us to enable ECH. At that time, our custom Discourse configuration will be upgraded to exclusively use the strongest possible encryption, so that internal communication between the Caddy reverse proxy and the Discourse VM will be upgraded.

This isn't strictly necessary on our secured internal network, but we prefer to encrypt whenever possible anyway. In that case, the upgrade on the Discourse end would have no impact for people visiting the forum, since that line of communication would be governed by our Caddy configuration.