Skip to content

SASL Authentication

sasl: [
plain: [
enabled: true,
require_tls: true
],
session_timeout_ms: 60_000,
max_attempts_per_connection: 3
]
OptionDefaultDescription
plain.enabledtrueEnable the SASL PLAIN mechanism
plain.require_tlstrueRequire TLS for PLAIN authentication
session_timeout_ms60_000SASL session timeout (ms)
max_attempts_per_connection3Max failed SASL attempts before blocking

PLAIN is the only supported SASL mechanism. It sends credentials as base64-encoded plaintext.

When true (the default), PLAIN authentication is rejected on non-TLS connections:

:server 904 * :PLAIN mechanism requires TLS connection

This is a security measure to prevent credential exposure. For development, you may set require_tls: false, but never do this in production.

The PLAIN mechanism sends username and password in base64 (which is trivially decodable). It must only be used over TLS to prevent credential interception.

If a SASL session is started (client sent AUTHENTICATE PLAIN) but not completed within session_timeout_ms, the session is automatically expired by the background job SaslSessionExpiration.

After max_attempts_per_connection failed SASL attempts, further AUTHENTICATE commands receive:

:server 904 * :Too many SASL authentication attempts

The counter resets to 0 after a successful authentication.

Client → AUTHENTICATE PLAIN
Server → AUTHENTICATE +
Client → AUTHENTICATE <base64(authzid\0authcid\0password)>
Server → 900 nick!ident@host account :You are now logged in as account
Server → 903 nick :SASL authentication successful

On failure:

Server → 904 * :SASL authentication failed
sts: [
port: 6697,
duration: 2_592_000,
preload: false
]
OptionDefaultDescription
port6697TLS port to advertise for plaintext upgrade
duration2_592_000Policy cache duration in seconds (30 days)
preloadfalseAllow STS preloading

On plaintext connections: Clients receive sts=port=6697 in CAP LS, telling them which port to use for TLS.

On TLS connections: Clients receive sts=duration=2592000, telling them to cache the STS policy and always use TLS for this server.

Common duration values:

  • 86400 — 1 day
  • 2_592_000 — 30 days (default)
  • 31_536_000 — 1 year
monitor: [
max_targets: 100
]
OptionDefaultDescription
max_targets100Maximum MONITOR targets per user (0 = unlimited)

When a user tries to add more targets than max_targets, they receive ERR_MONLISTFULL (734).