Skip to content

TLS Certificates ​

TLS is ferrixd's primary transport — the [tls] section is required, and the server won't start without a real certificate, built-in ACME, or an explicit opt-in to a development self-signed one. One certificate serves every TLS listener: the IRC port, wss://, the S2S link listener, the [web] port and (with tls = true) the admin dashboard.

OptionUse it for
A: certificate filesproduction with certbot or any other ACME client
B: built-in ACMEproduction without an external ACME client
C: self-signeddevelopment (ferrixd run --dev)
D: pinned self-signedprivate networks and S2S links

Option A: real certificates (production) ​

toml
[tls]
cert = "/etc/ferrixd/fullchain.pem"
key  = "/etc/ferrixd/privkey.pem"

Both paths must be PEM. cert should be the full chain (leaf first, then intermediates) so clients can validate without fetching intermediates. cert and key must be set together — configuring only one is an error.

Let's Encrypt ​

Any ACME client works; ferrixd just reads PEM files. With certbot:

sh
certbot certonly --standalone -d irc.example.org
toml
[tls]
cert = "/etc/letsencrypt/live/irc.example.org/fullchain.pem"
key  = "/etc/letsencrypt/live/irc.example.org/privkey.pem"

Two operational notes:

  1. Permissions. ferrixd should run as an unprivileged user; make sure that user can read the key (a deploy hook that copies the pair into /etc/ferrixd/ with tight ownership is the usual pattern).
  2. Renewal is automatic — no hook, no restart. ferrixd checks the certificate and key files every reload_interval_secs (default 60) and installs a renewed pair on its own; set it to 0 to turn the watch off. A pair that fails to load (say, the key was replaced but not yet the certificate) is reported once and ignored until the files change again — the current certificate stays armed. To apply a renewal at once, run ferrixd ctl reload-certs (or REHASH) from your deploy hook. Either way the certificate and key are reloaded for every TLS listener (client, wss://, [web], [admin] and the S2S link listener) and the TLS client configuration used for all outbound links is rebuilt, without dropping the process or any live connection: only handshakes started after the reload use the new material. If the new PEM is unreadable or malformed the reload fails and the previous certificate stays armed, so a botched renewal never leaves the listener without a certificate. An established outbound link keeps the certificate it handshook with until it reconnects; the next (re)connect — whether the auto-dial reconnect loop after a drop, an operator CONNECT, or a SQUIT + CONNECT — presents the reloaded certificate automatically.

Validate before reloading:

sh
ferrixd check

check builds the actual TLS configuration, so an unreadable key, a mismatched pair, or a malformed PEM fails here with a precise error.

Option B: built-in ACME (automatic certificates) ​

ferrixd can obtain and renew its own certificate from Let's Encrypt (or any RFC 8555 CA) — no certbot, no deploy hook:

toml
[tls.acme]
domains = ["irc.example.org"]
contact = ["mailto:admin@example.org"]
dir = "/var/lib/ferrixd/acme"        # account key, cert.pem, key.pem (0600)
http_bind = "0.0.0.0:80"             # HTTP-01 challenge responder
accept_terms = true                  # you agree to the CA's terms of service
# directory = "https://acme-staging-v02.api.letsencrypt.org/directory"  # for testing
# renew_before_days = 30

[tls.acme] replaces cert/key. How it works:

  • Proof of control uses HTTP-01: ferrixd answers http://<domain>/.well-known/acme-challenge/… on http_bind. The CA connects to port 80 of every listed domain, so that address must be reachable as port 80 (bind it directly — which needs the CAP_NET_BIND_SERVICE capability for an unprivileged user — or forward port 80 to it). The listener answers nothing but pending challenges.
  • On first start, before the CA has issued anything, the server runs on a temporary self-signed certificate (logged as tls.acme_placeholder) and switches to the real one the moment it arrives — no restart.
  • The certificate is renewed when it expires within renew_before_days (checked every 12 hours); a failed attempt is retried with backoff (5 minutes, doubling, capped at 6 hours) while the current certificate keeps serving.
  • Files are written atomically (key first, then certificate). Use the staging directory while testing to stay clear of production rate limits.
  • Wildcard names are not supported (they need DNS-01). TLS-ALPN-01 is not offered either: it would require the acme-tls/1 ALPN protocol on the TLS listeners, which would break browser wss:// clients.

Watch the expiry in Prometheus: ferrixd_tls_cert_not_after_seconds (metrics).

promql
ferrixd_tls_cert_not_after_seconds - time() < 14 * 86400

Option C: self-signed (development) ​

toml
[tls]
self_signed_dev = true
dev_hostnames = ["localhost", "irc.example.test"]

Generates an ephemeral certificate at startup — new on every start, never written to disk. Clients must disable verification. This is exactly what ferrixd run --dev uses. Never use it in production; the config comment says the same thing.

If cert/key are set, self_signed_dev is ignored.

Option D: pinned self-signed (small private networks) ​

Between "real CA" and "ephemeral throwaway" there is a third, perfectly sound setup for private networks: a stable self-signed certificate that clients and link peers pin by fingerprint.

sh
ferrixd gen-cert -H irc.example.test -H irc-alt.example.test \
    --cert /etc/ferrixd/cert.pem --key /etc/ferrixd/key.pem

gen-cert writes the pair (private key chmod 0600 on Unix), and prints the certificate's SHA-256 fingerprint. Reference the files from [tls] as in Option A. You can re-print the fingerprint any time:

sh
ferrixd fingerprint /etc/ferrixd/cert.pem

This is also the recommended setup for S2S links, which don't use CA validation at all — peers authenticate each other by pinned fingerprint plus a shared secret. See Federation.

Client certificates (SASL EXTERNAL) ​

ferrixd accepts TLS client certificates and can use their SHA-256 fingerprint as an authentication factor via SASL EXTERNAL — passwordless login. The account lists its permitted fingerprints:

toml
[[accounts]]
name = "alice"
fingerprints = ["3f6a…"]   # lowercase hex SHA-256

Generate a client cert with any tool (or ferrixd gen-cert), get its fingerprint with ferrixd fingerprint, and configure your IRC client to present it. Details: Accounts & SASL.

Plaintext, and why it is caged ​

toml
[server]
plain_bind = "127.0.0.1:6667"

A plaintext listener exists because nc 127.0.0.1 6667 is a wonderful debugging tool. It is restricted to loopback: a non-loopback plain_bind fails validation unless you also set allow_plain_nonlocal = true, which exists for one legitimate case — terminating TLS in a trusted local proxy. If that's not you, don't set it.

WebSocket transport (ws:// / wss://) ​

Browser clients speak IRC over WebSockets. ferrixd serves them natively — no gateway process:

toml
[server]
wss_bind = "0.0.0.0:7443"  # secure: terminates TLS with the [tls] cert below
ws_bind  = "127.0.0.1:7080" # plaintext: loopback-only unless allow_plain_nonlocal

Serving the web client too?

The [web] listener also accepts IRC over WebSocket (at /irc, with irc = true, the default), next to the web client and uploads, on one HTTPS port. If you run [web], you usually don't need wss_bind at all. Don't put both on the same port.

wss_bind uses the same certificate as tls_bind (and picks up a REHASH-triggered certificate swap the same way). Each IRC line is one WebSocket message with no trailing CRLF; the server negotiates the text.ircv3.net and binary.ircv3.net subprotocols. ws_bind is plaintext and, like plain_bind, is loopback-only unless allow_plain_nonlocal = true — prefer wss_bind for anything a browser reaches over the network.

Timeouts ​

Two [limits] knobs guard the connection setup path:

SettingDefaultGuards against
handshake_timeout_secs15clients that open a socket and stall the TLS handshake
registration_timeout_secs30connections that complete TLS but never register

Both free the slot by closing the connection.

Dual-licensed under MIT or Apache-2.0.