Skip to content

Accounts & SASL ​

ferrixd has accounts built in — no external services daemon. An account gives a user a stable identity: it shows up in account-tag and extended-join, drives account extbans (~a:), grants an unforgeable cloak, and is what channel registration hangs off.

There are three ways accounts come to exist:

  1. Seeded from the config — [[accounts]] tables, the operator-managed way.
  2. Self-registered at runtime — the REGISTER command (draft/account-registration, also offered by the web client's sign-up form), persisted to SQLite when [persistence] is enabled.
  3. Created by an administrator at runtime — ferrixd ctl account create <name> <password> [email] or the admin dashboard. These are self-managed accounts like registered ones: their owners can change them with ACCOUNT.

Seeding accounts in the config ​

toml
[[accounts]]
name = "alice"
# Production: a precomputed Argon2id PHC hash.
password_hash = "$argon2id$v=19$m=19456,t=2,p=1$…$…"
# SASL EXTERNAL: permitted TLS client-cert fingerprints (lowercase hex SHA-256).
fingerprints = ["3f6a1c…"]

[[accounts]]
name = "bob"
# Development convenience: plaintext, hashed with Argon2id at startup.
password = "change-me"

Generate hashes with the built-in helper (prompts without echo; --confirm prompts twice). Use --toml for an account: it prints password_hash and the scram line that SASL SCRAM-SHA-256 needs (see below):

sh
ferrixd hash-password --toml

Config accounts are reloadable at runtime with REHASH.

How passwords are stored and checked

Passwords are hashed with Argon2id and verified in constant time. For SCRAM, the server derives and stores the SCRAM key material (salt, 4096 PBKDF2 iterations, stored key, server key) — the plaintext password is never kept. See Security Model.

SASL mechanisms ​

ferrixd advertises sasl=PLAIN,EXTERNAL,SCRAM-SHA-256 in CAP LS 302.

PLAIN ​

The workhorse. The client sends \0username\0password base64-encoded during registration; the server verifies against the Argon2id hash. Since the transport is TLS, the password is never on the wire in the clear.

Client-side (WeeChat):

/set irc.server.ferrix.sasl_mechanism plain
/set irc.server.ferrix.sasl_username alice
/set irc.server.ferrix.sasl_password s3cret

SCRAM-SHA-256 ​

Challenge–response: the password never leaves the client, and the server stores only derived keys. Prefer it when your client supports it — it also protects the password from a compromised-but-passive server.

A password_hash account needs an explicit scram credential

SCRAM key material cannot be derived from an Argon2 hash — deriving it needs the plaintext, which a password_hash account never gives the server. Such an account can therefore do PLAIN but not SCRAM unless you also supply a scram = "…" credential. Mint both at once:

$ ferrixd hash-password --toml
Password:
password_hash = "$argon2id$v=19$m=19456,t=2,p=1$…"
scram = "4096:…:…:…"

Paste both lines into the [[accounts]] block. An account seeded with a plaintext password gets its SCRAM credentials derived automatically and needs nothing extra.

/set irc.server.ferrix.sasl_mechanism scram-sha-256

SASL EXTERNAL ​

Passwordless: authentication is the TLS client certificate itself. The server hashes the presented certificate (SHA-256) and matches it against the account's fingerprints list.

Setup:

sh
# 1. Mint a client certificate (any tool works; gen-cert is convenient)
ferrixd gen-cert -H alice --cert alice.pem --key alice.key

# 2. Read its fingerprint
ferrixd fingerprint alice.pem
toml
# 3. Allow it on the account
[[accounts]]
name = "alice"
fingerprints = ["<the fingerprint>"]
# 4. Point the client at the cert and select EXTERNAL (WeeChat)
/set irc.server.ferrix.tls_cert ~/.config/weechat/alice.pem
/set irc.server.ferrix.sasl_mechanism external

The wire flow ​

For the curious (or for writing a bot without a SASL library) — PLAIN looks like this during connection registration:

» CAP LS 302
« :irc.example.org CAP * LS :sasl=PLAIN,EXTERNAL,SCRAM-SHA-256 …
» CAP REQ :sasl
« :irc.example.org CAP * ACK :sasl
» AUTHENTICATE PLAIN
« AUTHENTICATE +
» AUTHENTICATE AGFsaWNlAHMzY3JldA==
« :irc.example.org 900 * *!*@* alice :You are now logged in as alice
« :irc.example.org 903 * :SASL authentication successful
» CAP END

Long payloads are chunked in 400-byte AUTHENTICATE lines per the spec; the server bounds the accumulated buffer at 8192 bytes (ERR_SASLTOOLONG beyond that).

Reauthentication ​

A client that negotiated sasl may run AUTHENTICATE again after registration to switch to (or add) an account, without reconnecting (IRCv3 SASL 3.2). The exchange is identical to the one above — the same 900/903 confirm the new login. On success the new account replaces the old (and co-members with account-notify see the ACCOUNT change); a failed attempt is rejected with 904 ERR_SASLFAIL and the existing login is kept. During the initial handshake, by contrast, a client may authenticate only once (907 ERR_SASLALREADY).

Self-registration: REGISTER ​

With the draft/account-registration capability, users can create their own account:

REGISTER * your@email.example s3cret

(The first parameter is the account name; * means "use my current nick".) Outcomes are reported as standard-replies, e.g. FAIL REGISTER ACCOUNT_EXISTS … if the name is taken.

  • REGISTER works during the handshake too (the cap advertises before-connect), so a client can create its account before it finishes registering its connection.
  • With [persistence] configured, self-registered accounts are stored in SQLite and survive restarts.
  • Without it, they last until the process exits — fine for testing, surprising in production, so enable persistence on real servers.
  • Self-registered accounts are network-wide: every change is synced to linked servers, so you can log in anywhere on the network.
  • Registrations are rate-limited per source address (max_per_ip_per_hour, default 5).

E-mail verification: VERIFY ​

By default an account is usable the moment it is registered. To require a verified address, choose how the code is delivered in [account_registration]:

toml
[account_registration]
verification = "smtp"           # or "command", or "none" (default)
code_ttl_secs = 86400           # unverified accounts are deleted after this
verify_url = "https://irc.example.org/verify?account={account}&code={code}"

[account_registration.smtp]
host = "smtp.example.org"
port = 587
security = "starttls"           # starttls | tls | none
username = "irc@example.org"
password_env = "FERRIXD_SMTP_PASSWORD"   # the secret stays out of the file
from = "irc@example.org"

The capability then advertises email-required, and the flow is:

REGISTER alice alice@example.org s3cret
« REGISTER VERIFICATION_REQUIRED alice :Account created; a verification code was sent to …
VERIFY alice K7PQ2M9X
« VERIFY SUCCESS alice :Account verified and logged in

Until it is verified the account cannot log in (SASL refuses it). Codes are random, stored only as a SHA-256 hash, compared in constant time, and a connection gets five wrong guesses. If the mail cannot be sent the user is told and the registration is rolled back.

With verification = "command" ferrixd runs your program instead of speaking SMTP — a mailer script, a webhook, an SMS gateway. It receives FERRIXD_ACCOUNT, FERRIXD_EMAIL, FERRIXD_CODE, FERRIXD_NETWORK and FERRIXD_VERIFY_URL in its environment and must exit 0 within 30 seconds:

toml
[account_registration]
verification = "command"
command = ["/usr/local/bin/ferrixd-send-code"]

Managing your account: ACCOUNT ​

Self-registered accounts are managed from IRC. Replies are standard replies (NOTE ACCOUNT … / FAIL ACCOUNT …).

CommandWhat it does
ACCOUNT INFOyour account's type, registration time, e-mail and certificate fingerprints
ACCOUNT PASSWORD <old> <new>change the password (re-derives both the Argon2id hash and the SCRAM credentials)
ACCOUNT CERT ADD [fingerprint]allow a client certificate for SASL EXTERNAL — without an argument, the one you are connected with. At most 16 per account; a fingerprint belongs to one account
ACCOUNT CERT DEL <fingerprint> / ACCOUNT CERT LISTremove / list them
ACCOUNT EMAIL <address|*>change (or with * remove) the address; with verification on, the new address takes effect after VERIFY
ACCOUNT DROP <password>delete the account and everything tied to it: channel registrations it founded, its read markers, and the direct messages it wrote (right to erasure). Every session logged in to it is logged out, network-wide

Operators manage other accounts without the password: ACCOUNT INFO <account> and ACCOUNT SET <account> PASSWORD <new> | EMAIL <address|*> | CERT ADD|DEL <fp> | DROP | VERIFY.

Accounts seeded from [[accounts]] in the config file are read-only from IRC (FAIL ACCOUNT ACCOUNT_READONLY) — the file stays the source of truth for them.

What an account changes ​

Once logged in (any mechanism):

EffectWhere it shows
account-tag on your messagesclients with the cap see @account=alice
extended-joinyour account name in JOIN lines
account-notifylogin/logout broadcast to common channels
RPL_WHOISACCOUNT (330)WHOIS shows "is logged in as"
Account extbans+b ~a:badguy matches the account, not the mask
Cloak alice.<network>with cloak_key set, your host is your identity
Channel registrationREGISTER #chan requires a logged-in founder

Several devices, one user (multiclient) ​

With [multiclient] enabled = true, a connection that logs in (SASL) to an account already online on the same server attaches to that user instead of becoming a second one — same nick, same channels — the way a bouncer would, but built in:

toml
[multiclient]
enabled = true
max_connections = 4          # devices per account
always_on = true             # stay present when the last device leaves
always_on_expiry_secs = 604800
auto_away_message = "Disconnected"
rejoin = true                # rejoin the account's channels on next login
  • The new device gets the normal welcome burst and then a JOIN (with topic and names) for every channel the user is in.
  • Everything sent to the user reaches every device, each with only the IRCv3 tags it negotiated. What one device sends, the others show — channel messages and private messages alike, with or without echo-message. Nick changes, joins and parts appear everywhere.
  • Linked servers see a single user; nothing changes on the wire.
  • One device leaving changes nothing for the others. With always-on, even the last one leaving does not quit the user: it is marked away (auto_away_message, announced via away-notify) and stays in its channels; logging in again resumes it and clears the away. A session nobody returns to quits after always_on_expiry_secs. Missed messages are fetched with CHATHISTORY as usual.
  • Rejoin remembers an account's channels when its user quits (also across restarts, with [persistence]) and joins them again on the next login.
  • KILL and server bans end the user on every device, always-on or not.

Nick protection ​

Two opt-in policies in [nicks] keep nicks from being taken over.

Nick delay (RFC 2811 §3.2) — delay_secs = 60. When a user disappears involuntarily (a netsplit, or a ping timeout), their nick is held: anyone else who tries it gets 437 ERR_UNAVAILRESOURCE until the hold runs out. A hold remembers the departed user's account, so the owner — reconnecting and logging in with SASL — gets the nick straight back. Ping-timeout holds are announced to the whole network; netsplit holds are taken by every server on its own, since each sees the split. A quit the user chose (QUIT, KILL) holds nothing.

Account nick reservation — reserve_account_nicks = true. Every registered account's name is reserved for that account:

  • Someone else may still pick it, but is warned and has reservation_grace_secs to log in to the account; otherwise they are renamed to a guest nick (Guest12345).
  • The authenticated owner can take it back at once: NICK alice while someone else holds it renames the squatter and hands the nick over.
toml
[nicks]
delay_secs = 60
reserve_account_nicks = true
reservation_grace_secs = 30

Troubleshooting ​

SymptomLikely cause
904 ERR_SASLFAIL on PLAINwrong password, or account only exists in a config that hasn't been REHASHed
904 on EXTERNALclient didn't present a certificate, or fingerprint not in fingerprints (must be lowercase hex)
905 ERR_SASLTOOLONGclient sent >8 KiB of SASL data — misbehaving client
906 ERR_SASLABORTEDclient sent AUTHENTICATE * — usually a client-side timeout
Account gone after restartself-registered without [persistence]

Dual-licensed under MIT or Apache-2.0.