Skip to main content

Freeradius

@shrug/freeradiusv2026.07.12.1· 1d agoMODELS
01README

Manage a FreeRADIUS server wherever it runs (local | ssh | nsenter): write raddb config files atomically with backups, gate every restart on radiusd -C, and roll back on a failed check. Typed methods for clients, modules, VLAN post-auth policy, cert perms, and removing swamp-managed blocks.

02Models1
@shrug/freeradiusv2026.07.12.1freeradius.ts

Global Arguments

ArgumentTypeDescription
host?stringSSH host — required for transport=ssh|nsenter
machine?stringsystemd-nspawn machine name — required for transport=nsenter
userstringSSH username (ssh|nsenter)
portnumberSSH port (ssh|nsenter)
raddbDirstringFreeRADIUS config root (raddb) in the target
unitstringsystemd unit (radiusd on EL, freeradius on Debian)
radiusdBinstringconfig-check binary in the target (radiusd | freeradius)
backupDirstringWhere apply copies previous file versions (NEVER alongside config)
fn configCheck()
Run `radiusd -C` in the target and report pass/fail + (tail-bounded) output (read-only). Uses -C, not -CX, to avoid persisting the config dump (which contains secrets).
fn apply(files: array, restart: boolean, checkArgs: array, allowOutsideRaddb: boolean)
Atomically write raddb config files in the target, gate on `radiusd -C`, and (optionally) restart — rolling back all files if the check or restart fails.
ArgumentTypeDescription
filesarrayWhole-file config units to write under raddb
restartbooleanRestart the unit after a passing check (false = stage + check only)
checkArgsarrayConfig-check args. Default -C (quiet). -CX dumps config incl. secrets.
allowOutsideRaddbbooleanPermit writing files outside raddbDir (e.g. systemd drop-ins).
fn setClient(shortname: string, ipaddr: string, secret: string, nastype?: string, extra?: record, clientsFile?: string, restart: boolean)
Idempotently manage one `client <shortname> { … }` stanza in clients.conf as a swamp-managed block (secret from vault), then gate on `radiusd -C` and optionally restart. Re-running replaces the block; surrounding hand-authored clients are untouched.
ArgumentTypeDescription
shortnamestringclient stanza name (bareword)
ipaddrstringclient ipaddr (e.g. 10.0.0.5 or an FQDN)
secretstringRADIUS shared secret (wire a vault expression here; never persisted)
nastype?stringoptional nastype (e.g. other)
extra?recordadditional `key = value` lines (values used verbatim)
clientsFile?stringclients.conf path (default <raddbDir>/clients.conf)
restartbooleanRestart after a passing check (false = stage + check only)
fn putModule(name: string, content: string, enabled: boolean, restart: boolean)
Write a module file to mods-available/<name> and (by default) enable it via the mods-enabled/<name> symlink — never a copy — then gate on `radiusd -C` and optionally restart. Use this to assert invariants like the ldap pool `start = 0`.
ArgumentTypeDescription
namestringmodule name (bareword, e.g. ldap/eap)
contentstringfull module file content
enabledbooleanEnsure the mods-enabled/<name> symlink (false = write available only)
restartbooleanRestart after a passing check (false = stage + check only)
fn putSite(rules: array, defaultVlan: number, gate?: string, policyBody?: string, siteFile?: string, policyFile?: string, restart: boolean)
Manage the LDAP-group → VLAN post-auth steering policy as a swamp-owned $INCLUDE'd file, wired into sites-enabled/default's post-auth stanza (idempotent). Gate on `radiusd -C` and optionally restart.
ArgumentTypeDescription
rulesarraygroup → VLAN override rules (order = precedence)
defaultVlannumberVLAN assigned when no override rule matches
gate?stringunlang condition gating the block (default &request:EAP-Message)
policyBody?stringraw policy body override (bypasses rules/defaultVlan generation)
siteFile?stringsite file to wire (default <raddbDir>/sites-enabled/default)
policyFile?stringswamp-owned policy file (default <raddbDir>/swamp/vlan-steering.conf)
restartbooleanRestart after a passing check (false = stage + check only)
fn certPerms(paths: array, owner: string, mode: string)
Idempotently assert owner:group + mode on cert/key files (renewal-safe; certmonger resets these on renewal). Defaults to certs/server.key → root:radiusd 640. Read-only w.r.t. config: no check, no restart.
ArgumentTypeDescription
pathsarraycert/key paths (relative to raddbDir or absolute)
ownerstringchown owner:group
modestringchmod mode
fn removeManaged(kind: string, key: string, file: string, restart: boolean)
Remove a swamp-managed marker block (e.g. a `setClient` client or a `putSite` $INCLUDE) from a raddb file, then gate on `radiusd -C` and optionally restart. Strips ONLY the `# >>> swamp-managed:<kind>:<key> >>> … <<<` region; surrounding hand-authored config keeps its exact bytes. A no-op (no write, no restart) when the block is absent. Does NOT delete any file the block referenced (e.g. an $INCLUDE'd policy stays on disk, unloaded).
ArgumentTypeDescription
kindstringManaged-block kind, e.g. 'client' (setClient) or 'include' (putSite)
keystringManaged-block key, e.g. the client shortname, or the $INCLUDE'd path
filestringraddb file containing the block (relative to raddbDir or absolute),
restartbooleanRestart after a passing check when a block was actually removed

Resources

configCheck(infinite)— Outcome of a radiusd -CX config check
applyResult(infinite)— Outcome of an apply (write→check→restart, with rollback)
attempt(infinite)— Audit record of a mutation attempt (request + result/error + timestamp). Written on both success and failure.
permResult(infinite)— Outcome of a certPerms run (post-change owner/mode per file)
03Previous Versions1
2026.07.11.2Jul 11, 2026
04Stats
A
100 / 100
Downloads
0
Archive size
43.0 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License declared1/1earned
  • Verified public repository2/2earned
05Platforms
06Labels