Services: NickServ + ChanServ

bin/services is a separate process. It links to the ircd as an ordinary server peer and introduces two bots:

Both stores are JSON on disk with rotating backups (backup_count, default 5). A corrupt file is never replaced by an empty one: the newest readable backup loads, or services refuse to start and leave the file alone. On a network of several servers, run exactly one copy, linked to one of them.

upgrading from the built-in NickServ

Older releases kept accounts inside every ircd ([accounts] in sekurircd.toml). Nothing has to be converted: with no [nickserv] store_file set, NickServ finds that config/accounts.json (or accounts.json beside services.toml after make install) and uses it in place, keeping a copy of the pre-upgrade file as accounts.json.bak1. ChanServ keeps its chanserv.json. The old [accounts] section is ignored with a warning; move settings such as enforce_nicks, max_accounts and email_command to [nickserv]. Services admins (SUSPEND/FDROP/SASET) are now accounts listed in [nickserv] admins, not an oper privilege.

network operators

An [[opers]] entry in services.toml makes an account an IRC operator on whichever server it logs in to, with no [[operators]] block on that server. Services sends the user's server an SVSOPER when they IDENTIFY or log in with SASL, and every other server already trusts an oper from another server, so they reach the whole network. It ends when they log out or disconnect, or when you remove the entry.

[[opers]]
account    = "youraccount"
certfp     = "0123456789abcdef...64 hex digits"   # SHA-256 of the TLS client certificate they connect with
privileges = ["all"]                              # or: kill, kline, sa, host, wallops, rehash, die, link, override, auspex, immune

[[opers]]
account       = "helper"
password_only = true                              # no certificate needed (the account password alone is enough)
privileges    = ["kill", "kline"]

enable it

1. ircd side: turn on linking and add a peer

[links]
enabled = true
mode = "hub"

[[links.peers]]
name = "services.sekurircd.local"
password_hash = "scrypt$16384$8$1$<salt-hex>$<digest-hex>"   # from sekurircd --hash-password

2. services side: point it at the link port

cp services/services.template.toml services/services.toml
# edit [link] host/port to the ircd's [links] bind/port,
# name/password to the [[links.peers]] entry above (the plain secret goes here)

See the full services.template.toml on GitHub for every option, including [storage] backup_count.

run it

./bin/services --config services/services.toml                     # foreground
./bin/services --config services/services.toml --daemon --pidfile services/services.pid
./bin/services --stop --pidfile services/services.pid

A second --daemon against a live pidfile is refused. If the ircd is down or the link drops, services keep retrying. Easiest: ./sekurircd start from the repo root starts services automatically when services/services.toml exists (see install). Under systemd: systemctl --user enable --now services (it then follows sekurircd: stopping or restarting the ircd takes services with it).

NickServ

[nickserv]
#admins        = ["youraccount"]   # SUSPEND/UNSUSPEND/NOEXPIRE/ACTIVATE/FDROP/SASET PASSWORD, full INFO
#expire_days   = 0                 # drop accounts nobody logged in to for this long (0 = never); admins, [[opers]],
                                   # suspended and NOEXPIRE accounts never expire; their channels lose them as founder/access
#expire_warn_days = 0              # mail the verified address this long before (email_command gets purpose "expire")
#require_email = false             # REGISTER needs an email; the account works once VERIFY'd (needs email_command)
#verify_window_hours = 24          # an unverified registration is dropped after this
#enforce_nicks = false             # rename unidentified users of registered nicks...
#enforce_grace = 60                # ...after this many seconds
#always_on     = true              # false = SET ALWAYS-ON is off on this network
#always_on_expire_days = 30       # a detached always-on nick is kept this long (0 = never expires)
#max_accounts  = 0                 # 0 = unlimited
#account_cloak = true              # a logged-in user with no chosen vhost shows account_cloak_format (false = usual cloak)
#account_cloak_format = "users/{account}"   # {account}, {network}; a chosen vhost wins, VHOST DEFAULT goes back to it
#email_command = "/usr/local/bin/send-verification"   # mails SET EMAIL / RESETPASS codes
/msg NickServ REGISTER <password> [email]       # the account is named after your nick
/msg NickServ IDENTIFY [account] <password>     # or log in with SASL while connecting
/msg NickServ GHOST <nick>  |  REGAIN <nick>   # free your nick, on any server
/msg NickServ SET PASSWORD <old> <new>  |  SET EMAIL <address>  |  SET AJOIN <#chan,...>|OFF  |  SET ALWAYS-ON ON|OFF  |  VHOST [<host>|DEFAULT|OFF]  |  VERIFY <code>
/msg NickServ RESETPASS <account>               # mails a code to the verified address
/msg NickServ VERIFY [account] <code>          # confirms the email; with require_email, activates a new account and logs you in
/msg NickServ GROUP  |  UNGROUP <nick>  |  CERT ADD|DEL|INFO  |  INFO [account]  |  DROP <password>
/msg NickServ LISTLOGINS  |  LISTCHANS          # your logged-in connections; channels you found or have =account access in
/msg NickServ STATUS|ACC [nick]                 # 3 = logged in to the nick's account, 1 = not, 0 = offline/unregistered (for bots)

ChanServ

commands

/msg ChanServ REGISTER #chan [password]            # you must be opped on #chan
/msg ChanServ IDENTIFY #chan [password]            # every new connection, to reclaim founder status
/msg ChanServ DROP #chan [password]
/msg ChanServ SETPASS #chan [old] <new>
/msg ChanServ JOIN #chan [password]                # GUARD: ChanServ stays in the channel
/msg ChanServ PART #chan [password]
/msg ChanServ TOPICLOCK #chan ON|OFF [password]
/msg ChanServ TOPIC #chan <text> [password]
/msg ChanServ TOPICAPPEND|TOPICPREPEND #chan <text> [password]   # joined to the topic with " | "
/msg ChanServ TOPICSWAP #chan <search>:<replace> [password]     # first match only
/msg ChanServ INFO #chan
/msg ChanServ ACCESS #chan ADD|DEL|LIST [<mask> <v|h|o>] [password]
/msg ChanServ AKICK #chan ADD|DEL|LIST [<mask>] [password]
/msg ChanServ SUCCESSOR #chan SET <mask> [password]
/msg ChanServ SUCCESSOR #chan CLAIM <new-password>
/msg ChanServ SET #chan MLOCK|DESC|URL|ENTRYMSG ...
/msg ChanServ SET #chan FOUNDER <account|-> [password]
/msg ChanServ SET #chan PRIVATE|RESTRICTED|SECUREOPS ON|OFF [password]
/msg ChanServ HELP

No password while logged in. If you are logged in to NickServ (IDENTIFY or SASL), ChanServ uses your account: the founder account can do everything, and an =account ACCESS entry can do what its level allows. Each level adds to the one before.

levelcommands
vVOICE/DEVOICE, INVITE and UNBAN on yourself
hKICK, TOPIC, TOPICAPPEND/TOPICPREPEND/TOPICSWAP, HALFOP yourself; VOICE, INVITE, UNBAN others
oOP/DEOP, HALFOP others, AKICK ADD/DEL
aTOPICLOCK, ACCESS ADD/DEL for levels below a, ADMIN yourself
qSET (except FOUNDER), JOIN/PART, OWNER yourself, ADMIN others, ACCESS up to a
founderDROP, SETPASS, SET FOUNDER, SUCCESSOR, OWNER others, ACCESS up to q

Protection: KICK and the DE* commands never work on someone whose access is at or above yours, so an o can't deop or kick the founder or an admin. The founder can act on anyone.

Hostmask ACCESS entries still give modes on join, but never command access: only an account does. If you type the channel password anyway, ChanServ removes it before using the rest, so it never ends up in a topic or kick reason. A channel registered without an account has no founder account until you run SET #chan FOUNDER <account> <password> once.

The password belongs to the channel record; anyone who knows it can IDENTIFY as founder. IDENTIFY lasts for the connection only and must be repeated after reconnecting. /HELP in ChanServ prints exact syntax for each command.

FOUNDER ties the channel to an account, recognised on join, which may use * as the password. PRIVATE hides the channel from ChanServ LIST, RESTRICTED kicks anyone not on the access list, and SECUREOPS (on for new registrations) checks every +o against the access level, so a v entry never covers @.

takeover protection

ChanServ remembers each registered channel's creation timestamp (TS), as Anope does. If the channel was recreated since ChanServ last saw it (on another server, during a netsplit, or while services were down), ChanServ resets it: default modes, no +k/+i/+l/redirect, empty ban, exception and invite lists, then +r, MLOCK and a locked topic back. Anyone holding ops who isn't the founder, identified, or on the access list at a level that covers the rank loses them. A channel that keeps the TS ChanServ knows, such as one a relinking server brings back, is left alone.

When services relink, ChanServ sweeps every registered channel, giving ACCESS modes and kicking AKICK (and, with RESTRICTED, unlisted) members who joined in the meantime. ACCESS and AKICK apply on JOIN in every registered channel, not only GUARDed ones. ChanServ itself can't be kicked or deopped (484).

guard and topiclock

JOIN makes ChanServ a permanent member, so the channel can never go empty or be squatted. The setting persists across restarts. Each time it (re)joins it deops anyone not identified this session, closing the gap where a full ircd restart lets a stranger win the race to an empty channel. TOPICLOCK records the topic and restores it when GUARD rejoins, since topics live only in ircd memory.

access and akick masks

/msg ChanServ ACCESS #chan ADD *@trusted.example h <password>   # auto +h on JOIN from that host
/msg ChanServ ACCESS #chan ADD =alice o <password>               # auto +o once alice is identified
/msg ChanServ AKICK  #chan ADD *@bad.example <password>

brute-force protection

Every command that checks an existing password locks that nick out of password checks, network-wide, for a short window after repeated failures. That also stops one nick grinding through passwords across many channels. The lockout clears on QUIT and follows a nick change.