<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>rradius User Manual on Embark Systems</title>
        <link>https://embark.systems/en/rradius/</link>
        <description>Recent content in rradius User Manual on Embark Systems</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en</language><atom:link href="https://embark.systems/en/rradius/index.xml" rel="self" type="application/rss+xml" /><item>
            <title>0. Guide to the Manual</title>
            <link>https://embark.systems/en/rradius/00-guide/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/00-guide/</guid>
            <description>&lt;p&gt;This manual walks through setting up rradius for common deployment scenarios, step by step. Each scenario comes with a configuration file, tables and Lua scripts that can be started as they are, in &lt;code&gt;rradius-server/examples/scenarios/&lt;/code&gt;. Every field is described in full in the reference document &lt;code&gt;docs/usage.md&lt;/code&gt;; the manual covers only what each scenario needs and points to the matching section.&lt;/p&gt;&#xA;&lt;p&gt;The examples are tested automatically (&lt;code&gt;rradius-server/tests/scenarios_test.rs&lt;/code&gt;). The tests start each scenario the way the manual does, send login, accounting, TACACS+ and CoA requests, and check that the results match what the manual says. So if an example breaks, a test fails. What the tests cannot cover (real devices, a real roaming federation, external services) is listed in each chapter&amp;rsquo;s &amp;ldquo;Before going live&amp;rdquo;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;read-these-two-chapters-first&#34;&gt;Read these two chapters first&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Chapter&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Contents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../01-concepts/&#34; &gt;1. Concepts&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How rradius handles a request, how the configuration is laid out, where data lives, how to test&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../02-quick-start/&#34; &gt;2. Quick Start&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One node, accounts in a table, your first Access-Accept within ten minutes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;what-do-you-want-to-do&#34;&gt;What do you want to do&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;I want to&amp;hellip;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Chapter&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Let staff join the company Wi-Fi with a password or a certificate&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../03-enterprise-wifi/&#34; &gt;3&lt;/a&gt;; revocation and roaming in &lt;a class=&#34;link&#34; href=&#34;../15-wifi-certs/&#34; &gt;15&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Let devices that cannot do 802.1X join Wi-Fi, each person with their own passphrase&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../12-psk-wifi/&#34; &gt;12&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Let devices with our own SIM cards join Wi-Fi&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../13-sim-wifi/&#34; &gt;13&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Put printers and IP phones on the wired network&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../04-wired-mab/&#34; &gt;4&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Let VPN users log in with the company directory, or add a one-time code&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../05-remote-access/&#34; &gt;5&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Control who can log in to routers and which commands they may run&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../06-device-admin/&#34; &gt;6&lt;/a&gt;; over TLS in &lt;a class=&#34;link&#34; href=&#34;../16-device-admin-tls/&#34; &gt;16&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Run broadband: plans, simultaneous sessions, disconnects, accounting&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../07-broadband/&#34; &gt;7&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Keep serving when any one server stops&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../08-ha-cluster/&#34; &gt;8&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Send other organisations&amp;rsquo; accounts to their own servers&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../09-realm-proxy/&#34; &gt;9&lt;/a&gt;; joining a roaming federation in &lt;a class=&#34;link&#34; href=&#34;../11-roaming/&#34; &gt;11&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Serve NAS on the other side of the internet or behind NAT&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../10-radsec/&#34; &gt;10&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Manage hundreds of NAS that change often&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../14-branch-nas/&#34; &gt;14&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Use accounts that already live in another system, without copying them&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;directory (LDAP/AD) in &lt;a class=&#34;link&#34; href=&#34;../05-remote-access/&#34; &gt;5&lt;/a&gt;, HTTP API in &lt;a class=&#34;link&#34; href=&#34;../18-external-api/&#34; &gt;18&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Move from an old authentication system without making everyone reset passwords&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../17-migrate-users/&#34; &gt;17&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Day-to-day work after going live&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../19-operations/&#34; &gt;19&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Find the cause of a problem from its symptom&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../20-troubleshooting/&#34; &gt;20&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;by-scenario&#34;&gt;By scenario&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Chapter&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Scenario&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Features used&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Example directory&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../03-enterprise-wifi/&#34; &gt;3. Enterprise Wi-Fi&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;802.1X: company laptops use certificates, staff phones use passwords, VLAN by group&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP-TLS, PEAP, &lt;code&gt;certificate_query&lt;/code&gt;, dynamic VLAN&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;enterprise-wifi/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../04-wired-mab/&#34; &gt;4. Wired MAC authentication&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Printers, IP phones and other devices that cannot do 802.1X&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Lua scripts, range clients&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;wired-mab/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../05-remote-access/&#34; &gt;5. Remote access&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;VPN logins against the company directory (LDAP/AD), TOTP codes for the jump host&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;LDAP, groups, named chains, Access-Challenge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;remote-access/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../06-device-admin/&#34; &gt;6. Network device administration&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Administrators log in to routers, with commands limited and recorded by role&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+ authentication, authorization, accounting, authorization groups&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;device-admin/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../07-broadband/&#34; &gt;7. Broadband provider&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PPPoE/IPoE: plan rates, simultaneous sessions, disconnects from the billing system&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;all_accept&lt;/code&gt;, accounting, CoA forwarding, accounting spool&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;broadband/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../08-ha-cluster/&#34; &gt;8. High-availability cluster&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Three nodes, service continues when any one stops&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;hiqlite cluster, WireGuard, migrations&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;ha-cluster/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../09-realm-proxy/&#34; &gt;9. Forwarding by realm&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounts of partners or headquarters go to their own servers&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[proxy]&lt;/code&gt;, failover, RadSec upstreams&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;realm-proxy/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../10-radsec/&#34; &gt;10. RadSec&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;NAS across untrusted networks or behind NAT; disconnects travel over the NAS&amp;rsquo;s own connection&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius.tls]&lt;/code&gt;, &lt;code&gt;tls_name&lt;/code&gt;, CoA over RadSec, &lt;code&gt;coa_sender&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radsec/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../11-roaming/&#34; &gt;11. Roaming federation&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;eduroam and the like: visitors go to their home institution, our own people come back through the federation&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[proxy.discovery]&lt;/code&gt; (DNS), load balancing and weights, active checks, spool for forwarded accounting&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;roaming/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../12-psk-wifi/&#34; &gt;12. A Wi-Fi passphrase per person&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One WPA2-PSK SSID, each person with their own passphrase and VLAN&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius.dpsk]&lt;/code&gt;, &lt;code&gt;dpsk-seal&lt;/code&gt;, passphrase replied by MAC&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;psk-wifi/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../13-sim-wifi/&#34; &gt;13. Wi-Fi login with SIM cards&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;USIM cards you issue yourself, no certificates and no passwords&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP-AKA&amp;rsquo;, &lt;code&gt;aka-seal&lt;/code&gt;, master key, rate limits&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;sim-wifi/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../14-branch-nas/&#34; &gt;14. Hundreds of branch NAS&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;NAS listed in a table, so adding one needs no configuration change&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius.dynamic_clients]&lt;/code&gt;, the &lt;code&gt;client&lt;/code&gt; command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;branch-nas/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../15-wifi-certs/&#34; &gt;15. Certificate revocation and fast reconnection&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Revoke lost laptops; avoid a full handshake every time a device roams&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;CRL, OCSP, &lt;code&gt;resumption_ms&lt;/code&gt;, &lt;code&gt;shared_tickets&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;wifi-certs/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../16-device-admin-tls/&#34; &gt;16. TACACS+ over TLS&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Move device administration from shared secrets to TLS 1.3 and device certificates&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[tacacs.tls]&lt;/code&gt;, &lt;code&gt;tls_name&lt;/code&gt;, &lt;code&gt;tls_only&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;device-admin-tls/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../17-migrate-users/&#34; &gt;17. Moving accounts from an old system&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Bring old password hashes over as they are, then move to new formats gradually&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Password formats, name normalisation, &lt;code&gt;[accounts]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrate-users/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../18-external-api/&#34; &gt;18. Accounts in another system&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Ask the membership system&amp;rsquo;s API over HTTPS on every login&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[lua.http]&lt;/code&gt;, &lt;code&gt;http_request&lt;/code&gt;, &lt;code&gt;verifies_password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;external-api/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;after-going-live&#34;&gt;After going live&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Chapter&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Contents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../19-operations/&#34; &gt;19. Operations&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Changing accounts and configuration, reloading, rotating secrets and keys, metrics, overload, the accounting spool, upgrades, backups&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../20-troubleshooting/&#34; &gt;20. Troubleshooting by symptom&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No reply, rejected, slow, missing accounting, TLS failing, startup failing: where to look first for each&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;shared-conventions-for-the-examples&#34;&gt;Shared conventions for the examples&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Relative paths in a configuration file are relative to that file&amp;rsquo;s directory,&lt;/strong&gt; so every scenario can be started inside the repository:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd rradius-server&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cargo build --release&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./target/release/rradius-server --config examples/scenarios/quick-start/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;With a release archive,&lt;/strong&gt; unpack &lt;code&gt;rradius-&amp;lt;version&amp;gt;-&amp;lt;platform&amp;gt;.tar.gz&lt;/code&gt;; its directory layout is the same as the repository. Go into its &lt;code&gt;rradius-server/&lt;/code&gt; directory and replace &lt;code&gt;./target/release/rradius-server&lt;/code&gt; in each chapter with &lt;code&gt;../bin/rradius-server&lt;/code&gt;. Every other command and path stays the same, and there is no &lt;code&gt;cargo build&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd rradius-0.1.0-linux-x86_64/rradius-server&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;../bin/rradius-server --config examples/scenarios/quick-start/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Some scenarios need a script run before they can start,&lt;/strong&gt; because certificates and keys do not belong in the repository:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Script&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Scenarios&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What it creates&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;make-certs.sh&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;enterprise-wifi/&lt;/code&gt;, &lt;code&gt;radsec/&lt;/code&gt;, &lt;code&gt;roaming/&lt;/code&gt;, &lt;code&gt;device-admin-tls/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A demo CA and certificates in &lt;code&gt;certs/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;setup.sh&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;psk-wifi/&lt;/code&gt;, &lt;code&gt;sim-wifi/&lt;/code&gt;, &lt;code&gt;wifi-certs/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Key files (mode 0600), and demo data or certificates sealed with them&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;These are for testing only. &lt;code&gt;setup.sh&lt;/code&gt; does not overwrite files that already exist; to start over, stop the server and delete the files it created and &lt;code&gt;data/&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Secret files (&lt;code&gt;*.secret&lt;/code&gt;) all hold demo values,&lt;/strong&gt; marked &lt;code&gt;change-me&lt;/code&gt;. Always replace them in production; see &lt;a class=&#34;link&#34; href=&#34;../19-operations/#changing-secrets&#34; &gt;chapter 19&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Demo data is in &lt;code&gt;migrations/2_demo_*.sql&lt;/code&gt;&lt;/strong&gt; (&lt;code&gt;2_imported_users.sql&lt;/code&gt; in the account migration scenario), and the structure is in &lt;code&gt;1_schema.sql&lt;/code&gt;. In production, delete the demo data files or replace them with your own data before the first start. Once applied, a file cannot be changed; see &lt;a class=&#34;link&#34; href=&#34;../01-concepts/#tables-and-migrations&#34; &gt;chapter 1&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Ports are the standard ones&lt;/strong&gt; (1812, 1813, 2083, 3799, 49, 300). Starting two scenarios on the same machine at once conflicts; start one at a time or change the ports.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;code&gt;data/&lt;/code&gt;, &lt;code&gt;spool/&lt;/code&gt;, &lt;code&gt;certs/&lt;/code&gt; and key files created at runtime are not in git.&lt;/strong&gt; To start over, stop the server and delete &lt;code&gt;data/&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;NAS addresses are demo private ranges.&lt;/strong&gt; For local testing, change the client &lt;code&gt;address&lt;/code&gt; to &lt;code&gt;127.0.0.1&lt;/code&gt; (quick start already does), or requests are treated as coming from an unknown source and get no reply.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Some scenarios share files:&lt;/strong&gt; most use &lt;code&gt;quick-start/accounting.lua&lt;/code&gt; for accounting, and &lt;code&gt;device-admin-tls/&lt;/code&gt; uses the scripts and tables of &lt;code&gt;device-admin/&lt;/code&gt;. When copying a scenario elsewhere, take the directories it refers to with it.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>1. Concepts</title>
            <link>https://embark.systems/en/rradius/01-concepts/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/01-concepts/</guid>
            <description>&lt;h2 id=&#34;what-rradius-does&#34;&gt;What rradius does&#xA;&lt;/h2&gt;&lt;p&gt;rradius is an AAA server. When someone wants to get online or log in, a network device (a NAS: wireless controller, switch, VPN gateway, BNG, router) asks it three things:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Authentication&lt;/strong&gt;: who is this, and is the password or certificate right.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Authorization&lt;/strong&gt;: once accepted, what do they get, such as a VLAN, a rate, a privilege level, or the commands they may run.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Accounting&lt;/strong&gt;: when they came online and went offline, and how much traffic they used.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Devices and rradius talk over these protocols:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Protocol&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Used for&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Port&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RADIUS (UDP)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;User access: Wi-Fi, wired 802.1X, VPN, PPPoE&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;authentication 1812, accounting 1813&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RadSec (RADIUS over TLS)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RADIUS that has to cross an untrusted network (chapter 10)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;2083&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+ (TCP)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Administrators logging in to network devices (chapter 6)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;49&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+ over TLS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The same, with the whole connection inside TLS 1.3 (chapter 16)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;300&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Other systems can also send &amp;ldquo;disconnect&amp;rdquo; and &amp;ldquo;change authorization&amp;rdquo; requests (Disconnect, CoA) to port 3799, and rradius forwards them to the NAS (chapters 7 and 10).&lt;/p&gt;&#xA;&lt;h2 id=&#34;how-a-request-is-handled&#34;&gt;How a request is handled&#xA;&lt;/h2&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;NAS ──Access-Request──► rradius&#xA;                          │&#xA;                          ├─ source is not a configured client ─► dropped, no reply&#xA;                          │    (with [radius.dynamic_clients] and a source in its ranges: look it up in the table first, chapter 14)&#xA;                          ├─ Status-Server ─────────────────────► answered directly (when status_server = true)&#xA;                          ├─ name&amp;#39;s realm matches [proxy] ──────► forwarded upstream, reply relayed as is (chapters 9, 11)&#xA;                          ├─ carries EAP-Message ───────────────► after EAP (TLS, PEAP, TTLS, AKA&amp;#39;) completes,&#xA;                          │                                        the name goes to the chain below (chapters 3, 13, 15)&#xA;                          ├─ carries a Wi-Fi 4-way handshake ───► [radius.dpsk] finds whose passphrase it is,&#xA;                          │                                        then hands that person to the chain below (chapter 12)&#xA;                          ├─ client has auth = &amp;#34;name&amp;#34; ──────────► that named chain&#xA;                          ├─ [[auth.handlers]] exist ───────────► the default chain&#xA;                          └─ none of these ─────────────────────► [lua].script&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;An authentication chain (&lt;code&gt;[auth]&lt;/code&gt;)&lt;/strong&gt; runs several handlers (&lt;code&gt;sql&lt;/code&gt;, &lt;code&gt;ldap&lt;/code&gt;, &lt;code&gt;lua&lt;/code&gt;) in order. With &lt;code&gt;first_match&lt;/code&gt;, the first handler that has an opinion decides. With &lt;code&gt;all_accept&lt;/code&gt;, every handler must agree, which is the usual way to say &amp;ldquo;check the password first, then check policy&amp;rdquo;. See usage section 3.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The top-level script (&lt;code&gt;[lua].script&lt;/code&gt;)&lt;/strong&gt; is always required. It handles &lt;strong&gt;all accounting&lt;/strong&gt; and &lt;strong&gt;TACACS+ authorization&lt;/strong&gt;, and also authentication when there is no chain. So in scenarios with a chain, the top-level script usually only does accounting.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Accounting (Accounting-Request)&lt;/strong&gt; does not go through a chain. It always goes to the top-level script, or upstream when the name matches &lt;code&gt;[proxy]&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Requests that arrive over RadSec take the same path.&lt;/strong&gt; The only differences are how the NAS is recognised (by certificate) and how packets are protected (TLS).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;No reply is deliberate.&lt;/strong&gt; When the source is unknown, the signature is wrong, the server is too busy, or an upstream does not answer, rradius does not reply, so that the NAS retransmits or fails over. For how to investigate &amp;ldquo;no reply&amp;rdquo;, see &lt;a class=&#34;link&#34; href=&#34;../20-troubleshooting/#the-nas-sent-a-request-and-got-no-reply-at-all&#34; &gt;chapter 20&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;the-configuration-file&#34;&gt;The configuration file&#xA;&lt;/h2&gt;&lt;p&gt;One configuration file is one server. The common sections:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Section&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Contents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;dictionary&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The RADIUS dictionary, &lt;code&gt;share/dictionary&lt;/code&gt; in the repository&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[lua]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The top-level script and script limits&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[cluster]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Data directory, cluster secret, nodes, migrations&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[auth]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Authentication chains&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;no&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius]&lt;/code&gt;, &lt;code&gt;[[radius.clients]]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RADIUS ports and the devices that may ask&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;for RADIUS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius.tls]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RadSec (chapter 10)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;no&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius.eap]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP and certificates for 802.1X (chapters 3, 13, 15)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;for EAP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius.dpsk]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A Wi-Fi passphrase per person (chapter 12)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;no&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius.dynamic_clients]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;NAS looked up from a table (chapter 14)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;no&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius.coa]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Receiving disconnect requests from other systems (chapters 7, 10)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;no&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius.accounting_spool]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Spooling accounting when the database cannot take writes (chapter 7)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;no&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[tacacs]&lt;/code&gt;, &lt;code&gt;[[tacacs.clients]]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+ (chapter 6)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;for TACACS+&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[tacacs.tls]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+ over TLS (chapter 16)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;no&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[proxy]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Forwarding by realm (chapters 9, 11)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;no&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[lua.http]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Letting scripts call HTTP APIs (chapter 18)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;no&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[accounts]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SQL run by the &lt;code&gt;rradius-server user&lt;/code&gt; command (chapter 19)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;no&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[metrics]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Prometheus metrics&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;no&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[log]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Log format, level, tracing particular users&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;no&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;At least one of &lt;code&gt;[radius]&lt;/code&gt; and &lt;code&gt;[tacacs]&lt;/code&gt; is required. Every section rejects fields it does not know, so a misspelt field makes startup fail and names the field.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Relative paths are relative to the configuration file&amp;rsquo;s directory,&lt;/strong&gt; not to where the server is started.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Secrets always go in files&lt;/strong&gt; (&lt;code&gt;secret_file&lt;/code&gt;), never in the configuration file. A trailing newline in the file is removed.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Key file permissions are checked.&lt;/strong&gt; Keys that protect table contents (&lt;code&gt;aka.key&lt;/code&gt;, &lt;code&gt;dpsk.key&lt;/code&gt;, &lt;code&gt;ticket.seal&lt;/code&gt;) must have permissions such as 0600, 0640 or 0400. If others can read them, the server refuses to start. They are not in the repository; each scenario&amp;rsquo;s &lt;code&gt;setup.sh&lt;/code&gt; creates them.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Configuration errors fail at startup&lt;/strong&gt; (exit status 2), and the message names the field. Check before going live with &lt;code&gt;--check&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-server --check --config /etc/rradius/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It checks the configuration, dictionary, certificates, migration file names and script syntax. It does not connect to the database or LDAP, so a wrong SQL statement or LDAP password only shows up after startup.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;clients-who-may-ask&#34;&gt;Clients: who may ask&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;[[radius.clients]]&lt;/code&gt; lists the devices that may send requests. Each has an address (a single IP or a range) and a shared secret.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;clients&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;wlc&amp;#34;&lt;/span&gt;                 &lt;span style=&#34;color:#75715e&#34;&gt;# logs, metrics and scripts all use this name for the client&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.30.0.10&amp;#34;&lt;/span&gt;       &lt;span style=&#34;color:#75715e&#34;&gt;# or &amp;#34;10.30.0.0/24&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;secret_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;wlc.secret&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Sources not on the list get no reply at all.&lt;/strong&gt; This is the most common &amp;ldquo;the server does nothing&amp;rdquo; for newcomers; look for &lt;code&gt;unknown client&lt;/code&gt; in the log.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Longest prefix wins:&lt;/strong&gt; with both &lt;code&gt;10.0.0.0/8&lt;/code&gt; and &lt;code&gt;10.30.0.10&lt;/code&gt;, the latter is more specific and is used.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Shared secrets should be long.&lt;/strong&gt; Fewer than 16 characters gives a warning; 24 or more random characters is recommended. Each device can have its own.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Message-Authenticator is required by default.&lt;/strong&gt; Old devices that do not send it are dropped. Set &lt;code&gt;require_message_authenticator = &amp;quot;no&amp;quot;&lt;/code&gt; or &lt;code&gt;&amp;quot;auto&amp;quot;&lt;/code&gt; on that client; see usage section 2.6.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When there are many NAS that change often,&lt;/strong&gt; they can live in a table instead of the configuration file (&lt;a class=&#34;link&#34; href=&#34;../14-branch-nas/&#34; &gt;chapter 14&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When a NAS uses RadSec,&lt;/strong&gt; it can be recognised by certificate alone, without a fixed address (&lt;a class=&#34;link&#34; href=&#34;../10-radsec/&#34; &gt;chapter 10&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;tables-and-migrations&#34;&gt;Tables and migrations&#xA;&lt;/h2&gt;&lt;p&gt;rradius has a built-in database (hiqlite: SQLite plus Raft replication), used the same way on one node and in a cluster. You define the tables for accounts, reply attributes and accounting yourself, as SQL files in &lt;code&gt;migrations_dir&lt;/code&gt;, applied in numbered order at startup:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;migrations/&#xA;  1_schema.sql        creates the tables&#xA;  2_demo_users.sql    demo data&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;File names are &lt;code&gt;&amp;lt;number&amp;gt;_&amp;lt;name&amp;gt;.sql&lt;/code&gt;,&lt;/strong&gt; numbered consecutively from 1.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;An applied file cannot be changed;&lt;/strong&gt; changing it makes startup fail. To change the structure or add data, add a file with the next number and restart (one node at a time in a cluster). See usage section 2.5.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Scripts read and write data:&lt;/strong&gt; &lt;code&gt;sql_query&lt;/code&gt; reads the local replica, and &lt;code&gt;sql_execute&lt;/code&gt; writes and replicates to every node. Values from the request are always passed as parameters, never spliced into the SQL string:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-lua&#34; data-lang=&#34;lua&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;local&lt;/span&gt; rows &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; sql_query(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT plan FROM subscribers WHERE username = ?&amp;#34;&lt;/span&gt;, {get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Name&amp;#39;&lt;/span&gt;)})&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Adding accounts, changing passwords and disabling accounts need no migration: set up &lt;code&gt;[accounts]&lt;/code&gt; and use the &lt;code&gt;rradius-server user&lt;/code&gt; command, which takes effect across the cluster at once; see &lt;a class=&#34;link&#34; href=&#34;../19-operations/#accounts-and-data&#34; &gt;chapter 19&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;accounting-must-be-safe-to-repeat&#34;&gt;Accounting must be safe to repeat&#xA;&lt;/h2&gt;&lt;p&gt;A NAS that gets no Accounting-Response retransmits, so:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The accounting script replies only when it returns &lt;code&gt;&#39;accept&#39;&lt;/code&gt;.&lt;/strong&gt; Any other result (including a script error) gets no reply; the NAS retransmits and the script runs again.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Handling the same packet twice must give the same result as once.&lt;/strong&gt; The examples all use &lt;code&gt;INSERT ... ON CONFLICT DO UPDATE&lt;/code&gt; or &lt;code&gt;INSERT OR IGNORE&lt;/code&gt;, keyed on the NAS plus &lt;code&gt;Acct-Session-Id&lt;/code&gt; (a session ID is unique only within one NAS). One client can be a whole range, so &amp;ldquo;which NAS&amp;rdquo; must come from the &lt;code&gt;NAS-IP-Address&lt;/code&gt; or &lt;code&gt;NAS-Identifier&lt;/code&gt; the NAS reports, not from the client name alone.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Return &lt;code&gt;&#39;accept&#39;&lt;/code&gt; for packets you do not want to record too,&lt;/strong&gt; or the NAS keeps retransmitting them.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;testing-tools&#34;&gt;Testing tools&#xA;&lt;/h2&gt;&lt;p&gt;The examples are tested with the FreeRADIUS client tools: the &lt;code&gt;freeradius-utils&lt;/code&gt; package on Debian and Ubuntu, or Homebrew&amp;rsquo;s &lt;code&gt;freeradius-server&lt;/code&gt; on macOS.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;By default rradius drops Access-Requests without a Message-Authenticator.&lt;/strong&gt; The project has tested with &lt;code&gt;radclient&lt;/code&gt; from FreeRADIUS 3.2.10, which adds it automatically. Older versions may not, and their requests are dropped with no reply. In that case use &lt;code&gt;radclient&lt;/code&gt; and add &lt;code&gt;Message-Authenticator=0x00&lt;/code&gt; to the input; it then computes the correct value:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Name=alice,User-Password=alice-password,Message-Authenticator=0x00&amp;#39;&lt;/span&gt; | radclient 127.0.0.1:1812 auth testing123-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# PAP login: user, password, server, NAS port, shared secret&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radtest alice alice-password 127.0.0.1 &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; testing123-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# CHAP login&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radtest -t chap alice alice-password 127.0.0.1 &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; testing123-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Accounting&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Name=alice,Acct-Session-Id=s1,Acct-Status-Type=Start&amp;#39;&lt;/span&gt; | radclient 127.0.0.1:1813 acct testing123-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Is the server alive (Status-Server)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Message-Authenticator=0x00&amp;#39;&lt;/span&gt; | radclient 127.0.0.1:1812 status testing123-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;For 802.1X (EAP), use &lt;code&gt;eapol_test&lt;/code&gt; from wpa_supplicant; an example configuration is in &lt;a class=&#34;link&#34; href=&#34;../03-enterprise-wifi/#3-test-with-eapol_test&#34; &gt;chapter 3&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;For TACACS+, use &lt;code&gt;tacacs_client&lt;/code&gt; (the Python package &lt;code&gt;tacacs_plus&lt;/code&gt;) or a real device; see &lt;a class=&#34;link&#34; href=&#34;../06-device-admin/&#34; &gt;chapter 6&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;For RadSec and TACACS+ over TLS, certificates and handshakes can be checked first with &lt;code&gt;openssl s_client&lt;/code&gt;; see &lt;a class=&#34;link&#34; href=&#34;../10-radsec/#3-check-the-handshake&#34; &gt;chapter 10&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Some login methods have no ready-made command-line tool to simulate them (the Wi-Fi 4-way handshake, SIM cards, logins over TACACS+ over TLS). The chapters for those scenarios explain how the automated tests verify them, and which parts wait for real devices.&lt;/li&gt;&#xA;&lt;li&gt;Every login writes one line to the authentication log (&lt;code&gt;[log] auth = true&lt;/code&gt;, on by default), naming the client, the user name, the chain and the handler that decided. Start with that line when investigating.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>2. Quick Start</title>
            <link>https://embark.systems/en/rradius/02-quick-start/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/02-quick-start/</guid>
            <description>&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt; get rradius running on one machine, with accounts in a table, log in with &lt;code&gt;radtest&lt;/code&gt;, then send some accounting and confirm it was written. Most later scenarios build on this one.&lt;/p&gt;&#xA;&lt;p&gt;Example directory: &lt;code&gt;rradius-server/examples/scenarios/quick-start/&lt;/code&gt;&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;File&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Contents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Configuration file&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/1_schema.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Three tables: &lt;code&gt;users&lt;/code&gt;, &lt;code&gt;user_reply&lt;/code&gt;, &lt;code&gt;accounting&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/2_demo_users.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Demo accounts&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accounting.lua&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting script, also used by chapters 3, 5, 8 and 9&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;*.secret&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Shared secrets for the cluster and the NAS (demo values)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;steps&#34;&gt;Steps&#xA;&lt;/h2&gt;&lt;h3 id=&#34;1-build-and-check-the-configuration&#34;&gt;1. Build and check the configuration&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd rradius-server&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cargo build --release&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./target/release/rradius-server --check --config examples/scenarios/quick-start/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;With a release archive there is nothing to build: unpack it, go into its &lt;code&gt;rradius-server/&lt;/code&gt; directory, and replace &lt;code&gt;./target/release/rradius-server&lt;/code&gt; below with &lt;code&gt;../bin/rradius-server&lt;/code&gt; (see the shared conventions for the examples).&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd rradius-0.1.0-macos-aarch64/rradius-server&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;../bin/rradius-server --check --config examples/scenarios/quick-start/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When it prints &lt;code&gt;configuration ok&lt;/code&gt;, you can start it.&lt;/p&gt;&#xA;&lt;h3 id=&#34;2-start&#34;&gt;2. Start&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./target/release/rradius-server --config examples/scenarios/quick-start/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The first start creates the database in &lt;code&gt;examples/scenarios/quick-start/data/&lt;/code&gt; and applies the two migration files. Once you see &lt;code&gt;RADIUS Server listening on 127.0.0.1:1812 and 127.0.0.1:1813&lt;/code&gt;, it accepts requests.&lt;/p&gt;&#xA;&lt;h3 id=&#34;3-log-in&#34;&gt;3. Log in&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radtest alice alice-password 127.0.0.1 &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; testing123-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You get an Access-Accept with &lt;code&gt;Session-Timeout = 3600&lt;/code&gt; and &lt;code&gt;Filter-Id = &amp;quot;staff&amp;quot;&lt;/code&gt;; both attributes come from the &lt;code&gt;user_reply&lt;/code&gt; table. Try a few more:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Command&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Result&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Why&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radtest -t chap alice alice-password ...&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accept&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;alice is stored in plain text, so CHAP works&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radtest bob bob-password ...&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accept, with &lt;code&gt;Reply-Message&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;bob is stored as a bcrypt hash&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radtest -t chap bob bob-password ...&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reject&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;CHAP needs plain text; a hash cannot do it&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radtest carol carol-password ...&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reject&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;carol&amp;rsquo;s &lt;code&gt;enabled&lt;/code&gt; is 0&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radtest alice wrong ...&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reject&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;wrong password&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;4-accounting&#34;&gt;4. Accounting&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Name=alice,Acct-Session-Id=s1,Acct-Status-Type=Start&amp;#39;&lt;/span&gt; | radclient 127.0.0.1:1813 acct testing123-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Name=alice,Acct-Session-Id=s1,Acct-Status-Type=Stop,Acct-Session-Time=120,Acct-Input-Octets=5000&amp;#39;&lt;/span&gt; | radclient 127.0.0.1:1813 acct testing123-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Both get an Accounting-Response. The &lt;code&gt;accounting&lt;/code&gt; table has one new row, with &lt;code&gt;stopped&lt;/code&gt; filled in.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-configuration-explained&#34;&gt;The configuration explained&#xA;&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;policy&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;first_match&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;handlers&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;type&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sql&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;user_query&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT password FROM users WHERE username = ? AND enabled = 1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;reply_query&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT attribute, value FROM user_reply WHERE username = ?&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;user_query&lt;/code&gt; returns the password.&lt;/strong&gt; The first column can be plain text or one of many hashes (&lt;code&gt;{crypt}&lt;/code&gt;, &lt;code&gt;{argon2}&lt;/code&gt;, &lt;code&gt;{SSHA}&lt;/code&gt;, &lt;code&gt;{nthash}&lt;/code&gt;, &amp;hellip;); see usage section 5. New deployments should use &lt;code&gt;{argon2}&lt;/code&gt; or bcrypt. Accounts that must support CHAP or PEAP can only be stored in plain text or as &lt;code&gt;{nthash}&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Disabled accounts are excluded in the query itself:&lt;/strong&gt; no row means the account does not exist. This handler is the only one in the chain, so the login is rejected.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;reply_query&lt;/code&gt; returns (attribute, value)&lt;/strong&gt; pairs, one attribute per row, named as in the dictionary. If a value has the wrong format, the reply becomes an Access-Reject even with the right password, so check the data before going live.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;With &lt;code&gt;[auth]&lt;/code&gt;, the top-level script only handles accounting.&lt;/strong&gt; &lt;code&gt;accounting.lua&lt;/code&gt; returns &lt;code&gt;reject&lt;/code&gt; for anything that is not accounting right at the start, so even if the configuration changes it lets no one in.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;what-accountinglua-does&#34;&gt;What &lt;code&gt;accounting.lua&lt;/code&gt; does&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Start, Interim-Update and Stop write to the same row.&lt;/strong&gt; The key is the client, the NAS and &lt;code&gt;Acct-Session-Id&lt;/code&gt;. The NAS is the &lt;code&gt;NAS-IP-Address&lt;/code&gt;, &lt;code&gt;NAS-IPv6-Address&lt;/code&gt; or &lt;code&gt;NAS-Identifier&lt;/code&gt; it reports, or the client name when there is none, so NAS behind one client configured as a whole range stay apart. Writes use &lt;code&gt;INSERT ... ON CONFLICT DO UPDATE&lt;/code&gt; and keep the larger value of each number, so retransmissions and reordering never move data backwards.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Stop only ends sessions that are still open,&lt;/strong&gt; so a retransmitted Stop does not change the first end time.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Accounting-On/Off (a NAS reboot)&lt;/strong&gt; ends only the open sessions of the NAS that sent it, recording &lt;code&gt;terminate_cause&lt;/code&gt; 11 (NAS-Reboot).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;Acct-Delay-Time&lt;/code&gt; is used to restore the time,&lt;/strong&gt; so packets the NAS sent late, or replayed from the accounting spool, are not treated as just having happened.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Traffic over 4 GiB&lt;/strong&gt; gets its carry from &lt;code&gt;Acct-*-Gigawords&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Packets without &lt;code&gt;Acct-Session-Id&lt;/code&gt;&lt;/strong&gt; are logged and answered, or the NAS would retransmit them forever.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;using-your-own-data&#34;&gt;Using your own data&#xA;&lt;/h2&gt;&lt;ol&gt;&#xA;&lt;li&gt;Delete &lt;code&gt;migrations/2_demo_users.sql&lt;/code&gt; and replace it with your own accounts, or keep it and add a &lt;code&gt;3_*.sql&lt;/code&gt; that deletes the demo accounts. &lt;strong&gt;Decide before the first production start;&lt;/strong&gt; an applied file cannot be changed.&lt;/li&gt;&#xA;&lt;li&gt;Replace the contents of every &lt;code&gt;*.secret&lt;/code&gt;; see &lt;a class=&#34;link&#34; href=&#34;../19-operations/#changing-secrets&#34; &gt;chapter 19&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Change &lt;code&gt;[[radius.clients]]&lt;/code&gt; to your devices&amp;rsquo; addresses, and &lt;code&gt;[radius] bind&lt;/code&gt; to the address to serve on (the example only listens on &lt;code&gt;127.0.0.1&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;Bind &lt;code&gt;[metrics]&lt;/code&gt; to an internal address only; it has no authentication.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;common-problems&#34;&gt;Common problems&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radtest&lt;/code&gt; gets no reply&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The source address is not in &lt;code&gt;[[radius.clients]]&lt;/code&gt;, the shared secret is wrong, or a firewall blocks the port. The log shows &lt;code&gt;unknown client&lt;/code&gt; or a &lt;code&gt;Message-Authenticator&lt;/code&gt; message&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migration file ... changed after it was applied&lt;/code&gt; at startup&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An applied file was changed. In development, stop the server, delete &lt;code&gt;data/&lt;/code&gt; and start again; in production, restore the original contents and add a new file&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Right password but Reject, with &lt;code&gt;RADIUS response attribute error&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An attribute name or value format in &lt;code&gt;user_reply&lt;/code&gt; is wrong&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting keeps being retransmitted&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The script failed or did not return &lt;code&gt;&#39;accept&#39;&lt;/code&gt;; the log shows &lt;code&gt;Lua script error&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;See usage section 8 for what other messages mean.&lt;/p&gt;&#xA;</description>
        </item><item>
            <title>3. Enterprise Wi-Fi (802.1X)</title>
            <link>https://embark.systems/en/rradius/03-enterprise-wifi/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/03-enterprise-wifi/</guid>
            <description>&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt; the company&amp;rsquo;s WPA2/WPA3-Enterprise wireless network.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Company laptops carry certificates signed by the company CA, log in with &lt;strong&gt;EAP-TLS&lt;/strong&gt;, and go into device VLAN 10.&lt;/li&gt;&#xA;&lt;li&gt;Staff&amp;rsquo;s own phones have no certificate, log in with a user name and password over &lt;strong&gt;PEAP-MSCHAPv2&lt;/strong&gt;, and go into staff VLAN 20.&lt;/li&gt;&#xA;&lt;li&gt;People who leave and lost laptops are disabled in the table and can no longer log in, without waiting for certificate revocation.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Example directory: &lt;code&gt;rradius-server/examples/scenarios/enterprise-wifi/&lt;/code&gt;&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;File&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Contents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Configuration file&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;make-certs.sh&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Creates a demo CA, a server certificate and one laptop certificate&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/1_schema.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accounts&lt;/code&gt; (users and devices), &lt;code&gt;group_reply&lt;/code&gt; (VLAN per group), &lt;code&gt;accounting&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/2_demo_data.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Staff staff1 (enabled), staff2 (disabled), laptop laptop-001&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;eapol/peap.conf&lt;/code&gt;, &lt;code&gt;eapol/tls.conf&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Test configurations for &lt;code&gt;eapol_test&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Accounting reuses &lt;code&gt;accounting.lua&lt;/code&gt; from the quick start.&lt;/p&gt;&#xA;&lt;h2 id=&#34;steps&#34;&gt;Steps&#xA;&lt;/h2&gt;&lt;h3 id=&#34;1-create-the-certificates&#34;&gt;1. Create the certificates&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd rradius-server/examples/scenarios/enterprise-wifi&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./make-certs.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This creates &lt;code&gt;ca.pem&lt;/code&gt;, &lt;code&gt;server.pem&lt;/code&gt;/&lt;code&gt;server.key&lt;/code&gt; (name &lt;code&gt;radius.corp.example.com&lt;/code&gt;) and &lt;code&gt;device.pem&lt;/code&gt;/&lt;code&gt;device.key&lt;/code&gt; (name &lt;code&gt;laptop-001.corp.example.com&lt;/code&gt;) in &lt;code&gt;certs/&lt;/code&gt;. &lt;strong&gt;For testing only.&lt;/strong&gt; In production, server and client certificates are issued by the company CA, and the server&amp;rsquo;s private key never leaves the server.&lt;/p&gt;&#xA;&lt;h3 id=&#34;2-change-the-client-address-and-start&#34;&gt;2. Change the client address and start&#xA;&lt;/h3&gt;&lt;p&gt;For local testing, change &lt;code&gt;address = &amp;quot;10.30.0.10&amp;quot;&lt;/code&gt; in &lt;code&gt;[[radius.clients]]&lt;/code&gt; to &lt;code&gt;127.0.0.1&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd ../../..   &lt;span style=&#34;color:#75715e&#34;&gt;# back to rradius-server&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./target/release/rradius-server --config examples/scenarios/enterprise-wifi/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;3-test-with-eapol_test&#34;&gt;3. Test with eapol_test&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;eapol_test&lt;/code&gt; is in the &lt;code&gt;eapoltest&lt;/code&gt; package on Debian and Ubuntu. Run it in the scenario directory so the certificate paths in its configuration resolve:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd examples/scenarios/enterprise-wifi&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;eapol_test -c eapol/peap.conf -a 127.0.0.1 -s wlc-shared-secret-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;eapol_test -c eapol/tls.conf -a 127.0.0.1 -s wlc-shared-secret-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Both must print &lt;code&gt;SUCCESS&lt;/code&gt;, with &lt;code&gt;Tunnel-Private-Group-Id&lt;/code&gt; in the Access-Accept (20 for PEAP, 10 for TLS). rradius&amp;rsquo;s authentication log:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;wlc&amp;#34; source=127.0.0.1 user=&amp;#34;anonymous@corp.example.com&amp;#34; account=&amp;#34;staff1&amp;#34; chain=&amp;#34;eap&amp;#34; handler=&amp;#34;eap-peap&amp;#34; decision=&amp;#34;accept&amp;#34;&#xA;authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;wlc&amp;#34; source=127.0.0.1 user=&amp;#34;laptop-001.corp.example.com&amp;#34; account=&amp;#34;laptop-001.corp.example.com&amp;#34; chain=&amp;#34;eap&amp;#34; handler=&amp;#34;eap-tls&amp;#34; decision=&amp;#34;accept&amp;#34;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For PEAP, &lt;code&gt;user&lt;/code&gt; is the anonymous outer name and &lt;code&gt;account&lt;/code&gt; is the real inner account.&lt;/p&gt;&#xA;&lt;p&gt;These two &lt;code&gt;eapol_test&lt;/code&gt; configurations have been run for real in Docker with the &lt;code&gt;eapoltest&lt;/code&gt; package. This scenario&amp;rsquo;s automated test only uses PAP to check the chain and the VLANs; EAP itself is covered by the project&amp;rsquo;s interoperability tests. The automated test of &lt;a class=&#34;link&#34; href=&#34;../15-wifi-certs/&#34; &gt;chapter 15&lt;/a&gt; goes through a full EAP-TLS exchange.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-configuration-explained&#34;&gt;The configuration explained&#xA;&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;eap&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;cert_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;certs/server.pem&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;key_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;certs/server.key&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;client_ca_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;certs/ca.pem&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;methods&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;tls&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;peap&amp;#34;&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;clients&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;wlc&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.30.0.10&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;secret_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;wlc.secret&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;eap_methods&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;tls&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;peap&amp;#34;&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;client_ca_file&lt;/code&gt; is the CA that issues client certificates.&lt;/strong&gt; Only it is trusted, not the system&amp;rsquo;s root certificates.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When &lt;code&gt;methods&lt;/code&gt; has two or more entries, every client must set &lt;code&gt;eap_methods&lt;/code&gt;,&lt;/strong&gt; and the list order is the order they are offered in. A client can refuse the first and ask for the second (EAP Nak), so if one controller should only accept certificates, list only &lt;code&gt;[&amp;quot;tls&amp;quot;]&lt;/code&gt; for it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A valid certificate does not by itself mean the login is accepted.&lt;/strong&gt; After the handshake succeeds, the name on the certificate goes to the authentication chain, so disabling a device only takes a table change.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;handlers&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;type&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sql&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;user_query&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT password FROM accounts WHERE name = ? AND kind = &amp;#39;user&amp;#39; AND enabled = 1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;certificate_query&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT 1 FROM accounts WHERE name = ? AND kind = &amp;#39;device&amp;#39; AND enabled = 1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;reply_query&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT r.attribute, r.value FROM accounts a JOIN group_reply r ON r.grp = a.grp WHERE a.name = ?&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;PEAP uses &lt;code&gt;user_query&lt;/code&gt;:&lt;/strong&gt; MS-CHAPv2 has to compare against plain text or an NT hash, so the password is stored as &lt;code&gt;{nthash}&lt;/code&gt; (&lt;code&gt;2_demo_data.sql&lt;/code&gt; shows how it is computed). Accounts stored as bcrypt or argon2 cannot use PEAP; use EAP-TTLS with inner PAP instead, see usage section 2.12.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;EAP-TLS uses &lt;code&gt;certificate_query&lt;/code&gt;:&lt;/strong&gt; a row found means accept. Devices have no password, so &lt;code&gt;user_query&lt;/code&gt; cannot be used (a NULL password column is rejected).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;reply_query&lt;/code&gt; is used by both kinds of login,&lt;/strong&gt; returning the three VLAN attributes by group. The &lt;code&gt;:1&lt;/code&gt; in &lt;code&gt;Tunnel-Type:1&lt;/code&gt; is a tag, and the three attributes must use the same tag.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;username&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;strip_realm&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;suffix&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;lowercase&lt;/span&gt; = &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;Staff may type &lt;code&gt;Staff1@corp.example.com&lt;/code&gt;; account lookup uses &lt;code&gt;staff1&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Certificate logins do not strip the realm:&lt;/strong&gt; the certificate proves the full name, so a login is rejected when the name would change by more than case. Store devices under the full name on the certificate, and keep &lt;code&gt;@&lt;/code&gt; out of device names.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;the-name-on-the-certificate&#34;&gt;The name on the certificate&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;rradius uses the certificate&amp;rsquo;s DNS SAN and email SAN as names, and the CN only when there are neither. The client&amp;rsquo;s EAP Identity must match one of them (&lt;code&gt;match_identity = true&lt;/code&gt;, the default).&lt;/li&gt;&#xA;&lt;li&gt;When clients fill in an anonymous Identity, set &lt;code&gt;match_identity = false&lt;/code&gt; to use the certificate&amp;rsquo;s first name instead.&lt;/li&gt;&#xA;&lt;li&gt;To decide on certificate fields in a script (an OU, for example), use &lt;code&gt;tls_subject_attrs&lt;/code&gt; rather than matching the whole subject string; see usage section 4.2.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;other-login-methods&#34;&gt;Other login methods&#xA;&lt;/h2&gt;&lt;p&gt;This chapter uses the two most common ones. Other choices:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Situation&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What to use&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Where&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Passwords exist only as hashes (bcrypt, argon2, brought over from an old system), or LDAP should verify by bind&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP-TTLS with inner PAP: add &lt;code&gt;&amp;quot;ttls&amp;quot;&lt;/code&gt; to &lt;code&gt;methods&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;usage section 2.12, &lt;a class=&#34;link&#34; href=&#34;../17-migrate-users/#what-can-and-cannot-be-moved&#34; &gt;chapter 17&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Devices carry USIM cards the company issued&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP-AKA&#39;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../13-sim-wifi/&#34; &gt;chapter 13&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Devices cannot do 802.1X, but each person should have their own Wi-Fi passphrase&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A WPA2 passphrase per person&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../12-psk-wifi/&#34; &gt;chapter 12&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Devices can do nothing at all (printers)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;MAC authentication&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../04-wired-mab/&#34; &gt;chapter 4&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;before-going-live&#34;&gt;Before going live&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Clients must verify the server certificate.&lt;/strong&gt; PEAP&amp;rsquo;s protection rests entirely on TLS; when clients do not verify, a fake access point can obtain password hashes. Push the CA and the server name (&lt;code&gt;radius.corp.example.com&lt;/code&gt;) to devices through MDM or group policy. This is the most common deployment mistake.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The server certificate&lt;/strong&gt; should carry the &lt;code&gt;serverAuth&lt;/code&gt; EKU; &lt;code&gt;make-certs.sh&lt;/code&gt; adds it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Revocation:&lt;/strong&gt; with &lt;code&gt;crl_file&lt;/code&gt; set, every CA in the chain needs a CRL; send SIGHUP after updating them. When the CA offers only OCSP, set &lt;code&gt;ocsp&lt;/code&gt;. Without either, disabling a device relies on &lt;code&gt;enabled&lt;/code&gt; in the table. See &lt;a class=&#34;link&#34; href=&#34;../15-wifi-certs/&#34; &gt;chapter 15&lt;/a&gt; for how and the trade-offs.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Devices that roam do a full handshake every time:&lt;/strong&gt; that is the default. To let reconnecting devices resume their previous session, set &lt;code&gt;resumption_ms&lt;/code&gt;; see &lt;a class=&#34;link&#34; href=&#34;../15-wifi-certs/#fast-reconnection-session-resumption&#34; &gt;chapter 15&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;One login must complete on one node.&lt;/strong&gt; With several nodes, wireless controllers must always send to the same one (active/standby), or a load balancer must pin by source; see &lt;a class=&#34;link&#34; href=&#34;../08-ha-cluster/&#34; &gt;chapter 8&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;This has not yet been tested with real access points and every operating system,&lt;/strong&gt; only with &lt;code&gt;eapol_test&lt;/code&gt;. Before going live, try it once with your real controller and a few phones and laptops.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;common-problems&#34;&gt;Common problems&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Startup fails, mentioning &lt;code&gt;eap_methods&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;methods&lt;/code&gt; has several methods and a client does not set &lt;code&gt;eap_methods&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PEAP fails, log shows &lt;code&gt;decision=&amp;quot;reject&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The account does not exist, is disabled, or its password is not plain text or &lt;code&gt;{nthash}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP-TLS handshake succeeds but the login is rejected&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;certificate_query&lt;/code&gt; finds nothing: the name differs from the table, or &lt;code&gt;kind&lt;/code&gt; or &lt;code&gt;enabled&lt;/code&gt; is wrong&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP-TLS log says the Identity does not match&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The client&amp;rsquo;s Identity differs from both the certificate&amp;rsquo;s SAN and CN; change the client setting or set &lt;code&gt;match_identity = false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;UnknownRevocationStatus&lt;/code&gt; appears&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;crl_file&lt;/code&gt; is set but the CRL of some CA in the chain is missing&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Phones keep asking whether to trust the certificate&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The device does not have the CA, or the server name differs from the configured one&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;</description>
        </item><item>
            <title>4. Wired MAC Authentication (MAB)</title>
            <link>https://embark.systems/en/rradius/04-wired-mab/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/04-wired-mab/</guid>
            <description>&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt; the switch ports run 802.1X, but printers, IP phones and cameras cannot do 802.1X. When the switch gets no EAP, it asks with the device&amp;rsquo;s MAC address as the user name instead (MAC Authentication Bypass). Known devices go into their VLAN; unknown ones are rejected, and the switch puts them into a guest or quarantine VLAN.&lt;/p&gt;&#xA;&lt;p&gt;Example directory: &lt;code&gt;rradius-server/examples/scenarios/wired-mab/&lt;/code&gt;&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;File&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Contents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Configuration file: no &lt;code&gt;[auth]&lt;/code&gt;, everything goes to the script&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/1_schema.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;mac_devices&lt;/code&gt; (MAC, VLAN, note)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/2_demo_data.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One printer (VLAN 30), one IP phone (VLAN 40)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The script is the repository&amp;rsquo;s &lt;code&gt;examples/mac-auth.lua&lt;/code&gt;, which the configuration points to directly.&lt;/p&gt;&#xA;&lt;h2 id=&#34;steps&#34;&gt;Steps&#xA;&lt;/h2&gt;&lt;h3 id=&#34;1-change-the-client-and-start&#34;&gt;1. Change the client and start&#xA;&lt;/h3&gt;&lt;p&gt;The example client is the whole switch management range &lt;code&gt;10.40.0.0/24&lt;/code&gt;. For local testing, change it to &lt;code&gt;127.0.0.1&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd rradius-server&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./target/release/rradius-server --config examples/scenarios/wired-mab/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;2-simulate-the-switchs-request&#34;&gt;2. Simulate the switch&amp;rsquo;s request&#xA;&lt;/h3&gt;&lt;p&gt;A switch&amp;rsquo;s MAB request puts the MAC address in &lt;code&gt;User-Name&lt;/code&gt;, &lt;code&gt;User-Password&lt;/code&gt; and &lt;code&gt;Calling-Station-Id&lt;/code&gt;, written differently by each vendor:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Name=00-11-22-AA-BB-CC,User-Password=00-11-22-AA-BB-CC,Calling-Station-Id=00-11-22-AA-BB-CC&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  | radclient 127.0.0.1:1812 auth switches-shared-secret-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You get an Access-Accept with the three VLAN 30 attributes (&lt;code&gt;Tunnel-Type = VLAN&lt;/code&gt;, &lt;code&gt;Tunnel-Medium-Type = IEEE-802&lt;/code&gt;, &lt;code&gt;Tunnel-Private-Group-Id = 30&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;code&gt;User-Name&lt;/code&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;code&gt;Calling-Station-Id&lt;/code&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Result&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;00-11-22-AA-BB-CC&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;00-11-22-AA-BB-CC&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accept, VLAN 30&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;00a0.c912.3456&lt;/code&gt; (Cisco style)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;00:a0:c9:12:34:56&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accept, VLAN 40&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;001122aabbcc&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;00:00:00:00:00:01&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reject: the name differs from the actual device&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;00ffffffffff&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;00:ff:ff:ff:ff:ff&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reject: unknown&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;what-the-script-does&#34;&gt;What the script does&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Normalises MAC addresses:&lt;/strong&gt; removes &lt;code&gt;-&lt;/code&gt;, &lt;code&gt;:&lt;/code&gt; and &lt;code&gt;.&lt;/code&gt;, lowercases, and requires exactly 12 hexadecimal characters. So the table stores &lt;code&gt;001122aabbcc&lt;/code&gt; however the switch writes it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;User-Name&lt;/code&gt; and &lt;code&gt;Calling-Station-Id&lt;/code&gt; must be the same MAC.&lt;/strong&gt; The name is what the device says; &lt;code&gt;Calling-Station-Id&lt;/code&gt; is what the switch sees. If they differ, the login is rejected.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Does not check the password.&lt;/strong&gt; MAB has no secret to compare; it relies on the address alone.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Handles only RADIUS authentication.&lt;/strong&gt; Accounting is always answered, and TACACS+ is always rejected.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;limits-of-this-approach&#34;&gt;Limits of this approach&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;A MAC address is not a secret.&lt;/strong&gt; Anyone who can see the device&amp;rsquo;s label or the cable can impersonate it. Put these devices in VLANs that reach only the services they need (printers only the print server, phones only the SIP server), never into a general network.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;What happens to unknown devices after the reject&lt;/strong&gt; is the switch&amp;rsquo;s failure handling (a guest VLAN, or staying quarantined, for example). That is switch configuration, not rradius.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;To put unknown devices straight into a guest VLAN,&lt;/strong&gt; change the script to return &lt;code&gt;accept&lt;/code&gt; with the guest VLAN when nothing is found. That means anyone who plugs in a cable gets online, so check what the guest VLAN can reach first.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;together-with-8021x-on-the-same-switch&#34;&gt;Together with 802.1X on the same switch&#xA;&lt;/h2&gt;&lt;p&gt;When a port tries 802.1X first and falls back to MAB, both kinds of request come from the same client. To handle that:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Keep EAP and MAB apart:&lt;/strong&gt; add &lt;code&gt;[radius.eap]&lt;/code&gt; (chapter 3) and a chain for ordinary accounts, with &lt;code&gt;mac-auth.lua&lt;/code&gt; as a &lt;code&gt;lua&lt;/code&gt; handler after it. The comment at the top of &lt;code&gt;mac-auth.lua&lt;/code&gt; explains the order: the handler that checks passwords judges the name first, and the MAC is looked at only when that handler does not know it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;In a PEAP chain, an &lt;code&gt;accept&lt;/code&gt; from a &lt;code&gt;lua&lt;/code&gt; handler does not count;&lt;/strong&gt; some handler must actually have checked a password, so the MAB rule never lets PEAP through without one.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;adding-devices&#34;&gt;Adding devices&#xA;&lt;/h2&gt;&lt;p&gt;For now, devices are added with a new migration file, for example &lt;code&gt;3_add_cameras.sql&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;INSERT&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;INTO&lt;/span&gt; mac_devices (mac, vlan, note) &lt;span style=&#34;color:#66d9ef&#34;&gt;VALUES&lt;/span&gt; (&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;0011223344aa&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;50&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;front door camera&amp;#39;&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Put it in &lt;code&gt;migrations/&lt;/code&gt; and restart. For many devices that change often, see &lt;a class=&#34;link&#34; href=&#34;../19-operations/#accounts-and-data&#34; &gt;chapter 19&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
        </item><item>
            <title>5. Remote Access: VPN Logins Against the Company Directory, One-Time Codes for the Jump Host</title>
            <link>https://embark.systems/en/rradius/05-remote-access/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/05-remote-access/</guid>
            <description>&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The VPN gateway&lt;/strong&gt; logs users in with their company directory (Active Directory or OpenLDAP) user name and password. Only members of the &lt;code&gt;vpn-users&lt;/code&gt; group may connect; IT staff and contractors get different access rules by group, and contractors stay connected for at most 8 hours.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The jump host&lt;/strong&gt; (SSH with pam_radius, or any other system that supports RADIUS) asks for the password and then for the 6-digit code (TOTP) from an authenticator app on the phone.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Each kind of device uses its own &lt;strong&gt;named chain&lt;/strong&gt;: the client&amp;rsquo;s &lt;code&gt;auth = &amp;quot;name&amp;quot;&lt;/code&gt; decides which.&lt;/p&gt;&#xA;&lt;p&gt;Example directory: &lt;code&gt;rradius-server/examples/scenarios/remote-access/&lt;/code&gt;&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;File&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Contents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The two chains, &lt;code&gt;vpn&lt;/code&gt; and &lt;code&gt;mfa&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;ldap.secret&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Password of the directory service account (demo value)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/1_schema.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;mfa_users&lt;/code&gt; and &lt;code&gt;mfa_pending&lt;/code&gt; for the codes, and &lt;code&gt;accounting&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/2_demo_data.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Jump host account ops1, code key &lt;code&gt;JBSWY3DPEHPK3PXP&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The jump host script is the repository&amp;rsquo;s &lt;code&gt;examples/two-step-totp.lua&lt;/code&gt;; accounting reuses &lt;code&gt;accounting.lua&lt;/code&gt; from the quick start.&lt;/p&gt;&#xA;&lt;h2 id=&#34;vpn-the-ldap-chain&#34;&gt;VPN: the LDAP chain&#xA;&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;chains&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;vpn&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;policy&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;first_match&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;chains&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;vpn&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;handlers&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;type&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ldap&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;urls&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ldaps://dc1.corp.example.com&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ldaps://dc2.corp.example.com&amp;#34;&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;bind_dn&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;CN=svc-radius,OU=Service Accounts,DC=corp,DC=example,DC=com&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;bind_password_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ldap.secret&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;base_dn&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;OU=People,DC=corp,DC=example,DC=com&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;filter&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;(&amp;amp;(sAMAccountName={user})(!(userAccountControl:1.2.840.113556.1.4.803:=2)))&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;password_check&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;bind&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;required_groups&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;CN=vpn-users,OU=Groups,DC=corp,DC=example,DC=com&amp;#34;&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The flow:&lt;/strong&gt; bind as the service account, find the user with &lt;code&gt;filter&lt;/code&gt; (&lt;code&gt;{user}&lt;/code&gt; is escaped), then bind once more with the user&amp;rsquo;s DN and password to check the password. Not found means skip (pass to the next handler); more than one match means reject.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;urls&lt;/code&gt; are tried in order,&lt;/strong&gt; moving to the next only when a server cannot be reached or times out. A server that answers with an error (a wrong service account password, for example) rejects at once without trying the next, so service account problems show up immediately.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;filter&lt;/code&gt; excludes disabled accounts:&lt;/strong&gt; the example above is for AD. OpenLDAP can use &lt;code&gt;(&amp;amp;(uid={user})(!(pwdAccountLockedTime=*)))&lt;/code&gt;, depending on how the directory is set up; check it against your own directory first.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;required_groups&lt;/code&gt;:&lt;/strong&gt; people not in the group are rejected just like a wrong password. By default the user&amp;rsquo;s &lt;code&gt;memberOf&lt;/code&gt; is used; when the directory has no &lt;code&gt;memberOf&lt;/code&gt;, search for groups with &lt;code&gt;group_base_dn&lt;/code&gt; and &lt;code&gt;group_filter&lt;/code&gt; instead, see usage section 3.5.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;ldaps://&lt;/code&gt; or StartTLS.&lt;/strong&gt; &lt;code&gt;ldap://&lt;/code&gt; upgrades with StartTLS automatically; when the directory certificate is not signed by a CA the system trusts, set &lt;code&gt;ca_file&lt;/code&gt;. Plain-text LDAP also needs &lt;code&gt;allow_plaintext = true&lt;/code&gt; and is not recommended.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;password_check = &amp;quot;bind&amp;quot;&lt;/code&gt; supports only PAP.&lt;/strong&gt; The VPN gateway must send the password with PAP (RADIUS encrypts &lt;code&gt;User-Password&lt;/code&gt;). To support CHAP, MS-CHAPv2 or PEAP, use &lt;code&gt;password_check = &amp;quot;attribute&amp;quot;&lt;/code&gt; to read a password attribute, which requires the directory to store plain text or NT hashes.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;chains&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;vpn&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;handlers&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;group_reply&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;group&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;CN=it-staff,OU=Groups,DC=corp,DC=example,DC=com&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;attributes&lt;/span&gt; = { &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Filter-Id&amp;#34;&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;vpn-it&amp;#34;&lt;/span&gt; }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;chains&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;vpn&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;handlers&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;group_reply&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;group&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;CN=contractors,OU=Groups,DC=corp,DC=example,DC=com&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;attributes&lt;/span&gt; = { &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Filter-Id&amp;#34;&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;vpn-contractor&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Session-Timeout&amp;#34;&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;28800&amp;#34;&lt;/span&gt; }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;A user gets the attributes of each group they belong to. &lt;strong&gt;The VPN gateway must have a filter or group policy of the same name,&lt;/strong&gt; and the attribute names depend on the gateway (some use &lt;code&gt;Class&lt;/code&gt;, some vendor attributes).&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;reply_attributes&lt;/code&gt; can turn the user&amp;rsquo;s own LDAP attributes into RADIUS attributes, such as a fixed IP per person.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;chains&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;vpn&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;username&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;strip_realm&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;both&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;lowercase&lt;/span&gt; = &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Users may type &lt;code&gt;CORP\alice&lt;/code&gt; or &lt;code&gt;alice@corp.example.com&lt;/code&gt;; the directory lookup uses &lt;code&gt;alice&lt;/code&gt; for both. Named chains do not inherit &lt;code&gt;[auth.username]&lt;/code&gt;; it has to be written under each chain.&lt;/p&gt;&#xA;&lt;h3 id=&#34;testing-the-vpn-chain&#34;&gt;Testing the VPN chain&#xA;&lt;/h3&gt;&lt;p&gt;The LDAP addresses in the example are made up; replace them with your own directory to test:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radtest alice &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;her-password&amp;#39;&lt;/span&gt; 127.0.0.1 &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; vpn-gw-shared-secret-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;(For local testing, change the &lt;code&gt;address&lt;/code&gt; of &lt;code&gt;vpn-gw&lt;/code&gt; to &lt;code&gt;127.0.0.1&lt;/code&gt;.) The authentication log&amp;rsquo;s &lt;code&gt;handler&lt;/code&gt; is &lt;code&gt;ldap&lt;/code&gt;. The log does not distinguish reasons for a reject (a wrong password and not being in the group look the same). Directory problems get a line of their own: an unreachable server or timeout is a WARN &lt;code&gt;auth ldap handler: &amp;lt;URL&amp;gt;: &amp;lt;error&amp;gt;&lt;/code&gt; (the next server is tried); an error from the directory, such as a wrong service account password, is an ERROR &lt;code&gt;auth ldap handler: &amp;lt;URL&amp;gt;: &amp;lt;error&amp;gt;; rejecting&lt;/code&gt;. When there is no such message and the cause is still unclear, first use &lt;code&gt;ldapsearch&lt;/code&gt; with the service account to look up the user and their &lt;code&gt;memberOf&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;jump-host-password-plus-totp&#34;&gt;Jump host: password plus TOTP&#xA;&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;chains&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;mfa&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;policy&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;first_match&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;chains&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;mfa&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;handlers&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;type&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;lua&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;script&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;../../two-step-totp.lua&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The flow:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;jump host ── Access-Request (user, password) ──────────► rradius checks the password&#xA;          ◄─ Access-Challenge (State, &amp;#34;Enter your code&amp;#34;)&#xA;user types the code&#xA;jump host ── Access-Request (user, code, State) ───────► rradius checks the TOTP&#xA;          ◄─ Access-Accept&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;A &lt;code&gt;State&lt;/code&gt; can be used once and is valid for 60 seconds.&lt;/strong&gt; It is stored in &lt;code&gt;mfa_pending&lt;/code&gt; and taken with a &lt;code&gt;DELETE&lt;/code&gt; in the second step, so two requests can never use the same challenge.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Each code can be used only once:&lt;/strong&gt; the time step last used is recorded, and only later ones are accepted.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Five wrong guesses lock the account for 5 minutes.&lt;/strong&gt; Only someone who knows the password can trigger the lock. Guesses at the password itself are not limited; the jump host or a firewall has to limit them.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The two steps can land on different nodes;&lt;/strong&gt; every write in the example goes through the cluster, so this is not a problem.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;testing&#34;&gt;Testing&#xA;&lt;/h3&gt;&lt;p&gt;For local testing, change the &lt;code&gt;address&lt;/code&gt; of &lt;code&gt;jump-host&lt;/code&gt; to &lt;code&gt;127.0.0.1&lt;/code&gt;. &lt;code&gt;radtest&lt;/code&gt; does not handle Access-Challenge, so send two requests:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radtest ops1 ops1-password 127.0.0.1 &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; jump-host-shared-secret-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# an Access-Challenge comes back; note the value of State (starting with 0x)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;oathtool --totp -b JBSWY3DPEHPK3PXP      &lt;span style=&#34;color:#75715e&#34;&gt;# produce the current code&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Name=ops1,User-Password=&amp;lt;code&amp;gt;,State=&amp;lt;value of State&amp;gt;&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  | radclient 127.0.0.1:1812 auth jump-host-shared-secret-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The second request gets an Access-Accept. Sending the same &lt;code&gt;State&lt;/code&gt; again is rejected.&lt;/p&gt;&#xA;&lt;h3 id=&#34;on-an-ssh-jump-host&#34;&gt;On an SSH jump host&#xA;&lt;/h3&gt;&lt;p&gt;pam_radius shows the &lt;code&gt;Reply-Message&lt;/code&gt; of an Access-Challenge to the user and sends the answer back, so an SSH login asks for the password and then the code. Put rradius&amp;rsquo;s address and the contents of &lt;code&gt;jump-host.secret&lt;/code&gt; in &lt;code&gt;/etc/pam_radius.conf&lt;/code&gt;; a timeout of 5 seconds or more is recommended.&lt;/p&gt;&#xA;&lt;h3 id=&#34;using-your-own-accounts&#34;&gt;Using your own accounts&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;two-step-totp.lua&lt;/code&gt; keeps passwords in &lt;code&gt;mfa_users.password&lt;/code&gt; and &lt;strong&gt;compares them in plain text.&lt;/strong&gt; To use hashes or LDAP for the password, the script has to be rewritten: for example, change the chain to &lt;code&gt;all_accept&lt;/code&gt; with an LDAP handler first to check the password and the script doing only the code. Then the &amp;ldquo;password&amp;rdquo; of the second step is the code, which LDAP rejects, so the script has to take over when &lt;code&gt;State&lt;/code&gt; is present. That is more involved; try it in a test environment first.&lt;/li&gt;&#xA;&lt;li&gt;Code keys are Base32, one per person, given to the user as a QR code (&lt;code&gt;otpauth://totp/...&lt;/code&gt;) to scan.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;before-going-live&#34;&gt;Before going live&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;ldap.secret&lt;/code&gt; holds the directory service account&amp;rsquo;s password; make it readable only by the account that runs rradius. The service account only needs to search users and groups; it needs no write access.&lt;/li&gt;&#xA;&lt;li&gt;The DNs in &lt;code&gt;required_groups&lt;/code&gt; and &lt;code&gt;group_reply&lt;/code&gt; must be written exactly as in the directory; check the user&amp;rsquo;s &lt;code&gt;memberOf&lt;/code&gt; with &lt;code&gt;ldapsearch&lt;/code&gt; first. &lt;code&gt;memberOf&lt;/code&gt; holds only direct memberships; for nested groups in AD, use &lt;code&gt;group_base_dn&lt;/code&gt; with &lt;code&gt;group_filter = &amp;quot;(member:1.2.840.113556.1.4.1941:={dn})&amp;quot;&lt;/code&gt; (this form has not yet been tested against AD).&lt;/li&gt;&#xA;&lt;li&gt;LDAP connections are kept and reused, up to &lt;code&gt;pool_size&lt;/code&gt; per URL (4 by default). Raise it for high login volumes.&lt;/li&gt;&#xA;&lt;li&gt;The contractors&amp;rsquo; &lt;code&gt;Session-Timeout&lt;/code&gt; only works when the gateway supports it.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>6. Network Device Administration (TACACS&#43;)</title>
            <link>https://embark.systems/en/rradius/06-device-admin/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/06-device-admin/</guid>
            <description>&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt; network administrators log in to routers and switches over SSH.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Accounts are managed centrally, instead of a set of local accounts on every device.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;strong&gt;netadmin&lt;/strong&gt; role: privilege level 15, every command allowed.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;strong&gt;noc&lt;/strong&gt; role: privilege level 1, look only (&lt;code&gt;show&lt;/code&gt;, &lt;code&gt;ping&lt;/code&gt;, &lt;code&gt;traceroute&lt;/code&gt;). &lt;code&gt;show&lt;/code&gt; only takes the items the script lists (interfaces, version, VLANs, routes and the like), not the configuration, because it contains passwords.&lt;/li&gt;&#xA;&lt;li&gt;Every command is recorded: who, from where, on which device, what they ran.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;TACACS+ separates authentication, authorization and accounting into three kinds of request, and a device can ask &amp;ldquo;is this allowed&amp;rdquo; for every command. That is what makes it better suited than RADIUS for device administration.&lt;/p&gt;&#xA;&lt;p&gt;Example directory: &lt;code&gt;rradius-server/examples/scenarios/device-admin/&lt;/code&gt;&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;File&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Contents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+ only, no &lt;code&gt;[radius]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;tacacs.lua&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Authorization (by role) and accounting (recording commands)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/1_schema.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;admins&lt;/code&gt; (accounts, roles), &lt;code&gt;tacacs_log&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/2_demo_data.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;netadmin1 and noc1, with bcrypt passwords&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;who-handles-what&#34;&gt;Who handles what&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Request&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Handled by&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Authentication (user name and password)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The &lt;code&gt;sql&lt;/code&gt; handler in &lt;code&gt;[auth]&lt;/code&gt;: bcrypt hashes in the &lt;code&gt;admins&lt;/code&gt; table&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Authorization (starting a shell, each command)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;tacacs.lua&lt;/code&gt;, with &lt;code&gt;phase&lt;/code&gt; &lt;code&gt;&amp;quot;authorization&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting (login, logout, command records)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;tacacs.lua&lt;/code&gt;, with &lt;code&gt;phase&lt;/code&gt; &lt;code&gt;&amp;quot;accounting&amp;quot;&lt;/code&gt;, written to &lt;code&gt;tacacs_log&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;This scenario authorizes by the user&amp;rsquo;s role, so it goes to the top-level script, which does the main work. When authorization depends only on the device, you can skip the script and use &amp;ldquo;authorization groups&amp;rdquo; below.&lt;/p&gt;&#xA;&lt;h2 id=&#34;steps&#34;&gt;Steps&#xA;&lt;/h2&gt;&lt;h3 id=&#34;1-start&#34;&gt;1. Start&#xA;&lt;/h3&gt;&lt;p&gt;TACACS+ uses port 49, and ordinary accounts cannot bind ports below 1024. For local testing, change &lt;code&gt;[tacacs] port&lt;/code&gt; to 4949 first; for production, see &amp;ldquo;Before going live&amp;rdquo; below. The example client is &lt;code&gt;10.50.0.0/24&lt;/code&gt;; for local testing, change it to &lt;code&gt;127.0.0.1&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd rradius-server&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./target/release/rradius-server --config examples/scenarios/device-admin/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;2-test-with-tacacs_client&#34;&gt;2. Test with &lt;code&gt;tacacs_client&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;tacacs_client&lt;/code&gt; is the command that comes with the Python package &lt;code&gt;tacacs_plus&lt;/code&gt; (&lt;code&gt;pip install tacacs_plus&lt;/code&gt;). Its options may differ slightly between versions; &lt;code&gt;tacacs_client --help&lt;/code&gt; is authoritative:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;K&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;tacacs-shared-secret-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;tacacs_client -H 127.0.0.1 -p &lt;span style=&#34;color:#ae81ff&#34;&gt;4949&lt;/span&gt; -k $K -u noc1 authenticate          &lt;span style=&#34;color:#75715e&#34;&gt;# type noc1-password&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;tacacs_client -H 127.0.0.1 -p &lt;span style=&#34;color:#ae81ff&#34;&gt;4949&lt;/span&gt; -k $K -u noc1 authorize -c service&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;shell cmd&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;tacacs_client -H 127.0.0.1 -p &lt;span style=&#34;color:#ae81ff&#34;&gt;4949&lt;/span&gt; -k $K -u noc1 authorize -c service&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;shell cmd&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;show cmd-arg&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;running-config&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Request&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;netadmin1&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;noc1&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Start a shell (empty &lt;code&gt;cmd=&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Pass, &lt;code&gt;priv-lvl=15&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Pass, &lt;code&gt;priv-lvl=1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;show interfaces&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Pass&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Pass&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;show running-config&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Pass&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Fail&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;configure terminal&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Pass&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Fail&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;the-script-explained&#34;&gt;The script explained&#xA;&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-lua&#34; data-lang=&#34;lua&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;local&lt;/span&gt; cmd &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;cmd&amp;#39;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;-- No cmd: starting a shell (EXEC authorization); reply with the privilege level.&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;not&lt;/span&gt; cmd &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; cmd &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;then&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  set_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;priv-lvl&amp;#39;&lt;/span&gt;, role &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;netadmin&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;and&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;15&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;accept&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;end&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The arguments of an authorization request&lt;/strong&gt; can all be read with &lt;code&gt;get_attr&lt;/code&gt;: &lt;code&gt;service&lt;/code&gt;, &lt;code&gt;cmd&lt;/code&gt;, &lt;code&gt;protocol&lt;/code&gt; and so on. For repeated arguments use &lt;code&gt;get_attrs&lt;/code&gt;; &lt;code&gt;get_attrs(&#39;cmd-arg&#39;)&lt;/code&gt;, for example, gives every argument of the command.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Attributes added with &lt;code&gt;set_attr&lt;/code&gt;&lt;/strong&gt; go back to the device as &lt;code&gt;name=value&lt;/code&gt; (PASS_ADD).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Accounting&lt;/strong&gt; is keyed on &lt;code&gt;task_id&lt;/code&gt; plus the event (&lt;code&gt;start_time&lt;/code&gt; and &lt;code&gt;stop_time&lt;/code&gt; say whether it is a start or a stop), written with &lt;code&gt;INSERT OR IGNORE&lt;/code&gt;, so a retransmission from the device still leaves one row. The command and its arguments are put back together into one line in &lt;code&gt;cmd&lt;/code&gt;, such as &lt;code&gt;show interfaces&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Once an account is disabled&lt;/strong&gt; (&lt;code&gt;enabled = 0&lt;/code&gt;), authentication and authorization both reject it, and a session that is already logged in is stopped at its next command.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;without-a-script-authorization-groups&#34;&gt;Without a script: authorization groups&#xA;&lt;/h2&gt;&lt;p&gt;When authorization depends only on the device, not on the user, you can write rules in the configuration file instead of the authorization part of the script. For example, only network administrators can log in to core routers, and always get privilege level 15; access switches are for the on-call staff, who can only look:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;tacacs&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;authorize_groups&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;core&lt;/span&gt; = [&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;permit service=shell cmd\* {priv-lvl=15}&amp;#39;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;permit service=shell cmd=.*&amp;#39;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;access&lt;/span&gt; = [&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;permit service=shell cmd\* {priv-lvl=1}&amp;#39;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;deny cmd=show cmd-arg=(running-config|startup-config)&amp;#39;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;permit service=shell cmd=(show|ping|traceroute|exit|terminal)&amp;#39;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;tacacs&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;clients&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;core-routers&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.50.0.0/24&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;secret_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;tacacs.secret&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;authorize_group&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;core&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;tacacs&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;clients&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;access-switches&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.60.0.0/22&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;secret_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;tacacs.secret&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;authorize_group&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;access&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;Rules are matched in order, and the first that holds decides; put &lt;code&gt;deny&lt;/code&gt; before a broader &lt;code&gt;permit&lt;/code&gt;. When no rule holds, the request is refused.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;cmd\*&lt;/code&gt; is the &lt;code&gt;cmd*&lt;/code&gt; a device sends when asking to start a shell, and &lt;code&gt;{priv-lvl=15}&lt;/code&gt; goes back to the device as the privilege level.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Always use single quotes;&lt;/strong&gt; double-quoted strings do not accept &lt;code&gt;\*&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Devices with &lt;code&gt;authorize_group&lt;/code&gt; set do not run the authorization part of the script. Authentication and accounting are unchanged, so the accounting records of &lt;code&gt;tacacs.lua&lt;/code&gt; still work.&lt;/li&gt;&#xA;&lt;li&gt;Rules do not distinguish users: in the example above, everyone who can log in to the access switches can only look. To distinguish by role as earlier in this chapter, keep using the script.&lt;/li&gt;&#xA;&lt;li&gt;The full description of the format and its checks is in usage section 2.3.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;device-configuration&#34;&gt;Device configuration&#xA;&lt;/h2&gt;&lt;p&gt;Using Cisco IOS as an example (&lt;strong&gt;not yet tested on real devices&lt;/strong&gt;; commands may differ between versions, so confirm on a lab device before going live):&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;aaa new-model&#xA;tacacs server rradius-1&#xA; address ipv4 10.50.0.100&#xA; key tacacs-shared-secret-change-me&#xA;aaa group server tacacs+ RRADIUS&#xA; server name rradius-1&#xA;!&#xA;aaa authentication login default group RRADIUS local&#xA;aaa authorization exec default group RRADIUS local&#xA;aaa authorization commands 1 default group RRADIUS local&#xA;aaa authorization commands 15 default group RRADIUS local&#xA;aaa accounting exec default start-stop group RRADIUS&#xA;aaa accounting commands 1 default stop-only group RRADIUS&#xA;aaa accounting commands 15 default stop-only group RRADIUS&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Always keep &lt;code&gt;local&lt;/code&gt; as a fallback,&lt;/strong&gt; and before configuring, make sure the local emergency account can log in. When rradius is down or unreachable, the device uses its local accounts; without a fallback you lock yourself out.&lt;/li&gt;&#xA;&lt;li&gt;Turn on authentication first, and turn on command authorization only once that works. A mistake can refuse even &lt;code&gt;exit&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Do not hand enable to rradius unless you set &lt;code&gt;enable = &amp;quot;login&amp;quot;&lt;/code&gt;.&lt;/strong&gt; By default rradius refuses enable requests (it answers FAIL), and a device that gets FAIL does not fall back to its local enable password. Two ways to handle this:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Keep the device&amp;rsquo;s local enable password (&lt;code&gt;aaa authentication enable default enable&lt;/code&gt;). The configuration above does not hand enable to rradius; the privilege level comes from &lt;code&gt;priv-lvl&lt;/code&gt; in the authorization reply, so administrators usually do not need enable.&lt;/li&gt;&#xA;&lt;li&gt;Set &lt;code&gt;enable = &amp;quot;login&amp;quot;&lt;/code&gt; in &lt;code&gt;[tacacs]&lt;/code&gt;, and have the device use &lt;code&gt;aaa authentication enable default group RRADIUS enable&lt;/code&gt;. Administrators then enable with their own password, so limit it in the script, for example letting only the &lt;code&gt;netadmin&lt;/code&gt; role pass when &lt;code&gt;authen_service == 2&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;With several rradius servers, list several &lt;code&gt;server name&lt;/code&gt; lines under &lt;code&gt;aaa group server&lt;/code&gt;; the device tries them in order.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;before-going-live&#34;&gt;Before going live&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Port 49:&lt;/strong&gt; use systemd&amp;rsquo;s &lt;code&gt;AmbientCapabilities=CAP_NET_BIND_SERVICE&lt;/code&gt;, or give the binary &lt;code&gt;setcap cap_net_bind_service=+ep&lt;/code&gt;. Do not run it as root.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TACACS+ encryption is weak:&lt;/strong&gt; the obfuscation of RFC 8907 uses only MD5 and the shared secret, and is no substitute for real encryption. Keep traffic between devices and rradius on the management network, with long shared secrets (fewer than 16 characters gives a warning at startup) that differ per device (several &lt;code&gt;[[tacacs.clients]]&lt;/code&gt; can be used). When devices support TACACS+ over TLS (RFC 9887), use TLS instead; see &lt;a class=&#34;link&#34; href=&#34;../16-device-admin-tls/&#34; &gt;chapter 16&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;ASCII login&lt;/strong&gt; (the device asks for the user name, then the password) and PAP are both supported. Enable is refused by default, and password changes always get FAIL; see usage section 4.6.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;CHAP and MS-CHAPv2&lt;/strong&gt; (used only by devices that dial in over PPP) are checked by the authentication chain, so the account&amp;rsquo;s password must be in a form the server can read: plain text for CHAP, plain text or &lt;code&gt;{nthash}&lt;/code&gt; for MS-CHAPv2. The example accounts are stored as bcrypt, so these two kinds of login are rejected; ordinary SSH logins (PAP, ASCII) are unaffected. Devices without a chain get RESTART and can switch to PAP.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Messages for the user:&lt;/strong&gt; text set by the script with &lt;code&gt;set_attr(&#39;server_msg&#39;, &#39;...&#39;)&lt;/code&gt; goes into the reply, and devices usually show it to the person logging in, for example to explain why a command was refused. Authorization group rules cannot carry a message.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Idle connections&lt;/strong&gt; are closed after 300 seconds without a complete packet (&lt;code&gt;idle_timeout_ms&lt;/code&gt;), and each connection allows at most 8 unfinished logins.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Keeping records:&lt;/strong&gt; &lt;code&gt;tacacs_log&lt;/code&gt; keeps growing, and rradius does not clean it up. For removing old data, see &lt;a class=&#34;link&#34; href=&#34;../19-operations/#removing-old-data&#34; &gt;chapter 19&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;common-problems&#34;&gt;Common problems&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The connection is closed at once&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The source is not in &lt;code&gt;[[tacacs.clients]]&lt;/code&gt;; the log shows &lt;code&gt;TACACS+ connection from unknown client&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Authentication answers ERROR, then the connection is closed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The shared secret differs, so the decoded contents are garbage. The log shows &lt;code&gt;a body did not decode, so the shared secret may be wrong&lt;/code&gt;, and &lt;code&gt;rradius_tacacs_malformed_total&lt;/code&gt; increases&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The &lt;code&gt;enable&lt;/code&gt; command always fails&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Enable is refused by default; the log shows &lt;code&gt;TACACS+ enable request refused&lt;/code&gt;. See &amp;ldquo;Device configuration&amp;rdquo; above&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Login works but every command is refused&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The authorization script refuses: the account has no role, &lt;code&gt;service&lt;/code&gt; is not &lt;code&gt;shell&lt;/code&gt;, or &lt;code&gt;cmd&lt;/code&gt; is not on the allowed list. With authorization groups, no rule held&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting answers ERROR&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The script failed; look for &lt;code&gt;Lua script error&lt;/code&gt;. The device retransmits&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;</description>
        </item><item>
            <title>7. Broadband Provider (PPPoE/IPoE)</title>
            <link>https://embark.systems/en/rradius/07-broadband/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/07-broadband/</guid>
            <description>&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt; a regional broadband provider whose subscribers get online through a BNG (broadband network gateway) over PPPoE or IPoE.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Each subscriber has a &lt;strong&gt;plan&lt;/strong&gt;: the plan sets the rate and the number of simultaneous sessions (1 for home, 4 for business).&lt;/li&gt;&#xA;&lt;li&gt;Subscribers in arrears are suspended and can no longer log in.&lt;/li&gt;&#xA;&lt;li&gt;Accounting records each session&amp;rsquo;s time, traffic and assigned IP.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When the billing system suspends someone, they must be disconnected at once,&lt;/strong&gt; but the billing system does not know which BNG they are on or what the session ID is, and does not have the BNG&amp;rsquo;s shared secret.&lt;/li&gt;&#xA;&lt;li&gt;Accounting must not be lost when the database has a brief problem.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Example directory: &lt;code&gt;rradius-server/examples/scenarios/broadband/&lt;/code&gt;&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;File&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Contents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;all_accept&lt;/code&gt; chain, CoA forwarding, accounting spool&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accounting.lua&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting: one row per session, recording the NAS and the IP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;session-limit.lua&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The simultaneous session check&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/1_schema.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;plans&lt;/code&gt;, &lt;code&gt;plan_reply&lt;/code&gt;, &lt;code&gt;subscribers&lt;/code&gt;, &lt;code&gt;accounting&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/2_demo_data.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Two plans, three subscribers (one suspended)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;the-flow&#34;&gt;The flow&#xA;&lt;/h2&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Login:      BNG ──► sql handler (password, plan attributes) ──► session-limit.lua (any slots left?) ──► Accept + rate&#xA;Accounting: BNG ──► accounting.lua ──► accounting table&#xA;Disconnect: billing system ──Disconnect-Request (User-Name only)──► rradius&#xA;            rradius looks up the accounting table with session_query ──► each session found goes to its BNG&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Session limits and disconnects both read the same &lt;code&gt;accounting&lt;/code&gt; table, so as long as accounting is right, both features are right.&lt;/p&gt;&#xA;&lt;h2 id=&#34;steps&#34;&gt;Steps&#xA;&lt;/h2&gt;&lt;h3 id=&#34;1-change-the-clients-and-start&#34;&gt;1. Change the clients and start&#xA;&lt;/h3&gt;&lt;p&gt;For local testing, change the &lt;code&gt;address&lt;/code&gt; of both &lt;code&gt;bng-1&lt;/code&gt; and &lt;code&gt;billing&lt;/code&gt; to &lt;code&gt;127.0.0.1&lt;/code&gt;, and the &lt;code&gt;coa_port&lt;/code&gt; of &lt;code&gt;bng-1&lt;/code&gt; to 3800 (otherwise requests forwarded to the BNG go back to rradius&amp;rsquo;s own port 3799).&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd rradius-server&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./target/release/rradius-server --config examples/scenarios/broadband/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;2-login-and-session-limits&#34;&gt;2. Login and session limits&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;S&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;bng-shared-secret-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radtest home0001 home0001-password 127.0.0.1 &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; $S&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Access-Accept: Mikrotik-Rate-Limit = &amp;#34;100M/100M&amp;#34;, Acct-Interim-Interval = 300&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Name=home0001,Acct-Session-Id=bb-1,Acct-Status-Type=Start,Framed-IP-Address=100.64.0.9&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  | radclient 127.0.0.1:1813 acct $S&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radtest home0001 home0001-password 127.0.0.1 &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; $S&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Access-Reject: the home plan allows one session; the log says too many sessions&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;radtest home0002 ...&lt;/code&gt; is always rejected; its &lt;code&gt;status&lt;/code&gt; is &lt;code&gt;suspended&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;3-the-billing-system-disconnects-someone&#34;&gt;3. The billing system disconnects someone&#xA;&lt;/h3&gt;&lt;p&gt;The billing system sends only &lt;code&gt;User-Name&lt;/code&gt;, signed with its own shared secret, to rradius&amp;rsquo;s port 3799:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Name=home0001&amp;#39;&lt;/span&gt; | radclient 127.0.0.1:3799 disconnect billing-coa-secret-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;rradius finds home0001&amp;rsquo;s open session (&lt;code&gt;bb-1&lt;/code&gt;, on &lt;code&gt;bng-1&lt;/code&gt;), adds &lt;code&gt;Acct-Session-Id = bb-1&lt;/code&gt; to the Disconnect-Request and forwards it to bng-1&amp;rsquo;s &lt;code&gt;coa_port&lt;/code&gt;, then passes the BNG&amp;rsquo;s answer back to the billing system. Locally there is no real BNG answering on port 3800, so after the retries (1 second × 3 by default) a NAK comes back with &lt;code&gt;Error-Cause&lt;/code&gt; 505. Sending it for a subscriber with no session gets NAK 503 (Session Context Not Found).&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-configuration-explained&#34;&gt;The configuration explained&#xA;&lt;/h2&gt;&lt;h3 id=&#34;check-the-password-first-then-the-slots&#34;&gt;Check the password first, then the slots&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;policy&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;all_accept&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;handlers&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;type&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sql&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;user_query&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT password FROM subscribers WHERE username = ? AND status = &amp;#39;active&amp;#39;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;reply_query&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT r.attribute, r.value FROM subscribers s JOIN plan_reply r ON r.plan = s.plan WHERE s.username = ?&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;handlers&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;type&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;lua&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;script&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;session-limit.lua&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;all_accept&lt;/code&gt;:&lt;/strong&gt; every handler must accept. When &lt;code&gt;sql&lt;/code&gt; rejects (wrong password, suspended), the script does not run; only after &lt;code&gt;sql&lt;/code&gt; accepts does the script check the slots.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Do not use &lt;code&gt;first_match&lt;/code&gt;:&lt;/strong&gt; then a name &lt;code&gt;sql&lt;/code&gt; cannot find goes to the script, which checks only the slots, and accounts that do not exist get in without a password.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;reply_query&lt;/code&gt; returns attributes by plan.&lt;/strong&gt; The example uses MikroTik&amp;rsquo;s &lt;code&gt;Mikrotik-Rate-Limit&lt;/code&gt;; BNGs from other vendors use their own attributes, such as Cisco&amp;rsquo;s &lt;code&gt;Cisco-AVPair&lt;/code&gt; or Juniper&amp;rsquo;s &lt;code&gt;ERX-*&lt;/code&gt;. Replace them in &lt;code&gt;plan_reply&lt;/code&gt; with names and values your BNG understands.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;Acct-Interim-Interval = 300&lt;/code&gt;&lt;/strong&gt; asks the BNG to report every 5 minutes. &lt;code&gt;STALE_AFTER&lt;/code&gt; in &lt;code&gt;session-limit.lua&lt;/code&gt; and &lt;code&gt;session_query&lt;/code&gt; in &lt;code&gt;[radius.coa]&lt;/code&gt; both treat a session not reported for more than 900 seconds as gone (a BNG that crashes sends no Stop), so this interval must be shorter than 900 seconds. To change the 900 seconds, change both places together.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;username&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;lowercase&lt;/span&gt; = &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;allowed&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;[a-z0-9._@-]+&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;HOME0001&lt;/code&gt; and &lt;code&gt;home0001&lt;/code&gt; are the same person; otherwise each would get its own slots. &lt;code&gt;accounting.lua&lt;/code&gt; lowercases names too.&lt;/p&gt;&#xA;&lt;h3 id=&#34;session-limitlua&#34;&gt;session-limit.lua&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-lua&#34; data-lang=&#34;lua&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SELECT p.max_sessions AS allowed,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;       (SELECT count(&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;) FROM accounting a&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        WHERE a.username &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; s.username AND a.stopped IS NULL AND a.updated &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;?&lt;/span&gt;) AS online&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;FROM subscribers s JOIN plans p ON p.name &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; s.plan&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;WHERE s.username &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;?&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;A slot is counted only from Accounting-Start. &lt;strong&gt;Two logins arriving at the same moment may both pass;&lt;/strong&gt; every approach that counts slots from accounting shares this limit.&lt;/li&gt;&#xA;&lt;li&gt;In a cluster, the local replica is read, which can lag slightly behind accounting just written.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;auth_user&lt;/code&gt; is the name after the chain normalised it (lowercase).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;accountinglua&#34;&gt;accounting.lua&#xA;&lt;/h3&gt;&lt;p&gt;The same as in the quick start (Start, Interim and Stop write to the same row, it is safe to repeat, and a NAS reboot ends that NAS&amp;rsquo;s sessions), plus:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The &lt;code&gt;nas&lt;/code&gt; column:&lt;/strong&gt; where CoA must be sent, taken from the &lt;code&gt;NAS-IP-Address&lt;/code&gt; or &lt;code&gt;NAS-IPv6-Address&lt;/code&gt; the NAS reports, or the client name when there is neither.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The &lt;code&gt;framed_ip&lt;/code&gt; column:&lt;/strong&gt; the IP assigned to the subscriber, kept when a later Interim-Update does not carry it. Support staff need it to answer &amp;ldquo;who had this IP just now&amp;rdquo;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;coa-forwarding&#34;&gt;CoA forwarding&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;coa&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;port&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;3799&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;session_query&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT nas, session_id FROM accounting WHERE username = ? AND stopped IS NULL AND updated &amp;gt; strftime(&amp;#39;%s&amp;#39;, &amp;#39;now&amp;#39;) - 900 ORDER BY updated DESC&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;coa&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;clients&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;billing&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.20.0.5&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;secret_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;billing.secret&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;[[radius.coa.clients]]&lt;/code&gt; are the systems allowed to ask for disconnects,&lt;/strong&gt; kept apart from the list of NAS.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A request that names a NAS (&lt;code&gt;NAS-IP-Address&lt;/code&gt; and so on) goes straight to that NAS;&lt;/strong&gt; only a request with just &lt;code&gt;User-Name&lt;/code&gt; is looked up with &lt;code&gt;session_query&lt;/code&gt;. The query has a single &lt;code&gt;?&lt;/code&gt;, filled with &lt;code&gt;User-Name&lt;/code&gt;, so the billing system cannot inject SQL.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Replies:&lt;/strong&gt; ACK when any BNG answers ACK; one of the NAKs when all refuse; NAK 503 when no session is found; 502 when none of the NAS found is a configured client; 505 when the query fails or no BNG answers. At most 32 sessions per subscriber are forwarded.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The BNG must have CoA (RFC 5176) enabled&lt;/strong&gt; and accept rradius&amp;rsquo;s source address, on the client&amp;rsquo;s &lt;code&gt;coa_port&lt;/code&gt; (3799 by default; some devices use 1700).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Requests with only &lt;code&gt;User-Name&lt;/code&gt; are convenient with many BNGs,&lt;/strong&gt; but the lookup depends on accounting: if the BNG sent no Start, nothing is found.&lt;/li&gt;&#xA;&lt;li&gt;To disconnect people yourself from a script or the command line, see &lt;code&gt;send_disconnect&lt;/code&gt; and the &lt;code&gt;rradius-server disconnect&lt;/code&gt; command in usage section 4.8.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;the-accounting-spool&#34;&gt;The accounting spool&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;accounting_spool&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;dir&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;spool&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When the database cannot take writes (the cluster has lost its majority, or a timeout), accounting is first written to a local directory and the BNG gets its reply; once things recover, &lt;code&gt;accounting.lua&lt;/code&gt; replays it. The script is safe to repeat, so replaying never counts twice. Spool files contain personal data, and the directory&amp;rsquo;s mode is 0700; if the disk fails, whatever has not been replayed is lost. See usage section 2.11.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Only failures caused by the database are spooled.&lt;/strong&gt; The script&amp;rsquo;s own errors, or a returned &lt;code&gt;&#39;reject&#39;&lt;/code&gt;, are not spooled and get no reply, just as without this section, so errors are not hidden.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The script can tell when it is replaying:&lt;/strong&gt; the global variable &lt;code&gt;replayed&lt;/code&gt; is &lt;code&gt;true&lt;/code&gt;, and &lt;code&gt;Acct-Delay-Time&lt;/code&gt; already includes the time spent in the spool.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Until recovery, features that depend on accounting cannot see this data:&lt;/strong&gt; session limits and disconnects both read the &lt;code&gt;accounting&lt;/code&gt; table. &lt;code&gt;rradius_acct_spool_bytes&lt;/code&gt; above 0 means there is a backlog; alert on it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;query_timeout_ms&lt;/code&gt; decides how long before spooling.&lt;/strong&gt; Without a cluster majority, a write fails only after &lt;code&gt;[lua] query_timeout_ms&lt;/code&gt; (5 seconds by default), and the BNG gets no reply meanwhile. Lower it when that is longer than the BNG&amp;rsquo;s retransmission interval.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Replay speed (&lt;code&gt;replay_window&lt;/code&gt;):&lt;/strong&gt; by default one record is replayed at a time, in write order, at a few thousand per second. After a long outage with a large backlog, &lt;code&gt;replay_window = 8&lt;/code&gt; replays several at once; but Start, Interim and Stop of the same session may then run at the same time or out of order. The example &lt;code&gt;accounting.lua&lt;/code&gt; writes all three to the same row and keeps the larger value of each number, so order does not matter; if your script relies on order, keep it at 1.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When replay gets stuck:&lt;/strong&gt; for how to read &lt;code&gt;rejected.log&lt;/code&gt; and &lt;code&gt;.corrupt&lt;/code&gt; files, see &lt;a class=&#34;link&#34; href=&#34;../20-troubleshooting/#accounting-keeps-being-retransmitted-or-accounting-is-missing&#34; &gt;chapter 20&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;before-going-live&#34;&gt;Before going live&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Where do plans and subscribers come from?&lt;/strong&gt; The demo subscribers in the example come from a migration file. The example configuration already has &lt;code&gt;[accounts]&lt;/code&gt;, so subscribers can be managed with &lt;code&gt;rradius-server user add|passwd|disable&lt;/code&gt; (disabling sets &lt;code&gt;status&lt;/code&gt; to &lt;code&gt;suspended&lt;/code&gt;); the billing system can also call these commands to stay in step, see &lt;a class=&#34;link&#34; href=&#34;../19-operations/#accounts-and-data&#34; &gt;chapter 19&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;IP address pools:&lt;/strong&gt; in the example, the BNG assigns addresses itself. To assign them from RADIUS, see &lt;code&gt;examples/ip-pool.lua&lt;/code&gt;, which guarantees across the whole cluster that an address is never given to two people at once.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Time quotas and allowed hours:&lt;/strong&gt; see &lt;code&gt;examples/quota-and-hours.lua&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The &lt;code&gt;accounting&lt;/code&gt; table keeps growing;&lt;/strong&gt; for removing old data see &lt;a class=&#34;link&#34; href=&#34;../19-operations/#removing-old-data&#34; &gt;chapter 19&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;For several BNGs and several rradius servers, see &lt;a class=&#34;link&#34; href=&#34;../08-ha-cluster/&#34; &gt;chapter 8&lt;/a&gt;. Every BNG must be able to receive CoA from every rradius node.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When the BNG is behind NAT or across an untrusted network,&lt;/strong&gt; it connects in over RadSec, and disconnects travel over the connection it opened; see &lt;a class=&#34;link&#34; href=&#34;../10-radsec/#disconnects-over-the-nass-own-connection&#34; &gt;chapter 10&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When subscriber data lives in the billing system and you do not want a copy,&lt;/strong&gt; each login can ask the billing system&amp;rsquo;s API; see &lt;a class=&#34;link&#34; href=&#34;../18-external-api/&#34; &gt;chapter 18&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;common-problems&#34;&gt;Common problems&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A subscriber who went offline is still told &amp;ldquo;too many sessions&amp;rdquo;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The BNG sent no Stop (a crash, a lost link), so it takes 900 seconds; or the BNG sent no Accounting-On when it rebooted&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A disconnect gets 503&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No open session found: the BNG sent no accounting, the name differs in case, or nothing was reported for more than 900 seconds&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A disconnect gets 505&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The BNG did not answer: CoA not enabled, wrong port, rradius&amp;rsquo;s source address not accepted, or a different shared secret&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A disconnect request gets no reply at all&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The sender is not in &lt;code&gt;[[radius.coa.clients]]&lt;/code&gt; or the secret is wrong; counted in &lt;code&gt;rradius_coa_relay_discarded_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;</description>
        </item><item>
            <title>8. High-Availability Cluster</title>
            <link>https://embark.systems/en/rradius/08-ha-cluster/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/08-ha-cluster/</guid>
            <description>&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt; authentication must not stop. Three rradius servers form a cluster, with data replicated to each of them automatically; when any one stops (a failure, an upgrade, a reboot), the other two keep serving, and the NAS move to the nodes that are alive.&lt;/p&gt;&#xA;&lt;p&gt;Example directory: &lt;code&gt;rradius-server/examples/scenarios/ha-cluster/&lt;/code&gt;&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;File&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Contents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;node1.toml&lt;/code&gt;, &lt;code&gt;node2.toml&lt;/code&gt;, &lt;code&gt;node3.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The three nodes&amp;rsquo; configurations, differing only in &lt;code&gt;node_id&lt;/code&gt;, &lt;code&gt;listen&lt;/code&gt; and &lt;code&gt;[metrics] bind&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;raft.secret&lt;/code&gt;, &lt;code&gt;api.secret&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Secrets internal to the cluster, the same on all three&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;nas.secret&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The NAS shared secret, the same on all three&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/1_schema.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Tables, the same as the quick start, &lt;strong&gt;with no demo accounts&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The accounting script reuses &lt;code&gt;../quick-start/accounting.lua&lt;/code&gt; from the quick start, so this chapter covers only the cluster itself. You add accounts yourself; see the steps below.&lt;/p&gt;&#xA;&lt;h2 id=&#34;architecture&#34;&gt;Architecture&#xA;&lt;/h2&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;             NAS (primary: node1, backups: node2, node3)&#xA;              │ RADIUS 1812/1813&#xA;   ┌──────────┼───────────────┐&#xA; node1      node2           node3       each holds all the data&#xA; 10.99.0.1  10.99.0.2       10.99.0.3   (WireGuard addresses)&#xA;   └──── raft 8100 / api 8200 ────┘     nodes talk only over WireGuard&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Writes (&lt;code&gt;sql_execute&lt;/code&gt;, migrations) go through Raft&lt;/strong&gt; and succeed only when a majority (2 of 3) agrees, so every node ends up with the same result.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Reads (&lt;code&gt;sql_query&lt;/code&gt;, the &lt;code&gt;sql&lt;/code&gt; handler) read the local replica.&lt;/strong&gt; They are fast, but may lag slightly behind data just written.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Three is the smallest highly available size:&lt;/strong&gt; with one stopped there is still a majority; with two nodes, stopping one leaves none. Five nodes can lose two at once.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Situation&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Authentication&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Accounting&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;All three up&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Normal&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Normal&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One stopped&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Normal (the NAS ask the others). If the one stopped is the leader, for the few seconds until a new leader is elected, logins that need to write get no reply and accounting writes time out&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Normal; if the leader stopped, those few seconds of accounting go to the spool (possibly once more than needed, see below)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Two stopped, one left&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Authentication that only reads data (&lt;code&gt;sql&lt;/code&gt;, &lt;code&gt;ldap&lt;/code&gt;) reads the local replica and answers as usual; logins that need to write (one-time codes, IP assignment, SIM cards) &lt;strong&gt;get no reply&lt;/strong&gt;, so the NAS retransmits or asks another node. With &lt;code&gt;stop_without_leader_ms&lt;/code&gt; set, past that time even read-only authentication and Status-Server get no reply&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Cannot be written. With the accounting spool, it is written locally and answered, then replayed when the cluster recovers&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;When the database is unusable, there is no reply rather than a reject.&lt;/strong&gt; When a login cannot be decided because the cluster database timed out or there is no leader, RADIUS does not reply and TACACS+ answers ERROR, so NAS and devices ask another node, and users never see &amp;ldquo;wrong password&amp;rdquo;. This is counted in &lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;database&amp;quot;}&lt;/code&gt;. A reject is sent only when the account certainly does not exist or the password is certainly wrong, and every database call of the script succeeded; a reject that follows a failed database call in the script also counts as undecided. When a script returns &lt;code&gt;ignore&lt;/code&gt; after a database failure, the next handler runs as usual. EAP conversations in progress are kept, and continue when the NAS retransmits.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;stop_without_leader_ms&lt;/code&gt; (&lt;code&gt;[cluster]&lt;/code&gt;, unset by default):&lt;/strong&gt; when a node has been without a leader for longer than this, even read-only logins and Status-Server get no reply (TACACS+ answers ERROR), counted as &lt;code&gt;reason=&amp;quot;no_leader&amp;quot;&lt;/code&gt;, so NAS and load balancers treat it as failed and ask the other side of the partition. The price is that when this is the only node left in the cluster, it does not serve either. Accounting is unaffected. Changing it needs a restart.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A node that was disconnected for a long time may need one restart when it comes back.&lt;/strong&gt; When more than 100,000 writes (&lt;code&gt;snapshot_every&lt;/code&gt;) happened while it was away, hiqlite cannot read its own log when it returns; rradius logs &lt;code&gt;exiting so that a restart recovers it&lt;/code&gt; and exits with status 1, and after a restart it catches up with the cluster. So every node needs automatic restarts (systemd &lt;code&gt;Restart=on-failure&lt;/code&gt;, Docker &lt;code&gt;restart: unless-stopped&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Do not restart the last node left.&lt;/strong&gt; The running node keeps serving read-only logins, but once restarted it can only come up when there is a leader (this is how hiqlite behaves), and with &lt;code&gt;migrations_dir&lt;/code&gt; it exits with status 1 after &lt;code&gt;migrations_wait_ms&lt;/code&gt;. Bring the other nodes back first.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A partitioned node reads stale data.&lt;/strong&gt; While it is cut off from the majority, accounts disabled on the other side, NAS removed and keys withdrawn all remain valid on it, and SIGHUP does not help, until the network recovers. If that is unacceptable, set &lt;code&gt;stop_without_leader_ms&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Writes handed to the cluster wait for their outcome.&lt;/strong&gt; When the database is slow (the leader is taking a snapshot, for example) or the leader changes, a write the script has already handed to the cluster is not abandoned midway; it waits for the cluster&amp;rsquo;s answer (at most 30 seconds), so the write is never &amp;ldquo;reported as failed but actually written&amp;rdquo;. Accounting can still be recorded twice, though: with no outcome within 30 seconds, accounting gets no reply and the NAS retransmits; and when a write waits longer than the time limit, later database calls in the same request time out at once, so the record goes to the spool and runs again on replay. Statements with &lt;code&gt;RETURNING&lt;/code&gt; still follow the time limit. So accounting scripts must still be safe to repeat (for example with &lt;code&gt;INSERT OR IGNORE&lt;/code&gt;, keyed on &lt;code&gt;Acct-Session-Id&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;steps&#34;&gt;Steps&#xA;&lt;/h2&gt;&lt;h3 id=&#34;1-prepare-each-host&#34;&gt;1. Prepare each host&#xA;&lt;/h3&gt;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Build the WireGuard network &lt;code&gt;10.99.0.0/24&lt;/code&gt; with the three hosts as peers, and use the firewall so that 8100 and 8200 accept connections only from &lt;code&gt;wg0&lt;/code&gt;. The full steps are in usage section 2.2.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Copy &lt;code&gt;quick-start/&lt;/code&gt; and &lt;code&gt;ha-cluster/&lt;/code&gt; from &lt;code&gt;examples/scenarios/&lt;/code&gt; to each host (for example to &lt;code&gt;/etc/rradius/&lt;/code&gt;), keeping their relative positions so &lt;code&gt;node*.toml&lt;/code&gt; can find &lt;code&gt;../quick-start/accounting.lua&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Add your own accounts:&lt;/strong&gt; set up &lt;code&gt;[accounts]&lt;/code&gt; and add them with &lt;code&gt;rradius-server user add&lt;/code&gt;, which writes to the whole cluster from any node; or add &lt;code&gt;2_users.sql&lt;/code&gt; to &lt;code&gt;ha-cluster/migrations/&lt;/code&gt;, in the format shown in &lt;a class=&#34;link&#34; href=&#34;../02-quick-start/&#34; &gt;chapter 2&lt;/a&gt; and &lt;a class=&#34;link&#34; href=&#34;../19-operations/#accounts-and-data&#34; &gt;chapter 19&lt;/a&gt;. Do not copy the quick start&amp;rsquo;s &lt;code&gt;2_demo_users.sql&lt;/code&gt;; its demo accounts have published passwords.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;code&gt;raft.secret&lt;/code&gt;, &lt;code&gt;api.secret&lt;/code&gt;, &lt;code&gt;nas.secret&lt;/code&gt; and &lt;code&gt;migrations/&lt;/code&gt; must be the same on every host.&lt;/strong&gt; Generate new secrets first, then copy them over:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;umask 077; openssl rand -base64 &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt; &amp;gt; raft.secret; openssl rand -base64 &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt; &amp;gt; api.secret&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;2-start&#34;&gt;2. Start&#xA;&lt;/h3&gt;&lt;p&gt;Start each of the three with its own configuration, in any order:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-server --config /etc/rradius/ha-cluster/node1.toml   &lt;span style=&#34;color:#75715e&#34;&gt;# on node1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-server --config /etc/rradius/ha-cluster/node2.toml   &lt;span style=&#34;color:#75715e&#34;&gt;# on node2&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-server --config /etc/rradius/ha-cluster/node3.toml   &lt;span style=&#34;color:#75715e&#34;&gt;# on node3&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;On the first start, each node waits for the cluster to form (a majority online) and then applies the migrations, waiting at most &lt;code&gt;migrations_wait_ms&lt;/code&gt; (120 seconds in the example). When one comes up before the others, it waits; that is not a failure.&lt;/li&gt;&#xA;&lt;li&gt;Once you see &lt;code&gt;RADIUS Server listening&lt;/code&gt;, it serves.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;NAS configuration:&lt;/strong&gt; set all three as RADIUS servers, as primary/backup or round robin, with the same shared secret. One EAP login must complete on one node (chapter 3), so with EAP use primary/backup, or have a load balancer pin by source.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;3-check&#34;&gt;3. Check&#xA;&lt;/h3&gt;&lt;p&gt;RADIUS uses the nodes&amp;rsquo; physical addresses, not the WireGuard addresses, and requests must come from a host in the client list (&lt;code&gt;10.80.0.0/16&lt;/code&gt; in the example), or there is no reply. From a host in that range, with an account added in item 3 above:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# every node accepts logins (replace 192.0.2.11 to .13 with the three physical addresses)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; ip in 192.0.2.11 192.0.2.12 192.0.2.13; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; radtest &amp;lt;user&amp;gt; &amp;lt;password&amp;gt; $ip &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;$(&lt;/span&gt;cat nas.secret&lt;span style=&#34;color:#66d9ef&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;; &lt;span style=&#34;color:#66d9ef&#34;&gt;done&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# each node&amp;#39;s metrics, on the node or from inside the WireGuard network&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;curl -s http://10.99.0.1:9812/metrics | grep rradius_&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When the management host is not in the client range, add a temporary &lt;code&gt;[[radius.clients]]&lt;/code&gt; with only its address (applied with SIGHUP), and remove it after testing.&lt;/p&gt;&#xA;&lt;p&gt;Send a Start to node1 and a Stop to node3, and the &lt;code&gt;accounting&lt;/code&gt; table has a single row: writes go through the cluster, so it does not matter which node received them.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-configuration-explained&#34;&gt;The configuration explained&#xA;&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;cluster&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;node_id&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;listen&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.99.0.1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;migrations_dir&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;migrations&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;migrations_wait_ms&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;120000&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;cluster&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;nodes&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;id&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;raft&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.99.0.1:8100&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;api&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.99.0.1:8200&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# ...the same for ids 2 and 3&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Every node lists all three nodes (itself included),&lt;/strong&gt; and &lt;code&gt;node_id&lt;/code&gt; says which one it is. There must be a node 1.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Set &lt;code&gt;listen&lt;/code&gt; to the WireGuard address.&lt;/strong&gt; With &lt;code&gt;[[cluster.nodes]]&lt;/code&gt;, the default is &lt;code&gt;0.0.0.0&lt;/code&gt;, which opens raft and api on every interface, and connections on those two ports are not encrypted.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;[lua] query_timeout_ms = 2000&lt;/code&gt;:&lt;/strong&gt; after losing the majority, a write fails only after this long, and only then does accounting go to the spool. The default of 5 seconds is longer than many NAS&amp;rsquo;s retransmission interval, and retransmissions would be dropped as still in progress.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;[radius.accounting_spool]&lt;/code&gt;:&lt;/strong&gt; each node replays only its own spool files, so put it on a persistent disk. &lt;code&gt;rradius_acct_spool_bytes&lt;/code&gt; above 0 means accounting that has not reached the database yet, which is useful for alerts.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;[log] format = &amp;quot;json&amp;quot;&lt;/code&gt;:&lt;/strong&gt; easier to handle when the three nodes send logs to the same collector.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;what-belongs-to-each-node&#34;&gt;What belongs to each node&#xA;&lt;/h3&gt;&lt;p&gt;Tables replicate automatically, but the following do not. Go through them one by one when planning several nodes:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Item&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Per node&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Watch out for&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Configuration files, scripts, dictionary, &lt;code&gt;migrations/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One copy each&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Contents must be the same. After a change, update every node and send each a SIGHUP or restart it&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;raft.secret&lt;/code&gt;, &lt;code&gt;api.secret&lt;/code&gt;, NAS shared secret files&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One copy each&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Contents must be the same&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Key files: &lt;code&gt;aka.key&lt;/code&gt; (chapter 13), &lt;code&gt;dpsk.key&lt;/code&gt; (chapter 12), &lt;code&gt;ticket.seal&lt;/code&gt; (chapter 15)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One copy each&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Contents must be the same, and they are not in the database&lt;/strong&gt;; copy them to every node yourself, and back them up separately&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Certificates, private keys, revocation lists&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One copy each&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;When updating, replace them on every node and send SIGHUP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting spool&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Each replays only its own files&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Put it on a persistent disk; when a node dies, whatever it has not replayed is lost&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP conversations in progress&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Only on the node that received them&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One login must stay on one node&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TLS sessions for resumption&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;By default only on the node that issued them&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;With &lt;code&gt;shared_tickets = true&lt;/code&gt;, EAP-TLS can resume across nodes (chapter 15)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Remembered results: dynamic clients (chapter 14), the key matched for a per-person passphrase (chapter 12), upstreams found by DNS (chapter 11)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Each remembers its own&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;When a table change must take effect at once, send SIGHUP to every node. A partitioned node reads an old replica, and SIGHUP does not help&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Cluster state&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Each sees its own&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_cluster_leader&lt;/code&gt;, &lt;code&gt;rradius_cluster_is_leader&lt;/code&gt;, &lt;code&gt;rradius_cluster_applied_index&lt;/code&gt;, &lt;code&gt;rradius_cluster_seconds_without_leader&lt;/code&gt; in &lt;code&gt;/metrics&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RadSec connections&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;On whichever node they connected to&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Only the node holding a NAS&amp;rsquo;s own connection can send CoA over it (chapter 10)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP-AKA&amp;rsquo; rate limits (only with &lt;code&gt;next_sqn_query&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Counted separately by default&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;With &lt;code&gt;shared_budget = true&lt;/code&gt;, shared across the cluster; with &lt;code&gt;current_sqn_query&lt;/code&gt; and &lt;code&gt;proven_sqn_query&lt;/code&gt; there is no such limit (chapter 13)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Upstream down state&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Each decides on its own&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Metrics, &lt;code&gt;[log.trace]&lt;/code&gt; timings&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Each its own&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Cluster totals are summed by the monitoring system; tracing must be set on every node involved&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;tuning&#34;&gt;Tuning&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;read_connections&lt;/code&gt;:&lt;/strong&gt; the number of connections reading the local database, twice the CPU count by default (at most 32). Logins are mostly reads, and queue when there are not enough connections. Lower it when memory is tight; each connection has its own cache.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;snapshot_every&lt;/code&gt;:&lt;/strong&gt; a node takes a snapshot every time this many writes accumulate, 100000 by default. Lower values make restarts faster after an abnormal exit (power loss, SIGKILL), but with many writes, frequent snapshots slow the service down.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;More nodes do not raise the write ceiling.&lt;/strong&gt; Every write goes through the same leader and waits for a majority to confirm. Logins (reads) are handled by each node on its own, so more nodes are faster. Between separate hosts, every write also waits for a round trip between nodes.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Measurements and explanations for these three are in usage section 2.2. Changing any of them needs a restart.&lt;/p&gt;&#xA;&lt;h2 id=&#34;day-to-day-operations&#34;&gt;Day-to-day operations&#xA;&lt;/h2&gt;&lt;h3 id=&#34;upgrades-and-reboots&#34;&gt;Upgrades and reboots&#xA;&lt;/h3&gt;&lt;p&gt;One at a time: stop a node → upgrade → start → confirm it is back in the cluster → do the next. Stopping only one at a time keeps the cluster&amp;rsquo;s majority throughout.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Confirming it is back:&lt;/strong&gt; the log says &lt;code&gt;cluster node N has caught up with the cluster&lt;/code&gt;, and &lt;code&gt;rradius_cluster_leader&lt;/code&gt; in &lt;code&gt;/metrics&lt;/code&gt; is 1. On startup a node waits for a leader, then for its local replica to catch up with the data the cluster has written, before it starts answering, so accounts added while it was down are visible from its very first answer. The wait is limited by &lt;code&gt;migrations_wait_ms&lt;/code&gt;; without &lt;code&gt;migrations_dir&lt;/code&gt;, if the wait runs out, it logs a warning and serves anyway (possibly with stale data).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Stop the leader last.&lt;/strong&gt; Do the node whose &lt;code&gt;rradius_cluster_is_leader&lt;/code&gt; is 1 last: stopping the leader causes an election, and writes during those seconds time out.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Stop with SIGTERM or Ctrl+C,&lt;/strong&gt; which closes the database cleanly. With several nodes this takes about 10 seconds (hiqlite waits 9.5 seconds first), so use &lt;code&gt;docker stop -t 30&lt;/code&gt; or set &lt;code&gt;stop_grace_period: 30s&lt;/code&gt;. SIGKILL (&lt;code&gt;kill -9&lt;/code&gt;, a container being forced to stop) does not, and on the next start the local database is rebuilt from the other nodes, which is slower.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;adding-a-migration&#34;&gt;Adding a migration&#xA;&lt;/h3&gt;&lt;ol&gt;&#xA;&lt;li&gt;Put the new file (for example &lt;code&gt;3_add_column.sql&lt;/code&gt;) on &lt;strong&gt;every&lt;/strong&gt; node.&lt;/li&gt;&#xA;&lt;li&gt;Restart the nodes one by one. The first one to restart applies it to the whole cluster; the others see it already applied when they restart.&lt;/li&gt;&#xA;&lt;li&gt;Do not start nodes whose directories differ at the same time; see usage section 2.5.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;replacing-a-failed-node&#34;&gt;Replacing a failed node&#xA;&lt;/h3&gt;&lt;p&gt;Start the new host with the same &lt;code&gt;node_id&lt;/code&gt;, the same addresses and configuration, and an empty &lt;code&gt;data/&lt;/code&gt;; it takes the data from the other nodes. &lt;strong&gt;This procedure has not been tested for real;&lt;/strong&gt; rehearse it in a test environment first. Adding or removing nodes while running is not supported yet.&lt;/p&gt;&#xA;&lt;h2 id=&#34;common-problems&#34;&gt;Common problems&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No &lt;code&gt;listening&lt;/code&gt; after startup, and finally an exit with status 1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No majority reached: the other nodes are not started, WireGuard does not connect, a firewall blocks it, or &lt;code&gt;raft.secret&lt;/code&gt; differs&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Login results on one node differ from the others&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;That node&amp;rsquo;s replica lags (compare &lt;code&gt;rradius_cluster_applied_index&lt;/code&gt; with the others), it is partitioned (&lt;code&gt;rradius_cluster_leader&lt;/code&gt; is 0), or its &lt;code&gt;migrations/&lt;/code&gt; differs; check its log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting slows down after stopping one node&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;It should not if the stopped node was not the leader. If it was the leader, writes time out and go to the spool during the few seconds of the election. With two stopped, after 5 seconds without a leader writes fail at once and go to the spool&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Some logins get no reply, and &lt;code&gt;reason=&amp;quot;database&amp;quot;&lt;/code&gt; keeps rising&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;That node cannot reach the cluster database (no leader, partitioned) or the database is too slow. Check &lt;code&gt;rradius_cluster_leader&lt;/code&gt; and the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One node does not answer at all, and &lt;code&gt;reason=&amp;quot;no_leader&amp;quot;&lt;/code&gt; keeps rising&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;stop_without_leader_ms&lt;/code&gt; is set and that node has been without a leader too long. Restore the network between it and the other nodes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wi-Fi logins occasionally fail, with the log mentioning &lt;code&gt;State&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The second half of an EAP conversation reached another node. Change the NAS to primary/backup, or have the load balancer pin by source&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;All SIM card or per-person passphrase logins fail on one node&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;That node&amp;rsquo;s key file (&lt;code&gt;aka.key&lt;/code&gt;, &lt;code&gt;dpsk.key&lt;/code&gt;) differs from the others&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After a table change, some nodes pick it up at once and some do not&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Each node remembers the results it looked up. Send SIGHUP to every node&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;</description>
        </item><item>
            <title>9. Forwarding by Realm</title>
            <link>https://embark.systems/en/rradius/09-realm-proxy/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/09-realm-proxy/</guid>
            <description>&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt; a branch office&amp;rsquo;s rradius serves the branch&amp;rsquo;s NAS.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The branch&amp;rsquo;s own accounts (&lt;code&gt;branch1&lt;/code&gt;, or &lt;code&gt;branch1@branch.example.com&lt;/code&gt;) are authenticated locally.&lt;/li&gt;&#xA;&lt;li&gt;Visitors from a partner log in as &lt;code&gt;alice@partner.example.org&lt;/code&gt; and are forwarded to the partner&amp;rsquo;s RADIUS servers. The partner has two; when the first does not answer, the second is used.&lt;/li&gt;&#xA;&lt;li&gt;Headquarters accounts (&lt;code&gt;@hq.example.com&lt;/code&gt; and subdomains like &lt;code&gt;@eng.hq.example.com&lt;/code&gt;) are forwarded to headquarters.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Example directory: &lt;code&gt;rradius-server/examples/scenarios/realm-proxy/&lt;/code&gt;&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;File&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Contents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[proxy]&lt;/code&gt; and the chain for local accounts&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;partner.secret&lt;/code&gt;, &lt;code&gt;hq.secret&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Shared secrets with the upstreams&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Local accounts (same structure as the quick start) and the demo account branch1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;how-forwarding-is-decided&#34;&gt;How forwarding is decided&#xA;&lt;/h2&gt;&lt;p&gt;The realm is the part of &lt;code&gt;User-Name&lt;/code&gt; after the last &lt;code&gt;@&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;alice@partner.example.org  ─► exact realm &amp;#34;partner.example.org&amp;#34; ─► partner-1, then partner-2 if no answer&#xA;bob@eng.hq.example.com     ─► &amp;#34;*.hq.example.com&amp;#34; ────────────────► hq-1&#xA;carol@hq.example.com       ─► &amp;#34;hq.example.com&amp;#34; ──────────────────► hq-1&#xA;branch1@branch.example.com ─► no realm matches ──────────────────► local chain&#xA;branch1                    ─► no @ ──────────────────────────────► local chain&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Matching order:&lt;/strong&gt; exact → the &lt;code&gt;*.&lt;/code&gt; entry that covers it (longest first) → &lt;code&gt;*&lt;/code&gt;, ignoring case. &lt;code&gt;*.hq.example.com&lt;/code&gt; does not cover &lt;code&gt;hq.example.com&lt;/code&gt; itself, so the example lists both.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Do not add &lt;code&gt;*&lt;/code&gt; casually.&lt;/strong&gt; It forwards every name with an &lt;code&gt;@&lt;/code&gt;, including your own accounts like &lt;code&gt;branch1@branch.example.com&lt;/code&gt;. &lt;code&gt;*&lt;/code&gt; is a suitable default exit only when there are no local accounts with a realm.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Forwarded requests are not handled locally:&lt;/strong&gt; no chain, no script, no EAP. The whole EAP conversation of 802.1X is forwarded as is, and the keys come from the upstream.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Accounting is forwarded by realm too,&lt;/strong&gt; and the NAS gets its reply only after the upstream answers. It is not written to the local accounting spool (the one in &lt;a class=&#34;link&#34; href=&#34;../07-broadband/#the-accounting-spool&#34; &gt;chapter 7&lt;/a&gt; only covers accounting the database cannot take). To keep a record when no upstream answers, use &lt;code&gt;[proxy.accounting_spool]&lt;/code&gt;; see &lt;a class=&#34;link&#34; href=&#34;../11-roaming/#spooling-accounting-when-every-upstream-is-down&#34; &gt;chapter 11&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;steps&#34;&gt;Steps&#xA;&lt;/h2&gt;&lt;p&gt;Local testing needs a server to play the &amp;ldquo;partner&amp;rdquo;. The simplest is a second copy of the quick start on other ports:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Copy the whole of &lt;code&gt;quick-start/&lt;/code&gt; outside the repository (for example &lt;code&gt;cp -R examples/scenarios/quick-start /tmp/partner&lt;/code&gt;), and in &lt;code&gt;/tmp/partner/rradius.toml&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Change &lt;code&gt;dictionary&lt;/code&gt; to the absolute path of &lt;code&gt;share/dictionary&lt;/code&gt; in the repository.&lt;/li&gt;&#xA;&lt;li&gt;Set &lt;code&gt;auth_port = 11812&lt;/code&gt;, &lt;code&gt;acct_port = 11813&lt;/code&gt; and &lt;code&gt;[metrics] port = 19812&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Add &lt;code&gt;listen = &amp;quot;127.0.0.1&amp;quot;&lt;/code&gt; to &lt;code&gt;[cluster]&lt;/code&gt;, and add &lt;code&gt;[[cluster.nodes]]&lt;/code&gt; at the end (&lt;code&gt;id = 1&lt;/code&gt;, &lt;code&gt;raft = &amp;quot;127.0.0.1:18100&amp;quot;&lt;/code&gt;, &lt;code&gt;api = &amp;quot;127.0.0.1:18200&amp;quot;&lt;/code&gt;) to stay off this machine&amp;rsquo;s 8100 and 8200. &lt;strong&gt;&lt;code&gt;listen&lt;/code&gt; is a must:&lt;/strong&gt; once nodes are listed, the default is to listen on every interface, and the demo &lt;code&gt;api.secret&lt;/code&gt; is public.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Then start it.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;In &lt;code&gt;realm-proxy/rradius.toml&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Change the &lt;code&gt;address&lt;/code&gt; of &lt;code&gt;branch-nas&lt;/code&gt; to &lt;code&gt;127.0.0.1&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Change &lt;code&gt;partner-2&lt;/code&gt; to &lt;code&gt;address = &amp;quot;127.0.0.1&amp;quot;&lt;/code&gt;, &lt;code&gt;auth_port = 11812&lt;/code&gt;, &lt;code&gt;acct_port = 11813&lt;/code&gt;, with &lt;code&gt;secret_file&lt;/code&gt; pointing to &lt;code&gt;../quick-start/localhost.secret&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Leave &lt;code&gt;partner-1&lt;/code&gt; at its original address to simulate &amp;ldquo;the first server does not answer&amp;rdquo;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Start realm-proxy:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./target/release/rradius-server --config examples/scenarios/realm-proxy/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Test:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;S&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;branch-nas-secret-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radtest Branch1@branch.example.com branch1-password 127.0.0.1 &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; $S   &lt;span style=&#34;color:#75715e&#34;&gt;# local, Filter-Id = branch&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radtest bob@partner.example.org bob-password 127.0.0.1 &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; $S          &lt;span style=&#34;color:#75715e&#34;&gt;# forwarded to partner, returns Welcome, bob&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The second is a few seconds slower: partner-1 got no answer within &lt;code&gt;timeout_ms × attempts&lt;/code&gt; (3 seconds × 2), was marked down, and partner-2 was used. Later requests go straight to partner-2, and every 10 seconds a Status-Server checks whether partner-1 is back. The first &lt;code&gt;radtest&lt;/code&gt; may time out before the answer arrives; sending it again succeeds.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;the-configuration-explained&#34;&gt;The configuration explained&#xA;&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;proxy&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;timeout_ms&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;3000&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;attempts&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;check_interval_ms&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;10000&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;proxy&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;servers&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;partner-1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;198.51.100.10&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;auth_port&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;1812&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;acct_port&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;1813&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;secret_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;partner.secret&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;proxy&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;realms&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;partner.example.org&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;servers&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;partner-1&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;partner-2&amp;#34;&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;strip_realm&lt;/span&gt; = &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;servers&lt;/code&gt; are tried in order,&lt;/strong&gt; those not marked down first. Authentication and accounting ports are judged separately.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Get the timing right:&lt;/strong&gt; one server waits at most &lt;code&gt;timeout_ms × attempts&lt;/code&gt;. That must be shorter than the NAS&amp;rsquo;s timeout, or the NAS gives up first; and &lt;code&gt;timeout_ms&lt;/code&gt; must be longer than any deliberate delay before the upstream rejects (FreeRADIUS, for example, waits 1 second by default before an Access-Reject), or wrong passwords are mistaken for an upstream that does not answer.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;strip_realm = true&lt;/code&gt;:&lt;/strong&gt; the partner only knows &lt;code&gt;alice&lt;/code&gt;, so &lt;code&gt;@partner.example.org&lt;/code&gt; is removed before sending. MS-CHAPv2 (not inside EAP) responses are computed with the full name; keep it &lt;code&gt;false&lt;/code&gt; then.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Upstream replies must carry a Message-Authenticator&lt;/strong&gt; (&lt;code&gt;require_message_authenticator = true&lt;/code&gt;, the default). Set &lt;code&gt;false&lt;/code&gt; only for old upstreams that do not send it; not recommended.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When none answer, the NAS gets no reply.&lt;/strong&gt; An Access-Reject would make the user think the password is wrong, so the NAS is left to time out and use its own backup.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;How a down upstream comes back:&lt;/strong&gt; every &lt;code&gt;check_interval_ms&lt;/code&gt; a Status-Server is sent, and an answer restores it. For upstreams that do not answer Status-Server, set &lt;code&gt;status_check = false&lt;/code&gt; on that server; it is then simply treated as restored when the time is up, and the next request decides.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Noticing a down server earlier (&lt;code&gt;probe_interval_ms&lt;/code&gt;):&lt;/strong&gt; by default an upstream is marked down only when real requests time out, so the first batch of requests after it fails all have to wait first. With &lt;code&gt;probe_interval_ms = 30000&lt;/code&gt; in &lt;code&gt;[[proxy.servers]]&lt;/code&gt;, once that server has given no answer of any kind for more than 30 seconds, Status-Server is sent actively, and 3 unanswered in a row mark it down. Backup servers that normally carry no traffic need this most. See &lt;a class=&#34;link&#34; href=&#34;../11-roaming/#national-proxy&#34; &gt;chapter 11&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;local-accounts&#34;&gt;Local accounts&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;username&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;strip_realm&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;suffix&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;lowercase&lt;/span&gt; = &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;Branch1@branch.example.com&lt;/code&gt; matches no realm, so it stays local, and the account lookup uses &lt;code&gt;branch1&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;roaming-between-organisations-radsec-upstreams&#34;&gt;Roaming between organisations: RadSec upstreams&#xA;&lt;/h2&gt;&lt;p&gt;When the partner is another organisation across the internet, do not forward over UDP; use RadSec (RADIUS over TLS): the whole packet is inside TLS, and both sides verify each other by certificate.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Prepare certificates.&lt;/strong&gt; Get the CA that issues the partner&amp;rsquo;s server certificate from the partner (or the roaming federation) and save it as &lt;code&gt;partner-ca.pem&lt;/code&gt;. When the partner verifies rradius, also prepare a certificate and private key issued by a CA the partner trusts (&lt;code&gt;our-cert.pem&lt;/code&gt;, &lt;code&gt;our-cert.key&lt;/code&gt;). Ask for the name on the partner&amp;rsquo;s server certificate, such as &lt;code&gt;radius.partner.example.org&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Change the upstream configuration.&lt;/strong&gt; Turn &lt;code&gt;partner-1&lt;/code&gt; into RadSec:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;proxy&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;servers&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;partner-1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;198.51.100.10&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;transport&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;tls&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;tls_name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;radius.partner.example.org&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ca_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;partner-ca.pem&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;cert_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;our-cert.pem&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;key_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;our-cert.key&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;Without &lt;code&gt;port&lt;/code&gt; it is 2083, used for both authentication and accounting; &lt;code&gt;auth_port&lt;/code&gt; and &lt;code&gt;acct_port&lt;/code&gt; can no longer be set.&lt;/li&gt;&#xA;&lt;li&gt;No &lt;code&gt;secret&lt;/code&gt; is needed: the RadSec shared secret is fixed as &lt;code&gt;radsec&lt;/code&gt; (RFC 6614), and the partner uses the same. Set &lt;code&gt;secret&lt;/code&gt; or &lt;code&gt;secret_file&lt;/code&gt; only when the partner specifies another.&lt;/li&gt;&#xA;&lt;li&gt;A realm&amp;rsquo;s &lt;code&gt;servers&lt;/code&gt; can mix RadSec and UDP upstreams, with failover in order as usual.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Check and start:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./target/release/rradius-server --check --config examples/scenarios/realm-proxy/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;An unreadable certificate file, a private key that does not match its certificate, or a missing &lt;code&gt;tls_name&lt;/code&gt; or &lt;code&gt;ca_file&lt;/code&gt; is reported here, naming the upstream and the field.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Confirm:&lt;/strong&gt; send a login that is forwarded to the partner. The log shows &lt;code&gt;proxy server partner-1: connected to 198.51.100.10:2083&lt;/code&gt;, and &lt;code&gt;rradius_proxy_connections_total{server=&amp;quot;partner-1&amp;quot;,result=&amp;quot;connected&amp;quot;}&lt;/code&gt; in &lt;code&gt;/metrics&lt;/code&gt; is 1. Later requests use the same connection, without a new handshake each time.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Differences from UDP upstreams:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;No retransmission.&lt;/strong&gt; TCP guarantees delivery, so a request is sent once and &lt;code&gt;attempts&lt;/code&gt; does not apply; with no answer within &lt;code&gt;timeout_ms&lt;/code&gt;, the next server is used. One server waits at most one &lt;code&gt;timeout_ms&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Authentication and accounting are marked down together,&lt;/strong&gt; because there is one port and one connection.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;One connection has at most 256 requests waiting for answers at once;&lt;/strong&gt; more queue. With a partner far away and busy, this is the ceiling (about 25,000 requests per second at a 10 ms round trip, an estimate). Measured on one machine, one connection handles about 100,000 requests per second, around a tenth less than a UDP upstream; see usage section 2.13.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;CoA uses this connection too:&lt;/strong&gt; Disconnect and CoA forwarded by realm to a RadSec upstream are sent on the same connection. The partner must be willing to receive them on it; check with the partner first.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Revocation lists (&lt;code&gt;crl_file&lt;/code&gt;) are read only at startup and on SIGHUP;&lt;/strong&gt; send SIGHUP when the partner replaces its list.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;before-going-live&#34;&gt;Before going live&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;UDP upstreams must be on a trusted network&lt;/strong&gt; (a leased line, a VPN), because RADIUS over UDP encrypts only the password. Across the internet, use RadSec upstreams (see the previous section).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Upstream addresses must be IPs,&lt;/strong&gt; not host names.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Shared secrets with UDP upstreams&lt;/strong&gt; should differ per organisation and be long.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Loops:&lt;/strong&gt; when two servers forward to each other, rradius drops and logs requests that carry its own Proxy-State.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Monitoring:&lt;/strong&gt; request counts, timeouts and down state of every upstream are in &lt;code&gt;/metrics&lt;/code&gt;; see usage section 2.8.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Reloading (SIGHUP)&lt;/strong&gt; applies changes to &lt;code&gt;[proxy]&lt;/code&gt;, and every upstream is treated as healthy again.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;CoA can be forwarded by realm too:&lt;/strong&gt; when no local NAS is found and the realm of &lt;code&gt;User-Name&lt;/code&gt; matches an entry, Disconnect and CoA requests go to that realm&amp;rsquo;s upstreams (to the upstream&amp;rsquo;s &lt;code&gt;coa_port&lt;/code&gt;, 3799 by default); see usage section 4.8.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Not available yet:&lt;/strong&gt; round robin, routing decided by a script, DTLS, TLS-PSK. See usage section 2.13.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;more-approaches&#34;&gt;More approaches&#xA;&lt;/h2&gt;&lt;p&gt;This chapter covers the most basic &amp;ldquo;failover in order&amp;rdquo;. The following are explained in &lt;a class=&#34;link&#34; href=&#34;../11-roaming/&#34; &gt;chapter 11&lt;/a&gt; with a roaming federation scenario:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Need&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Approach&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Spread requests over several upstreams, optionally weighted&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;balance = &amp;quot;load-balance&amp;quot;&lt;/code&gt;, &lt;code&gt;weight&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Too many upstreams to configure one by one&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[proxy.discovery]&lt;/code&gt;: look up the other side&amp;rsquo;s RadSec servers in DNS by realm&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Forwarded accounting must not be lost when no upstream answers&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[proxy.accounting_spool]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The other side also sends requests in&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius.tls]&lt;/code&gt;; see &lt;a class=&#34;link&#34; href=&#34;../10-radsec/&#34; &gt;chapter 10&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;common-problems&#34;&gt;Common problems&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Local accounts with a realm are forwarded&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;There is a &lt;code&gt;*&lt;/code&gt;, or a &lt;code&gt;*.&lt;/code&gt; entry covering your own domain&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Forwarded logins are always slow&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The first upstream never answers requests but does answer the Status-Server checks (it answers Status-Server but does not handle authentication). Remove it from &lt;code&gt;servers&lt;/code&gt;, or set &lt;code&gt;status_check = false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After a login with a wrong password, the upstream is marked down&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;timeout_ms&lt;/code&gt; is shorter than the upstream&amp;rsquo;s delay before rejecting&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A RadSec upstream never connects, with &lt;code&gt;cannot connect ... TLS:&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The partner&amp;rsquo;s certificate is not signed by the CA in &lt;code&gt;ca_file&lt;/code&gt; or is not valid for &lt;code&gt;tls_name&lt;/code&gt;, or the partner does not accept the certificate rradius presents (&lt;code&gt;cert_file&lt;/code&gt; not set, or not signed by a CA the partner trusts). The log message says which&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A RadSec upstream connects but every request times out&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The shared secret is not &lt;code&gt;radsec&lt;/code&gt;, so the partner&amp;rsquo;s replies fail verification: ask which secret the partner uses, and set it in &lt;code&gt;secret&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;</description>
        </item><item>
            <title>10. RadSec: NAS Across Untrusted Networks</title>
            <link>https://embark.systems/en/rradius/10-radsec/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/10-radsec/</guid>
            <description>&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt; the internet, or a stretch of network you do not trust, lies between the NAS and rradius. RADIUS over UDP protects only part of its contents, with the shared secret and MD5, and is not fit to cross such a network directly. Use RadSec instead (RADIUS over TLS, RFC 6614): the whole packet is inside TLS, and both sides verify each other by certificate.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The wireless controller at headquarters&lt;/strong&gt; has a fixed address and is recognised by certificate plus address.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The branch gateways&lt;/strong&gt; are behind NAT with no fixed address, and are recognised by certificate alone.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;To disconnect a user at a branch,&lt;/strong&gt; rradius cannot reach the gateway behind NAT, so the request travels over the RadSec connection the gateway opened itself.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The management system at headquarters&lt;/strong&gt; also connects in over RadSec, and sends disconnect requests on the same connection.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Example directory: &lt;code&gt;rradius-server/examples/scenarios/radsec/&lt;/code&gt;&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;File&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Contents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius.tls]&lt;/code&gt;, three kinds of client, &lt;code&gt;[radius.coa]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;make-certs.sh&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Creates a demo CA, a server certificate and three client certificates&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounts (same structure as the quick start) and the demo account alice&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;hq-wlc.secret&lt;/code&gt;, &lt;code&gt;helpdesk.secret&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The shared secret for the controller over UDP, and the shared secret the help desk uses to send CoA&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;how-it-differs-from-udp&#34;&gt;How it differs from UDP&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;UDP&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;RadSec&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Ports&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;authentication 1812, accounting 1813&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One TCP port, 2083; authentication, accounting and Status-Server share one connection&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How the NAS is recognised&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Source address&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Source address, certificate, or both&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Shared secret&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Each NAS&amp;rsquo;s own&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Fixed as &lt;code&gt;radsec&lt;/code&gt; (set by the RFC); protection comes from TLS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Message-Authenticator settings&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Apply&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Do not apply; TLS guarantees integrity&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Once connected, requests take exactly the same path as over UDP: the same authentication chains, scripts, EAP, forwarding by realm and accounting spool.&lt;/p&gt;&#xA;&lt;h2 id=&#34;steps&#34;&gt;Steps&#xA;&lt;/h2&gt;&lt;h3 id=&#34;1-create-the-certificates&#34;&gt;1. Create the certificates&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd rradius-server/examples/scenarios/radsec&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./make-certs.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;certs/&lt;/code&gt; then holds &lt;code&gt;ca.pem&lt;/code&gt;, the server&amp;rsquo;s &lt;code&gt;server.pem&lt;/code&gt;/&lt;code&gt;server.key&lt;/code&gt; (name &lt;code&gt;radius.example.net&lt;/code&gt;), and three client certificates: &lt;code&gt;hq-wlc&lt;/code&gt;, &lt;code&gt;branch-gw&lt;/code&gt; and &lt;code&gt;noc&lt;/code&gt;. &lt;strong&gt;For testing only.&lt;/strong&gt; In production, use a private CA dedicated to issuing NAS certificates (see &amp;ldquo;Before going live&amp;rdquo; below).&lt;/p&gt;&#xA;&lt;h3 id=&#34;2-start&#34;&gt;2. Start&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd ../../..   &lt;span style=&#34;color:#75715e&#34;&gt;# back to rradius-server&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./target/release/rradius-server --config examples/scenarios/radsec/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The log shows &lt;code&gt;RadSec listening on 0.0.0.0:2083&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;3-check-the-handshake&#34;&gt;3. Check the handshake&#xA;&lt;/h3&gt;&lt;p&gt;Before any NAS is available, connect once with &lt;code&gt;openssl&lt;/code&gt; using the branch gateway&amp;rsquo;s certificate to confirm the certificate part works:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd examples/scenarios/radsec&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;openssl s_client -connect 127.0.0.1:2083 -servername radius.example.net &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  -CAfile certs/ca.pem -cert certs/branch-gw.pem -key certs/branch-gw.key&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;Verify return code: 0 (ok)&lt;/code&gt; means both sides&amp;rsquo; certificates passed. Press Ctrl+C to finish.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;result=&amp;quot;accepted&amp;quot;&lt;/code&gt; in &lt;code&gt;curl -s http://127.0.0.1:9812/metrics | grep rradius_radsec_connections&lt;/code&gt; increases by 1.&lt;/li&gt;&#xA;&lt;li&gt;Connect again with the &lt;code&gt;hq-wlc&lt;/code&gt; certificate: the handshake succeeds, but the connection is closed at once, and the log says &lt;code&gt;its certificate fits no client&lt;/code&gt;. The &lt;code&gt;hq-wlc&lt;/code&gt; client has an &lt;code&gt;address&lt;/code&gt;, so it only accepts connections from &lt;code&gt;10.30.0.10&lt;/code&gt;, and none of the clients recognised by certificate alone has that name.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;code&gt;openssl&lt;/code&gt; can only check the handshake. Real logins have to come from a NAS or proxy that speaks RadSec; the automated test does this part in code: it connects with the &lt;code&gt;branch-gw&lt;/code&gt; certificate, logs alice in (Access-Accept with &lt;code&gt;Filter-Id = &amp;quot;staff&amp;quot;&lt;/code&gt;) and sends accounting.&lt;/p&gt;&#xA;&lt;h3 id=&#34;4-nas-configuration&#34;&gt;4. NAS configuration&#xA;&lt;/h3&gt;&lt;p&gt;Every NAS is configured differently, but the items to set are the same:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Item&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Value&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Server address and port&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;rradius&amp;rsquo;s address, TCP 2083&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Transport&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RadSec, RADIUS over TLS, or &amp;ldquo;TLS&amp;rdquo;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Trusted CA&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The CA that issues rradius&amp;rsquo;s server certificate (&lt;code&gt;ca.pem&lt;/code&gt; in the example)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Server name&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The name on the server certificate (&lt;code&gt;radius.example.net&lt;/code&gt; in the example)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Client certificate and private key&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;This NAS&amp;rsquo;s own (&lt;code&gt;branch-gw.pem&lt;/code&gt;, &lt;code&gt;branch-gw.key&lt;/code&gt; in the example)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Shared secret&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radsec&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;the-configuration-explained&#34;&gt;The configuration explained&#xA;&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;tls&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;bind&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;0.0.0.0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;port&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;2083&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;cert_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;certs/server.pem&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;key_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;certs/server.key&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;client_ca_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;certs/ca.pem&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;min_tls_version&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;1.2&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;network_clients_need_tls_name&lt;/span&gt; = &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;client_ca_file&lt;/code&gt; is the CA that issues NAS certificates.&lt;/strong&gt; rradius trusts only it, not the system&amp;rsquo;s root certificates. A NAS with no certificate, or one not signed by it, fails the handshake.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;min_tls_version&lt;/code&gt;&lt;/strong&gt; is &lt;code&gt;&amp;quot;1.2&amp;quot;&lt;/code&gt; by default. When every NAS supports TLS 1.3, it can be &lt;code&gt;&amp;quot;1.3&amp;quot;&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;[radius]&lt;/code&gt; is required;&lt;/strong&gt; RadSec is a section under it. UDP ports 1812 and 1813 stay open as usual; to keep UDP from being reached from outside, block it with the firewall.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;three-kinds-of-client&#34;&gt;Three kinds of client&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;clients&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;hq-wlc&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.30.0.10&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;tls_name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;hq-wlc.example.net&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;secret_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;hq-wlc.secret&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;clients&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;branch-gw&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;tls_name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;branch-gw.example.net&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;secret&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;unused-on-radsec-change-me&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;max_radsec_connections&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Setting&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;How it matches&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Suits&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;address&lt;/code&gt; only&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Source address. Any certificate from the same CA can act as this client&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A CA that signs only for NAS, fixed addresses&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;address&lt;/code&gt; plus &lt;code&gt;tls_name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Source address, and the certificate must be valid for this name&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;NAS with fixed addresses, &lt;code&gt;hq-wlc&lt;/code&gt; in the example&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;tls_name&lt;/code&gt; only&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The certificate must be valid for this name, from an address no other entry covers&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;NAS behind NAT whose addresses change, &lt;code&gt;branch-gw&lt;/code&gt; in the example&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;tls_name&lt;/code&gt; is matched against the certificate&amp;rsquo;s DNS SAN,&lt;/strong&gt; wildcards on the certificate included; the CN is not used.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The source address comes first.&lt;/strong&gt; When the source falls inside an entry with an &lt;code&gt;address&lt;/code&gt;, that entry handles it, and the certificate does not move the connection to another client. So the source of a NAS recognised by certificate alone must not fall inside another client&amp;rsquo;s range.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;secret&lt;/code&gt; is still required.&lt;/strong&gt; RadSec does not use it; it is used only when a client with an &lt;code&gt;address&lt;/code&gt; comes over UDP.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A client with only &lt;code&gt;tls_name&lt;/code&gt; can only use RadSec;&lt;/strong&gt; UDP never matches it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;max_radsec_connections&lt;/code&gt;&lt;/strong&gt; limits how many connections this client may have open at once. Without it, one certificate can use up all of &lt;code&gt;[radius.tls]&lt;/code&gt;&amp;rsquo;s &lt;code&gt;max_connections&lt;/code&gt; (1024 by default).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Be careful with range clients.&lt;/strong&gt; When &lt;code&gt;address&lt;/code&gt; is a range and there is no &lt;code&gt;tls_name&lt;/code&gt;, any address in the range can connect with any certificate from this CA. The example sets &lt;code&gt;network_clients_need_tls_name = true&lt;/code&gt;, so such clients do not accept RadSec connections (they can still use UDP).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;the-script-knows-which-nas-it-is&#34;&gt;The script knows which NAS it is&#xA;&lt;/h3&gt;&lt;p&gt;When a request comes over RadSec, the script can read the connection&amp;rsquo;s certificate: &lt;code&gt;radsec_subject&lt;/code&gt; is the subject as text, and &lt;code&gt;radsec_subject_attrs.CN[1]&lt;/code&gt; is one of its fields. It says &lt;strong&gt;who the NAS is&lt;/strong&gt;, not who the user is. For UDP requests and replayed accounting it is &lt;code&gt;nil&lt;/code&gt;. See usage section 4.2.&lt;/p&gt;&#xA;&lt;h2 id=&#34;disconnects-over-the-nass-own-connection&#34;&gt;Disconnects over the NAS&amp;rsquo;s own connection&#xA;&lt;/h2&gt;&lt;p&gt;The branch gateway is behind NAT, so rradius has no address to send a Disconnect-Request to. When a client with only &lt;code&gt;tls_name&lt;/code&gt; has a connection open, rradius sends it &lt;strong&gt;on the RadSec connection it opened&lt;/strong&gt; instead.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;coa_timeout_ms&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;2000&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;coa&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;bind&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;0.0.0.0&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;port&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;3799&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;coa&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;clients&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;helpdesk&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.30.0.50&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;secret_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;helpdesk.secret&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The help desk system (&lt;code&gt;helpdesk&lt;/code&gt;) sends the request over UDP to rradius&amp;rsquo;s port 3799, naming the NAS with &lt;code&gt;NAS-Identifier&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Name=alice,NAS-Identifier=branch-gw,Acct-Session-Id=rs-1&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  | radclient 127.0.0.1:3799 disconnect helpdesk-coa-secret-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;(For local testing, change the &lt;code&gt;address&lt;/code&gt; of &lt;code&gt;helpdesk&lt;/code&gt; to &lt;code&gt;127.0.0.1&lt;/code&gt; first.)&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;How the NAS is found:&lt;/strong&gt; the request&amp;rsquo;s &lt;code&gt;NAS-IP-Address&lt;/code&gt;, &lt;code&gt;NAS-IPv6-Address&lt;/code&gt; and &lt;code&gt;NAS-Identifier&lt;/code&gt; are matched, in that order, against client addresses or &lt;code&gt;name&lt;/code&gt;s. &lt;code&gt;branch-gw&lt;/code&gt; has no address, so its name is used.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;It is sent once on the connection,&lt;/strong&gt; waiting &lt;code&gt;coa_timeout_ms&lt;/code&gt;. TCP does not lose packets, so &lt;code&gt;coa_attempts&lt;/code&gt; is not used.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When the gateway has no connection open,&lt;/strong&gt; the answer is a NAK with &lt;code&gt;Error-Cause&lt;/code&gt; 502 (Request Not Routable). The command above gets exactly this when no gateway is connected.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The NAS must be willing to receive Disconnect and CoA on the connection it opened.&lt;/strong&gt; Not every device supports this; check with the vendor first.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Scripts can send them too:&lt;/strong&gt; &lt;code&gt;send_disconnect(&#39;branch-gw&#39;, {...})&lt;/code&gt; uses the same connection, and raises an error when there is none. The command-line &lt;code&gt;rradius-server disconnect&lt;/code&gt; does not run inside the server and cannot reach the connection, so it cannot target this kind of client.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;In a cluster, only the node holding that connection can send.&lt;/strong&gt; When the gateway is connected to node1, the request must go to node1; sent to another node it gets 502.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;the-management-system-over-radsec-too-coa_sender&#34;&gt;The management system over RadSec too: &lt;code&gt;coa_sender&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;clients&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;noc&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;tls_name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;noc.example.net&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;secret&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;unused-on-radsec-change-me&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;coa_sender&lt;/span&gt; = &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When the sender already connects to rradius over RadSec, set &lt;code&gt;coa_sender = true&lt;/code&gt; and it can send Disconnect-Request and CoA-Request on the same connection, with no separate UDP or shared secret. Answers are written back on the same connection.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Off by default.&lt;/strong&gt; Senders and NAS share port 2083, so a firewall cannot tell them apart; this setting is what decides who may disconnect users. Requests from clients without it are dropped, with &lt;code&gt;is not a coa_sender&lt;/code&gt; in the log.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Requires &lt;code&gt;[radius.coa]&lt;/code&gt; and &lt;code&gt;[radius.tls]&lt;/code&gt;.&lt;/strong&gt; When requests come only over RadSec, &lt;code&gt;[[radius.coa.clients]]&lt;/code&gt; can be left out, but the UDP port 3799 is still opened.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For the full rules (session lookup when only a user name is given, forwarding by realm to upstreams, the various NAKs), see &lt;a class=&#34;link&#34; href=&#34;../07-broadband/#coa-forwarding&#34; &gt;chapter 7&lt;/a&gt; and usage section 4.8.&lt;/p&gt;&#xA;&lt;h2 id=&#34;revoking-a-nas&#34;&gt;Revoking a NAS&#xA;&lt;/h2&gt;&lt;p&gt;Three ways, from fastest to slowest:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Remove its &lt;code&gt;[[radius.clients]]&lt;/code&gt; entry and send SIGHUP.&lt;/strong&gt; Open connections are closed at their next packet.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Revoke the certificate:&lt;/strong&gt; set &lt;code&gt;crl_file&lt;/code&gt;, put the new revocation list in place and send SIGHUP. The certificate then fails the handshake, and open connections are closed when they are checked again (at the SIGHUP, and once a minute after that). The revocation lists must cover every CA in the chain; missing one blocks every device.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When the CA offers only OCSP,&lt;/strong&gt; set &lt;code&gt;ocsp&lt;/code&gt;, the same way as for EAP-TLS; see &lt;a class=&#34;link&#34; href=&#34;../15-wifi-certs/#ocsp-when-the-ca-publishes-no-revocation-list&#34; &gt;chapter 15&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;before-going-live&#34;&gt;Before going live&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The CA signs only for NAS.&lt;/strong&gt; When the CA in &lt;code&gt;client_ca_file&lt;/code&gt; also signs users&amp;rsquo; EAP-TLS certificates, a user&amp;rsquo;s certificate can be used to connect in as a NAS (clients with only &lt;code&gt;address&lt;/code&gt; cannot stop it). Use a separate CA, or set &lt;code&gt;tls_name&lt;/code&gt; on every client.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Limit the sources of 2083 with the firewall.&lt;/strong&gt; With clients recognised by certificate alone, unknown connections cannot be stopped by source address before the handshake, so anyone who can reach the port can use up TLS handshakes.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Replace certificates before they expire.&lt;/strong&gt; An expired certificate fails the handshake, and an open connection stays open at most one more minute. After replacing the server certificate, send SIGHUP: new connections use the new one, and open ones are unaffected.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Behind a load balancer,&lt;/strong&gt; it must run in TCP mode and send a PROXY protocol header, with its addresses listed in &lt;code&gt;proxy_protocol_from&lt;/code&gt;; TLS is still handled by rradius. See usage section 2.7.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Different certificates for different names on one port&lt;/strong&gt; (multi-tenant) use &lt;code&gt;[[radius.tls.certificates]]&lt;/code&gt;; see the same section.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Idle connections&lt;/strong&gt; are closed after 300 seconds without a complete packet (&lt;code&gt;idle_timeout_ms&lt;/code&gt;), and the NAS reconnects. A NAS that sends Status-Server regularly is not closed.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Not tested:&lt;/strong&gt; RadSec with any real NAS. Interoperability tests have covered authentication, accounting and CoA with FreeRADIUS 3.2.10 as a proxy. CoA over the NAS&amp;rsquo;s own connection has only been tested with a NAS simulated in code.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;common-problems&#34;&gt;Common problems&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The log shows &lt;code&gt;RadSec handshake with ... failed&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The NAS presented no certificate, the certificate is not signed by &lt;code&gt;client_ca_file&lt;/code&gt;, it has been revoked, or the TLS versions do not match&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RadSec connection from unknown client&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The source is in no client&amp;rsquo;s address, and there is no client recognised by certificate alone&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The handshake succeeds but the connection drops at once, with &lt;code&gt;its certificate fits no client&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The certificate&amp;rsquo;s name is not that of any client with only &lt;code&gt;tls_name&lt;/code&gt;; or the source falls inside a client with an &lt;code&gt;address&lt;/code&gt; and the certificate is not valid for its &lt;code&gt;tls_name&lt;/code&gt; (the message is then &lt;code&gt;is not valid for client ...&#39;s tls_name&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;has no tls_name, which network_clients_need_tls_name asks for&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A range client has no &lt;code&gt;tls_name&lt;/code&gt;, and &lt;code&gt;network_clients_need_tls_name&lt;/code&gt; is on&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Connected, but no request gets a reply&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The NAS&amp;rsquo;s shared secret is not &lt;code&gt;radsec&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A disconnect gets 502&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;NAS-Identifier&lt;/code&gt; is not the client&amp;rsquo;s &lt;code&gt;name&lt;/code&gt;, that NAS has no connection open, or it is connected to another node&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A disconnect gets 505&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The NAS did not answer within &lt;code&gt;coa_timeout_ms&lt;/code&gt;: it does not support receiving CoA on this connection&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The connection drops every 5 minutes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The idle timeout; raise &lt;code&gt;idle_timeout_ms&lt;/code&gt; or have the NAS send Status-Server&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;</description>
        </item><item>
            <title>11. Roaming Federation (eduroam and the Like)</title>
            <link>https://embark.systems/en/rradius/11-roaming/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/11-roaming/</guid>
            <description>&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt; a university (realm &lt;code&gt;uni-a.example&lt;/code&gt; in the example) joins a roaming federation. Federation members accept each other&amp;rsquo;s accounts: a user from any member, visiting another member, can join the Wi-Fi with their own university&amp;rsquo;s account.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Our own people on campus:&lt;/strong&gt; &lt;code&gt;student1@uni-a.example&lt;/code&gt; is authenticated locally.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Visitors from other universities:&lt;/strong&gt; &lt;code&gt;bob@uni-b.example&lt;/code&gt; is forwarded to his own university. There are too many members to configure one by one, so the other side&amp;rsquo;s servers are found by looking up the realm in DNS; realms not found go to the national proxy.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Our own people at other universities:&lt;/strong&gt; their requests come back from the federation over RadSec and are authenticated locally.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A sister university&lt;/strong&gt; on the same leased line has two servers, and users should be spread across them.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When every upstream is down,&lt;/strong&gt; forwarded accounting must not be lost.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This chapter follows on from &lt;a class=&#34;link&#34; href=&#34;../09-realm-proxy/&#34; &gt;chapter 9&lt;/a&gt; (the basics of forwarding by realm) and &lt;a class=&#34;link&#34; href=&#34;../10-radsec/&#34; &gt;chapter 10&lt;/a&gt; (RadSec); what those chapters covered is not repeated.&lt;/p&gt;&#xA;&lt;p&gt;Example directory: &lt;code&gt;rradius-server/examples/scenarios/roaming/&lt;/code&gt;&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;File&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Contents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[proxy]&lt;/code&gt;, &lt;code&gt;[proxy.discovery]&lt;/code&gt;, &lt;code&gt;[proxy.accounting_spool]&lt;/code&gt;, &lt;code&gt;[radius.tls]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;make-certs.sh&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Creates a demo federation CA, our RadSec certificate, a certificate pretending to be the national proxy, and a server certificate for PEAP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Our accounts (same structure as the quick start) and the demo account student1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;wlc.secret&lt;/code&gt;, &lt;code&gt;uni-b.secret&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Shared secrets for the campus controller and the sister university&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;where-a-request-goes&#34;&gt;Where a request goes&#xA;&lt;/h2&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;student1                    no @ ───────────────────────────────► local&#xA;student1@uni-a.example      in local_realms ────────────────────► local&#xA;bob@uni-b.example           exact [[proxy.realms]] entry ───────► uni-b-1, uni-b-2 (spread)&#xA;carol@dept.gov.example      *.gov.example in [[proxy.realms]] ──► national proxy&#xA;dave@uni-c.example          no entry → DNS lookup ─┬─ found ────► uni-c&amp;#39;s own RadSec servers&#xA;                                                   ├─ DNS says none ─► * in [[proxy.realms]] → national proxy&#xA;                                                   └─ lookup fails ──► dropped; looked up again when the NAS retransmits&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Order:&lt;/strong&gt; exact realm → the &lt;code&gt;*.&lt;/code&gt; entry covering it → &lt;code&gt;local_realms&lt;/code&gt; → DNS → &lt;code&gt;*&lt;/code&gt;. &lt;code&gt;*&lt;/code&gt; is used only when DNS clearly says &amp;ldquo;none&amp;rdquo;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Forwarded requests are not handled locally.&lt;/strong&gt; The whole EAP conversation of 802.1X goes to the other side as is; passwords and keys are handled there, and this server never sees the password.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The local &lt;code&gt;[radius.eap]&lt;/code&gt;&lt;/strong&gt; serves only the requests that stay local (our own users).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;steps&#34;&gt;Steps&#xA;&lt;/h2&gt;&lt;h3 id=&#34;1-create-the-certificates-and-start&#34;&gt;1. Create the certificates and start&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd rradius-server/examples/scenarios/roaming&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./make-certs.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd ../../..&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./target/release/rradius-server --check --config examples/scenarios/roaming/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;--check&lt;/code&gt; confirms that every upstream&amp;rsquo;s certificate can be read and that private keys match their certificates. &lt;strong&gt;The upstream addresses in the example are documentation addresses,&lt;/strong&gt; so after starting, our own accounts can log in but forwarded requests get no reply. To see forwarding locally, follow &lt;a class=&#34;link&#34; href=&#34;../09-realm-proxy/#steps&#34; &gt;the steps in chapter 9&lt;/a&gt; to start a second quick start as the sister university, and point &lt;code&gt;uni-b-1&lt;/code&gt; and &lt;code&gt;uni-b-2&lt;/code&gt; at it.&lt;/p&gt;&#xA;&lt;p&gt;For local testing, change the &lt;code&gt;address&lt;/code&gt; of &lt;code&gt;campus-wlc&lt;/code&gt; to &lt;code&gt;127.0.0.1&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./target/release/rradius-server --config examples/scenarios/roaming/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radtest Student1@uni-a.example student1-password 127.0.0.1 &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; campus-wlc-secret-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You get an Access-Accept with &lt;code&gt;Filter-Id = &amp;quot;campus&amp;quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;2-what-to-replace-for-production&#34;&gt;2. What to replace for production&#xA;&lt;/h3&gt;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Apply to the federation for a RadSec certificate,&lt;/strong&gt; and obtain the federation&amp;rsquo;s CA. They replace &lt;code&gt;certs/radius.pem&lt;/code&gt;, &lt;code&gt;certs/radius.key&lt;/code&gt; and &lt;code&gt;certs/federation-ca.pem&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;local_realms&lt;/code&gt;, the national proxy names in &lt;code&gt;[[radius.clients]]&lt;/code&gt;, and the addresses and &lt;code&gt;tls_name&lt;/code&gt; of &lt;code&gt;flr-1&lt;/code&gt;/&lt;code&gt;flr-2&lt;/code&gt;&lt;/strong&gt; are replaced with the values the federation gives you.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The certificate in &lt;code&gt;[radius.eap]&lt;/code&gt;&lt;/strong&gt; is replaced with the one you want your own users to see; see &lt;a class=&#34;link&#34; href=&#34;../03-enterprise-wifi/&#34; &gt;chapter 3&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Publish your own NAPTR and SRV records in DNS&lt;/strong&gt; so other members can find you. The record format is set by the federation.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;the-configuration-explained&#34;&gt;The configuration explained&#xA;&lt;/h2&gt;&lt;h3 id=&#34;finding-the-other-sides-servers-in-dns&#34;&gt;Finding the other side&amp;rsquo;s servers in DNS&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;proxy&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;discovery&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ca_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;certs/federation-ca.pem&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;cert_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;certs/radius.pem&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;key_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;certs/radius.key&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;service&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;x-eduroam:radius.tls&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;local_realms&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;uni-a.example&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;*.uni-a.example&amp;#34;&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;lookup_timeout_ms&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;5000&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;realm_names_only&lt;/span&gt; = &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;probe_interval_ms&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;30000&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Realms without a &lt;code&gt;[[proxy.realms]]&lt;/code&gt; entry are looked up in DNS (RFC 7585): first the realm&amp;rsquo;s NAPTR records, taking those whose &lt;code&gt;service&lt;/code&gt; matches, then the SRV records they point to and the hosts&amp;rsquo; addresses, at most 8 addresses. Servers found this way always use RadSec, with failover in the order DNS gives.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;local_realms&lt;/code&gt; must list your own realms.&lt;/strong&gt; Federation members usually publish NAPTR records for their own realm too; without this, your own users would be looked up to your own RadSec server, forwarded out and back again, and never reach the local EAP and chains.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;service&lt;/code&gt;&lt;/strong&gt; defaults to RFC 7585&amp;rsquo;s &lt;code&gt;aaa+auth:radius.tls.tcp&lt;/code&gt;; eduroam uses &lt;code&gt;x-eduroam:radius.tls&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;ca_file&lt;/code&gt; is the federation&amp;rsquo;s CA,&lt;/strong&gt; which must have issued the other side&amp;rsquo;s certificate. &lt;code&gt;cert_file&lt;/code&gt; and &lt;code&gt;key_file&lt;/code&gt; are the certificate presented to the other side; most federations require mutual verification.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;realm_names_only = true&lt;/code&gt;:&lt;/strong&gt; the other side&amp;rsquo;s certificate must be valid for &lt;strong&gt;the realm itself&lt;/strong&gt; (a DNS name or a NAIRealm field). With &lt;code&gt;false&lt;/code&gt; (the default), being valid for the host name the SRV record points to also counts. The difference: rradius does not do DNSSEC, so host names come from unverified DNS answers. With &lt;code&gt;false&lt;/code&gt;, someone who can tamper with DNS and holds any federation certificate (another member, for example) can steer another realm&amp;rsquo;s requests to themselves. Turn it on when the federation&amp;rsquo;s certificates carry realm names; when the federation issues only host name certificates, turning it on means you cannot connect.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;lookup_timeout_ms&lt;/code&gt;:&lt;/strong&gt; the longest a whole lookup for one realm may take. Realms come from names users type, and DNS records are set by whoever owns the domain, so lookups are bounded: at most 16 lookups at once per node, and one realm is looked up only once at a time. When a lookup is in progress or the slots are used up, the request is simply dropped; by the time the NAS retransmits, the lookup has usually finished.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Results are remembered:&lt;/strong&gt; found servers are kept for the DNS TTL (at least 60 seconds, at most a day); &amp;ldquo;none&amp;rdquo; answers for 5 minutes; at most 4,096 realms are remembered. SIGHUP clears them.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A failed lookup is not &amp;ldquo;none&amp;rdquo;.&lt;/strong&gt; On a timeout, SERVFAIL or an unreachable DNS server:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If the realm was found before, the servers from last time keep being used, and the realm is looked up again after 30 seconds.&lt;/li&gt;&#xA;&lt;li&gt;If it was never found before, the realm&amp;rsquo;s requests are dropped for 30 seconds, &lt;strong&gt;neither sent to &lt;code&gt;*&lt;/code&gt; nor kept local&lt;/strong&gt;. Accounting sent to the wrong place would be billed by someone else, so no reply is better.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;probe_interval_ms&lt;/code&gt;:&lt;/strong&gt; when a discovered server has been idle this long, a Status-Server checks that it is still there.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;national-proxy&#34;&gt;National proxy&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;proxy&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;servers&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;flr-1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;198.51.100.1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;transport&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;tls&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;tls_name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;flr1.roam.example&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ca_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;certs/federation-ca.pem&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;cert_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;certs/radius.pem&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;key_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;certs/radius.key&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;probe_interval_ms&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;30000&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;proxy&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;realms&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;*.gov.example&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;servers&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;flr-1&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;flr-2&amp;#34;&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;proxy&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;realms&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;*&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;servers&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;flr-1&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;flr-2&amp;#34;&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;*&lt;/code&gt; is the exit when DNS finds nothing.&lt;/strong&gt; Members that publish no DNS records rely on the national proxy to forward.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;List organisations known to have no DNS records directly&lt;/strong&gt; (&lt;code&gt;*.gov.example&lt;/code&gt; in the example), saving a lookup every 5 minutes.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;probe_interval_ms&lt;/code&gt; (active checks):&lt;/strong&gt; without it, an upstream is marked down only after real requests time out. The backup &lt;code&gt;flr-2&lt;/code&gt; normally carries no traffic, and finding out it is down too only when the primary fails is too late. With it set, when an upstream has given no answer of any kind for this long, one Status-Server is sent; 3 unanswered in a row mark it down, and &lt;code&gt;rradius_proxy_server_alive&lt;/code&gt; becomes 0, which you can alert on. Upstreams carrying traffic receive no extra packets. The upstream must answer Status-Server.&lt;/li&gt;&#xA;&lt;li&gt;For the other rules of RadSec upstreams (one long-lived connection, no retransmission, 256 requests at once), see &lt;a class=&#34;link&#34; href=&#34;../09-realm-proxy/#roaming-between-organisations-radsec-upstreams&#34; &gt;chapter 9&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;the-federation-connecting-in&#34;&gt;The federation connecting in&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;tls&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;port&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;2083&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;cert_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;certs/radius.pem&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;key_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;certs/radius.key&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;client_ca_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;certs/federation-ca.pem&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;network_clients_need_tls_name&lt;/span&gt; = &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;clients&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;flr-1-in&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;tls_name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;flr1.roam.example&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;secret&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;unused-on-radsec-change-me&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When our people log in at another university, their requests come through the national proxy to port 2083 here. The national proxies are recognised by certificate alone (only &lt;code&gt;tls_name&lt;/code&gt;), so their addresses can change without a configuration change. The incoming name is &lt;code&gt;student1@uni-a.example&lt;/code&gt;, which is in &lt;code&gt;local_realms&lt;/code&gt;, so it stays local and is handled by &lt;code&gt;[radius.eap]&lt;/code&gt; and the chain.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Other members connecting directly:&lt;/strong&gt; when another member finds you through DNS, it connects straight to your port 2083, not through the national proxy. A peer connecting in must match some &lt;code&gt;[[radius.clients]]&lt;/code&gt; entry, or it is closed after the handshake. Two approaches:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;One entry per peer,&lt;/strong&gt; with &lt;code&gt;tls_name&lt;/code&gt; set to the name on its certificate. The strictest, but with many members the list never ends; you can ask them to come through the national proxy instead.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;One range entry covering the peers&amp;rsquo; addresses, without &lt;code&gt;tls_name&lt;/code&gt;.&lt;/strong&gt; Any peer in that range with any certificate from the federation CA can then connect in (&lt;a class=&#34;link&#34; href=&#34;../10-radsec/#three-kinds-of-client&#34; &gt;the table in chapter 10&lt;/a&gt;). &lt;code&gt;network_clients_need_tls_name&lt;/code&gt; cannot be on in that case, and there is a warning at startup. The range can also get in over UDP (with the &lt;code&gt;secret&lt;/code&gt;), so use a long random &lt;code&gt;secret&lt;/code&gt; and block its UDP with the firewall. The example does not set this up, and the scenario test does not cover it.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;spreading-over-several-upstreams&#34;&gt;Spreading over several upstreams&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;proxy&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;servers&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;uni-b-1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.41.0.1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;secret_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;uni-b.secret&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;weight&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;proxy&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;servers&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;uni-b-2&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.41.0.2&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;secret_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;uni-b.secret&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;weight&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;proxy&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;realms&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;uni-b.example&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;servers&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;uni-b-1&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;uni-b-2&amp;#34;&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;balance&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;load-balance&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;strip_realm&lt;/span&gt; = &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;balance = &amp;quot;load-balance&amp;quot;&lt;/code&gt;:&lt;/strong&gt; the default &lt;code&gt;failover&lt;/code&gt; always sends to the first server first. With &lt;code&gt;load-balance&lt;/code&gt;, each request gets a fixed order computed from &lt;code&gt;Calling-Station-Id&lt;/code&gt; and &lt;code&gt;User-Name&lt;/code&gt;, and goes first to the server ranked first.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The same device always reaches the same upstream:&lt;/strong&gt; every request of a whole EAP conversation, and Start, Interim-Update and Stop of the same session, all reach the same server, with nothing more to configure. Every node computes the same result, across restarts too.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;weight&lt;/code&gt;:&lt;/strong&gt; the share a server gets is proportional to it; &lt;code&gt;uni-b-2&lt;/code&gt; in the example gets about three quarters. Only &lt;code&gt;load-balance&lt;/code&gt; uses it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When one server goes down,&lt;/strong&gt; only the devices that ranked it first move; other devices are unaffected. EAP conversations in progress on the devices that move fail, and the NAS starts over.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;With few users the spread may lean to one server,&lt;/strong&gt; because it depends on how names and MACs are distributed.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The automated test logs 24 devices with different MACs in with the same account: both upstreams receive requests, and the one with &lt;code&gt;weight = 3&lt;/code&gt; receives more.&lt;/p&gt;&#xA;&lt;h3 id=&#34;spooling-accounting-when-every-upstream-is-down&#34;&gt;Spooling accounting when every upstream is down&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;proxy&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;accounting_spool&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;dir&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;spool/proxy&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;replay_interval_ms&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;5000&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;replay_window&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Without this section, forwarded accounting gets no reply when no upstream answers, and is lost after the NAS has retransmitted a few times. With it:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;When no upstream of the realm answers, the request is first written to the local &lt;code&gt;dir&lt;/code&gt;, and the NAS gets its reply once it is on disk.&lt;/li&gt;&#xA;&lt;li&gt;A background task sends them again, oldest first, at most &lt;code&gt;replay_window&lt;/code&gt; at a time, with the waiting time added to &lt;code&gt;Acct-Delay-Time&lt;/code&gt;. When the upstream still does not answer, it tries again after &lt;code&gt;replay_interval_ms&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;A record is done only once the upstream answers.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Only accounting is spooled.&lt;/strong&gt; Logins need an answer now; when no upstream answers there is no reply, so the NAS uses its own backup.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;At least once:&lt;/strong&gt; if the process stops between the upstream&amp;rsquo;s answer and recording progress, the same record is sent again. Upstreams must tolerate duplicates, usually judged by &lt;code&gt;Acct-Session-Id&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Order:&lt;/strong&gt; within one batch, Start and Stop of the same session may arrive reversed. When the upstream requires strict order, set &lt;code&gt;replay_window = 1&lt;/code&gt;, at the cost of slower replay.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;All realms share one queue.&lt;/strong&gt; When one realm&amp;rsquo;s upstreams never answer, spooled accounting of other realms waits too.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Make sure the spool is empty before removing a realm.&lt;/strong&gt; When SIGHUP removes a realm, its unsent accounting moves to &lt;code&gt;rejected.log&lt;/code&gt;. Check that &lt;code&gt;rradius_proxy_acct_spool_bytes&lt;/code&gt; is 0.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Kept apart from the local accounting spool:&lt;/strong&gt; &lt;code&gt;[radius.accounting_spool]&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../07-broadband/#the-accounting-spool&#34; &gt;chapter 7&lt;/a&gt;) covers accounting the database cannot take. The two directories must differ, and neither affects the other.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Changing this section needs a restart.&lt;/strong&gt; The files contain personal data such as user names; keep them on a persistent disk.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;before-going-live&#34;&gt;Before going live&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Monitoring:&lt;/strong&gt; &lt;code&gt;rradius_proxy_server_alive&lt;/code&gt; (alert on 0), &lt;code&gt;rradius_proxy_acct_spool_bytes&lt;/code&gt; (staying above 0 means an upstream has not recovered), &lt;code&gt;rradius_proxy_unanswered_total&lt;/code&gt; (requests no upstream answered). Servers found through DNS appear in these metrics too, with a &lt;code&gt;server&lt;/code&gt; label of &lt;code&gt;realm host:address:port&lt;/code&gt;; a large federation produces many time series.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Get the timing right:&lt;/strong&gt; each UDP upstream waits at most &lt;code&gt;timeout_ms × attempts&lt;/code&gt;, each RadSec upstream one &lt;code&gt;timeout_ms&lt;/code&gt;, and the first lookup of a realm adds the DNS time. The total must be shorter than the NAS&amp;rsquo;s timeout.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Anonymous outer names:&lt;/strong&gt; users&amp;rsquo; outer names are usually &lt;code&gt;anonymous@uni-b.example&lt;/code&gt;. Forwarding looks only at the realm, so this does not matter; but &lt;code&gt;load-balance&lt;/code&gt; spreads by outer name plus MAC, so anonymous users of one realm are told apart by MAC.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;CoA forwarded to upstreams by realm&lt;/strong&gt; uses only named realm entries, not &lt;code&gt;*&lt;/code&gt; and not servers found through DNS.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Not tested:&lt;/strong&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;DNS discovery has not been connected to a real federation.&lt;/strong&gt; Name matching, caching and forwarding were tested with simulated DNS; the lookup itself was tried against public DNS for one eduroam member&amp;rsquo;s records. The automated tests have no DNS, so this part is not in the scenario test.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Replay of spooled accounting after the upstream recovers:&lt;/strong&gt; the scenario test only checks &amp;ldquo;written to the spool and the NAS answered&amp;rdquo;; replay is covered by other tests in the project.&lt;/li&gt;&#xA;&lt;li&gt;The scenario test checks: our realm stays local, &lt;code&gt;*.gov.example&lt;/code&gt; reaches the upstream over RadSec, the sister university is spread by weight, accounting is answered when every upstream is down, and the national proxy connects in over RadSec.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;common-problems&#34;&gt;Common problems&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Our own users&amp;rsquo; logins get no reply, with &lt;code&gt;came back to this server&lt;/code&gt; in the log, or connections to our own port 2083 are closed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Our realm is not listed in &lt;code&gt;local_realms&lt;/code&gt;, so it was looked up to our own server and forwarded out&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No request for some realm gets a reply, with a WARN &lt;code&gt;[proxy.discovery]: realm ...&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The DNS lookup failed (rather than &amp;ldquo;none&amp;rdquo;), so the realm is dropped for 30 seconds. Check this host&amp;rsquo;s DNS settings (&lt;code&gt;/etc/resolv.conf&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Servers were found, but &lt;code&gt;cannot connect ... TLS:&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The other side&amp;rsquo;s certificate is not signed by &lt;code&gt;ca_file&lt;/code&gt;; or &lt;code&gt;realm_names_only&lt;/code&gt; is on and the other side&amp;rsquo;s certificate has only host names&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A visitor&amp;rsquo;s first login is especially slow&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The first lookup of the realm waits for DNS, and NAS retransmissions are dropped meanwhile. After that it is remembered for the TTL&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A visitor&amp;rsquo;s connection fails halfway and works on retry&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A &lt;code&gt;load-balance&lt;/code&gt; upstream just went down or came back, and that device moved&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_proxy_acct_spool_bytes&lt;/code&gt; never goes down&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Some realm&amp;rsquo;s upstream has not recovered and is holding up the whole queue; &lt;code&gt;rradius_proxy_server_alive&lt;/code&gt; shows which&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A federation peer connecting in is closed, with &lt;code&gt;its certificate fits no client&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No &lt;code&gt;[[radius.clients]]&lt;/code&gt; entry has a &lt;code&gt;tls_name&lt;/code&gt; that matches its certificate&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;</description>
        </item><item>
            <title>12. A Wi-Fi Passphrase per Person</title>
            <link>https://embark.systems/en/rradius/12-psk-wifi/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/12-psk-wifi/</guid>
            <description>&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt; the office has a WPA2-PSK SSID (the kind you join by typing a passphrase). Printers, TVs and visitors&amp;rsquo; devices cannot do 802.1X, so it cannot become the enterprise Wi-Fi of &lt;a class=&#34;link&#34; href=&#34;../03-enterprise-wifi/&#34; &gt;chapter 3&lt;/a&gt;; but the whole company shares one passphrase, and every time someone leaves, it has to be reset for everyone.&lt;/p&gt;&#xA;&lt;p&gt;Instead, &lt;strong&gt;give each person their own passphrase,&lt;/strong&gt; on the same SSID (vendors call this DPSK, iPSK, MPSK or PPSK):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Each person joins the same SSID with their own passphrase; rradius recognises who it is from the passphrase and puts them into a VLAN by person.&lt;/li&gt;&#xA;&lt;li&gt;When someone leaves, only their passphrase is stopped; nobody else is affected.&lt;/li&gt;&#xA;&lt;li&gt;Devices need not register their MAC first.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Access points do this in one of two ways, depending on which your AP supports:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Approach&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What the AP sends to rradius&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Must devices register first&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Where in this chapter&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Find the passphrase from the 4-way handshake&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The handshake of the connection (the ANonce and the 2nd EAPOL frame)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The main approach, &lt;code&gt;[radius.dpsk]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Reply with the passphrase by MAC&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The device&amp;rsquo;s MAC address&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;#the-second-approach-reply-with-the-passphrase-by-mac&#34; &gt;The second approach&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The 4-way handshake is how the device and the AP prove to each other that they know the passphrase; the passphrase itself is never sent. rradius tries each person&amp;rsquo;s key, and the one that produces the same result belongs to this person.&lt;/p&gt;&#xA;&lt;p&gt;Example directory: &lt;code&gt;rradius-server/examples/scenarios/psk-wifi/&lt;/code&gt;&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;File&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Contents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius.dpsk]&lt;/code&gt;, one client for each kind of AP, &lt;code&gt;[accounts]&lt;/code&gt; (disabling and enabling people), &lt;code&gt;[accounts.dpsk]&lt;/code&gt; (keys)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;setup.sh&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Creates &lt;code&gt;dpsk.key&lt;/code&gt; and sealed demo data&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;mac-psk.lua&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The script for the second approach&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/1_schema.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;people&lt;/code&gt; (people and VLANs), &lt;code&gt;dpsk_keys&lt;/code&gt; (each person&amp;rsquo;s keys), &lt;code&gt;device_psk&lt;/code&gt; (passphrases by MAC), &lt;code&gt;accounting&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;steps&#34;&gt;Steps&#xA;&lt;/h2&gt;&lt;h3 id=&#34;1-create-the-key-and-demo-data&#34;&gt;1. Create the key and demo data&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd rradius-server&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cargo build --release&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;examples/scenarios/psk-wifi/setup.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It does two things:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Creates &lt;code&gt;dpsk.key&lt;/code&gt;: the master key used to seal keys, 64 hexadecimal characters, mode 0600.&lt;/li&gt;&#xA;&lt;li&gt;Seals the passphrases of three demo people with &lt;code&gt;rradius-server dpsk-seal&lt;/code&gt;, writing &lt;code&gt;migrations/2_demo_keys.sql&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Neither file is in the repository: the master key must not be public, and sealed values go with the master key. &lt;strong&gt;Existing files are not overwritten:&lt;/strong&gt; replace the master key and the old data no longer opens.&lt;/p&gt;&#xA;&lt;p&gt;With a release archive, &lt;code&gt;setup.sh&lt;/code&gt; finds &lt;code&gt;bin/rradius-server&lt;/code&gt; by itself; when it lives elsewhere, set &lt;code&gt;RRADIUS_SERVER=/path/to/rradius-server&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;2-start&#34;&gt;2. Start&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./target/release/rradius-server --config examples/scenarios/psk-wifi/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;3-test&#34;&gt;3. Test&#xA;&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;A 4-way handshake cannot be simulated with &lt;code&gt;radtest&lt;/code&gt;;&lt;/strong&gt; testing it takes a supporting AP and a device. The automated test replays a handshake recorded beforehand (computed by a separate, independent program from &lt;code&gt;bob-passphrase&lt;/code&gt;) and checks:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Request&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Result&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;bob&amp;rsquo;s handshake, SSID &lt;code&gt;office&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Accept, VLAN 30, and &lt;code&gt;Tunnel-Password&lt;/code&gt; decrypts to bob&amp;rsquo;s PMK&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The same handshake with one bit changed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Reject: nobody&amp;rsquo;s passphrase matches&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The same handshake with SSID &lt;code&gt;guest&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Reject: this SSID has no keys&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After &lt;code&gt;user disable bob&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Reject, effective at once&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After &lt;code&gt;user enable bob&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Accept&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After &lt;code&gt;dpsk delete --ssid office bob&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Still Access-Accept (the key the device matched last time is remembered); Access-Reject after SIGHUP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After &lt;code&gt;dpsk add --ssid office bob&lt;/code&gt; (passphrase &lt;code&gt;bob-passphrase&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Accept&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The authentication log says who was recognised:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;office-aps&amp;#34; source=10.35.0.7 user=&amp;#34;020000000099&amp;#34; account=&amp;#34;bob&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;dpsk&amp;#34; decision=&amp;#34;accept&amp;#34;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;user&lt;/code&gt; is the name the AP sent (usually the device&amp;rsquo;s MAC), and &lt;code&gt;account&lt;/code&gt; is the person whose passphrase matched.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-configuration-explained&#34;&gt;The configuration explained&#xA;&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;dpsk&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;candidates_query&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT identity, pmk FROM dpsk_keys WHERE ssid = ? LIMIT 10000&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;key_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;dpsk.key&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;cache_lifetime_ms&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;3600000&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;max_candidates&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;10000&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;candidates_query&lt;/code&gt;&lt;/strong&gt; returns (identity, sealed PMK) for everyone on this SSID. &lt;code&gt;?&lt;/code&gt; is filled with the SSID. rradius tries them one by one in order, at most &lt;code&gt;max_candidates&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Add a &lt;code&gt;LIMIT&lt;/code&gt; to the query yourself.&lt;/strong&gt; &lt;code&gt;max_candidates&lt;/code&gt; only limits how many are tried; the query results are still read in full.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;What a PMK is:&lt;/strong&gt; the key WPA2 actually uses, computed from the passphrase and the SSID. Storing PMKs rather than passphrases means nothing has to be recomputed for each comparison (recomputing takes a few milliseconds each, far too slow across ten thousand people). &lt;strong&gt;Whoever has a PMK can join that SSID,&lt;/strong&gt; so the table holds only sealed values; values that are not sealed do not open and are skipped.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;key_file&lt;/code&gt;&lt;/strong&gt; is the master key used for sealing. Every node needs the same one, with permissions such as 0600, 0640 or 0400, or startup fails. &lt;strong&gt;Back it up separately:&lt;/strong&gt; it is not in the database, and losing it means everyone has to reset their passphrase.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;cache_lifetime_ms&lt;/code&gt;:&lt;/strong&gt; the key each device matched last time on this SSID is remembered and tried first next time, without a database query. When it does not match (the device changed passphrase), it is forgotten and the search starts over.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;How fast:&lt;/strong&gt; measured on a development machine, trying ten thousand candidates takes about 11 milliseconds, fifty thousand about 55 milliseconds; using the remembered key takes under 1 microsecond. At most 4 searches run at once; further requests are dropped and the AP retransmits. How long APs and devices are willing to wait during the handshake varies by vendor and has not been confirmed on real hardware; with many people, measure first. The measurements are in usage section 2.15.&lt;/p&gt;&#xA;&lt;h3 id=&#34;once-matched-may-this-person-connect&#34;&gt;Once matched: may this person connect&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;handlers&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;type&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sql&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;user_query&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT NULL FROM people WHERE identity = ?&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;certificate_query&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT 1 FROM people WHERE identity = ? AND enabled = 1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;reply_query&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&amp;#34;WITH p AS (SELECT vlan FROM people WHERE identity = ?)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  SELECT &amp;#39;Tunnel-Type:1&amp;#39;, &amp;#39;VLAN&amp;#39; FROM p&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  UNION ALL SELECT &amp;#39;Tunnel-Medium-Type:1&amp;#39;, &amp;#39;IEEE-802&amp;#39; FROM p&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  UNION ALL SELECT &amp;#39;Tunnel-Private-Group-Id:1&amp;#39;, vlan FROM p&amp;#34;&amp;#34;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A matching passphrase only proves &amp;ldquo;this is bob&amp;rdquo;. The identity then goes to this client&amp;rsquo;s authentication chain as &lt;strong&gt;an already proven name&lt;/strong&gt;, just as with a certificate login:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;certificate_query&lt;/code&gt;&lt;/strong&gt; accepts when it finds a row. Put the disabled condition here (&lt;code&gt;enabled = 1&lt;/code&gt;), so disabling a person takes effect at once, without waiting for remembered keys to expire.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;reply_query&lt;/code&gt;&lt;/strong&gt; gives the person&amp;rsquo;s VLAN. &lt;code&gt;reply_query&lt;/code&gt; can have only one &lt;code&gt;?&lt;/code&gt;, so &lt;code&gt;WITH&lt;/code&gt; looks it up once and returns three rows.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;user_query&lt;/code&gt;&lt;/strong&gt; is required, but this SSID has no user name and password logins. The example makes the password column always &lt;code&gt;NULL&lt;/code&gt;: any request with just a name and password is rejected.&lt;/li&gt;&#xA;&lt;li&gt;When a script decides, the &lt;code&gt;eap_method&lt;/code&gt; it sees is &lt;code&gt;&#39;dpsk&#39;&lt;/code&gt;, and &lt;code&gt;get_attr(&#39;User-Name&#39;)&lt;/code&gt; is the matched identity.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;On accept, rradius adds the PMK to the reply automatically&lt;/strong&gt; so the AP can complete the handshake: &lt;code&gt;Tunnel-Password&lt;/code&gt; for hostapd requests, &lt;code&gt;Ruckus-DPSK&lt;/code&gt; for Ruckus. You do not set these attributes yourself.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When nobody matches, the answer is an Access-Reject straight away,&lt;/strong&gt; without the chain or script.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;adding-disabling-and-changing-passphrases&#34;&gt;Adding, disabling and changing passphrases&#xA;&lt;/h2&gt;&lt;h3 id=&#34;adding-a-person&#34;&gt;Adding a person&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Add dave to the people table first (decide his VLAN, see below), then add his key for office.&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;%s\n&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;dave-passphrase&amp;#39;&lt;/span&gt; | rradius-server dpsk add --config rradius.toml --ssid office dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# added key of dave for office&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;The passphrase is read from standard input,&lt;/strong&gt; not given as an argument (arguments stay in the shell history). On a terminal it asks twice without echoing. A passphrase is 8 to 63 printable ASCII characters, or a PSK of 64 hexadecimal characters.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;What goes into the table is the sealed PMK,&lt;/strong&gt; bound to the identity and the SSID, so moved to someone else&amp;rsquo;s name or another SSID it does not open. To use the same passphrase on two SSIDs, run it once for each. The passphrase itself is never stored.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Run it on a host that has &lt;code&gt;key_file&lt;/code&gt;,&lt;/strong&gt; usually a node itself. The write goes through the cluster, so every node sees it at once, with no restart.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;The SQL it runs is set in &lt;code&gt;[accounts.dpsk]&lt;/code&gt;:&lt;/strong&gt; &lt;code&gt;?1&lt;/code&gt; is the identity, &lt;code&gt;?2&lt;/code&gt; the SSID, &lt;code&gt;?3&lt;/code&gt; the sealed PMK. The example:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;accounts&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;dpsk&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;add&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;INSERT INTO dpsk_keys (identity, ssid, pmk) VALUES (?1, ?2, ?3)&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;passwd&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;UPDATE dpsk_keys SET pmk = ?3 WHERE identity = ?1 AND ssid = ?2&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;delete&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;DELETE FROM dpsk_keys WHERE identity = ?1 AND ssid = ?2&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;show&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT identity, ssid FROM dpsk_keys WHERE identity = ?1 AND ssid = ?2&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;delete&lt;/code&gt; and &lt;code&gt;show&lt;/code&gt; may leave out &lt;code&gt;?2&lt;/code&gt; to handle all of a person&amp;rsquo;s SSIDs at once; the command still needs &lt;code&gt;--ssid&lt;/code&gt;, which is then not filled in, and the result reads &lt;code&gt;deleted keys of bob&lt;/code&gt;. The full rules are in section 2.14 of the reference document.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;The person&amp;rsquo;s row&lt;/strong&gt; is in the &lt;code&gt;people&lt;/code&gt; table, which decides whether they may connect and their VLAN. The example&amp;rsquo;s &lt;code&gt;[accounts]&lt;/code&gt; sets only &lt;code&gt;enable&lt;/code&gt;, &lt;code&gt;disable&lt;/code&gt; and &lt;code&gt;show&lt;/code&gt;; to add people with &lt;code&gt;user add&lt;/code&gt;, add an &lt;code&gt;add&lt;/code&gt; to &lt;code&gt;[accounts]&lt;/code&gt; that writes &lt;code&gt;people&lt;/code&gt; (it expects a password value, which this scenario does not use; write it to an unused column, or add people with SQL directly).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Bulk imports&lt;/strong&gt; can still use &lt;code&gt;dpsk-seal&lt;/code&gt; to produce sealed values and write them as a migration file (common for the first go-live; see how &lt;code&gt;setup.sh&lt;/code&gt; does it).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;disabling-and-enabling&#34;&gt;Disabling and enabling&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-server user disable --config rradius.toml bob&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-server user enable --config rradius.toml bob&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-server user show --config rradius.toml bob&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The example&amp;rsquo;s &lt;code&gt;[accounts]&lt;/code&gt; changes &lt;code&gt;enabled&lt;/code&gt; in the &lt;code&gt;people&lt;/code&gt; table. It takes effect across the cluster at once, and the next connection is rejected. &lt;strong&gt;Devices already connected are not kicked off;&lt;/strong&gt; that waits until they reconnect (roaming, waking from sleep). To disconnect them at once, see &lt;a class=&#34;link&#34; href=&#34;../07-broadband/#coa-forwarding&#34; &gt;CoA in chapter 7&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;changing-and-deleting&#34;&gt;Changing and deleting&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;%s\n&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;new-passphrase&amp;#39;&lt;/span&gt; | rradius-server dpsk passwd --config rradius.toml --ssid office bob&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-server dpsk delete --config rradius.toml --ssid office bob&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-server dpsk show --config rradius.toml --ssid office bob&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The results are &lt;code&gt;key changed for bob for office&lt;/code&gt; and &lt;code&gt;deleted key of bob for office&lt;/code&gt;; when there is no such row, it prints &lt;code&gt;no key of bob for office&lt;/code&gt; with status 1.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Afterwards, send SIGHUP to every node:&lt;/strong&gt; rradius remembers the key each device used last, and without it those devices can still join with the old passphrase for &lt;code&gt;cache_lifetime_ms&lt;/code&gt;. The commands only change the table; they do not notify the nodes. Disabling with &lt;code&gt;enabled = 0&lt;/code&gt; alone does not need this, because &lt;code&gt;certificate_query&lt;/code&gt; is checked on every connection.&lt;/p&gt;&#xA;&lt;h3 id=&#34;changing-the-master-key&#34;&gt;Changing the master key&#xA;&lt;/h3&gt;&lt;p&gt;On every node, set the new key as &lt;code&gt;key_file&lt;/code&gt; and the old one as &lt;code&gt;previous_key_file&lt;/code&gt;, and send SIGHUP; meanwhile both keys open values. Once everyone&amp;rsquo;s passphrase has been sealed again with the new key and the values in the table replaced, remove &lt;code&gt;previous_key_file&lt;/code&gt;. &lt;code&gt;dpsk passwd&lt;/code&gt; and &lt;code&gt;dpsk-seal&lt;/code&gt; take only passphrases (or a 64-hexadecimal-character PSK) and cannot turn an old sealed value straight into a new one, so the original passphrases are needed.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-second-approach-reply-with-the-passphrase-by-mac&#34;&gt;The second approach: reply with the passphrase by MAC&#xA;&lt;/h2&gt;&lt;p&gt;When the AP does not send the 4-way handshake (Cisco iPSK, Aruba MPSK, Meraki, Mist, or hostapd&amp;rsquo;s &lt;code&gt;wpa_psk_radius=1&lt;/code&gt; or &lt;code&gt;2&lt;/code&gt;), it asks rradius with the MAC address, when the device connects, &amp;ldquo;what is this device&amp;rsquo;s passphrase&amp;rdquo;. Every device must be registered first. This approach does not need &lt;code&gt;[radius.dpsk]&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;chains&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;mac-psk&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;policy&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;first_match&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;chains&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;mac-psk&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;handlers&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;type&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;lua&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;script&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;mac-psk.lua&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;clients&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;lab-aps&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.36.0.0/24&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;secret_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;lab-aps.secret&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;mac-psk&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;What &lt;code&gt;mac-psk.lua&lt;/code&gt; does:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;User-Name&lt;/code&gt; and &lt;code&gt;Calling-Station-Id&lt;/code&gt; must be the same MAC (both are first normalised to 12 lowercase hexadecimal characters, however they are written).&lt;/li&gt;&#xA;&lt;li&gt;Looks up the &lt;code&gt;device_psk&lt;/code&gt; table, and rejects when nothing is found.&lt;/li&gt;&#xA;&lt;li&gt;Replies with the passphrase through &lt;code&gt;set_attr(&#39;Tunnel-Password&#39;, ...)&lt;/code&gt;, which rradius encrypts with the shared secret; then the VLAN.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Local test (change the &lt;code&gt;address&lt;/code&gt; of &lt;code&gt;lab-aps&lt;/code&gt; to &lt;code&gt;127.0.0.1&lt;/code&gt;):&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Name=00-11-22-33-44-AA,User-Password=00-11-22-33-44-AA,Calling-Station-Id=00:11:22:33:44:aa&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  | radclient -x 127.0.0.1:1812 auth lab-aps-secret-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You get an Access-Accept with &lt;code&gt;Tunnel-Password&lt;/code&gt; and VLAN 40.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Each vendor wants a different attribute:&lt;/strong&gt; the &lt;code&gt;Tunnel-Password&lt;/code&gt; used in the example works for hostapd, Meraki and Mist. Cisco uses &lt;code&gt;Cisco-AVPair&lt;/code&gt;, Aruba &lt;code&gt;Aruba-MPSK-Passphrase&lt;/code&gt;, Ruckus &lt;code&gt;Ruckus-DPSK&lt;/code&gt; (with the PMK computed by the &lt;code&gt;wpa_pmk&lt;/code&gt; function); see usage section 2.15 for how.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The table holds passphrases in plain text,&lt;/strong&gt; because the AP needs the passphrase itself. Anyone who can read the database can see them.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;Cisco-AVPair&lt;/code&gt; values are not encrypted;&lt;/strong&gt; use it only on a trusted network or over RadSec.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A MAC is not a secret.&lt;/strong&gt; Someone can ask with a registered MAC, but the passphrase comes back encrypted for the AP, and the device still has to know the passphrase itself to join.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;before-going-live&#34;&gt;Before going live&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Only WPA2-PSK (the HMAC-SHA1 kind) is supported.&lt;/strong&gt; WPA3-SAE, WPA2-PSK-SHA256 and the version used when PMF (protected management frames) is required are not supported; such requests get an Access-Reject, with &lt;code&gt;key descriptor version 3 is not supported&lt;/code&gt; in the log. Set the SSID to plain WPA2-PSK, with PMF not set to &amp;ldquo;required&amp;rdquo;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Supported APs:&lt;/strong&gt; hostapd 2.11 and later with &lt;code&gt;wpa_psk_radius=3&lt;/code&gt;, and Ruckus APs that send &lt;code&gt;Ruckus-DPSK-Params&lt;/code&gt;. The AP&amp;rsquo;s MAC and the SSID are read from &lt;code&gt;Called-Station-Id&lt;/code&gt; (in the form &lt;code&gt;AA-BB-CC-DD-EE-FF:SSID&lt;/code&gt;), and the device&amp;rsquo;s MAC from &lt;code&gt;Calling-Station-Id&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Passphrases should be long and different for everyone.&lt;/strong&gt; When two people have the same passphrase, the one earlier in the query results is recognised.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Do not let users choose passphrases that are too short:&lt;/strong&gt; anyone within radio range can record the handshake and guess the passphrase offline. That is a limit of WPA2-PSK itself.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Not tested:&lt;/strong&gt; any real AP. Handshake matching has been cross-checked with the &lt;code&gt;dpsk&lt;/code&gt; module of FreeRADIUS 3.2.10 (the same handshake, both find the same passphrase). The Ruckus reply format comes from its dictionary notes and community discussion; there is no official documentation. The vendor attributes of the second approach have not been verified on real devices.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;common-problems&#34;&gt;Common problems&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Startup fails, mentioning &lt;code&gt;dpsk.key&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;setup.sh&lt;/code&gt; has not been run, or the file&amp;rsquo;s permissions are too broad (it needs something like 0600)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Nobody can join, with &lt;code&gt;do not open with key_file&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The values in the table were not sealed with this &lt;code&gt;dpsk.key&lt;/code&gt;, or the identity or SSID at sealing time differs from the row&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;key descriptor version 3 is not supported&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The SSID has PMF required or SHA256 on; change it to plain WPA2-PSK&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Called-Station-Id ... is not &amp;lt;access point MAC&amp;gt;:&amp;lt;SSID&amp;gt;&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The AP&amp;rsquo;s &lt;code&gt;Called-Station-Id&lt;/code&gt; does not carry the SSID; adjust the AP&amp;rsquo;s settings&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Right passphrase but rejected, with a name in the log&amp;rsquo;s &lt;code&gt;account&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The passphrase matched, but &lt;code&gt;certificate_query&lt;/code&gt; found nothing: the person is disabled, or not in the &lt;code&gt;people&lt;/code&gt; table&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The request is treated as an ordinary login, and &lt;code&gt;handler&lt;/code&gt; is not &lt;code&gt;dpsk&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The AP sent no handshake attributes: it does not support this approach, or it is not turned on (&lt;code&gt;wpa_psk_radius=3&lt;/code&gt; for hostapd)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Still able to join after the key was deleted&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No SIGHUP was sent, so the key the device used last is still remembered&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_dpsk_total{result=&amp;quot;busy&amp;quot;}&lt;/code&gt; increases&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;More than 4 searches at once: too many people, or too many connecting at once; reduce the candidates per SSID&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;</description>
        </item><item>
            <title>13. Wi-Fi Login with SIM Cards (EAP-AKA&#39;)</title>
            <link>https://embark.systems/en/rradius/13-sim-wifi/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/13-sim-wifi/</guid>
            <description>&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt; the factory&amp;rsquo;s handheld terminals and forklift terminals carry USIM cards the company issued itself. When these devices join Wi-Fi, the card itself should be what is verified:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;No certificate to issue per device, and no expiry dates to manage.&lt;/li&gt;&#xA;&lt;li&gt;No password that can leak or be guessed; the key inside the card cannot be read out.&lt;/li&gt;&#xA;&lt;li&gt;The card and the server verify &lt;strong&gt;each other,&lt;/strong&gt; so devices do not join fake access points.&lt;/li&gt;&#xA;&lt;li&gt;For a lost device, just stop its card.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This is &lt;strong&gt;EAP-AKA&amp;rsquo;&lt;/strong&gt;: the authentication used by mobile networks, carried over Wi-Fi 802.1X.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Check first whether it fits:&lt;/strong&gt; rradius only verifies &lt;strong&gt;cards you issued yourself,&lt;/strong&gt; meaning you hold each card&amp;rsquo;s Ki and OPc (the Milenage algorithm). It does not connect to a mobile operator&amp;rsquo;s systems (HSS), so SIM cards issued by an operator cannot be used.&lt;/p&gt;&#xA;&lt;p&gt;Example directory: &lt;code&gt;rradius-server/examples/scenarios/sim-wifi/&lt;/code&gt;&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;File&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Contents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius.eap]&lt;/code&gt; with only &lt;code&gt;aka-prime&lt;/code&gt;, &lt;code&gt;[radius.eap.aka]&lt;/code&gt;, &lt;code&gt;[accounts.aka]&lt;/code&gt; for the &lt;code&gt;aka&lt;/code&gt; command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;setup.sh&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Creates the master key &lt;code&gt;aka.key&lt;/code&gt; and one encrypted demo card&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/1_schema.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;aka_subscribers&lt;/code&gt; (cards), &lt;code&gt;accounting&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;some-terms&#34;&gt;Some terms&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Term&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Meaning&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;IMSI&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The card&amp;rsquo;s number, at most 15 digits. Here it is the account name&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Ki&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The card&amp;rsquo;s key, 32 hexadecimal characters. The card and the server each hold a copy; &lt;strong&gt;whoever obtains it can clone the card&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;OPc&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A value computed from the operator key and Ki, also one per card, and just as secret&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SQN&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The sequence number. It moves forward with every authentication, and the card does not accept numbers already used, so a recorded authentication cannot be replayed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Vector&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The set of values the server computes for one authentication (a random number, a value for the card to verify, the expected answer)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;steps&#34;&gt;Steps&#xA;&lt;/h2&gt;&lt;h3 id=&#34;1-create-the-master-key-and-the-demo-card&#34;&gt;1. Create the master key and the demo card&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd rradius-server&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cargo build --release&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;examples/scenarios/sim-wifi/setup.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;Creates &lt;code&gt;aka.key&lt;/code&gt;: the master key that encrypts Ki and OPc, 64 hexadecimal characters, mode 0600.&lt;/li&gt;&#xA;&lt;li&gt;Encrypts one demo card&amp;rsquo;s Ki and OPc with &lt;code&gt;rradius-server aka-seal&lt;/code&gt;, writing &lt;code&gt;migrations/2_demo_subscribers.sql&lt;/code&gt;. The demo card uses the published 3GPP test values, with IMSI &lt;code&gt;001010000000001&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Neither file is in the repository. &lt;strong&gt;Existing files are not overwritten:&lt;/strong&gt; replace the master key and the ciphertext in the table no longer decrypts.&lt;/p&gt;&#xA;&lt;h3 id=&#34;2-start&#34;&gt;2. Start&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./target/release/rradius-server --config examples/scenarios/sim-wifi/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;3-test&#34;&gt;3. Test&#xA;&lt;/h3&gt;&lt;p&gt;EAP-AKA&amp;rsquo; can only be tested with a card (or a program simulating one); &lt;code&gt;radtest&lt;/code&gt; cannot do it.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The automated test&lt;/strong&gt; plays the card itself, going through the whole authentication with the demo card&amp;rsquo;s Ki and OPc, and checks each row of the table below.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;With &lt;code&gt;eapol_test&lt;/code&gt;:&lt;/strong&gt; the project&amp;rsquo;s interoperability tests use a self-built wpa_supplicant 2.11 &lt;code&gt;eapol_test&lt;/code&gt; with the simulated USIM enabled; how is in &lt;code&gt;docker/interop/aka-client/&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Situation&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Result&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The demo card logs in&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Accept, with the IMSI as &lt;code&gt;User-Name&lt;/code&gt;, &lt;code&gt;Filter-Id = &amp;quot;plant-devices&amp;quot;&lt;/code&gt;, and the keys for wireless encryption&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The same card, with the card&amp;rsquo;s sequence number newer than the server&amp;rsquo;s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The card asks to resynchronise; once the server catches up, Access-Accept&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The same IMSI with a different Ki (a failed clone)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Reject&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An IMSI never issued&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Reject&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After &lt;code&gt;aka disable 001010000000001&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Reject&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After &lt;code&gt;aka add 001010000000002&lt;/code&gt; (given Ki and OPc), logging in with that card&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Accept&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The authentication log:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;plant-wlc&amp;#34; source=10.45.0.10 user=&amp;#34;anonymous@wlan.example&amp;#34; account=&amp;#34;001010000000001&amp;#34; chain=&amp;#34;eap&amp;#34; handler=&amp;#34;eap-aka-prime&amp;#34; decision=&amp;#34;accept&amp;#34;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;the-configuration-explained&#34;&gt;The configuration explained&#xA;&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;eap&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;methods&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;aka-prime&amp;#34;&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;eap&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;aka&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;network_name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;WLAN&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;key_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;aka.key&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;subscriber_query&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT ki, opc FROM aka_subscribers WHERE imsi = ?&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;current_sqn_query&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT sqn FROM aka_subscribers WHERE imsi = ?&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;proven_sqn_query&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;UPDATE aka_subscribers SET sqn = max(sqn, ?) WHERE imsi = ? RETURNING sqn&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;resync_query&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;UPDATE aka_subscribers SET sqn = max(sqn, ?) + 32 WHERE imsi = ? RETURNING sqn&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;With only &lt;code&gt;aka-prime&lt;/code&gt;, no server certificate is needed,&lt;/strong&gt; and &lt;code&gt;cert_file&lt;/code&gt; and &lt;code&gt;key_file&lt;/code&gt; cannot be set. When EAP-TLS or PEAP is enabled too, add the certificate and set &lt;code&gt;eap_methods&lt;/code&gt; on every client (&lt;a class=&#34;link&#34; href=&#34;../03-enterprise-wifi/#the-configuration-explained&#34; &gt;chapter 3&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;network_name&lt;/code&gt;&lt;/strong&gt; takes part in key derivation, and devices may check it; both sides must agree.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;subscriber_query&lt;/code&gt;&lt;/strong&gt; returns the encrypted Ki and OPc.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;current_sqn_query&lt;/code&gt; and &lt;code&gt;proven_sqn_query&lt;/code&gt;: the sequence number is written only after the card answers correctly.&lt;/strong&gt; Sending a Challenge only reads the current number and adds 32, without writing it back; only once the card answers correctly is it written with &lt;code&gt;proven_sqn_query&lt;/code&gt;. So someone who knows the IMSI but has no card cannot push the number forward, however often they ask, and cannot lock the card out (see &amp;ldquo;Preventing abuse&amp;rdquo; below). &lt;strong&gt;&lt;code&gt;proven_sqn_query&lt;/code&gt; must be written as &lt;code&gt;max(sqn, ?)&lt;/code&gt;&lt;/strong&gt; so the number only moves forward.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;resync_query&lt;/code&gt;&lt;/strong&gt; is used when the card says &amp;ldquo;my sequence number is newer&amp;rdquo;, and must also be written as &lt;code&gt;max(sqn, ?)&lt;/code&gt;; &lt;code&gt;SET sqn = ? + 32&lt;/code&gt; also passes the checks, but moves the number backwards.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;proven_sqn_query&lt;/code&gt; and &lt;code&gt;resync_query&lt;/code&gt; must end with &lt;code&gt;RETURNING&lt;/code&gt;, with the last column named &lt;code&gt;sqn&lt;/code&gt;, or startup fails.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The older approach&lt;/strong&gt; is &lt;code&gt;next_sqn_query&lt;/code&gt;: every Challenge first writes the number plus 32 to the database, so abuse has to be held off by a per-card limit, and that limit can be used up. New deployments should use the approach above; the two cannot be set together.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;once-the-card-passes-may-this-card-be-used&#34;&gt;Once the card passes: may this card be used&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;handlers&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;type&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sql&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;user_query&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT NULL FROM aka_subscribers WHERE imsi = ?&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;certificate_query&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT 1 FROM aka_subscribers WHERE imsi = ? AND enabled = 1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;reply_query&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT &amp;#39;Filter-Id&amp;#39;, plan FROM aka_subscribers WHERE imsi = ? AND plan &amp;lt;&amp;gt; &amp;#39;&amp;#39;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A card passing authentication only proves &amp;ldquo;this is that card&amp;rdquo;. The IMSI then goes to the authentication chain as &lt;strong&gt;an already proven name,&lt;/strong&gt; with the same rules as a certificate login: the &lt;code&gt;sql&lt;/code&gt; handler checks &lt;code&gt;certificate_query&lt;/code&gt;, and accepts when it finds a row. The disabled condition (&lt;code&gt;enabled = 1&lt;/code&gt;) goes here. &lt;code&gt;user_query&lt;/code&gt; is required but unused; the example makes the password column always &lt;code&gt;NULL&lt;/code&gt;, so nobody can log in with an IMSI plus a password.&lt;/p&gt;&#xA;&lt;p&gt;When a script decides, the &lt;code&gt;eap_method&lt;/code&gt; it sees is &lt;code&gt;&amp;quot;aka-prime&amp;quot;&lt;/code&gt;, and &lt;code&gt;get_attr(&#39;User-Name&#39;)&lt;/code&gt; is the IMSI.&lt;/p&gt;&#xA;&lt;h2 id=&#34;issuing-and-stopping-cards&#34;&gt;Issuing and stopping cards&#xA;&lt;/h2&gt;&lt;h3 id=&#34;adding-a-card&#34;&gt;Adding a card&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;%s\n%s\n&amp;#39;&lt;/span&gt; &amp;lt;Ki&amp;gt; &amp;lt;OPc&amp;gt; | rradius-server aka add --config rradius.toml &lt;span style=&#34;color:#ae81ff&#34;&gt;001010000000002&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# added subscriber 001010000000002&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Ki and OPc are read from standard input,&lt;/strong&gt; one line each, 32 hexadecimal characters each, never as arguments. On a terminal it asks &lt;code&gt;Ki: &lt;/code&gt; and &lt;code&gt;OPc: &lt;/code&gt; separately, without echoing.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;The command encrypts with the &lt;code&gt;key_file&lt;/code&gt; of &lt;code&gt;[radius.eap.aka]&lt;/code&gt; before writing to the table,&lt;/strong&gt; so the plain values never appear in the table, the log or the command&amp;rsquo;s output. Run it on a host with the master key, usually a node itself.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;The ciphertext is bound to the IMSI and the column,&lt;/strong&gt; so moved to another IMSI, or with Ki and OPc swapped, it does not decrypt.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;The write goes through the cluster,&lt;/strong&gt; so every node sees it at once, with no restart.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;The SQL it runs is set in &lt;code&gt;[accounts.aka]&lt;/code&gt;:&lt;/strong&gt; &lt;code&gt;?1&lt;/code&gt; is the IMSI, and &lt;code&gt;?2&lt;/code&gt; and &lt;code&gt;?3&lt;/code&gt; of &lt;code&gt;add&lt;/code&gt; are the encrypted Ki and OPc. The example:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;accounts&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;aka&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;add&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;INSERT INTO aka_subscribers (imsi, ki, opc) VALUES (?1, ?2, ?3)&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;enable&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;UPDATE aka_subscribers SET enabled = 1 WHERE imsi = ?1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;disable&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;UPDATE aka_subscribers SET enabled = 0 WHERE imsi = ?1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;delete&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;DELETE FROM aka_subscribers WHERE imsi = ?1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;show&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT imsi, label, plan, enabled, sqn FROM aka_subscribers WHERE imsi = ?1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Do not select &lt;code&gt;ki&lt;/code&gt; or &lt;code&gt;opc&lt;/code&gt; in &lt;code&gt;show&lt;/code&gt;. The full rules are in section 2.14 of the reference document.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Other columns&lt;/strong&gt; (&lt;code&gt;label&lt;/code&gt;, &lt;code&gt;plan&lt;/code&gt;) are not filled by the command; the example table has defaults. To write them too, have the &lt;code&gt;add&lt;/code&gt; SQL write fixed values, or change them later with SQL.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;The initial &lt;code&gt;sqn&lt;/code&gt;&lt;/strong&gt; is the table&amp;rsquo;s default (0 in the example), meaning the card&amp;rsquo;s factory sequence number. Being older than the card is fine: on the first login the card asks to resynchronise, and the server catches up.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;For issuing many cards,&lt;/strong&gt; use &lt;code&gt;aka-seal&lt;/code&gt; to produce ciphertext for each card and import them at once as a migration file (which is what &lt;code&gt;setup.sh&lt;/code&gt; does).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;stopping-restoring-showing-and-deleting-cards&#34;&gt;Stopping, restoring, showing and deleting cards&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-server aka disable --config rradius.toml &lt;span style=&#34;color:#ae81ff&#34;&gt;001010000000001&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-server aka enable --config rradius.toml &lt;span style=&#34;color:#ae81ff&#34;&gt;001010000000001&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-server aka show --config rradius.toml &lt;span style=&#34;color:#ae81ff&#34;&gt;001010000000001&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-server aka delete --config rradius.toml &lt;span style=&#34;color:#ae81ff&#34;&gt;001010000000001&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The results are messages like &lt;code&gt;disabled subscriber 001010000000001&lt;/code&gt;; when there is no such card it prints &lt;code&gt;no subscriber 001010000000001&lt;/code&gt; with status 1. It takes effect across the cluster at once and is seen by the next login, because every login reads the table, with no cache.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-master-key&#34;&gt;The master key&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;aka.key&lt;/code&gt; protects the Ki and OPc of every card in the table.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;What it protects against:&lt;/strong&gt; database files, backups, what is replicated between cluster nodes, scripts&amp;rsquo; &lt;code&gt;sql_query&lt;/code&gt;, and people with database access only. All of these see ciphertext.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;What it does not protect against:&lt;/strong&gt; someone who gets onto the host, who can read &lt;code&gt;aka.key&lt;/code&gt; and the program&amp;rsquo;s memory. If the master key leaks, treat every card as leaked; a leaked Ki means the card can be cloned, which changing the master key cannot undo. Only replacing the card can.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Every node needs the same key.&lt;/strong&gt; It is not in the database and is not replicated automatically. Without it, startup fails; when the contents differ, that only shows at decryption, and every login on that node fails.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Always back it up separately.&lt;/strong&gt; Losing it means importing every card again.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Permissions&lt;/strong&gt; must be something like 0600, 0640 or 0400; if others can read it, the server refuses to start.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Changing the master key:&lt;/strong&gt; on every node, put both keys in place (&lt;code&gt;key_file&lt;/code&gt; the new one, &lt;code&gt;previous_key_file&lt;/code&gt; the old) and send SIGHUP; re-encrypt both ciphertexts of every card with &lt;code&gt;aka-seal --key-file new --old-key-file old --imsi &amp;lt;IMSI&amp;gt;&lt;/code&gt; (giving the old ciphertext on standard input) and replace the values in the table; once all are done, remove &lt;code&gt;previous_key_file&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;preventing-abuse&#34;&gt;Preventing abuse&#xA;&lt;/h2&gt;&lt;p&gt;The server has to send a Challenge &lt;strong&gt;before&lt;/strong&gt; the other side has proven anything. Someone who knows an IMSI can keep asking.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;max_lookups&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;64&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;lookup_wait_ms&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;1000&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The sequence number cannot be pushed:&lt;/strong&gt; with &lt;code&gt;current_sqn_query&lt;/code&gt; and &lt;code&gt;proven_sqn_query&lt;/code&gt;, the Challenges someone without the card receives are never written to the database, and neither are wrong answers. So no per-card limit is needed; the attacker has no budget to use up, and the real card can log in at any time. The automated test confirms with 20 wrongly answered conversations that the sequence number does not move, and the real card logs in normally afterwards.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The cost:&lt;/strong&gt; when a card received a Challenge but the server never got the reply (lost signal, a NAS timeout), the next login first takes one extra round of resynchronisation, then succeeds as usual.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;max_lookups&lt;/code&gt;, &lt;code&gt;lookup_wait_ms&lt;/code&gt;:&lt;/strong&gt; each node runs at most this many subscriber lookups at once, which limits the load on the database. When full, it waits &lt;code&gt;lookup_wait_ms&lt;/code&gt; first, and refuses only if no slot frees up. When every device comes back online at once after a power cut, they queue instead of failing at once.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The older approach (&lt;code&gt;next_sqn_query&lt;/code&gt;)&lt;/strong&gt; advances the number every time, so it has &lt;code&gt;max_vectors_per_minute&lt;/code&gt; (a limit per node, per card, per minute) and &lt;code&gt;shared_budget&lt;/code&gt; (the limit shared across the whole cluster, at roughly half the login throughput). An attacker can use up this limit and keep that card out for a while. These two settings work only with &lt;code&gt;next_sqn_query&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Whether an IMSI exists can be seen:&lt;/strong&gt; issued IMSIs get a challenge, and unissued ones fail at once.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The IMSI is sent in plain text:&lt;/strong&gt; anyone within radio range can see a device&amp;rsquo;s IMSI. Pseudonyms and fast re-authentication are not available yet.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Not confirmed with real cards:&lt;/strong&gt; that a card refuses a second Challenge with &amp;ldquo;the same sequence number, a different RAND&amp;rdquo; is inferred from the 3GPP specification.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;several-nodes&#34;&gt;Several nodes&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;One login must complete on one node,&lt;/strong&gt; as with other EAP methods. Use primary/backup on the NAS, or have a load balancer pin by source (&lt;a class=&#34;link&#34; href=&#34;../08-ha-cluster/&#34; &gt;chapter 8&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Sequence numbers go through the cluster,&lt;/strong&gt; so when the cluster loses its majority no vectors can be issued, and AKA&amp;rsquo; logins fail.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;aka.key&lt;/code&gt; is one copy per node;&lt;/strong&gt; see above.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;before-going-live&#34;&gt;Before going live&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Not tested with real USIM cards and real devices,&lt;/strong&gt; only with wpa_supplicant&amp;rsquo;s simulated USIM and the project&amp;rsquo;s own tests. How each operating system supports and configures &amp;ldquo;a card not issued by an operator&amp;rdquo; is still unknown; always try with real cards and devices before going live.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The sequence number step of 32&lt;/strong&gt; follows 3GPP practice; how real cards check sequence numbers is up to the card, and only testing on real hardware will tell.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Only full EAP-AKA&amp;rsquo; authentication.&lt;/strong&gt; No EAP-AKA (the older version without the prime) and no EAP-SIM.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;common-problems&#34;&gt;Common problems&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Startup fails, mentioning &lt;code&gt;aka.key&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;setup.sh&lt;/code&gt; has not been run, or the file&amp;rsquo;s permissions are too broad&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;this subscriber&#39;s Ki: not a sealed value&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The table holds plain values; use the output of &lt;code&gt;aka-seal&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;sealed under a key this server does not have&lt;/code&gt; or &lt;code&gt;it does not open&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;This node&amp;rsquo;s &lt;code&gt;aka.key&lt;/code&gt; differs from the one used to encrypt, or the ciphertext was moved to another IMSI&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;an AUTS with a wrong MAC-S&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The card asked to resynchronise, but the Ki or OPc in the table differs from the card&amp;rsquo;s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;too many vectors for this subscriber&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;With &lt;code&gt;next_sqn_query&lt;/code&gt;, &lt;code&gt;max_vectors_per_minute&lt;/code&gt; was exceeded: the device keeps retrying, or someone keeps trying with this IMSI. With &lt;code&gt;current_sqn_query&lt;/code&gt; and &lt;code&gt;proven_sqn_query&lt;/code&gt; there is no such limit&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;the proven sequence number could not be stored&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The card answered correctly, but &lt;code&gt;proven_sqn_query&lt;/code&gt; failed, found no row, or is not written as &lt;code&gt;max(sqn, ?)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;too many subscriber lookups at once&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Many devices logging in at once, or the database slowing down; devices just retry. If it happens often, look at the database&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;resync_query left the sequence number at or below the card&#39;s&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;resync_query&lt;/code&gt; is not written as &lt;code&gt;max(sqn, ?) + 32&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The card keeps asking to resynchronise and cannot log in&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The sequence number in the table has been pushed further than the card accepts. Set &lt;code&gt;sqn&lt;/code&gt; back to a value the card accepts: &lt;code&gt;UPDATE aka_subscribers SET sqn = &amp;lt;value&amp;gt; WHERE imsi = &#39;...&#39;&lt;/code&gt; (as a migration file)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The card passes but the login is rejected, with &lt;code&gt;EAP conversation ... refused&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;certificate_query&lt;/code&gt; found nothing: the card is disabled, or the table has no enabled row for this IMSI&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;</description>
        </item><item>
            <title>14. Hundreds of Branch NAS: Dynamic Clients</title>
            <link>https://embark.systems/en/rradius/14-branch-nas/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/14-branch-nas/</guid>
            <description>&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt; a retail chain has hundreds of branches, each with an AP or gateway or two, and every month new stores open and old ones replace equipment. With the approach of the earlier chapters, every NAS needs its own &lt;code&gt;[[radius.clients]]&lt;/code&gt; in the configuration file, and every change means editing every node&amp;rsquo;s configuration and reloading.&lt;/p&gt;&#xA;&lt;p&gt;Instead, put the NAS in a &lt;strong&gt;table&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For requests whose source is not in the configuration file, rradius looks the source address up in the table, and when found, handles the request with the name and shared secret it found.&lt;/li&gt;&#xA;&lt;li&gt;Adding one takes a single &lt;code&gt;rradius-server client add&lt;/code&gt;; once written to the table, the whole cluster sees it, with no configuration change and no restart.&lt;/li&gt;&#xA;&lt;li&gt;Each NAS can have its own shared secret.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;When you do not need this:&lt;/strong&gt; with a dozen or so NAS that rarely change, the configuration file is fine. Nor with NAS on RadSec, which can already be recognised by certificate alone (&lt;a class=&#34;link&#34; href=&#34;../10-radsec/&#34; &gt;chapter 10&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Example directory: &lt;code&gt;rradius-server/examples/scenarios/branch-nas/&lt;/code&gt;&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;File&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Contents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius.dynamic_clients]&lt;/code&gt;, &lt;code&gt;[accounts.clients]&lt;/code&gt; for the &lt;code&gt;client&lt;/code&gt; command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/1_schema.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;nas&lt;/code&gt; (the branches&amp;rsquo; NAS), accounts and accounting (as in the quick start)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/2_demo_data.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One demo account clerk1, one demo NAS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;how-a-packet-is-recognised&#34;&gt;How a packet is recognised&#xA;&lt;/h2&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;source address&#xA;  ├─ matches some [[radius.clients]] ─────────────────► the configuration file&amp;#39;s (always first)&#xA;  ├─ not in the ranges of networks ───────────────────► dropped, no reply&#xA;  └─ in networks&#xA;       ├─ this address is remembered (found, not expired) ─► the remembered name and secret&#xA;       ├─ &amp;#34;not found&amp;#34; is remembered (not expired) ─────────► dropped&#xA;       └─ neither → look up the table&#xA;            ├─ found ─► remembered for lifetime_ms, this packet handled&#xA;            ├─ not found ─► remembered for negative_lifetime_ms, dropped&#xA;            └─ database error or too slow ─► dropped, not remembered, the next packet looks up again&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;steps&#34;&gt;Steps&#xA;&lt;/h2&gt;&lt;h3 id=&#34;1-start&#34;&gt;1. Start&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd rradius-server&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./target/release/rradius-server --config examples/scenarios/branch-nas/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;2-add-a-nas&#34;&gt;2. Add a NAS&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;%s\n&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;store-0107-secret-change-me&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  | ./target/release/rradius-server client add --config examples/scenarios/branch-nas/rradius.toml &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      --name store-0107-ap1 10.20.1.7&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# added client 10.20.1.7&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The row is now written across the cluster. From then on, requests from &lt;code&gt;10.20.1.7&lt;/code&gt; with this shared secret are handled, under the name &lt;code&gt;store-0107-ap1&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The example&amp;rsquo;s &lt;code&gt;networks&lt;/code&gt; is &lt;code&gt;10.20.0.0/16&lt;/code&gt;, and local test requests can only come from &lt;code&gt;127.0.0.1&lt;/code&gt;. So &lt;strong&gt;to see a dynamic lookup locally,&lt;/strong&gt; first change &lt;code&gt;networks&lt;/code&gt; to &lt;code&gt;[&amp;quot;127.0.0.0/8&amp;quot;]&lt;/code&gt;, then &lt;code&gt;client add --name test-ap 127.0.0.1&lt;/code&gt;, and send requests from this machine with that shared secret. That is what the automated test does.&lt;/p&gt;&#xA;&lt;h3 id=&#34;3-check&#34;&gt;3. Check&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;curl -s http://127.0.0.1:9812/metrics | grep rradius_dynamic_client&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;rradius_dynamic_client_lookups_total{result=&amp;quot;found&amp;quot;}&lt;/code&gt;: the number of successful lookups. A NAS is looked up only once within &lt;code&gt;lifetime_ms&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;rradius_dynamic_clients&lt;/code&gt;: how many are currently remembered.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;the-configuration-explained&#34;&gt;The configuration explained&#xA;&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;dynamic_clients&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;networks&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.20.0.0/16&amp;#34;&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;query&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT name, secret FROM nas WHERE address = ?&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;lifetime_ms&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;300000&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;negative_lifetime_ms&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;60000&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;max_clients&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;10000&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;networks&lt;/code&gt; (required):&lt;/strong&gt; only sources in these ranges are looked up. &lt;strong&gt;The narrower the better:&lt;/strong&gt; a single packet from any address in the range triggers a database query.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;query&lt;/code&gt; (required):&lt;/strong&gt; one &lt;code&gt;?&lt;/code&gt;, filled with the source address as text (&lt;code&gt;10.20.1.5&lt;/code&gt;). The first column is the name, the second the shared secret.&#xA;&lt;ul&gt;&#xA;&lt;li&gt;An empty name means the source address is used as the name.&lt;/li&gt;&#xA;&lt;li&gt;An empty secret, or a name equal to a client in the configuration file, is treated as not found, and a line is logged.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;lifetime_ms&lt;/code&gt;:&lt;/strong&gt; how long a found NAS is remembered (5 minutes by default). Changes to the table within that time are not seen by this node.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;negative_lifetime_ms&lt;/code&gt;:&lt;/strong&gt; how long &amp;ldquo;not found&amp;rdquo; is remembered (1 minute by default), during which it is not looked up again, so unknown sources cannot keep triggering queries.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;max_clients&lt;/code&gt;:&lt;/strong&gt; the most that are remembered. When full, expired entries are cleared first, then &amp;ldquo;not found&amp;rdquo; ones.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The query&amp;rsquo;s time limit&lt;/strong&gt; is &lt;code&gt;[lua] query_timeout_ms&lt;/code&gt;. The example sets it to 2 seconds.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;the-first-request-of-a-new-nas&#34;&gt;The first request of a new NAS&#xA;&lt;/h3&gt;&lt;p&gt;While a source is being looked up, its packets are dropped; they are also dropped when more than 16 lookups are running at once. So &lt;strong&gt;the first request of a new NAS usually gets a reply only after one retransmission;&lt;/strong&gt; after that it is as fast as a client in the configuration file. This is normal, and &lt;code&gt;rradius_dynamic_client_lookups_total{result=&amp;quot;busy&amp;quot;}&lt;/code&gt; counts it.&lt;/p&gt;&#xA;&lt;h3 id=&#34;how-dynamic-clients-differ-from-configured-ones&#34;&gt;How dynamic clients differ from configured ones&#xA;&lt;/h3&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Configured&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Dynamic&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Authentication chain&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Can be chosen with &lt;code&gt;auth&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Always the default chain&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP methods&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Can be chosen with &lt;code&gt;eap_methods&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;All of the server&amp;rsquo;s methods&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Message-Authenticator settings&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Can be overridden per client&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Those of &lt;code&gt;[radius]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;As a CoA target (&lt;code&gt;send_coa&lt;/code&gt;, CoA forwarding)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RadSec&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No, UDP only&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Per-client metrics&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No, only the two totals above&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;To send CoA to particular NAS, or have them use another chain, put those NAS in the configuration file. Configured clients always come first.&lt;/p&gt;&#xA;&lt;h2 id=&#34;adding-changing-and-removing-one&#34;&gt;Adding, changing and removing one&#xA;&lt;/h2&gt;&lt;h3 id=&#34;with-the-client-command&#34;&gt;With the &lt;code&gt;client&lt;/code&gt; command&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Add one: the shared secret is read from standard input, not the command line&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;%s\n&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;lt;this NAS&amp;#39;&lt;/span&gt;s shared secret&amp;gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39; | rradius-server client add --config rradius.toml --name store-0405-ap1 10.20.4.5&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;# Change the shared secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;printf &amp;#39;&lt;/span&gt;%s&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39; &amp;#39;&lt;/span&gt;&amp;lt;the new shared secret&amp;gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&amp;#39;&lt;/span&gt; | rradius-server client secret --config rradius.toml 10.20.4.5&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Show, remove&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-server client show --config rradius.toml 10.20.4.5&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-server client delete --config rradius.toml 10.20.4.5&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The SQL each action runs is set in &lt;code&gt;[accounts.clients]&lt;/code&gt;, and the table structure is up to you:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;accounts&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;clients&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;add&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;INSERT INTO nas (address, name, secret) VALUES (?1, ?2, ?3)&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;secret&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;UPDATE nas SET secret = ?2 WHERE address = ?1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;delete&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;DELETE FROM nas WHERE address = ?1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;show&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT address, name FROM nas WHERE address = ?1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;?1&lt;/code&gt; is the address; &lt;code&gt;?2&lt;/code&gt; of &lt;code&gt;add&lt;/code&gt; is the name and &lt;code&gt;?3&lt;/code&gt; the shared secret; &lt;code&gt;?2&lt;/code&gt; of &lt;code&gt;secret&lt;/code&gt; is the new shared secret.&lt;/strong&gt; The full rules are in section 2.14 of the reference document.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Checked before sending;&lt;/strong&gt; when something is wrong, nothing is written and it exits with status 2: the address must be one IP (not a range), must fall inside &lt;code&gt;networks&lt;/code&gt;, and must not fall inside the address or range of any configured client (it would never be looked up); the name must not equal a configured client&amp;rsquo;s (the server would treat it as not found).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A shared secret shorter than 16 characters gives a warning,&lt;/strong&gt; but is written anyway, as for configured clients.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The write goes through the cluster,&lt;/strong&gt; and it can run on any node. The command connects with &lt;code&gt;[cluster]&lt;/code&gt;&amp;rsquo;s &lt;code&gt;secret_api&lt;/code&gt;, so make the configuration file readable only by administrators.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Results:&lt;/strong&gt; &lt;code&gt;added client 10.20.4.5&lt;/code&gt;, &lt;code&gt;secret changed for client 10.20.4.5&lt;/code&gt;, &lt;code&gt;deleted client 10.20.4.5&lt;/code&gt;, status 0; &lt;code&gt;no client 10.20.4.5&lt;/code&gt; with status 1 when there is no such row; status 1 when the database refuses because the address or name already exists.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;with-a-migration-file&#34;&gt;With a migration file&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;-- 3_new_stores.sql&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;INSERT&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;INTO&lt;/span&gt; nas (address, name, secret) &lt;span style=&#34;color:#66d9ef&#34;&gt;VALUES&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  (&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;10.20.4.5&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;store-0405-ap1&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;lt;this NAS&amp;#39;&amp;#39;s shared secret&amp;gt;&amp;#39;&lt;/span&gt;),&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  (&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;10.20.4.6&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;store-0405-ap2&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;lt;this NAS&amp;#39;&amp;#39;s shared secret&amp;gt;&amp;#39;&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Put it on every node and restart them one by one (&lt;a class=&#34;link&#34; href=&#34;../08-ha-cluster/#adding-a-migration&#34; &gt;chapter 8&lt;/a&gt;). This suits importing a large batch the first time and keeping the list in version control; later changes use the &lt;code&gt;client&lt;/code&gt; command.&lt;/p&gt;&#xA;&lt;h3 id=&#34;how-soon-changes-take-effect&#34;&gt;How soon changes take effect&#xA;&lt;/h3&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Action&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;When this node sees it&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Adding a new one&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Its next packet (if never looked up before); if it was looked up before and &amp;ldquo;not found&amp;rdquo;, at most &lt;code&gt;negative_lifetime_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Changing the shared secret&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;At most &lt;code&gt;lifetime_ms&lt;/code&gt;. Meanwhile, packets the NAS sends with the new secret fail verification and get no reply&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Removing one&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;At most &lt;code&gt;lifetime_ms&lt;/code&gt;, during which it still works&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The &lt;code&gt;client&lt;/code&gt; command only changes the table and does not notify nodes, so the table above still applies. &lt;strong&gt;To take effect at once, send SIGHUP to every node:&lt;/strong&gt; reloading clears everything remembered. Secret changes and removals usually need this.&lt;/p&gt;&#xA;&lt;h2 id=&#34;before-going-live&#34;&gt;Before going live&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Shared secrets are stored in plain text in the table.&lt;/strong&gt; Anyone who can read the database, and scripts under &lt;code&gt;[lua]&lt;/code&gt;, can see them. Control access to the data directory, backups and scripts.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Source addresses can be forged.&lt;/strong&gt; UDP source addresses are unreliable; the shared secret and Message-Authenticator are the real verification. The example keeps the &lt;code&gt;[radius]&lt;/code&gt; default &lt;code&gt;require_message_authenticator = &amp;quot;yes&amp;quot;&lt;/code&gt;, which applies to dynamic clients too.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The cost of scanning:&lt;/strong&gt; when someone sends packets from many addresses in the range (or forged sources), each address triggers a lookup and is remembered as &amp;ldquo;not found&amp;rdquo;. The limit on concurrent lookups (16) and &lt;code&gt;negative_lifetime_ms&lt;/code&gt; bound the load, but keep &lt;code&gt;networks&lt;/code&gt; as small as possible anyway, and let the firewall pass only the ranges that really have NAS.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When the database has problems:&lt;/strong&gt; remembered NAS keep being served until &lt;code&gt;lifetime_ms&lt;/code&gt; expires; after that, lookups fail and packets are dropped (counted as &lt;code&gt;result=&amp;quot;failed&amp;quot;&lt;/code&gt;), without being remembered as &amp;ldquo;not found&amp;rdquo;. The lookup reads the local replica and by design does not need the cluster&amp;rsquo;s majority (this case has not been tested specifically).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The accounting spool:&lt;/strong&gt; once accounting from a dynamic client goes into the spool (&lt;a class=&#34;link&#34; href=&#34;../07-broadband/#the-accounting-spool&#34; &gt;chapter 7&lt;/a&gt;), replay looks the source address up again at that time, and handles it only if the name is the same. So &lt;strong&gt;do not rename a NAS while the spool still holds data,&lt;/strong&gt; or that accounting moves to &lt;code&gt;rejected.log&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The client column in the accounting table&lt;/strong&gt; is the name from the table, so names must be unique and must not change once set. &lt;code&gt;nas.name&lt;/code&gt; in the example is &lt;code&gt;UNIQUE&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Monitoring:&lt;/strong&gt; a sudden rise in &lt;code&gt;rradius_dynamic_client_lookups_total{result=&amp;quot;not_found&amp;quot;}&lt;/code&gt; means unregistered devices are sending requests, or someone is scanning; a rise in &lt;code&gt;result=&amp;quot;failed&amp;quot;&lt;/code&gt; means a database problem.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Not tested:&lt;/strong&gt; real NAS. The scenario test checks locally that logins and accounting work after &lt;code&gt;client add&lt;/code&gt;, that after &lt;code&gt;client secret&lt;/code&gt; the node keeps using the remembered secret until SIGHUP, and that after &lt;code&gt;client delete&lt;/code&gt; plus SIGHUP there is no reply.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;common-problems&#34;&gt;Common problems&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A new NAS gets no reply at all&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The source is not in &lt;code&gt;networks&lt;/code&gt;; the table&amp;rsquo;s &lt;code&gt;address&lt;/code&gt; differs from the source rradius sees (NAT, several interfaces); or it was just not found and is still within &lt;code&gt;negative_lifetime_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A new NAS&amp;rsquo;s first request gets no reply, and a retransmission works&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Normal: packets are dropped during the lookup&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The log says the name is the same as a configured client&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The table&amp;rsquo;s &lt;code&gt;name&lt;/code&gt; must not equal the &lt;code&gt;name&lt;/code&gt; of any &lt;code&gt;[[radius.clients]]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A NAS stops working after its secret was changed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The node still remembers the old secret; send SIGHUP or wait &lt;code&gt;lifetime_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;It still works after removal&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same as above&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP for a dynamic client offers methods it should not&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Dynamic clients cannot set &lt;code&gt;eap_methods&lt;/code&gt; and get all of the server&amp;rsquo;s methods. To restrict them, put that NAS in the configuration file&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;invalid&amp;quot;}&lt;/code&gt; increases&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The shared secret in the table differs from the one on the NAS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;</description>
        </item><item>
            <title>15. Certificate Revocation and Fast Reconnection</title>
            <link>https://embark.systems/en/rradius/15-wifi-certs/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/15-wifi-certs/</guid>
            <description>&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt; some time after the enterprise Wi-Fi of &lt;a class=&#34;link&#34; href=&#34;../03-enterprise-wifi/&#34; &gt;chapter 3&lt;/a&gt; goes live, two things come up:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;A laptop is lost.&lt;/strong&gt; Its certificate has two years left before it expires. Disabling it in the table stops logins, but the security policy requires the certificate itself to be revoked, and the same certificate may be used by other systems too.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Devices roaming between access points do a full TLS handshake at every new one.&lt;/strong&gt; At busy times the server&amp;rsquo;s CPU goes into signatures, and users feel a hiccup when they change access point. With several nodes, a device that reaches another node starts from scratch again.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This chapter adds three things to certificate logins (EAP-TLS): revocation lists (CRL), online revocation checks (OCSP), and resuming the previous session (session resumption).&lt;/p&gt;&#xA;&lt;p&gt;Example directory: &lt;code&gt;rradius-server/examples/scenarios/wifi-certs/&lt;/code&gt;&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;File&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Contents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;crl_file&lt;/code&gt;, &lt;code&gt;resumption_ms&lt;/code&gt; and &lt;code&gt;shared_tickets&lt;/code&gt; in &lt;code&gt;[radius.eap]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;setup.sh&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Creates a demo CA, a server certificate, two laptop certificates (one revoked), a revocation list and &lt;code&gt;ticket.seal&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;devices&lt;/code&gt; (devices and VLANs), &lt;code&gt;accounting&lt;/code&gt;, and two demo laptops&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;the-checks-a-certificate-login-passes&#34;&gt;The checks a certificate login passes&#xA;&lt;/h2&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Handshake: signed by client_ca_file? expired? in crl_file?&#xA;  │      (resuming an old session skips the handshake, but checks the certificate again against the current CA and CRL)&#xA;  ▼&#xA;OCSP (when configured): ask the CA&amp;#39;s responder for this certificate&amp;#39;s status&#xA;  ▼&#xA;Name: does the EAP Identity match a name on the certificate?&#xA;  ▼&#xA;Authentication chain: does certificate_query find this device?&#xA;  ▼&#xA;Access-Accept&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Each check can stop a device, at different speeds:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Approach&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;How soon it takes effect&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Suits&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Disabled in the table (&lt;code&gt;enabled = 0&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The next login, across the cluster&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Everyday disabling. Stops it only at rradius&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Revocation list (CRL)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Once the new list is on every node and SIGHUP has been sent&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;CAs that publish CRLs&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;OCSP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Once the answer obtained earlier expires (set by the CA, commonly hours to days)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;CAs that offer only OCSP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;steps&#34;&gt;Steps&#xA;&lt;/h2&gt;&lt;h3 id=&#34;1-create-the-certificates-and-key&#34;&gt;1. Create the certificates and key&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd rradius-server&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;examples/scenarios/wifi-certs/setup.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This creates &lt;code&gt;certs/&lt;/code&gt; (the CA, the server certificate, &lt;code&gt;laptop-001&lt;/code&gt;, the revoked &lt;code&gt;laptop-002&lt;/code&gt;, &lt;code&gt;ca.crl&lt;/code&gt;) and &lt;code&gt;ticket.seal&lt;/code&gt; in the scenario directory. &lt;strong&gt;For testing only.&lt;/strong&gt; Existing files are not overwritten.&lt;/p&gt;&#xA;&lt;h3 id=&#34;2-start&#34;&gt;2. Start&#xA;&lt;/h3&gt;&lt;p&gt;For local testing, change the &lt;code&gt;address&lt;/code&gt; of &lt;code&gt;wlc&lt;/code&gt; to &lt;code&gt;127.0.0.1&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./target/release/rradius-server --config examples/scenarios/wifi-certs/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;3-test&#34;&gt;3. Test&#xA;&lt;/h3&gt;&lt;p&gt;Use &lt;code&gt;eapol_test&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../03-enterprise-wifi/#3-test-with-eapol_test&#34; &gt;chapter 3&lt;/a&gt; explains how to install it), with a configuration like &lt;code&gt;eapol/tls.conf&lt;/code&gt; from chapter 3, changing the certificate to &lt;code&gt;certs/laptop-001.pem&lt;/code&gt; and &lt;code&gt;certs/laptop-001.key&lt;/code&gt; here and &lt;code&gt;identity&lt;/code&gt; to &lt;code&gt;laptop-001.corp.example.com&lt;/code&gt;. This chapter does not include its own &lt;code&gt;eapol_test&lt;/code&gt; configuration and has not run this scenario with it.&lt;/p&gt;&#xA;&lt;p&gt;The automated test plays the laptop itself, goes through the whole EAP-TLS exchange, and checks:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Situation&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Result&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;laptop-001&lt;/code&gt; logs in for the first time&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Accept, VLAN 10, full handshake&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;laptop-001&lt;/code&gt; logs in again&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Accept, &lt;strong&gt;resuming the previous session&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;laptop-002&lt;/code&gt; (in the revocation list)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Reject&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;laptop-001&lt;/code&gt;&amp;rsquo;s certificate, but claiming to be &lt;code&gt;laptop-002&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Reject: the name does not match the certificate&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After &lt;code&gt;user disable laptop-001.corp.example.com&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Reject, even for a resumed session&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After &lt;code&gt;user enable ...&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Accept&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;revocation-lists-crl&#34;&gt;Revocation lists (CRL)&#xA;&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;eap&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;client_ca_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;certs/ca.pem&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;crl_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;certs/ca.crl&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Certificates on the list fail the handshake.&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;After updating the list, send SIGHUP&lt;/strong&gt; so it is read again; every node needs the updated file and the signal. New conversations use the new list, and conversations in progress finish with the old one (two minutes at most).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The lists must cover every CA in the chain.&lt;/strong&gt; With an intermediate CA, concatenate the root and intermediate CRLs into one file (PEM). When one is missing, every device is rejected, with &lt;code&gt;UnknownRevocationStatus&lt;/code&gt; in the log.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When the list expires, EAP-TLS keeps using it,&lt;/strong&gt; so make sure it is updated regularly yourself; certificates revoked after it expired would be missed.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Scheduled updates:&lt;/strong&gt; use cron or a systemd timer to download the CRL from the CA regularly, convert it to PEM, put it at &lt;code&gt;crl_file&lt;/code&gt;&amp;rsquo;s location, and send SIGHUP. When the download fails, keep the old file; never put an empty file in place.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The example&amp;rsquo;s &lt;code&gt;setup.sh&lt;/code&gt; shows how to revoke a certificate and produce a CRL with &lt;code&gt;openssl ca&lt;/code&gt;; the notes at the top of the file have the commands for revoking another one later.&lt;/p&gt;&#xA;&lt;h2 id=&#34;ocsp-when-the-ca-publishes-no-revocation-list&#34;&gt;OCSP: when the CA publishes no revocation list&#xA;&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;eap&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ocsp&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;soft&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ocsp_url&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;http://ocsp.corp.example.com/&amp;#34;&lt;/span&gt;   &lt;span style=&#34;color:#75715e&#34;&gt;# optional&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;OCSP asks the CA&amp;rsquo;s server (the responder) in real time &amp;ldquo;is this certificate still valid&amp;rdquo;. In the example configuration these two lines are comments, because the demo CA has no responder.&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Setting&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Responder says good&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Says revoked&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Says unknown, does not answer, or answers wrongly&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;quot;off&amp;quot;&lt;/code&gt; (default)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Not asked&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Not asked&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Not asked&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;quot;soft&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Let through&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rejected&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Let through, logging &lt;code&gt;OCSP: no answer, let through&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;quot;hard&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Let through&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rejected&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rejected&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;&amp;quot;soft&amp;quot;&lt;/code&gt; or &lt;code&gt;&amp;quot;hard&amp;quot;&lt;/code&gt;:&lt;/strong&gt; with &lt;code&gt;&amp;quot;hard&amp;quot;&lt;/code&gt;, as soon as the responder goes down, every certificate login fails, which ties Wi-Fi availability to the CA&amp;rsquo;s OCSP service. &lt;code&gt;&amp;quot;soft&amp;quot;&lt;/code&gt; does not, but someone who can block the connection between rradius and the responder can make revocation ineffective. When revocation must take effect, use &lt;code&gt;&amp;quot;hard&amp;quot;&lt;/code&gt; and make sure the responder is reliable enough.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Who is asked:&lt;/strong&gt; the responder address in the certificate, or &lt;code&gt;ocsp_url&lt;/code&gt; (which is used for every certificate in the chain, so it must know the whole chain). The CAs in &lt;code&gt;client_ca_file&lt;/code&gt; themselves are not checked.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Answers are remembered&lt;/strong&gt; until the expiry time they state. The same device logging in again is not asked about again, so revocation takes effect only once the old answer has expired.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A down responder does not make every login wait:&lt;/strong&gt; one query waits at most 3 seconds, and certificates with no answer are not asked about again for 90 seconds.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Nodes must be able to reach the responder,&lt;/strong&gt; usually HTTP on port 80. Proxies set in environment variables are not used.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;CRL and OCSP can be set together;&lt;/strong&gt; both must pass.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Limits:&lt;/strong&gt; answer signatures are supported only for RSA (2048 bits or more) and ECDSA P-256/P-384. When &lt;code&gt;client_ca_file&lt;/code&gt; has a CA with another kind of key, setting &lt;code&gt;ocsp&lt;/code&gt; makes startup fail, naming which CA it is.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;RadSec (&lt;code&gt;[radius.tls]&lt;/code&gt;) and TACACS+ over TLS (&lt;code&gt;[tacacs.tls]&lt;/code&gt;) have the same &lt;code&gt;ocsp&lt;/code&gt; and &lt;code&gt;ocsp_url&lt;/code&gt;, for checking NAS and device certificates, in the same way; the difference is that open connections are looked at again about once a minute. The full rules are under &amp;ldquo;OCSP&amp;rdquo; in usage section 2.12.&lt;/p&gt;&#xA;&lt;h2 id=&#34;fast-reconnection-session-resumption&#34;&gt;Fast reconnection (session resumption)&#xA;&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;eap&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;resumption_ms&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;3600000&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;shared_tickets&lt;/span&gt; = &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ticket_seal_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ticket.seal&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A device&amp;rsquo;s first login does a full TLS handshake. When it reconnects within &lt;code&gt;resumption_ms&lt;/code&gt; (roaming to another access point, waking from sleep), both sides resume directly with the secret negotiated last time, skipping the certificate exchange and the signatures.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Security checks are not skipped:&lt;/strong&gt; on resumption, the previous certificate is checked again against the current &lt;code&gt;client_ca_file&lt;/code&gt; and &lt;code&gt;crl_file&lt;/code&gt;, and OCSP too when configured; the name check and authentication chain that follow are the same as for a full handshake. So revocation and disabling are just as effective for resumed sessions.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;resumption_ms&lt;/code&gt;&lt;/strong&gt; defaults to 0 (no resumption), at most one day. How long to set it depends on how long you can accept a device not presenting its certificate again.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;resumption_ms-alone&#34;&gt;&lt;code&gt;resumption_ms&lt;/code&gt; alone&#xA;&lt;/h3&gt;&lt;p&gt;Sessions are kept in each node&amp;rsquo;s memory.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Only TLS 1.2 can resume.&lt;/li&gt;&#xA;&lt;li&gt;A device reaching &lt;strong&gt;another node&lt;/strong&gt; finds no record there and does a full handshake.&lt;/li&gt;&#xA;&lt;li&gt;Cleared by a restart or SIGHUP.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;That is enough for a single node, or when the NAS always reaches the same node (primary/backup).&lt;/p&gt;&#xA;&lt;h3 id=&#34;adding-shared_tickets--true&#34;&gt;Adding &lt;code&gt;shared_tickets = true&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;rradius also issues &lt;strong&gt;session tickets&lt;/strong&gt;: the data needed for resumption, encrypted and handed to the device to keep, which the device brings back on its next connection.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Devices can resume on any node,&lt;/strong&gt; because every node can decrypt them.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;TLS 1.3 can resume too.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;The keys that encrypt tickets are rotated by the cluster itself:&lt;/strong&gt; one per &lt;code&gt;resumption_ms&lt;/code&gt; period, stored in a cluster table and shared by the nodes. There is no key rotation to schedule yourself.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;code&gt;ticket_seal_file&lt;/code&gt; (required):&lt;/strong&gt; the ticket keys in the table are encrypted again with this file. It is not in the database, so someone who has only the database or a backup cannot decrypt the ticket keys, and so cannot forge tickets to impersonate a device.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;umask 077; openssl rand -hex &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt; &amp;gt; ticket.seal&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Every node needs the same file,&lt;/strong&gt; with permissions such as 0600, 0640 or 0400. A node with different contents cannot open keys written by the others, logging &lt;code&gt;does not open with ticket_seal_file&lt;/code&gt;; that node neither issues tickets nor accepts tickets issued by other nodes, and devices do a full handshake instead. &lt;strong&gt;Logins still complete,&lt;/strong&gt; only more slowly.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;When the database cannot be read for a moment,&lt;/strong&gt; the same applies: that login issues no ticket and completes as usual, logging &lt;code&gt;EAP session ticket keys: ...&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;which-methods-resume&#34;&gt;Which methods resume&#xA;&lt;/h3&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Method&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Resumes?&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP-TLS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Yes. With &lt;code&gt;shared_tickets&lt;/code&gt;, across nodes and with TLS 1.3 too&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PEAP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Saves only the outer handshake; the inner password is still checked. It issues no tickets, so only on the same node&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP-TTLS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Does not resume&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP-AKA&#39;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Not applicable; it has no TLS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;changing-ticketseal&#34;&gt;Changing &lt;code&gt;ticket.seal&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;On every node, set the new file as &lt;code&gt;ticket_seal_file&lt;/code&gt; and the old one as &lt;code&gt;previous_ticket_seal_file&lt;/code&gt;, and send SIGHUP. New keys are then encrypted with the new file, those encrypted with the old file still open, and tickets already issued stay valid.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;All nodes must change within the same &lt;code&gt;resumption_ms&lt;/code&gt; period.&lt;/strong&gt; Nodes not yet changed cannot open keys written by changed nodes, and issue no tickets during that time.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Once all are changed, wait three more &lt;code&gt;resumption_ms&lt;/code&gt; periods&lt;/strong&gt; before removing &lt;code&gt;previous_ticket_seal_file&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Changing without &lt;code&gt;previous_ticket_seal_file&lt;/code&gt; also works, at the cost of tickets issued in up to two periods becoming invalid, so devices do one full handshake.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;other-ways-to-save-cpu&#34;&gt;Other ways to save CPU&#xA;&lt;/h2&gt;&lt;p&gt;With a high login volume, switch the server certificate to &lt;strong&gt;ECDSA P-256&lt;/strong&gt;: on the same machine, each full handshake uses about a third of the CPU of RSA 2048. Use the P-256 curve, not P-384 (old Android versions have been reported not to support it). The server uses one certificate at a time, so connect once with every kind of device before switching. Measurements and compatibility notes are in usage section 2.12.&lt;/p&gt;&#xA;&lt;h2 id=&#34;before-going-live&#34;&gt;Before going live&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Protect &lt;code&gt;ticket.seal&lt;/code&gt; like a certificate private key.&lt;/strong&gt; Losing it loses no data (generate a new one, and devices do one full handshake), but leaking it together with the database lets someone forge tickets.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TLS 1.2 tickets carry more risk:&lt;/strong&gt; a ticket contains the main secret of that connection, and someone who obtains the key of the time can compute that connection&amp;rsquo;s wireless encryption keys. TLS 1.3 resumption always exchanges keys anew and does not have this problem. When every device supports TLS 1.3, the risk is much smaller.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Monitoring:&lt;/strong&gt; a sudden rise in &lt;code&gt;rradius_eap_sessions_total{method=&amp;quot;tls&amp;quot;,result=&amp;quot;reject&amp;quot;}&lt;/code&gt; may mean a missing CRL for some CA, or OCSP set to &lt;code&gt;&amp;quot;hard&amp;quot;&lt;/code&gt; with the responder down.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Not tested:&lt;/strong&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;OCSP is not in the scenario test,&lt;/strong&gt; because it needs a responder. The project&amp;rsquo;s interoperability tests (&lt;code&gt;docker/interop/run.sh&lt;/code&gt;) have tested EAP-TLS with OpenSSL&amp;rsquo;s responder.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Resumption across nodes is not in the scenario test:&lt;/strong&gt; the scenario test has one node, and checks that a second login on the same node resumes the session, that the revocation list stops the revoked certificate, and that a disabled device is rejected on resumption too.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Real access points and every operating system.&lt;/strong&gt; Whether devices bring tickets back, and how they resume, differs between clients.&lt;/li&gt;&#xA;&lt;li&gt;The part of &lt;code&gt;setup.sh&lt;/code&gt; that creates certificates and the revocation list has been run with LibreSSL 3.3 (macOS) and OpenSSL 3.5 (a Linux container).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;common-problems&#34;&gt;Common problems&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After setting &lt;code&gt;crl_file&lt;/code&gt;, every device is rejected, with &lt;code&gt;UnknownRevocationStatus&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The CRL of some CA is missing, or a CRL of another CA was put in place&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A revoked certificate can still log in&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;CRL: the new list is not yet on that node, or no SIGHUP was sent. OCSP: the old answer has not expired, or it is &lt;code&gt;&amp;quot;soft&amp;quot;&lt;/code&gt; and the responder did not answer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;OCSP: no good answer: ...&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;With &lt;code&gt;&amp;quot;hard&amp;quot;&lt;/code&gt;, no answer was obtained. The reason follows: the responder cannot be reached, the answer has expired, or the signature is wrong&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;OCSP: no answer, let through&lt;/code&gt; keeps appearing in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;With &lt;code&gt;&amp;quot;soft&amp;quot;&lt;/code&gt;, the responder does not answer; can the node reach it?&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Startup fails, mentioning &lt;code&gt;ticket_seal_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;shared_tickets&lt;/code&gt; is set but the file does not exist, its permissions are too broad, or &lt;code&gt;resumption_ms&lt;/code&gt; is not set&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Startup fails, mentioning &lt;code&gt;ticket_key_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An old setting that has been removed. Use &lt;code&gt;shared_tickets&lt;/code&gt; and a newly created &lt;code&gt;ticket_seal_file&lt;/code&gt;; do not rename the old file and reuse it&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;does not open with ticket_seal_file&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;This node&amp;rsquo;s &lt;code&gt;ticket.seal&lt;/code&gt; differs from the other nodes&amp;rsquo;. Logins work, but do not resume&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;the certificate of a resumed session no longer passes&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The check on resumption found the certificate revoked or expired. This is a normal reject&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;resumption_ms&lt;/code&gt; is set but every login is a full handshake&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The device reached another node without &lt;code&gt;shared_tickets&lt;/code&gt;; it uses TTLS; or the device itself does not resume&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;</description>
        </item><item>
            <title>16. Network Device Administration: Moving to TACACS&#43; over TLS</title>
            <link>https://embark.systems/en/rradius/16-device-admin-tls/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/16-device-admin-tls/</guid>
            <description>&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt; the TACACS+ of &lt;a class=&#34;link&#34; href=&#34;../06-device-admin/&#34; &gt;chapter 6&lt;/a&gt; obfuscates packet contents with the shared secret, which uses only MD5 and cannot stop someone who can capture traffic on the management network: administrators&amp;rsquo; passwords and every command they ran can be decoded. Newer devices support &lt;strong&gt;TACACS+ over TLS&lt;/strong&gt; (RFC 9887): the whole connection goes inside TLS 1.3, and devices and the server verify each other by certificate.&lt;/p&gt;&#xA;&lt;p&gt;Devices are not all replaced in a day, so there is a period where both run side by side:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Core routers&lt;/strong&gt; already support it: they move to the TLS port, each with its own certificate.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Access switches&lt;/strong&gt; still have old firmware: they keep using the shared secret port.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Once everything has moved,&lt;/strong&gt; the port without TLS is closed.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This chapter reuses the accounts, roles and command records of chapter 6, and covers only TLS and the migration.&lt;/p&gt;&#xA;&lt;p&gt;Example directory: &lt;code&gt;rradius-server/examples/scenarios/device-admin-tls/&lt;/code&gt;&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;File&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Contents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[tacacs]&lt;/code&gt; plus &lt;code&gt;[tacacs.tls]&lt;/code&gt;, two kinds of client, one authorization group&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;make-certs.sh&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Creates a demo device CA, a server certificate and three device certificates&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;core.secret&lt;/code&gt;, &lt;code&gt;access.secret&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Shared secrets for the two groups of devices&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The script and tables are chapter 6&amp;rsquo;s &lt;code&gt;../device-admin/tacacs.lua&lt;/code&gt; and &lt;code&gt;../device-admin/migrations/&lt;/code&gt;, so the two directories must be kept together.&lt;/p&gt;&#xA;&lt;h2 id=&#34;two-ports&#34;&gt;Two ports&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Port without TLS&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;TLS port&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Setting&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[tacacs] port&lt;/code&gt;, 49 by default&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[tacacs.tls] port&lt;/code&gt;, 300 by default&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Protection&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Obfuscation with the shared secret (MD5)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TLS 1.3, and devices must present a certificate&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How devices are recognised&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Source address&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Source address, plus certificate&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Shared secret&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Must match the device&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Not used (still required in the configuration)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Once connected, authentication, authorization and accounting are handled exactly the same way: the same chains, scripts and authorization groups.&lt;/p&gt;&#xA;&lt;h2 id=&#34;steps&#34;&gt;Steps&#xA;&lt;/h2&gt;&lt;h3 id=&#34;1-create-the-certificates&#34;&gt;1. Create the certificates&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd rradius-server/examples/scenarios/device-admin-tls&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./make-certs.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;certs/&lt;/code&gt; then holds &lt;code&gt;ca.pem&lt;/code&gt;, the server&amp;rsquo;s &lt;code&gt;server.pem&lt;/code&gt;/&lt;code&gt;server.key&lt;/code&gt; (name &lt;code&gt;tacacs.mgmt.example.net&lt;/code&gt;), and three device certificates: &lt;code&gt;core-rtr-1&lt;/code&gt;, &lt;code&gt;core-rtr-2&lt;/code&gt; and &lt;code&gt;spare&lt;/code&gt;. &lt;strong&gt;For testing only.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;2-start&#34;&gt;2. Start&#xA;&lt;/h3&gt;&lt;p&gt;49 and 300 are both below 1024, which ordinary accounts cannot bind. For local testing, change them to 4949 and 4300 first; for production, see &lt;a class=&#34;link&#34; href=&#34;../06-device-admin/#before-going-live&#34; &gt;&amp;ldquo;Before going live&amp;rdquo; in chapter 6&lt;/a&gt;. For local testing, change the &lt;code&gt;address&lt;/code&gt; of &lt;code&gt;core-rtr-1&lt;/code&gt; to &lt;code&gt;127.0.0.1&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd ../../..&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./target/release/rradius-server --config examples/scenarios/device-admin-tls/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The log has two lines, &lt;code&gt;TACACS+ Server listening on ...&lt;/code&gt; and &lt;code&gt;TACACS+ over TLS listening on ...&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;3-check-the-handshake&#34;&gt;3. Check the handshake&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd examples/scenarios/device-admin-tls&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;openssl s_client -connect 127.0.0.1:4300 -tls1_3 -servername tacacs.mgmt.example.net &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  -CAfile certs/ca.pem -cert certs/core-rtr-1.pem -key certs/core-rtr-1.key&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;Verify return code: 0 (ok)&lt;/code&gt; means the certificate part works. &lt;code&gt;openssl&lt;/code&gt; can only check the handshake; logins and authorization have to come from a device that supports RFC 9887. The automated test plays the device in code and checks the following:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Situation&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Result&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;core-rtr-1&lt;/code&gt;&amp;rsquo;s certificate, from its address: netadmin1 logs in&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PASS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same connection: wrong password&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;FAIL&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same connection: netadmin1 starts a shell&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PASS, &lt;code&gt;priv-lvl=15&lt;/code&gt; (decided by the script from the role)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same connection: noc1 runs &lt;code&gt;configure terminal&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;FAIL&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A packet not marked &amp;ldquo;unobfuscated&amp;rdquo;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;ERROR, connection closed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;core-rtr-2&lt;/code&gt;&amp;rsquo;s certificate, from &lt;code&gt;core-rtr-1&lt;/code&gt;&amp;rsquo;s address&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Closed after the handshake: the certificate is not valid for this device&amp;rsquo;s &lt;code&gt;tls_name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A certificate belonging to no device (&lt;code&gt;spare&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Closed after the handshake&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A client that only speaks TLS 1.2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Handshake fails&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;core-rtr-1&lt;/code&gt; connecting to the port without TLS instead&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Connection closed: a device with &lt;code&gt;tls_name&lt;/code&gt; set can only use TLS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access switch with the shared secret: starts a shell&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PASS, &lt;code&gt;priv-lvl=1&lt;/code&gt; (the authorization group&amp;rsquo;s rule)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access switch: &lt;code&gt;show running-config&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;FAIL&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;the-configuration-explained&#34;&gt;The configuration explained&#xA;&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;tacacs&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;port&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;49&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;enable&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;deny&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;tacacs&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;tls&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;port&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;300&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;cert_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;certs/server.pem&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;key_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;certs/server.key&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;client_ca_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;certs/ca.pem&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;tls_only&lt;/span&gt; = &lt;span style=&#34;color:#66d9ef&#34;&gt;false&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;client_ca_file&lt;/code&gt; is the CA that issues device certificates.&lt;/strong&gt; Only it is trusted, not the system&amp;rsquo;s root certificates. Use a CA dedicated to network devices: if this CA also signs certificates for other purposes, those could be used to impersonate devices (see &lt;code&gt;tls_name&lt;/code&gt; below).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TLS 1.3 only, and devices must have a certificate.&lt;/strong&gt; A device with no certificate, the wrong certificate, or only TLS 1.2 fails the handshake.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The address comes from &lt;code&gt;[tacacs] bind&lt;/code&gt;;&lt;/strong&gt; both ports bind the same address. The connection limit and idle timeout are shared too.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;binding-certificates-to-devices-with-tls_name&#34;&gt;Binding certificates to devices with &lt;code&gt;tls_name&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;tacacs&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;clients&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;core-rtr-1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.50.0.1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;tls_name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;core-rtr-1.mgmt.example.net&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;secret_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;core.secret&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;tacacs&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;clients&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;access-switches&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.60.0.0/22&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;secret_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;access.secret&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;authorize_group&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;readonly&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A device is always first matched to its &lt;code&gt;[[tacacs.clients]]&lt;/code&gt; entry by source address, and connections from sources not on the list are closed before the handshake. Then &lt;code&gt;tls_name&lt;/code&gt; is looked at:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Client setting&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;TLS port&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Port without TLS&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Single address, no &lt;code&gt;tls_name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Yes. Any certificate from the CA can connect from this address&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Single address, with &lt;code&gt;tls_name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Yes; the certificate must be valid for this name&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;No&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Range, no &lt;code&gt;tls_name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;No&lt;/strong&gt;; closed after the handshake, logging &lt;code&gt;needs tls_name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Range, with &lt;code&gt;tls_name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Yes; the certificate must be valid for this name (a wildcard certificate can be used)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;No&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;tls_name&lt;/code&gt; is matched against the DNS names in the certificate&amp;rsquo;s SAN.&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Setting &lt;code&gt;tls_name&lt;/code&gt; declares &amp;ldquo;this device has moved&amp;rdquo;:&lt;/strong&gt; it can no longer use the port without TLS. Even someone who has the old shared secret and spoofs its address cannot get in.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;secret&lt;/code&gt; is still required;&lt;/strong&gt; the TLS port does not use it.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;authorization-is-unchanged&#34;&gt;Authorization is unchanged&#xA;&lt;/h3&gt;&lt;p&gt;The example&amp;rsquo;s core routers do not set &lt;code&gt;authorize_group&lt;/code&gt;, so authorization goes to chapter 6&amp;rsquo;s script and is decided by the user&amp;rsquo;s role. The access switches set &lt;code&gt;authorize_group = &amp;quot;readonly&amp;quot;&lt;/code&gt;, so rules decide, regardless of user: even netadmin1 gets only &lt;code&gt;priv-lvl=1&lt;/code&gt; on the access switches. For the difference between the two, see &lt;a class=&#34;link&#34; href=&#34;../06-device-admin/#without-a-script-authorization-groups&#34; &gt;chapter 6&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-order-of-the-migration&#34;&gt;The order of the migration&#xA;&lt;/h2&gt;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Prepare the CA and certificates.&lt;/strong&gt; One per device, named with its management host name. The server certificate&amp;rsquo;s name must be the name filled in on the devices.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Add &lt;code&gt;[tacacs.tls]&lt;/code&gt; and restart.&lt;/strong&gt; Adding this section needs a restart; SIGHUP alone is not enough. At this point every device still uses port 49, with no effect at all.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Move devices one at a time:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Install the certificate and the CA on the device, and configure it to reach rradius over TLS.&lt;/li&gt;&#xA;&lt;li&gt;Confirm it connects (see &amp;ldquo;Which port each device uses&amp;rdquo; below).&lt;/li&gt;&#xA;&lt;li&gt;Add &lt;code&gt;tls_name&lt;/code&gt; to its &lt;code&gt;[[tacacs.clients]]&lt;/code&gt; and send SIGHUP. From then on it can only use TLS.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;strong&gt;Step 3 comes after step 2.&lt;/strong&gt; Adding &lt;code&gt;tls_name&lt;/code&gt; first means the device is refused on port 49 before its TLS is set up; that is when the device&amp;rsquo;s local emergency account earns its keep.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Devices that were covered by one range&lt;/strong&gt; (&lt;code&gt;access-switches&lt;/code&gt; in the example): as they move, give each moved device its own single-address entry (longest prefix wins, overriding the range), with &lt;code&gt;tls_name&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Once everything has moved, set &lt;code&gt;tls_only = true&lt;/code&gt; and send SIGHUP.&lt;/strong&gt; The port without TLS stops serving at once: new connections, and open connections at their next packet, are closed, logging &lt;code&gt;tls_only takes TACACS+ over TLS only&lt;/code&gt;. After the next restart, that port is not opened at all. &lt;strong&gt;Changing back from &lt;code&gt;true&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt; needs a restart.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;RFC 9887 recommends keeping the period where both run side by side as short as possible.&lt;/p&gt;&#xA;&lt;h3 id=&#34;which-port-each-device-uses&#34;&gt;Which port each device uses&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The authentication log&lt;/strong&gt; has one line per login, with the device&amp;rsquo;s name as &lt;code&gt;client&lt;/code&gt;. Setting &lt;code&gt;[log] level&lt;/code&gt; to &lt;code&gt;debug&lt;/code&gt; shows every TACACS+ connection.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Try tightening:&lt;/strong&gt; add &lt;code&gt;tls_name&lt;/code&gt; to a device that has moved. If it is in fact still using port 49, its next request fails, the device falls back to its local accounts, and you notice at once.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;rradius_tacacs_connections_total&lt;/code&gt; does not distinguish ports; connections on both are counted together.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;revoking-and-renewing-certificates&#34;&gt;Revoking and renewing certificates&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Revocation lists:&lt;/strong&gt; set &lt;code&gt;crl_file&lt;/code&gt;, with one for every CA in the chain. Send SIGHUP after updating.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;OCSP:&lt;/strong&gt; set &lt;code&gt;ocsp = &amp;quot;soft&amp;quot;&lt;/code&gt; or &lt;code&gt;&amp;quot;hard&amp;quot;&lt;/code&gt;, the same way as in &lt;a class=&#34;link&#34; href=&#34;../15-wifi-certs/#ocsp-when-the-ca-publishes-no-revocation-list&#34; &gt;chapter 15&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Open connections are checked again:&lt;/strong&gt; once more than 60 seconds have passed since the last check, the certificate is checked again (CA, revocation list, expiry, &lt;code&gt;tls_name&lt;/code&gt;) before the next packet is handled. A connection that fails is closed. An idle connection is checked only when it sends its next packet.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Replace the server certificate before it expires&lt;/strong&gt; and send SIGHUP: new connections use the new one, and open ones are unaffected.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When a device&amp;rsquo;s certificate expires,&lt;/strong&gt; that device cannot log in, and only its local accounts work. Monitor certificate expiry dates.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;before-going-live&#34;&gt;Before going live&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Devices must keep a local emergency account,&lt;/strong&gt; as in chapter 6. An expired certificate, a changed CA or a wrong clock all stop TLS from connecting.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Device clocks must be right.&lt;/strong&gt; Certificates have start and expiry times, and a clock that is far off fails the handshake. This is especially likely when logging in after a device reboot, before it has synchronised its clock.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Firewall:&lt;/strong&gt; open port 300 to the devices&amp;rsquo; management range. Close 49 when the migration is over.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;No session resumption.&lt;/strong&gt; Every connection does a full handshake and certificate check; devices that keep a long-lived connection (single-connection) need fewer handshakes.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Not yet tested on real devices,&lt;/strong&gt; only with a program (a rustls client). RFC 9887 was published in December 2025; check with vendors first which devices and versions support it. Device configuration commands differ by vendor, and this chapter does not include them.&lt;/li&gt;&#xA;&lt;li&gt;The other items of chapter 6&amp;rsquo;s &amp;ldquo;Before going live&amp;rdquo; (permissions for port 49, keeping records) still apply.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;common-problems&#34;&gt;Common problems&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Startup fails, mentioning the certificates of &lt;code&gt;tacacs.tls&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;make-certs.sh&lt;/code&gt; has not been run, or the private key does not match the certificate&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Startup fails, mentioning &lt;code&gt;tls_name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;tls_name&lt;/code&gt; is set but there is no &lt;code&gt;[tacacs.tls]&lt;/code&gt;, or that client has no &lt;code&gt;address&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A device connecting to port 300 fails the handshake&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The device presented no certificate, the certificate is not signed by &lt;code&gt;client_ca_file&lt;/code&gt;, it is revoked or expired, or the device only speaks TLS 1.2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The handshake succeeds but the connection drops at once, with &lt;code&gt;needs tls_name&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;This device&amp;rsquo;s client is a range without &lt;code&gt;tls_name&lt;/code&gt;. Give it its own entry with &lt;code&gt;tls_name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The handshake succeeds but the connection drops at once&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The certificate is not valid for this client&amp;rsquo;s &lt;code&gt;tls_name&lt;/code&gt;: the wrong certificate is installed, or the name is not among the DNS names in the SAN&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After adding &lt;code&gt;tls_name&lt;/code&gt;, that device cannot log in&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;It is still using port 49. Move the device to TLS first&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Every request gets ERROR and the connection drops&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The device still sends obfuscated packets over TLS (not marked unobfuscated). The device&amp;rsquo;s TLS mode is not set correctly&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After setting &lt;code&gt;tls_only = true&lt;/code&gt;, no old device can log in&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Some devices have not moved yet. Change it back to &lt;code&gt;false&lt;/code&gt; and restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;</description>
        </item><item>
            <title>17. Moving Accounts from an Old System</title>
            <link>https://embark.systems/en/rradius/17-migrate-users/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/17-migrate-users/</guid>
            <description>&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt; the company is replacing its old authentication system with rradius. The old system might be an old RADIUS server, an LDAP directory, mail server accounts, or some home-grown database. It holds a few thousand accounts, all with hashed passwords, and nobody knows the plain text.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Nobody should have to reset their password.&lt;/strong&gt; Bring the old system&amp;rsquo;s hashes over as they are, and users keep logging in with their existing passwords.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The old hashes are mostly weak&lt;/strong&gt; (MD5, SHA-1). Once moved, a password change stores a new format, and the old formats gradually disappear.&lt;/li&gt;&#xA;&lt;li&gt;The old system&amp;rsquo;s account names vary in case and some carry a domain; they need to be made consistent.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If the old LDAP directory is staying, there is no need to move anything: let rradius ask the directory directly (&lt;a class=&#34;link&#34; href=&#34;../05-remote-access/&#34; &gt;chapter 5&lt;/a&gt;). This chapter is about putting accounts into rradius&amp;rsquo;s own tables.&lt;/p&gt;&#xA;&lt;p&gt;Example directory: &lt;code&gt;rradius-server/examples/scenarios/migrate-users/&lt;/code&gt;&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;File&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Contents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The &lt;code&gt;sql&lt;/code&gt; handler, name normalisation, &lt;code&gt;[accounts]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/1_schema.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;users&lt;/code&gt; (with an extra &lt;code&gt;origin&lt;/code&gt; column recording the source), &lt;code&gt;user_reply&lt;/code&gt;, &lt;code&gt;accounting&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/2_imported_users.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Eight demo accounts, each in a different old format&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;how-it-works&#34;&gt;How it works&#xA;&lt;/h2&gt;&lt;p&gt;The &lt;code&gt;user_query&lt;/code&gt; of the &lt;code&gt;sql&lt;/code&gt; handler returns the password column. The start of the password column says what it is, with &lt;code&gt;{format}&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;{SSHA}ZvqZAfdyjd1PQiq8rurmdodN8ihkZW1vc2FsdA==&#xA;{crypt}$1$demosalt$EhA8qeu4qSun8gh9DajmS1&#xA;{nthash}9d232eea31049319fc8ab84300855a34&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;At login, rradius uses the algorithm named by the prefix to compute the password the user typed once, and compares it with the stored value. So &lt;strong&gt;one table can mix any formats,&lt;/strong&gt; one per account.&lt;/p&gt;&#xA;&lt;h2 id=&#34;steps&#34;&gt;Steps&#xA;&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd rradius-server&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./target/release/rradius-server --config examples/scenarios/migrate-users/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For local testing, change the &lt;code&gt;address&lt;/code&gt; of &lt;code&gt;nas&lt;/code&gt; to &lt;code&gt;127.0.0.1&lt;/code&gt;. The demo accounts&amp;rsquo; passwords are all &amp;ldquo;account-password&amp;rdquo;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;S&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;nas-shared-secret-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radtest ldap1 ldap1-password 127.0.0.1 &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; $S     &lt;span style=&#34;color:#75715e&#34;&gt;# {SSHA}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radtest shell1 shell1-password 127.0.0.1 &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; $S   &lt;span style=&#34;color:#75715e&#34;&gt;# MD5-crypt under {crypt}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radtest mail1 mail1-password 127.0.0.1 &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; $S     &lt;span style=&#34;color:#75715e&#34;&gt;# {NS-MTA-MD5}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radtest &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;EXAMPLE\LDAP1@example.com&amp;#39;&lt;/span&gt; ldap1-password 127.0.0.1 &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; $S   &lt;span style=&#34;color:#75715e&#34;&gt;# the name is first normalised to ldap1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;All of them get an Access-Accept.&lt;/p&gt;&#xA;&lt;h2 id=&#34;which-format-old-data-maps-to&#34;&gt;Which format old data maps to&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What it looks like in the old system&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Store as&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Demo account&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;LDAP &lt;code&gt;userPassword&lt;/code&gt; already of the form &lt;code&gt;{SSHA}...&lt;/code&gt;, &lt;code&gt;{SSHA512}...&lt;/code&gt;, &lt;code&gt;{SHA}...&lt;/code&gt;, &lt;code&gt;{MD5}...&lt;/code&gt;, &lt;code&gt;{SMD5}...&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Copied as is&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;ldap1, ldap2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;OpenLDAP&amp;rsquo;s &lt;code&gt;{PBKDF2-SHA256}rounds$salt$hash&lt;/code&gt; (also &lt;code&gt;-SHA1&lt;/code&gt;, &lt;code&gt;-SHA512&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Copied as is&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;ldap3&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;{X-PBKDF2}HMACSHA2+256:rounds:salt:hash&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Copied as is&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;ldap4&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The second field of &lt;code&gt;/etc/shadow&lt;/code&gt; (&lt;code&gt;$1$...&lt;/code&gt;, &lt;code&gt;$5$...&lt;/code&gt;, &lt;code&gt;$6$...&lt;/code&gt;, &lt;code&gt;$2b$...&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Prefixed with &lt;code&gt;{crypt}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;shell1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;LDAP&amp;rsquo;s &lt;code&gt;{CRYPT}$6$...&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Copied as is (the prefix ignores case)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An old mail server&amp;rsquo;s &lt;code&gt;{NS-MTA-MD5}...&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Copied as is&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;mail1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Hexadecimal MD5, SHA-1 or SHA-256 in a database (unsalted)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Converted to Base64, prefixed with &lt;code&gt;{MD5}&lt;/code&gt;, &lt;code&gt;{SHA}&lt;/code&gt; or &lt;code&gt;{SHA256}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;old1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;NT hash (32 hexadecimal characters)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Prefixed with &lt;code&gt;{nthash}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;win1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;argon2&amp;rsquo;s &lt;code&gt;$argon2id$...&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Prefixed with &lt;code&gt;{argon2}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Plain text&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;As is; add &lt;code&gt;{clear}&lt;/code&gt; when the value itself starts with &lt;code&gt;{&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;&lt;strong&gt;Hexadecimal to Base64:&lt;/strong&gt; old databases often store hashes as hexadecimal strings, while rradius&amp;rsquo;s &lt;code&gt;{MD5}&lt;/code&gt; and &lt;code&gt;{SHA}&lt;/code&gt; kind need Base64:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;%s&amp;#39;&lt;/span&gt; 91f881a968b893e4092eca12a52293ef | xxd -r -p | base64&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# kfiBqWi4k+QJLsoSpSKT7w==     →  store as {MD5}kfiBqWi4k+QJLsoSpSKT7w==&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;For salted hashes, the salt goes after.&lt;/strong&gt; The &lt;code&gt;{SSHA}&lt;/code&gt; kind is &amp;ldquo;hash followed by salt&amp;rdquo;, Base64-encoded together, computed as &lt;code&gt;hash(password + salt)&lt;/code&gt;. When the old system computes &lt;code&gt;hash(salt + password)&lt;/code&gt;, or mixes them some other way, there is no matching format, and those accounts can only have their passwords reset.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When unsure, try first with a test account whose password you know.&lt;/strong&gt; A value in the wrong format never matches and lets nobody in, so trying is safe.&lt;/li&gt;&#xA;&lt;li&gt;The full list of formats is in usage section 5.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;what-can-and-cannot-be-moved&#34;&gt;What can and cannot be moved&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Hashes only work with login methods that send the plain-text password to the server.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Login method&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Can it use hashes?&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PAP (VPN, the web logins of most NAS, TACACS+ PAP and ASCII)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Every format&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP-TTLS with inner PAP (Wi-Fi)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Every format&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;CHAP (common for PPPoE)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Plain text only&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;MS-CHAPv2, PEAP (the most common Wi-Fi user name and password method)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Plain text or &lt;code&gt;{nthash}&lt;/code&gt; only&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;So:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;When the old system stored NT hashes,&lt;/strong&gt; moved accounts can use PEAP directly (the demo win1).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When the old system has only other hashes and Wi-Fi must use user names and passwords,&lt;/strong&gt; there are two ways: switch Wi-Fi to EAP-TTLS with inner PAP (operating system support varies, so check first); or ask users to change their password once, storing it as &lt;code&gt;{nthash}&lt;/code&gt; at that point (see below).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;PPPoE with CHAP&lt;/strong&gt; cannot work without plain text; only a reset helps.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The automated test checks that all eight demo accounts can log in with PAP, and that the &lt;code&gt;{SSHA}&lt;/code&gt; account is rejected with CHAP.&lt;/p&gt;&#xA;&lt;h2 id=&#34;importing&#34;&gt;Importing&#xA;&lt;/h2&gt;&lt;p&gt;Turn the data exported from the old system into a migration file:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;-- 2_imported_users.sql&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;INSERT&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;INTO&lt;/span&gt; users (username, password, origin) &lt;span style=&#34;color:#66d9ef&#34;&gt;VALUES&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  (&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;ldap1&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;{SSHA}ZvqZAfdyjd1PQiq8rurmdodN8ihkZW1vc2FsdA==&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;ldap&amp;#39;&lt;/span&gt;),&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  (&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;shell1&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;{crypt}$1$demosalt$EhA8qeu4qSun8gh9DajmS1&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;shadow&amp;#39;&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Have the file ready before the first start.&lt;/strong&gt; A migration file cannot change once applied; to add accounts later, add a file with the next number.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Lowercase account names and remove domains first,&lt;/strong&gt; consistent with the normalisation settings below.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;In SQL strings, single quotes are written twice.&lt;/strong&gt; When a program generates this file, remember to handle quotes in names and hashes.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The &lt;code&gt;origin&lt;/code&gt; column&lt;/strong&gt; is not required; the example uses it to record where each account&amp;rsquo;s password came from, so you can later count how many old formats remain.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When the file is large&lt;/strong&gt; (hundreds of thousands of rows), the import takes a while; raise &lt;code&gt;[cluster] migrations_wait_ms&lt;/code&gt; above the import time, see usage section 2.5.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The exported file holds everyone&amp;rsquo;s password hashes,&lt;/strong&gt; and weak hashes can be cracked offline. Protect it in transit and at rest, and delete temporary copies after the import. The same goes for the migration file itself.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;You can also add accounts one by one with &lt;code&gt;user add&lt;/code&gt; instead of a migration file, but it only accepts plain-text passwords (which it hashes itself), so it cannot be used to move existing hashes.&lt;/p&gt;&#xA;&lt;h2 id=&#34;inconsistent-names&#34;&gt;Inconsistent names&#xA;&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;username&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;strip_realm&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;both&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;lowercase&lt;/span&gt; = &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Users of the old system are used to typing &lt;code&gt;EXAMPLE\ldap1&lt;/code&gt;, &lt;code&gt;ldap1@example.com&lt;/code&gt; or &lt;code&gt;LDAP1&lt;/code&gt;. This setting turns all of them into &lt;code&gt;ldap1&lt;/code&gt; before the account lookup: first it removes everything up to the last backslash, then everything after the last &lt;code&gt;@&lt;/code&gt;, and finally lowercases.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Names in the table must be lowercase first.&lt;/strong&gt; Otherwise the row &lt;code&gt;Alice&lt;/code&gt; is never found.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Two accounts that differed only in case become one.&lt;/strong&gt; Find and resolve them before importing.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Be careful with forwarding by realm (&lt;code&gt;[proxy]&lt;/code&gt;):&lt;/strong&gt; names with &lt;code&gt;@&lt;/code&gt; are matched against realms first, and those that match are forwarded and never get here.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;replacing-the-old-formats&#34;&gt;Replacing the old formats&#xA;&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;accounts&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;scheme&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;bcrypt&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;passwd&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;UPDATE users SET password = ?2, origin = &amp;#39;rradius&amp;#39; WHERE username = ?1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-server user passwd --config rradius.toml mail1    &lt;span style=&#34;color:#75715e&#34;&gt;# asks for the new password twice&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;user passwd&lt;/code&gt; stores the new password in the format set by &lt;code&gt;scheme&lt;/code&gt;, replacing the old hash; the example also changes &lt;code&gt;origin&lt;/code&gt; to &lt;code&gt;rradius&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Which &lt;code&gt;scheme&lt;/code&gt;:&lt;/strong&gt; for PAP only, the default &lt;code&gt;bcrypt&lt;/code&gt; (&lt;code&gt;sha512-crypt&lt;/code&gt; with very high login volumes); for PEAP and MS-CHAPv2, &lt;code&gt;nthash&lt;/code&gt;; for CHAP, only &lt;code&gt;clear&lt;/code&gt;. See &lt;a class=&#34;link&#34; href=&#34;../19-operations/#with-the-user-command&#34; &gt;chapter 19&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;rradius does not replace old hashes automatically at login,&lt;/strong&gt; and has no interface for users to change their own password. An administrator, or your portal, has to call &lt;code&gt;user passwd&lt;/code&gt; (with the password on standard input).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Seeing how many remain:&lt;/strong&gt; &lt;code&gt;user show &amp;lt;account&amp;gt;&lt;/code&gt; prints that account&amp;rsquo;s &lt;code&gt;origin&lt;/code&gt;. rradius has no command that queries the whole table; to count, you could occasionally compute it with &lt;code&gt;sql_query&lt;/code&gt; in the accounting script and write it to the log with &lt;code&gt;log()&lt;/code&gt; (this chapter does not include such a script).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Set a deadline.&lt;/strong&gt; For accounts that have not changed their password by then, set the password to &lt;code&gt;NULL&lt;/code&gt; with a migration file (accounts whose password column is &lt;code&gt;NULL&lt;/code&gt; can never log in), and ask them to have an administrator reset it.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;before-going-live&#34;&gt;Before going live&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Run both side by side for a while first.&lt;/strong&gt; Point a few NAS at rradius and leave the rest on the old system; switch over completely once the login results agree.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Reply attributes from the old system&lt;/strong&gt; (VLAN, rate, privilege) need moving too, into &lt;code&gt;user_reply&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../02-quick-start/#the-configuration-explained&#34; &gt;chapter 2&lt;/a&gt;). Attribute names must be names in rradius&amp;rsquo;s dictionary, and a value in the wrong format makes the login fail, so after moving, actually log in with a few accounts rather than relying on &lt;code&gt;--check&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The old system&amp;rsquo;s shared secrets&lt;/strong&gt; can be kept, so the NAS only need the server address changed. Better still, use this chance to make them long and different per device.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Verifying &lt;code&gt;{crypt}&lt;/code&gt; and &lt;code&gt;{argon2}&lt;/code&gt; is deliberately slow,&lt;/strong&gt; so many logins at once queue. The same goes for PBKDF2 with a high round count.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Not tested:&lt;/strong&gt; an actual export and import from any particular old system. The demo hashes were computed from each format&amp;rsquo;s definition with Python&amp;rsquo;s &lt;code&gt;hashlib&lt;/code&gt; and &lt;code&gt;openssl passwd&lt;/code&gt;, and the scenario test confirms rradius verifies them; the project has also tested the PBKDF2 formats with values produced by a real OpenLDAP.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;common-problems&#34;&gt;Common problems&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A moved account is rejected with the right password&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The wrong prefix (a hexadecimal MD5 with &lt;code&gt;{MD5}&lt;/code&gt; added but not converted to Base64, for example); the salt is in a different position from the format&amp;rsquo;s definition; or the hash was truncated or picked up whitespace during the import&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Only accounts whose names have capitals cannot log in&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;lowercase&lt;/code&gt; is on, but the names in the table were not lowercased&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PAP works, Wi-Fi PEAP does not&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PEAP needs plain text or &lt;code&gt;{nthash}&lt;/code&gt;; other hashes cannot do it&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PAP works, PPPoE CHAP does not&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;CHAP needs plain text&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Names with &lt;code&gt;@&lt;/code&gt; get no reply or are forwarded&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;They match a realm in &lt;code&gt;[proxy]&lt;/code&gt; and went to an upstream&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Slower at login peaks&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;bcrypt, argon2 or PBKDF2 with many rounds are queueing. Switch to &lt;code&gt;sha512-crypt&lt;/code&gt; when passwords change, or accept the speed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migration file ... changed after it was applied&lt;/code&gt; at startup&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An import file already applied was changed. To add data, add a file with the next number&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;</description>
        </item><item>
            <title>18. Accounts in Another System: Verifying over an HTTP API</title>
            <link>https://embark.systems/en/rradius/18-external-api/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/18-external-api/</guid>
            <description>&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt; Wi-Fi at a hotel, a coworking space or a membership venue. Accounts and passwords already live in the membership system (or the booking or billing system), which has an HTTP API. You do not want to copy the accounts into rradius and then work out how to keep them in sync.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;On every login, rradius asks the membership system over HTTPS &amp;ldquo;is this user name and password right&amp;rdquo;.&lt;/li&gt;&#xA;&lt;li&gt;The membership system also answers with the person&amp;rsquo;s plan, which rradius turns into attributes for the NAS.&lt;/li&gt;&#xA;&lt;li&gt;rradius stores no accounts; accounting is still recorded in rradius&amp;rsquo;s own table.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Example directory: &lt;code&gt;rradius-server/examples/scenarios/external-api/&lt;/code&gt;&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;File&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Contents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[lua.http]&lt;/code&gt; and a chain with a single &lt;code&gt;lua&lt;/code&gt; handler&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;member-api.lua&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The script that calls the API&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;migrations/1_schema.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Only the &lt;code&gt;accounting&lt;/code&gt; table&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;steps&#34;&gt;Steps&#xA;&lt;/h2&gt;&lt;p&gt;The API address in the example (&lt;code&gt;members.example.com&lt;/code&gt;) is made up; started as is, every login is rejected because it cannot connect. To use your own system:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Put your API host in &lt;code&gt;[lua.http] allowed_hosts&lt;/code&gt; in &lt;code&gt;rradius.toml&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;In &lt;code&gt;member-api.lua&lt;/code&gt;, change &lt;code&gt;API&lt;/code&gt; (the URL) and &lt;code&gt;API_KEY&lt;/code&gt; (the key), and adjust how requests and responses are handled for your API.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Check and start:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd rradius-server&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./target/release/rradius-server --check --config examples/scenarios/external-api/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./target/release/rradius-server --config examples/scenarios/external-api/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;For local testing, change the &lt;code&gt;address&lt;/code&gt; of &lt;code&gt;hotspot&lt;/code&gt; to &lt;code&gt;127.0.0.1&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radtest &amp;lt;user&amp;gt; &amp;lt;password&amp;gt; 127.0.0.1 &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; hotspot-shared-secret-change-me&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The automated test starts a fake membership system locally, points the script&amp;rsquo;s URL at it, and checks:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Situation&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Result&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The API answers 200 with header &lt;code&gt;X-Plan: gold&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Accept, &lt;code&gt;Filter-Id = &amp;quot;gold&amp;quot;&lt;/code&gt;, &lt;code&gt;Session-Timeout = 14400&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The user name and password contain &lt;code&gt;&amp;amp;&lt;/code&gt;, &lt;code&gt;=&lt;/code&gt; and spaces&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Sent encoded, and the API receives the right values&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The API answers 401&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Reject&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A CHAP login&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Reject: there is no plain-text password to give the API&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The API never answers&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Reject after &lt;code&gt;timeout_ms&lt;/code&gt;, logging &lt;code&gt;member API gave no answer&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;the-api-the-script-assumes&#34;&gt;The API the script assumes&#xA;&lt;/h2&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;POST https://members.example.com/v1/radius/login&#xA;Authorization: Bearer &amp;lt;API key&amp;gt;&#xA;Content-Type: application/x-www-form-urlencoded&#xA;&#xA;username=&amp;lt;user&amp;gt;&amp;amp;password=&amp;lt;password&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Response&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Meaning&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;200, header &lt;code&gt;X-Plan: &amp;lt;plan&amp;gt;&lt;/code&gt; (optional)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The user name and password are right, and the person may get online&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;401, 403&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The user name or password is wrong, or the person may not get online now&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Anything else&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Treated as a failure; rejected, and the status code logged&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;&lt;strong&gt;Scripts have no JSON functions.&lt;/strong&gt; So the example has the API answer with status codes and response headers, and form-encodes the request. When your API only speaks JSON:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The request can be built as a string yourself (escaping quotes and backslashes in values yourself, which is not recommended), or ask for an endpoint on the API side that accepts form encoding.&lt;/li&gt;&#xA;&lt;li&gt;Taking values out of a JSON response is only possible with Lua string matching (&lt;code&gt;string.match&lt;/code&gt;). That works for a simple fixed format, but is unreliable for complex structures.&lt;/li&gt;&#xA;&lt;li&gt;The most robust option is a thin adapter service in front of the membership system, or an endpoint made specifically for RADIUS.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;the-configuration-explained&#34;&gt;The configuration explained&#xA;&lt;/h2&gt;&lt;h3 id=&#34;where-scripts-may-connect&#34;&gt;Where scripts may connect&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;lua&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;http&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;allowed_hosts&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;members.example.com&amp;#34;&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;timeout_ms&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;1500&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;max_concurrent&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;64&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Without this section, scripts have no &lt;code&gt;http_request&lt;/code&gt;.&lt;/strong&gt; With it, they can connect only to the hosts in &lt;code&gt;allowed_hosts&lt;/code&gt;, matched exactly by host and port, with no wildcards.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A host name alone&lt;/strong&gt; allows only HTTPS on port 443. Write other ports as &lt;code&gt;&amp;quot;billing.internal:8443&amp;quot;&lt;/code&gt;. For unencrypted HTTP (recommended only on the local machine or an isolated network), write &lt;code&gt;&amp;quot;http://legacy.internal:8080&amp;quot;&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;timeout_ms&lt;/code&gt;&lt;/strong&gt; is the total time from connecting to reading the whole response. &lt;strong&gt;It must be shorter than the NAS&amp;rsquo;s retransmission time,&lt;/strong&gt; or rradius is still waiting after the NAS has given up.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;max_concurrent&lt;/code&gt;:&lt;/strong&gt; the most requests waiting on one host at once. Beyond it, &lt;code&gt;http_request&lt;/code&gt; fails at once (&lt;code&gt;busy&lt;/code&gt;) instead of queueing. Logins and accounting are counted separately.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Certificates signed by an internal CA&lt;/strong&gt; need &lt;code&gt;ca_file&lt;/code&gt;. Server certificates are always verified; there is no option to turn verification off.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;the-chain&#34;&gt;The chain&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[&lt;span style=&#34;color:#a6e22e&#34;&gt;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;handlers&lt;/span&gt;]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;type&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;lua&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;script&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;member-api.lua&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;verifies_password&lt;/span&gt; = &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;verifies_password = true&lt;/code&gt;&lt;/strong&gt; tells rradius &amp;ldquo;this script really checks the password&amp;rdquo;. Ordinary PAP logins do not need it; but for Wi-Fi EAP-TTLS with inner PAP to go through this script it must be set, or an &lt;code&gt;accept&lt;/code&gt; from the script is treated as a reject.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Only login methods that carry the plain-text password work:&lt;/strong&gt; PAP, and EAP-TTLS with inner PAP. CHAP, MS-CHAPv2 and PEAP do not send the password itself, so the API has nothing to compare.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;the-script&#34;&gt;The script&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-lua&#34; data-lang=&#34;lua&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;local&lt;/span&gt; response, problem &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; http_request{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  url &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; API,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  method &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;POST&amp;#39;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  headers &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    Authorization &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Bearer &amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;..&lt;/span&gt; API_KEY,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Content-Type&amp;#39;&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;application/x-www-form-urlencoded&amp;#39;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  },&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  body &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;username=&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;..&lt;/span&gt; url_encode(user) &lt;span style=&#34;color:#f92672&#34;&gt;..&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;amp;password=&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;..&lt;/span&gt; url_encode(password),&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;not&lt;/span&gt; response &lt;span style=&#34;color:#66d9ef&#34;&gt;then&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  log(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;member API gave no answer:&amp;#39;&lt;/span&gt;, problem)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;reject&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;end&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;What &lt;code&gt;http_request&lt;/code&gt; returns:&lt;/strong&gt; when a response arrives, a table (&lt;code&gt;status&lt;/code&gt;, &lt;code&gt;body&lt;/code&gt;, &lt;code&gt;headers&lt;/code&gt;, with lowercase header names); 4xx and 5xx count as arriving. When none arrives (timeout, cannot connect, not on the allow list, response too large, too busy), &lt;code&gt;nil&lt;/code&gt; and the reason.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Always &lt;code&gt;url_encode&lt;/code&gt; values that come from users.&lt;/strong&gt; User names and passwords are typed by users; without encoding, an &lt;code&gt;&amp;amp;&lt;/code&gt; in the name slips an extra parameter to the API.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Take more care when putting values into the URL path:&lt;/strong&gt; &lt;code&gt;url_encode&lt;/code&gt; raises a script error (and the request is rejected) for the empty string, &lt;code&gt;.&lt;/code&gt; and &lt;code&gt;..&lt;/code&gt;, because &lt;code&gt;..&lt;/code&gt; in a path reaches another endpoint. The example puts values in the request body, and logins whose name is exactly &lt;code&gt;.&lt;/code&gt; or &lt;code&gt;..&lt;/code&gt; are still rejected because of the script error.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;What to do when the API does not answer is up to the script.&lt;/strong&gt; The example rejects. It could let people through instead (a hotel may prefer guests to get online first), but that means any password works while the API is down; think it through.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Do not log passwords.&lt;/strong&gt; The example&amp;rsquo;s &lt;code&gt;log()&lt;/code&gt; writes only the reason and status code. rradius&amp;rsquo;s own log does not write URL paths, headers or bodies, only the host and the kind of error.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The API key is written in the script,&lt;/strong&gt; so make the script file readable only by the account that runs rradius. To change the key, edit the file and send SIGHUP.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Check values in the response too.&lt;/strong&gt; The example accepts only an &lt;code&gt;X-Plan&lt;/code&gt; that looks like a name before putting it in &lt;code&gt;Filter-Id&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;when-the-api-slows-down-or-stops&#34;&gt;When the API slows down or stops&#xA;&lt;/h2&gt;&lt;p&gt;Every login waits for the API, so the API&amp;rsquo;s speed is the login speed.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The API stops:&lt;/strong&gt; every login waits &lt;code&gt;timeout_ms&lt;/code&gt; before being rejected. At most &lt;code&gt;max_concurrent&lt;/code&gt; logins wait at once; more are rejected at once, so rradius&amp;rsquo;s own capacity is not used up.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Watch the metrics:&lt;/strong&gt; rises in &lt;code&gt;rradius_script_http_requests_total{result=&amp;quot;timeout&amp;quot;}&lt;/code&gt;, &lt;code&gt;{result=&amp;quot;error&amp;quot;}&lt;/code&gt; or &lt;code&gt;{result=&amp;quot;busy&amp;quot;}&lt;/code&gt; mean API trouble; &lt;code&gt;{result=&amp;quot;ok&amp;quot;}&lt;/code&gt; counts responses received (401 included).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;NAS retransmissions:&lt;/strong&gt; while a request is still being handled, the NAS&amp;rsquo;s retransmissions are dropped, so the API is not asked twice. Retransmissions within 10 seconds after handling get the previous answer directly.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;rradius does not remember previous answers.&lt;/strong&gt; Every login asks once. To reduce the load on the API, the script could record a &amp;ldquo;pass&amp;rdquo; in an rradius table for a few minutes (&lt;code&gt;sql_execute&lt;/code&gt;) and check the table first; but passwords cannot be stored in plain text, so that approach needs your own design, and the example does not do it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The script&amp;rsquo;s execution limit&lt;/strong&gt; (&lt;code&gt;[lua] max_execution_ms&lt;/code&gt;) does not count time spent waiting for the API.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;should-accounting-notify-the-api-too&#34;&gt;Should accounting notify the API too&#xA;&lt;/h2&gt;&lt;p&gt;The example&amp;rsquo;s accounting only writes to the local table. To notify the membership system when users come online and go offline, the accounting script can also call &lt;code&gt;http_request&lt;/code&gt;, but note:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The NAS gets a reply only when the accounting script returns &lt;code&gt;accept&lt;/code&gt;.&lt;/strong&gt; If the script fails when the API does not answer, the NAS retransmits and the script runs again; the API must tolerate receiving the same notification twice.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Do not let API failures block accounting.&lt;/strong&gt; The more robust approach is for accounting to write to the table and return &lt;code&gt;accept&lt;/code&gt; as usual, with another program sending the data from the table to the membership system.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;before-going-live&#34;&gt;Before going live&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Limit sources and rates on the API side.&lt;/strong&gt; rradius forwards whatever user name and password anyone types on the login page, so password guessing traffic reaches the API too.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;DNS:&lt;/strong&gt; the allow list matches host names and does not check the addresses they resolve to. If DNS is tampered with, requests may go elsewhere; HTTPS certificate verification is the protection then, so do not use &lt;code&gt;http://&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Redirects are not followed.&lt;/strong&gt; When the API answers 3xx, the script gets the 3xx.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Several nodes:&lt;/strong&gt; each node calls the API on its own, so the API must accept every node&amp;rsquo;s source address.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Not tested:&lt;/strong&gt; any real membership or billing system. The scenario test uses a fake local API (without TLS), so HTTPS certificate verification is not part of that test; other tests in the project cover &lt;code&gt;http_request&lt;/code&gt; itself.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;common-problems&#34;&gt;Common problems&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;attempt to call a nil value&lt;/code&gt; in the log, pointing at the &lt;code&gt;http_request&lt;/code&gt; line&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The configuration file has no &lt;code&gt;[lua.http]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Every login is rejected, with &lt;code&gt;member API gave no answer: ... is not in lua.http.allowed_hosts&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The host or port in the script is not exactly the same as in &lt;code&gt;allowed_hosts&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;member API gave no answer&lt;/code&gt; in the log, with a timeout as the reason&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The API is too slow or unreachable; try the same URL with &lt;code&gt;curl&lt;/code&gt; from the node&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The reason concerns the certificate&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The API&amp;rsquo;s certificate is signed by an internal CA; set &lt;code&gt;ca_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_script_http_requests_total{result=&amp;quot;busy&amp;quot;}&lt;/code&gt; increases&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;More than &lt;code&gt;max_concurrent&lt;/code&gt; requests waiting at once: the API is too slow, or the limit is too low&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PAP works, Wi-Fi does not&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wi-Fi uses PEAP or MS-CHAPv2; this approach only works with EAP-TTLS inner PAP, and the handler needs &lt;code&gt;verifies_password = true&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Startup fails, saying there are no trusted root certificates&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The host has no system CA certificates (common in minimal containers); install &lt;code&gt;ca-certificates&lt;/code&gt; or set &lt;code&gt;ca_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;</description>
        </item><item>
            <title>19. Operations</title>
            <link>https://embark.systems/en/rradius/19-operations/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/19-operations/</guid>
            <description>&lt;p&gt;This chapter gathers the things commonly done after going live. The full rules for each are in the reference document; here are only the ways to do them and what to watch out for. To find the cause of a problem from its symptom, see &lt;a class=&#34;link&#34; href=&#34;../20-troubleshooting/&#34; &gt;chapter 20&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;checklist-before-going-live&#34;&gt;Checklist before going live&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; Every &lt;code&gt;*.secret&lt;/code&gt; replaced with newly generated values (see &amp;ldquo;Changing secrets&amp;rdquo; below), with file permissions letting only the account that runs rradius read them.&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; Key files (&lt;code&gt;aka.key&lt;/code&gt;, &lt;code&gt;dpsk.key&lt;/code&gt;, &lt;code&gt;ticket.seal&lt;/code&gt;) generated by you, the same on every node, mode 0600, and backed up separately.&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; No demo certificates; expiry dates of the server certificate and of NAS and device certificates monitored.&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; Demo data files removed from &lt;code&gt;migrations/&lt;/code&gt;, or replaced with real data before the first start.&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; &lt;code&gt;[[radius.clients]]&lt;/code&gt; lists only devices that will really ask; no &lt;code&gt;0.0.0.0/0&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; &lt;code&gt;[metrics]&lt;/code&gt; bound only to an internal address; with several nodes, &lt;code&gt;[cluster] listen&lt;/code&gt; bound to a WireGuard or internal network address.&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; The firewall opens only the ports in use, with limited sources: 1812, 1813 (UDP), 2083 (RadSec), 3799 (CoA), 49 and 300 (TACACS+).&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; &lt;code&gt;rradius-server --check --config ...&lt;/code&gt; passes.&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; Started by a service manager such as systemd, stopped with SIGTERM (not SIGKILL) with 30 seconds or more allowed, and the data directory and accounting spool directory on a persistent local disk.&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; Automatic restarts set up (systemd &lt;code&gt;Restart=on-failure&lt;/code&gt;, Docker &lt;code&gt;restart: unless-stopped&lt;/code&gt;): when a node&amp;rsquo;s database breaks, rradius exits with status 1 and relies on the restart to recover (&lt;a class=&#34;link&#34; href=&#34;../08-ha-cluster/&#34; &gt;chapter 8&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; After startup, the log has a &lt;code&gt;listening&lt;/code&gt; line for every port that should be open. When TACACS+, RadSec or metrics ports cannot be bound, only an error line is logged, and the process does not exit.&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; One login, accounting, and any CoA you will use tried with real devices (not just &lt;code&gt;radtest&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; Monitoring connected at least to &amp;ldquo;the node is alive&amp;rdquo; (Status-Server) and the metrics listed below.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;accounts-and-data&#34;&gt;Accounts and data&#xA;&lt;/h2&gt;&lt;p&gt;When accounts live in rradius&amp;rsquo;s own tables, manage them with the &lt;code&gt;rradius-server user&lt;/code&gt; command; when they live elsewhere, have rradius ask there:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Approach&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Suits&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;How&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;The &lt;code&gt;user&lt;/code&gt; command&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounts that change often (broadband subscribers, staff, guests)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius-server user add|passwd|enable|disable|delete|show&lt;/code&gt;, seen by the next login&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;The &lt;code&gt;client&lt;/code&gt;, &lt;code&gt;dpsk&lt;/code&gt; and &lt;code&gt;aka&lt;/code&gt; commands&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Dynamic client NAS, per-person Wi-Fi keys, SIM cards&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius-server client|dpsk|aka ...&lt;/code&gt;, with SQL set in &lt;code&gt;[accounts.clients]&lt;/code&gt;, &lt;code&gt;[accounts.dpsk]&lt;/code&gt; and &lt;code&gt;[accounts.aka]&lt;/code&gt; (chapters 12, 13, 14)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Migration files&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Data that rarely changes and whose history you want to keep (plans, devices, table structure)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Add a SQL file with the next number, put it on every node, and restart them one by one&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Verified by an existing directory&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The company already has AD/LDAP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The &lt;code&gt;ldap&lt;/code&gt; handler queries the directory directly; rradius stores no accounts (chapter 5)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Verified by an existing system&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounts are in a billing or membership system&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Ask that system&amp;rsquo;s API with &lt;code&gt;http_request&lt;/code&gt; in a &lt;code&gt;lua&lt;/code&gt; handler (chapter 18)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Moved from an old system&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Replacing an old authentication system&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Import the old password hashes as they are, so users need not reset passwords (chapter 17)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;with-the-user-command&#34;&gt;With the &lt;code&gt;user&lt;/code&gt; command&#xA;&lt;/h3&gt;&lt;p&gt;First add &lt;code&gt;[accounts]&lt;/code&gt; to the configuration file, with the SQL for each action (&lt;code&gt;?1&lt;/code&gt; is the account, &lt;code&gt;?2&lt;/code&gt; the password). For the quick start&amp;rsquo;s &lt;code&gt;users&lt;/code&gt; table:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;accounts&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;add&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;INSERT INTO users (username, password) VALUES (?1, ?2)&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;passwd&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;UPDATE users SET password = ?2 WHERE username = ?1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;enable&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;UPDATE users SET enabled = 1 WHERE username = ?1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;disable&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;UPDATE users SET enabled = 0 WHERE username = ?1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;delete&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;DELETE FROM users WHERE username = ?1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;show&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT username, enabled FROM users WHERE username = ?1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The server need not restart; the command reads the configuration file every time. Then:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-server user add --config rradius.toml dave        &lt;span style=&#34;color:#75715e&#34;&gt;# asks for the password twice, without echoing&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-server user disable --config rradius.toml carol   &lt;span style=&#34;color:#75715e&#34;&gt;# disables; user_query must look only for enabled = 1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-server user show --config rradius.toml dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;It changes the whole cluster,&lt;/strong&gt; with no node-by-node work and no reload. The cluster must be running, and the host running the command must reach the nodes&amp;rsquo; api port.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Passwords are read from standard input,&lt;/strong&gt; so they do not stay in the shell history. For a batch import, one account per line, sent through a pipe.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;How passwords are stored is set by &lt;code&gt;scheme&lt;/code&gt;:&lt;/strong&gt; bcrypt by default; &lt;code&gt;sha512-crypt&lt;/code&gt; for high login volumes; &lt;code&gt;clear&lt;/code&gt; for CHAP (PPPoE, for example); &lt;code&gt;nthash&lt;/code&gt; for MS-CHAPv2 or PEAP. The broadband scenario&amp;rsquo;s example configuration uses &lt;code&gt;clear&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Names are treated as at login:&lt;/strong&gt; with &lt;code&gt;[auth.username]&lt;/code&gt;, &lt;code&gt;Dave@Corp&lt;/code&gt; is stored as &lt;code&gt;dave&lt;/code&gt;, according to the settings.&lt;/li&gt;&#xA;&lt;li&gt;The full configuration rules, output and status codes are in usage section 2.14.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Protect the configuration file:&lt;/strong&gt; these commands connect to the cluster with &lt;code&gt;secret_api&lt;/code&gt;, which is the key to the whole database. Let only administrators read the configuration and secret files, and run the commands on a node or over WireGuard.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;with-migration-files&#34;&gt;With migration files&#xA;&lt;/h3&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;-- 3_plans.sql&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;INSERT&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;INTO&lt;/span&gt; plans (name, max_sessions) &lt;span style=&#34;color:#66d9ef&#34;&gt;VALUES&lt;/span&gt; (&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;family-500m&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;UPDATE&lt;/span&gt; users &lt;span style=&#34;color:#66d9ef&#34;&gt;SET&lt;/span&gt; enabled &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;WHERE&lt;/span&gt; username &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;carol&amp;#39;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Each file runs only once,&lt;/strong&gt; and cannot be changed once applied. So it suits a &amp;ldquo;change record&amp;rdquo;, not frequent password changes.&lt;/li&gt;&#xA;&lt;li&gt;Do not change data by connecting other tools directly to the cluster&amp;rsquo;s api port.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The &lt;code&gt;user&lt;/code&gt; command only handles accounts.&lt;/strong&gt; Dynamic client NAS, per-person Wi-Fi keys and SIM cards each have their own command: &lt;code&gt;client&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../14-branch-nas/#with-the-client-command&#34; &gt;chapter 14&lt;/a&gt;), &lt;code&gt;dpsk&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../12-psk-wifi/#adding-a-person&#34; &gt;chapter 12&lt;/a&gt;) and &lt;code&gt;aka&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../13-sim-wifi/#adding-a-card&#34; &gt;chapter 13&lt;/a&gt;), used the same way as &lt;code&gt;user&lt;/code&gt;. Other tables use migration files.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;removing-old-data&#34;&gt;Removing old data&#xA;&lt;/h2&gt;&lt;p&gt;Tables like &lt;code&gt;accounting&lt;/code&gt; and &lt;code&gt;tacacs_log&lt;/code&gt; keep growing, and rradius does not clean them up. They can be pruned regularly from the accounting script: at most once an hour, with only one request in the whole cluster actually doing it.&lt;/p&gt;&#xA;&lt;p&gt;First create a table that records the time, with a migration:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;-- 3_housekeeping.sql&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;CREATE&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;TABLE&lt;/span&gt; housekeeping (name TEXT &lt;span style=&#34;color:#66d9ef&#34;&gt;PRIMARY&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;KEY&lt;/span&gt;, last_run INTEGER &lt;span style=&#34;color:#66d9ef&#34;&gt;NOT&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;NULL&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;INSERT&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;INTO&lt;/span&gt; housekeeping &lt;span style=&#34;color:#66d9ef&#34;&gt;VALUES&lt;/span&gt; (&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;purge-accounting&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Add this before &lt;code&gt;return &#39;accept&#39;&lt;/code&gt; in the accounting script:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-lua&#34; data-lang=&#34;lua&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;-- At most once an hour: read the local replica first, so not every request writes to the cluster.&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;local&lt;/span&gt; now &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; math.floor(now_unix())&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;local&lt;/span&gt; due &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; sql_query(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT 1 FROM housekeeping WHERE name = &amp;#39;purge-accounting&amp;#39; AND last_run &amp;lt; ?&amp;#34;&lt;/span&gt;, {now &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;3600&lt;/span&gt;})&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;-- The write goes through the cluster, so only one request succeeds in changing last_run, and it does the delete.&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;#&lt;/span&gt;due &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;and&lt;/span&gt; sql_execute(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;UPDATE housekeeping SET last_run = ? WHERE name = &amp;#39;purge-accounting&amp;#39; AND last_run &amp;lt; ?&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {now, now &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;3600&lt;/span&gt;}) &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;then&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#75715e&#34;&gt;-- Delete at most 10000 rows at a time; leave the rest for the next hour, so no single write takes too long.&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#75715e&#34;&gt;-- ORDER BY makes every node delete the same rows.&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  sql_execute(&lt;span style=&#34;color:#e6db74&#34;&gt;[[DELETE FROM accounting WHERE rowid IN&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;    (SELECT rowid FROM accounting WHERE stopped IS NOT NULL AND stopped &amp;lt; ? ORDER BY rowid LIMIT 10000)]]&lt;/span&gt;, {now &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;180&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;86400&lt;/span&gt;})&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;end&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;How long to keep data (180 days in the example) depends on regulations and company policy. Providers may have a minimum retention period; &lt;strong&gt;check before deleting.&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;The delete runs while handling an accounting request, which then gets its reply a little later. The amount deleted must finish within &lt;code&gt;[lua] query_timeout_ms&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;To keep historical data, have an external export move it away first, then delete.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;reloading-sighup&#34;&gt;Reloading (SIGHUP)&#xA;&lt;/h2&gt;&lt;p&gt;Most settings take effect with a SIGHUP after a change, without a restart:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kill -HUP &lt;span style=&#34;color:#66d9ef&#34;&gt;$(&lt;/span&gt;pidof rradius-server&lt;span style=&#34;color:#66d9ef&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;systemctl reload rradius        &lt;span style=&#34;color:#75715e&#34;&gt;# when the service file has ExecReload=/bin/kill -HUP $MAINPID&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The log says &lt;code&gt;configuration reloaded from ...&lt;/code&gt;, or &lt;code&gt;reload failed, keeping the running configuration: ...&lt;/code&gt; (the old configuration then stays in use; fix it and send the signal again).&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What changed&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;How it takes effect&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Scripts, authentication chains and name normalisation, &lt;code&gt;[lua]&lt;/code&gt; time limits, &lt;code&gt;[lua.http]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SIGHUP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RADIUS and TACACS+ client lists, shared secret files, TACACS+ authorization groups and &lt;code&gt;enable&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SIGHUP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Certificates, private keys, CAs and revocation lists for EAP, RadSec and TACACS+ over TLS; other &lt;code&gt;[radius.eap]&lt;/code&gt; settings (affecting only new conversations)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SIGHUP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[proxy]&lt;/code&gt; (every upstream treated as healthy again, DNS results cleared)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SIGHUP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius.dynamic_clients]&lt;/code&gt;, &lt;code&gt;[radius.dpsk]&lt;/code&gt; (remembered results cleared)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SIGHUP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[[radius.coa.clients]]&lt;/code&gt;, &lt;code&gt;coa_timeout_ms&lt;/code&gt;, &lt;code&gt;coa_attempts&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SIGHUP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[log.trace]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SIGHUP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The dictionary, &lt;code&gt;[cluster]&lt;/code&gt; (including new migrations), other &lt;code&gt;[log]&lt;/code&gt; settings, &lt;code&gt;[metrics]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Every listening address and port; adding or removing &lt;code&gt;[radius]&lt;/code&gt;, &lt;code&gt;[radius.tls]&lt;/code&gt;, &lt;code&gt;[radius.coa]&lt;/code&gt;, &lt;code&gt;[tacacs]&lt;/code&gt; or &lt;code&gt;[tacacs.tls]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Concurrency limits (&lt;code&gt;max_auth_inflight&lt;/code&gt;, &lt;code&gt;max_acct_inflight&lt;/code&gt;, &lt;code&gt;max_connections&lt;/code&gt;), &lt;code&gt;idle_timeout_ms&lt;/code&gt;, &lt;code&gt;[lua] max_memory_mb&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The two accounting spools (&lt;code&gt;[radius.accounting_spool]&lt;/code&gt;, &lt;code&gt;[proxy.accounting_spool]&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;When settings that need a restart have changed,&lt;/strong&gt; SIGHUP lists them in the log (&lt;code&gt;these need a restart to apply: ...&lt;/code&gt;) and applies the others as usual.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Nothing applies unless everything is valid.&lt;/strong&gt; With one error, everything stays as it was, and service is not interrupted.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Requests in progress finish with the old configuration.&lt;/strong&gt; Open TACACS+ and RadSec connections are not dropped, but their next packet is handled with the new list: a connection whose client was removed is closed.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;SIGHUP is also the way to &amp;ldquo;clear what is remembered&amp;rdquo;:&lt;/strong&gt; dynamic clients, the keys matched for per-person passphrases, upstreams found through DNS, and TLS sessions without &lt;code&gt;shared_tickets&lt;/code&gt; are all cleared.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The full list is in usage section 2.9. &lt;strong&gt;Each node reloads on its own;&lt;/strong&gt; in a cluster, update the files on every node and send each the signal.&lt;/p&gt;&#xA;&lt;h2 id=&#34;changing-secrets&#34;&gt;Changing secrets&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Secret&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;How to change it&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;NAS shared secrets (&lt;code&gt;secret_file&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One NAS at a time: change the NAS first, then rradius&amp;rsquo;s file and send SIGHUP; or the other way round, whichever side can change first. In between, that NAS&amp;rsquo;s requests fail. With a different secret per NAS, only one is affected at a time&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;ldap.secret&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Change the service account&amp;rsquo;s password in the directory first, then the file, and send SIGHUP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;raft.secret&lt;/code&gt;, &lt;code&gt;api.secret&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Must be the same on every node, so &lt;strong&gt;the whole cluster has to stop to change them;&lt;/strong&gt; schedule a maintenance window&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+ shared secrets&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;As for NAS. After SIGHUP, open connections must use the new secret from their next packet&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Upstream shared secrets (&lt;code&gt;[[proxy.servers]]&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Agree a time with the other side, change both together, then send SIGHUP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;aka.key&lt;/code&gt;, &lt;code&gt;dpsk.key&lt;/code&gt; (master keys protecting table contents)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Without downtime: keep the old and new keys side by side (&lt;code&gt;previous_key_file&lt;/code&gt;), re-encrypt the data, then remove the old one. See &lt;a class=&#34;link&#34; href=&#34;../13-sim-wifi/#the-master-key&#34; &gt;chapter 13&lt;/a&gt; and &lt;a class=&#34;link&#34; href=&#34;../12-psk-wifi/#changing-the-master-key&#34; &gt;chapter 12&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;ticket.seal&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Old and new side by side (&lt;code&gt;previous_ticket_seal_file&lt;/code&gt;); see &lt;a class=&#34;link&#34; href=&#34;../15-wifi-certs/#changing-ticketseal&#34; &gt;chapter 15&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Certificates and private keys&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Replace the files and send SIGHUP. New connections and conversations use the new ones; open ones are unaffected&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;To generate a new secret:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;umask 077; openssl rand -base64 &lt;span style=&#34;color:#ae81ff&#34;&gt;24&lt;/span&gt; &amp;gt; nas.secret&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A shared secret under 16 characters gives a warning at startup, at reload and with &lt;code&gt;--check&lt;/code&gt; (&lt;code&gt;has a shared secret shorter than 16 octets&lt;/code&gt;), but startup is not refused. Some old devices limit the length or characters, so confirm the device accepts the generated value.&lt;/p&gt;&#xA;&lt;h2 id=&#34;monitoring&#34;&gt;Monitoring&#xA;&lt;/h2&gt;&lt;p&gt;With &lt;code&gt;[metrics]&lt;/code&gt; on, &lt;code&gt;GET /metrics&lt;/code&gt; returns the Prometheus format. Look at these first:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Metric&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Means&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Advice&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rate of &lt;code&gt;rradius_radius_responses_total{code=&amp;quot;access_reject&amp;quot;}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Failed logins&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A sudden rise: leaked password attempts, a directory failure, a configuration error&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;unknown_client&amp;quot;}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Unknown sources&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rising: a new device not added to the list, or someone scanning&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;invalid&amp;quot;}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Bad signatures or formats&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rising: a wrong shared secret&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;overload&amp;quot;}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Dropped because too busy&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Investigate when above 0: a slow database, slow scripts&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_acct_spool_bytes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting not yet written to the database&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Staying above 0: a database or cluster problem&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_cluster_leader&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Whether this node has a usable leader&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;0 for more than a few seconds: this node is partitioned or the cluster has no majority&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rate of &lt;code&gt;rradius_radius_duplicates_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The NAS is retransmitting&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rising steadily: handling is slower than the NAS&amp;rsquo;s retransmission interval&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_proxy_server_alive&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Whether an upstream is healthy&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Alert on 0&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_proxy_unanswered_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Requests no upstream answered&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rising: every upstream of a realm has a problem&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_proxy_acct_spool_bytes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Forwarded accounting waiting for upstreams to recover&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Staying above 0: an upstream has not recovered&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_acct_spool_rejected_total&lt;/code&gt;, &lt;code&gt;rradius_proxy_acct_spool_rejected_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting given up during replay&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Above 0: look at &lt;code&gt;rejected.log&lt;/code&gt; in the spool directory&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_radsec_connections_total{result=&amp;quot;handshake_failed&amp;quot;}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Failed RadSec handshakes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rising: certificates expired or revoked, or someone trying&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_radsec_connections_open&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Current RadSec connections&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Below the number of NAS: some NAS has disconnected&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_eap_sessions_total{result=&amp;quot;timeout&amp;quot;}&lt;/code&gt;, &lt;code&gt;{result=&amp;quot;evicted&amp;quot;}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Unfinished and evicted 802.1X conversations&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rising steadily; see &lt;a class=&#34;link&#34; href=&#34;../20-troubleshooting/#wi-fi-8021x&#34; &gt;chapter 20&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_dynamic_client_lookups_total{result=&amp;quot;not_found&amp;quot;}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Unregistered sources&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A sudden rise: new devices not registered, or someone scanning&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_script_http_requests_total{result=&amp;quot;timeout&amp;quot;}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;APIs called by scripts timing out&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rising: an API problem&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_coa_relay_total{result=&amp;quot;failed&amp;quot;}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Disconnect requests the NAS did not answer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rising: the NAS&amp;rsquo;s CoA settings or the network&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_reload_total{result=&amp;quot;error&amp;quot;}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Failed reloads&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Above 0: read the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_log_dropped_lines_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Log lines that could not be written in time&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rising: the log destination is too slow&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Status-Server is the most accurate liveness check, because it takes the same path as authentication:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Message-Authenticator=0x00&amp;#39;&lt;/span&gt; | radclient -t &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; -r &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; 10.99.0.1:1812 status &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;$(&lt;/span&gt;cat nas.secret&lt;span style=&#34;color:#66d9ef&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;All metrics are in usage section 2.8.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Values accumulate from startup,&lt;/strong&gt; each node counting its own, and a reload does not reset them. Alert on rates, not absolute values.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;/metrics&lt;/code&gt; has no authentication and no TLS;&lt;/strong&gt; bind it only to an internal address.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;what-happens-when-it-gets-too-busy&#34;&gt;What happens when it gets too busy&#xA;&lt;/h2&gt;&lt;p&gt;When rradius is too busy, it does not answer with errors; it &lt;strong&gt;does not answer,&lt;/strong&gt; so the NAS retransmits or uses its backup:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The number of requests handled at once is limited:&lt;/strong&gt; &lt;code&gt;max_auth_inflight&lt;/code&gt; for logins and &lt;code&gt;max_acct_inflight&lt;/code&gt; for accounting, 4096 each by default, counted separately, so an accounting surge cannot take login slots. Packets beyond the limit are dropped, with at most one log line per second, &lt;code&gt;RADIUS ... overloaded: discarded N packets&lt;/code&gt;, and &lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;overload&amp;quot;}&lt;/code&gt; increases.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;NAS retransmissions are not handled twice:&lt;/strong&gt; while a request is still being handled, its retransmitted packets are dropped; retransmissions within 10 seconds after handling get the previous answer directly, without querying the database or directory again.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Raising the limits usually does not help.&lt;/strong&gt; A suitable value is roughly &amp;ldquo;requests handled per second × the NAS&amp;rsquo;s retransmission timeout&amp;rdquo;; anything larger just lets more requests queue until after the NAS has given up. When overload appears, first find what makes each request slow (the database, the directory, an upstream, an API, password hashing); see &lt;a class=&#34;link&#34; href=&#34;../20-troubleshooting/#logins-are-slow-or-only-sometimes-work&#34; &gt;chapter 20&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TACACS+ and RadSec&lt;/strong&gt; are limited by connection count (&lt;code&gt;max_connections&lt;/code&gt;, 1024 each by default), and new connections beyond it are closed at once.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;On Linux,&lt;/strong&gt; each UDP port opens as many receiving sockets as there are CPUs by default; physical machines dedicated to rradius can also turn on &lt;code&gt;[runtime] pin_threads = true&lt;/code&gt;. Other platforms use a single socket. See usage section 2.4.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;everyday-care-of-the-accounting-spool&#34;&gt;Everyday care of the accounting spool&#xA;&lt;/h2&gt;&lt;p&gt;With &lt;code&gt;[radius.accounting_spool]&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../07-broadband/#the-accounting-spool&#34; &gt;chapter 7&lt;/a&gt;) or &lt;code&gt;[proxy.accounting_spool]&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../11-roaming/#spooling-accounting-when-every-upstream-is-down&#34; &gt;chapter 11&lt;/a&gt;) set:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Task&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;How&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Knowing whether there is a backlog&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_acct_spool_bytes&lt;/code&gt; or &lt;code&gt;rradius_proxy_acct_spool_bytes&lt;/code&gt; above 0 means there is. Alert when it stays up&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Estimating how long it lasts&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Each record is a little over a hundred bytes plus the attributes the NAS sent. The default limit is 1 GiB; once full, new accounting gets no reply and relies on NAS retransmission&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Seeing what was given up&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rejected.log&lt;/code&gt; in the spool directory: requests that would give the same result if run again (rejected by the script, SQL errors, a client that no longer exists). &lt;strong&gt;It is not cleaned up automatically, and never replayed&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Seeing what is damaged&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Files ending in &lt;code&gt;.corrupt&lt;/code&gt; and &lt;code&gt;truncated.log&lt;/code&gt;: left by power loss or disk problems&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Maintenance downtime&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SIGTERM stops replay; data stays on disk and continues at the next start&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Replacing a node&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wait for this node&amp;rsquo;s spool to empty (the metric at 0) before shutting it down, or whatever it has not replayed stays on the old disk&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Changing settings&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Both spools&amp;rsquo; settings need a restart to apply. Before removing a &lt;code&gt;[proxy.realms]&lt;/code&gt; entry, make sure the forwarding spool is empty&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Spool files are raw packets, with user names and addresses. The directory&amp;rsquo;s mode is 0700; take it into account for backups and when disposing of disks.&lt;/p&gt;&#xA;&lt;h2 id=&#34;investigating-one-users-problem&#34;&gt;Investigating one user&amp;rsquo;s problem&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;1. Look at the authentication log first.&lt;/strong&gt; One line per login:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;wlc&amp;#34; source=10.30.0.10 user=&amp;#34;Staff1@corp.example.com&amp;#34; account=&amp;#34;staff1&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;sql&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;user&lt;/code&gt; is the name the device sent, &lt;code&gt;account&lt;/code&gt; is the name used for the account lookup, and &lt;code&gt;chain&lt;/code&gt; and &lt;code&gt;handler&lt;/code&gt; say who decided.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;2. When you need the full packets, turn on tracing for a while:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;log&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;trace&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;users&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;staff1&amp;#34;&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;minutes&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;30&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;After SIGHUP, this user&amp;rsquo;s requests and responses are written to the log in full (passwords shown as &lt;code&gt;&amp;lt;hidden&amp;gt;&lt;/code&gt;), stopping automatically after 30 minutes. &lt;code&gt;clients = [&amp;quot;wlc&amp;quot;]&lt;/code&gt; traces one device instead. &lt;strong&gt;The log will contain personal data;&lt;/strong&gt; remove this section when done.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;3. Script problems&lt;/strong&gt; show as &lt;code&gt;Lua script error (&amp;lt;protocol&amp;gt;/&amp;lt;phase&amp;gt;): &amp;lt;file&amp;gt;:&amp;lt;line&amp;gt;: &amp;lt;message&amp;gt;&lt;/code&gt;. Scripts can print their own messages with &lt;code&gt;log(...)&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For what common messages mean, see usage section 8.&lt;/p&gt;&#xA;&lt;h2 id=&#34;upgrading&#34;&gt;Upgrading&#xA;&lt;/h2&gt;&lt;ol&gt;&#xA;&lt;li&gt;Read the new version&amp;rsquo;s change notes, especially items marked as upgrade notes.&lt;/li&gt;&#xA;&lt;li&gt;Run &lt;code&gt;--check&lt;/code&gt; with the new version against your current configuration.&lt;/li&gt;&#xA;&lt;li&gt;One node: stop → replace the binary → start. A cluster: one node at a time; see &lt;a class=&#34;link&#34; href=&#34;../08-ha-cluster/#upgrades-and-reboots&#34; &gt;chapter 8&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;backups&#34;&gt;Backups&#xA;&lt;/h2&gt;&lt;p&gt;rradius has no built-in backup command. The cluster itself keeps three copies and survives losing one host, but &lt;strong&gt;data deleted by mistake is replicated to every node,&lt;/strong&gt; so keep separate copies anyway:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The source of accounts must be rebuildable:&lt;/strong&gt; keep migration files in version control; when accounts come from a directory or another system, that is the original.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Data that exists only in rradius, such as accounting,&lt;/strong&gt; is exported regularly by an external process to the billing system or a data warehouse.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Key files are not in the database and need separate backups:&lt;/strong&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;aka.key&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../13-sim-wifi/&#34; &gt;chapter 13&lt;/a&gt;): losing it means importing every card again.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;dpsk.key&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../12-psk-wifi/&#34; &gt;chapter 12&lt;/a&gt;): losing it means everyone has to reset their Wi-Fi passphrase.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;ticket.seal&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../15-wifi-certs/&#34; &gt;chapter 15&lt;/a&gt;): losing it loses no data; generate a new one, and devices do one full handshake.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Keep key file backups apart from database backups.&lt;/strong&gt; Kept together, whoever gets the backup has both the ciphertext and the key.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Configuration files, scripts and certificates&lt;/strong&gt; go into version control or a configuration management tool; private keys and &lt;code&gt;*.secret&lt;/code&gt; are kept separately, however you manage secrets.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>20. Troubleshooting by Symptom</title>
            <link>https://embark.systems/en/rradius/20-troubleshooting/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/20-troubleshooting/</guid>
            <description>&lt;p&gt;This chapter starts from &amp;ldquo;what you see&amp;rdquo; and tells you where to look first. The &amp;ldquo;Common problems&amp;rdquo; at the end of each chapter cover problems specific to that scenario; this one covers problems across scenarios. The full table of messages is in usage section 8.&lt;/p&gt;&#xA;&lt;h2 id=&#34;have-these-four-ready&#34;&gt;Have these four ready&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Tool&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What it shows&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;How to use it&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;The authentication log&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The result of every login, and who decided&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Log lines starting with &lt;code&gt;authentication protocol=...&lt;/code&gt;, present by default&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Metrics&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;What leaves no log line: dropped packets, overload, upstream state&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;curl -s http://127.0.0.1:9812/metrics&lt;/code&gt;, with &lt;code&gt;[metrics]&lt;/code&gt; set&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Tracing&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The full requests and responses of one user or one NAS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[log.trace]&lt;/code&gt; plus SIGHUP; see &lt;a class=&#34;link&#34; href=&#34;../19-operations/#investigating-one-users-problem&#34; &gt;chapter 19&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;&lt;code&gt;--check&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Problems in the configuration file, certificates or script syntax&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius-server --check --config ...&lt;/code&gt;, without affecting the running service&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;&lt;strong&gt;The authentication log records only requests that reached a decision.&lt;/strong&gt; Dropped packets (unknown source, bad signature, overload, retransmissions) leave no log line; look at the metrics. This is the most common misunderstanding: nothing in the log does not mean the packet never arrived.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-nas-sent-a-request-and-got-no-reply-at-all&#34;&gt;The NAS sent a request and got no reply at all&#xA;&lt;/h2&gt;&lt;p&gt;rradius deliberately does not reply in many cases (a reply would give an attacker information, or make the NAS think the password was wrong). First see which label of this metric is rising:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;curl -s http://127.0.0.1:9812/metrics | grep -E &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;rradius_radius_(discarded|duplicates|packets)_total&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What is rising&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Meaning&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What to do&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Nothing moves&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The packet does not reach rradius&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The firewall, routing, the address and port set on the NAS; whether &lt;code&gt;[radius] bind&lt;/code&gt; listens only on &lt;code&gt;127.0.0.1&lt;/code&gt;; confirm with &lt;code&gt;tcpdump -ni any udp port 1812&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;discarded{reason=&amp;quot;unknown_client&amp;quot;}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The source address is not in &lt;code&gt;[[radius.clients]]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The log shows &lt;code&gt;unknown client&lt;/code&gt; with the source address. When the NAS is behind NAT, rradius sees the translated address. With dynamic clients, see &lt;a class=&#34;link&#34; href=&#34;../14-branch-nas/#common-problems&#34; &gt;chapter 14&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;discarded{reason=&amp;quot;invalid&amp;quot;}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wrong shared secret, bad format, or no Message-Authenticator&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;When the log shows &lt;code&gt;lacking a Message-Authenticator&lt;/code&gt;: old devices do not send this attribute; set &lt;code&gt;require_message_authenticator = &amp;quot;no&amp;quot;&lt;/code&gt; or &lt;code&gt;&amp;quot;auto&amp;quot;&lt;/code&gt; on that client (&lt;a class=&#34;link&#34; href=&#34;../01-concepts/#clients-who-may-ask&#34; &gt;chapter 1&lt;/a&gt;). Otherwise check the shared secret, watching for extra whitespace at the end of the file&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;discarded{reason=&amp;quot;overload&amp;quot;}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Requests handled at once reached the limit&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;See &amp;ldquo;Logins are slow, or only sometimes work&amp;rdquo; below&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;duplicates&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Retransmissions: the original request is still being handled&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Handling is too slow for the NAS to wait. See &amp;ldquo;Logins are slow, or only sometimes work&amp;rdquo; below&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;packets&lt;/code&gt; rises but there is no reply&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The request was handled, but the decision was not to reply&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Forwarded by realm and no upstream answered (&lt;a class=&#34;link&#34; href=&#34;../09-realm-proxy/&#34; &gt;chapter 9&lt;/a&gt;); the accounting script did not return &lt;code&gt;&#39;accept&#39;&lt;/code&gt;; EAP&amp;rsquo;s &lt;code&gt;max_sessions_per_device&lt;/code&gt; is full&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;&lt;strong&gt;Use Status-Server to separate &amp;ldquo;network and secret&amp;rdquo; from &amp;ldquo;the account&amp;rdquo;:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Message-Authenticator=0x00&amp;#39;&lt;/span&gt; | radclient -t &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; -r &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &amp;lt;address&amp;gt;:1812 status &amp;lt;shared secret&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A reply means the network works, the source is recognised and the shared secret is right, so the problem is in the request itself. No reply means the problem is one of those three. Send this from a host in the client list.&lt;/p&gt;&#xA;&lt;h2 id=&#34;logins-are-rejected&#34;&gt;Logins are rejected&#xA;&lt;/h2&gt;&lt;p&gt;Find that login&amp;rsquo;s line in the authentication log and look at &lt;code&gt;handler&lt;/code&gt; and &lt;code&gt;account&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;wlc&amp;#34; source=10.30.0.10 user=&amp;#34;Staff1@corp.example.com&amp;#34; account=&amp;#34;staff1&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;sql&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;code&gt;handler&lt;/code&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Meaning&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Common causes&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The &lt;code&gt;sql&lt;/code&gt; handler rejected&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wrong password; the password column is &lt;code&gt;NULL&lt;/code&gt; or empty; more than one row found; the password&amp;rsquo;s format cannot be used with this login method (CHAP needs plain text, MS-CHAPv2 plain text or &lt;code&gt;{nthash}&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;ldap&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The &lt;code&gt;ldap&lt;/code&gt; handler rejected&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wrong password, not in &lt;code&gt;required_groups&lt;/code&gt;; when the directory cannot be reached or the service account fails to log in, there is also a log message starting with &lt;code&gt;auth ldap handler:&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;lua&lt;/code&gt;, &lt;code&gt;script&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A script rejected&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The script&amp;rsquo;s logic, or a script error (the log shows &lt;code&gt;Lua script error&lt;/code&gt;, with the file and line)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;none&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Every handler skipped&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The account does not exist (&lt;code&gt;sql&lt;/code&gt; found nothing, &lt;code&gt;ldap&lt;/code&gt; did not find it). First check that &lt;code&gt;account&lt;/code&gt; is the name you expect&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;no_password_check&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Nobody in an &lt;code&gt;all_accept&lt;/code&gt; chain checked a password&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The account is not in &lt;code&gt;sql&lt;/code&gt; or &lt;code&gt;ldap&lt;/code&gt;; only a later script said yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;normalization&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The name was stopped before the chain&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The name was empty after processing, or does not match &lt;code&gt;[auth.username] allowed&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;eap-tls&lt;/code&gt;, &lt;code&gt;eap-peap&lt;/code&gt;, &lt;code&gt;eap-ttls&lt;/code&gt;, &lt;code&gt;eap-aka-prime&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The EAP conversation ended in a reject&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The line before usually has &lt;code&gt;EAP conversation with client ... failed&lt;/code&gt; or &lt;code&gt;refused&lt;/code&gt; with the reason; see &amp;ldquo;Wi-Fi (802.1X)&amp;rdquo; below&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;dpsk&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A per-person passphrase&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Nobody&amp;rsquo;s passphrase matched (&lt;code&gt;account&lt;/code&gt; is empty), or it matched but that person is disabled (&lt;a class=&#34;link&#34; href=&#34;../12-psk-wifi/#common-problems&#34; &gt;chapter 12&lt;/a&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A realm name, with &lt;code&gt;chain=&amp;quot;proxy&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The upstream rejected&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Investigate on the upstream&amp;rsquo;s side&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;&lt;strong&gt;The password is definitely right:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is &lt;code&gt;account&lt;/code&gt; the same as the name in the table? Case, and whether it carries a realm. See &lt;code&gt;[auth.username]&lt;/code&gt; (usage section 3.6).&lt;/li&gt;&#xA;&lt;li&gt;Does the log show &lt;code&gt;RADIUS response attribute error&lt;/code&gt;? That means a reply attribute&amp;rsquo;s name or value is wrong (&lt;code&gt;reply_query&lt;/code&gt;, &lt;code&gt;group_reply&lt;/code&gt;, the script&amp;rsquo;s &lt;code&gt;set_attr&lt;/code&gt;), which rejects even with the right password.&lt;/li&gt;&#xA;&lt;li&gt;Was the log line perhaps not written by this rradius at all? With several nodes, look on each.&lt;/li&gt;&#xA;&lt;li&gt;Was a name with &lt;code&gt;@&lt;/code&gt; forwarded by &lt;code&gt;[proxy]&lt;/code&gt;? Then &lt;code&gt;chain&lt;/code&gt; is &lt;code&gt;proxy&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;No log line for this login at all:&lt;/strong&gt; go back to the previous section; it was dropped. Or &lt;code&gt;[log] auth = false&lt;/code&gt; has turned the log off.&lt;/p&gt;&#xA;&lt;h2 id=&#34;logins-are-slow-or-only-sometimes-work&#34;&gt;Logins are slow, or only sometimes work&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What to look at&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Means&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RADIUS authentication overloaded: discarded N packets&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Requests handled at once reached &lt;code&gt;max_auth_inflight&lt;/code&gt; (4096 by default). This is the effect, not the cause: something is making each request slow&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_radius_duplicates_total&lt;/code&gt; rising&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The NAS is retransmitting; handling takes longer than its retransmission interval&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;sql_query timed out&lt;/code&gt; or &lt;code&gt;sql_execute timed out&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The database is slow, or the cluster has no majority. Such logins get no reply (&lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;database&amp;quot;}&lt;/code&gt;), and the NAS retransmits or asks another node&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Timeouts from &lt;code&gt;auth ldap handler:&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The directory is slow or unreachable&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_script_http_requests_total{result=&amp;quot;timeout&amp;quot;}&lt;/code&gt; rising&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An API called by a script is slow (&lt;a class=&#34;link&#34; href=&#34;../18-external-api/#when-the-api-slows-down-or-stops&#34; &gt;chapter 18&lt;/a&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_proxy_requests_total{result=&amp;quot;timeout&amp;quot;}&lt;/code&gt; rising&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An upstream is slow or down&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Finding the slow part:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Password hashing:&lt;/strong&gt; bcrypt and argon2 are deliberately slow, verifying no more at once than there are CPU cores, with the rest queueing. At peaks, a few hundred logins a second already queue. For high login volumes, switch to &lt;code&gt;sha512-crypt&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../19-operations/#with-the-user-command&#34; &gt;chapter 19&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Writes:&lt;/strong&gt; scripts that write to the database on every login (quotas, IP assignment, two-step verification) go through the cluster and are slower than reads alone. Right after the cluster loses its majority, writes fail only after &lt;code&gt;[lua] query_timeout_ms&lt;/code&gt;; after more than 5 seconds without a leader they fail at once. These logins all get no reply rather than a reject.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The first upstream does not answer:&lt;/strong&gt; when forwarding by realm, every request first waits for the first server to time out before trying the next, until it is marked down. &lt;code&gt;probe_interval_ms&lt;/code&gt; notices earlier (&lt;a class=&#34;link&#34; href=&#34;../11-roaming/#national-proxy&#34; &gt;chapter 11&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Raising &lt;code&gt;max_auth_inflight&lt;/code&gt; usually does not help.&lt;/strong&gt; The NAS gives up after a few seconds, and a longer queue just means more wasted work. Fix the cause of the slowness first.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Accounting slowing logins down:&lt;/strong&gt; the number of accounting scripts running at once is limited (CPU cores minus 2), leaving threads for logins; but both share the database, so heavy accounting scripts still affect logins.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;accounting-keeps-being-retransmitted-or-accounting-is-missing&#34;&gt;Accounting keeps being retransmitted, or accounting is missing&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;The NAS keeps retransmitting the same accounting:&lt;/strong&gt; the accounting script did not return &lt;code&gt;&#39;accept&#39;&lt;/code&gt;, so rradius did not reply.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;Lua script error (radius/accounting)&lt;/code&gt; in the log: the script failed; look at the file and line.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Lua script did not accept accounting&lt;/code&gt; in the log: the script ended normally but returned something else. Packets you do not want to record must also return &lt;code&gt;&#39;accept&#39;&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;sql_execute timed out&lt;/code&gt; in the log: the database cannot take writes. With the accounting spool set up, this case is written locally first and then answered (&lt;a class=&#34;link&#34; href=&#34;../07-broadband/#the-accounting-spool&#34; &gt;chapter 7&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Accounting is missing:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Check&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Means&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_acct_spool_bytes&lt;/code&gt; above 0&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Still in the spool waiting for replay, not yet in the database. It empties by itself once the database recovers and the script works&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rejected.log&lt;/code&gt; in the spool directory&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Requests given up during replay: rejected by the script, SQL syntax or constraint errors, a client that no longer exists. The file is not cleaned up automatically, and never replayed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Files ending in &lt;code&gt;.corrupt&lt;/code&gt; or &lt;code&gt;truncated.log&lt;/code&gt; in the spool directory&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Left by power loss or disk problems; the requests in them were not replayed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_acct_spool_full_total&lt;/code&gt; rising&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The spool is full or writing failed; these requests got no reply and rely on NAS retransmission&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RADIUS accounting overloaded&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;max_acct_inflight&lt;/code&gt; was reached, and packets were dropped&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The accounting is forwarded&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Look at &lt;code&gt;rradius_proxy_acct_spool_*&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../11-roaming/#spooling-accounting-when-every-upstream-is-down&#34; &gt;chapter 11&lt;/a&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;&lt;strong&gt;The spool never goes down (&lt;code&gt;rradius_acct_spool_bytes&lt;/code&gt; stays above 0):&lt;/strong&gt; replay is stuck on the first record. The database has not recovered, or the script fails every time. Look at log messages starting with &lt;code&gt;Lua script&lt;/code&gt; and &lt;code&gt;accounting spool&lt;/code&gt;; once the script is fixed and SIGHUP sent, it continues by itself.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The same accounting was recorded twice:&lt;/strong&gt; the script is not safe to repeat. When a NAS updates &lt;code&gt;Acct-Delay-Time&lt;/code&gt; and retransmits, it uses a new Identifier, so rradius cannot tell it is a retransmission; spool replay can also run it again. Writes must use &lt;code&gt;INSERT ... ON CONFLICT&lt;/code&gt; or &lt;code&gt;INSERT OR IGNORE&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../01-concepts/#accounting-must-be-safe-to-repeat&#34; &gt;chapter 1&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;h2 id=&#34;wi-fi-8021x&#34;&gt;Wi-Fi (802.1X)&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;EAP conversation with client ... failed&lt;/code&gt; in the log, with a reason mentioning &lt;code&gt;State&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The second half of the conversation reached another node. One login must stay on one node: primary/backup on the NAS, or a load balancer pinning by source (&lt;a class=&#34;link&#34; href=&#34;../08-ha-cluster/&#34; &gt;chapter 8&lt;/a&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;... failed&lt;/code&gt; with a TLS error as the reason&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The client broke off because it does not trust the server certificate (no CA on the device, a server name mismatch), or TLS versions or cipher suites do not match&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;... refused&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The certificate (or card) passed, but the name does not match, or the chain did not accept it: &lt;code&gt;certificate_query&lt;/code&gt; found nothing, or &lt;code&gt;ldap&lt;/code&gt; has no &lt;code&gt;certificate_filter&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;the chain did not accept the inner name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wrong PEAP or TTLS password, or no such account&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;the chain accepted the inner name without checking a password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The handler that accepted is a &lt;code&gt;lua&lt;/code&gt; handler without &lt;code&gt;verifies_password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;this client has no chain to check a password with&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PEAP and TTLS need an authentication chain, and this client has none&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PEAP keeps failing, while a PAP test works&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The password is not plain text or &lt;code&gt;{nthash}&lt;/code&gt;; or &lt;code&gt;ldap&lt;/code&gt; uses &lt;code&gt;bind&lt;/code&gt; mode&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The client picks a method you did not want to offer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;That client&amp;rsquo;s &lt;code&gt;eap_methods&lt;/code&gt; lists it. To accept only certificates, list only &lt;code&gt;[&amp;quot;tls&amp;quot;]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_eap_sessions_total{result=&amp;quot;timeout&amp;quot;}&lt;/code&gt; is high&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Clients did not finish: users cancelled after a certificate warning, a poor signal, or the NAS&amp;rsquo;s EAP timeout is too short&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;result=&amp;quot;evicted&amp;quot;&lt;/code&gt; keeps rising&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Conversations at once exceed &lt;code&gt;max_sessions&lt;/code&gt; or &lt;code&gt;max_sessions_per_client&lt;/code&gt;. When every user goes through the same controller, raise the latter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;result=&amp;quot;overload&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One device opened too many conversations at once (&lt;code&gt;max_sessions_per_device&lt;/code&gt;), or EAP-AKA&amp;rsquo; rate limits&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Revocation and session resumption problems&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../15-wifi-certs/#common-problems&#34; &gt;Chapter 15&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;&lt;strong&gt;The inner name cannot be seen:&lt;/strong&gt; in the authentication log for PEAP and TTLS, &lt;code&gt;user&lt;/code&gt; is the anonymous outer name, and &lt;code&gt;account&lt;/code&gt; is the real account. &lt;code&gt;[log.trace]&lt;/code&gt; matches outer names, so trace the whole NAS with &lt;code&gt;clients = [...]&lt;/code&gt;, or list the outer names actually used.&lt;/p&gt;&#xA;&lt;h2 id=&#34;tls-connections-radsec-tacacs-over-tls-radsec-upstreams&#34;&gt;TLS connections (RadSec, TACACS+ over TLS, RadSec upstreams)&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RadSec handshake with ... failed&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The other side has no certificate, or it is not signed by &lt;code&gt;client_ca_file&lt;/code&gt;, revoked or expired, or the TLS versions do not match&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The handshake succeeds but the connection is closed at once&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The certificate passed but matched no client: see whether the log says &lt;code&gt;fits no client&lt;/code&gt;, &lt;code&gt;is not valid for client ...&#39;s tls_name&lt;/code&gt; or &lt;code&gt;needs tls_name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Every device fails to connect at the same time&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The server certificate expired; &lt;code&gt;crl_file&lt;/code&gt; is missing a CA; &lt;code&gt;ocsp = &amp;quot;hard&amp;quot;&lt;/code&gt; and the responder is down; RadSec has &lt;code&gt;reject_expired_crl&lt;/code&gt; on and the CRL expired&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A replaced certificate or CRL does not take effect&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SIGHUP is needed, on every node&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;proxy server ...: cannot connect ... TLS:&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Connecting to an upstream failed. The rest of the message says whether the other side&amp;rsquo;s certificate is not trusted by &lt;code&gt;ca_file&lt;/code&gt;, is not valid for &lt;code&gt;tls_name&lt;/code&gt;, or the other side does not accept the certificate you presented&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accepting a connection failed N times&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;File descriptors ran out. Raise &lt;code&gt;ulimit -n&lt;/code&gt;, or lower &lt;code&gt;max_connections&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;&lt;code&gt;openssl s_client&lt;/code&gt; can check the handshake on its own; see &lt;a class=&#34;link&#34; href=&#34;../10-radsec/#3-check-the-handshake&#34; &gt;chapter 10&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;forwarding-by-realm&#34;&gt;Forwarding by realm&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;no proxy server answered a request for realm ...&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No upstream gave a valid answer: down, a firewall, a wrong shared secret, or the upstream&amp;rsquo;s answer had no Message-Authenticator&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;proxy server ... is not answering on ...&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;This server was marked down, and the next is used for now. Later a Status-Server checks whether it is back&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An upstream is marked down after a mistyped password&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;timeout_ms&lt;/code&gt; is shorter than the upstream&amp;rsquo;s deliberate delay before rejecting&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;a request for realm ... came back to this server&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The forwarding configuration loops&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Local accounts are forwarded&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;There is a &lt;code&gt;*&lt;/code&gt; or an entry covering your own domain; with DNS discovery, your own realms are not listed in &lt;code&gt;local_realms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Every request for some realm is dropped&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The DNS lookup failed (&lt;a class=&#34;link&#34; href=&#34;../11-roaming/#common-problems&#34; &gt;chapter 11&lt;/a&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;disconnects-disconnect-coa&#34;&gt;Disconnects (Disconnect, CoA)&#xA;&lt;/h2&gt;&lt;p&gt;The &lt;code&gt;Error-Cause&lt;/code&gt; of a NAK states the reason directly:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Result&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Meaning&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No reply at all&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The sender is not in &lt;code&gt;[[radius.coa.clients]]&lt;/code&gt;, the shared secret is wrong, or more than 256 requests at once. &lt;code&gt;rradius_coa_relay_discarded_total&lt;/code&gt; increases&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;NAK 502&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No NAS found: the request&amp;rsquo;s &lt;code&gt;NAS-IP-Address&lt;/code&gt; or &lt;code&gt;NAS-Identifier&lt;/code&gt; matches no client; or a NAS recognised only by certificate has no connection open&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;NAK 503&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Only a user name was given, and &lt;code&gt;session_query&lt;/code&gt; found no open session&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;NAK 505&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The NAS gave no valid answer (CoA not enabled, wrong port, rradius&amp;rsquo;s source not accepted, a different shared secret); &lt;code&gt;session_query&lt;/code&gt; failed; or the request contains attributes that must be encrypted&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;NAK with another &lt;code&gt;Error-Cause&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The NAS&amp;rsquo;s own answer, passed back as is&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;&lt;code&gt;send_disconnect&lt;/code&gt; and &lt;code&gt;send_coa&lt;/code&gt; returning &lt;code&gt;&amp;quot;timeout&amp;quot;&lt;/code&gt;, and &lt;code&gt;rradius-server disconnect&lt;/code&gt; printing &lt;code&gt;timeout&lt;/code&gt;, have the same causes as the first item of 505. The command sends from the host it runs on, so the NAS must accept that source address.&lt;/p&gt;&#xA;&lt;h2 id=&#34;tacacs&#34;&gt;TACACS+&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The connection is closed at once, with &lt;code&gt;TACACS+ connection from unknown client&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The source is not in &lt;code&gt;[[tacacs.clients]]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Authentication answers ERROR, with &lt;code&gt;a body did not decode, so the shared secret may be wrong&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The shared secrets differ. &lt;code&gt;rradius_tacacs_malformed_total&lt;/code&gt; increases too&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Logins work, but every command is refused&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The authorization script refuses, or no rule of the authorization group holds (&lt;a class=&#34;link&#34; href=&#34;../06-device-admin/#common-problems&#34; &gt;chapter 6&lt;/a&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;enable&lt;/code&gt; always fails, with &lt;code&gt;TACACS+ enable request refused&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Enable is refused by default. Do not put rradius in the device&amp;rsquo;s enable methods, or set &lt;code&gt;enable = &amp;quot;login&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;CHAP and MS-CHAPv2 logins get RESTART&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;This client has no authentication chain, or the chain only has a script without &lt;code&gt;verifies_password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Logins keep answering ERROR&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;More than 8 unfinished logins on one connection, or a single login taking more than 60 seconds&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;TACACS+ overloaded: closed N connections&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;max_connections&lt;/code&gt; was reached. When devices open connections and never close them, lower &lt;code&gt;idle_timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TLS problems&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../16-device-admin-tls/#common-problems&#34; &gt;Chapter 16&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;startup-fails&#34;&gt;Startup fails&#xA;&lt;/h2&gt;&lt;p&gt;Look at the exit status:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Status&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Meaning&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Common causes&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The configuration is wrong, and nothing has started&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The message names the file and field: a misspelt field, a missing file, a script syntax error, a certificate and key that do not match, key file permissions too broad, problems in migration file names or contents&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The configuration is fine, but the environment does not allow it&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The RADIUS UDP ports or the CoA port cannot be bound (in use, or no permission; the message gives the address and port); the cluster was not ready within &lt;code&gt;migrations_wait_ms&lt;/code&gt; (other nodes not up, or unreachable)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;When TACACS+, RadSec or metrics ports cannot be bound, the process does not exit;&lt;/strong&gt; it logs one error line, and other services run as usual. So with TACACS+ on port 49 and no permission, the process looks healthy but devices cannot connect; after startup, confirm the log has &lt;code&gt;listening&lt;/code&gt; for every port.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;migration file &#39;...&#39; changed after it was applied&lt;/code&gt;:&lt;/strong&gt; an applied file was changed. Restore its original contents, and add a file with the next number for changes. In development you can stop the server, delete &lt;code&gt;data/&lt;/code&gt; and start over.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A node keeps exiting with status 1, with &lt;code&gt;cluster was not ready to apply migrations&lt;/code&gt; in the log:&lt;/strong&gt; the majority of nodes is not online yet; or &lt;code&gt;migrations_wait_ms&lt;/code&gt; is shorter than the slowest SQL file takes to run.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;Raft node has not been initialized&lt;/code&gt; keeps appearing:&lt;/strong&gt; the node has not joined the cluster yet. Have the other nodes started? Can they reach each other&amp;rsquo;s raft and api ports? Is &lt;code&gt;raft.secret&lt;/code&gt; the same?&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;--check&lt;/code&gt; before starting&lt;/strong&gt; catches most of the status 2 problems, but it does not connect to the database or directory, so wrong SQL or a wrong LDAP password only shows up after startup.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;a-reload-did-not-take-effect&#34;&gt;A reload did not take effect&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;reload failed, keeping the running configuration: ...&lt;/code&gt; in the log:&lt;/strong&gt; the new configuration has an error, and the service keeps using the old one. Fix it and send SIGHUP again. &lt;code&gt;rradius_reload_total{result=&amp;quot;error&amp;quot;}&lt;/code&gt; increases.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;these need a restart to apply: ...&lt;/code&gt; in the log:&lt;/strong&gt; the settings listed changed but apply only after a restart; the others have been applied. The list is in &lt;a class=&#34;link&#34; href=&#34;../19-operations/#reloading-sighup&#34; &gt;chapter 19&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Only one node took effect:&lt;/strong&gt; each node reloads on its own; files must go on every node and the signal to every node.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The dictionary file changed:&lt;/strong&gt; the dictionary is not reread; restart.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The migration directory changed:&lt;/strong&gt; new files are applied only at startup.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;the-cluster&#34;&gt;The cluster&#xA;&lt;/h2&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Login results on one node differ from the others&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;That node&amp;rsquo;s &lt;code&gt;migrations/&lt;/code&gt;, scripts or configuration file differ from the others&amp;rsquo;; or it is partitioned (&lt;code&gt;rradius_cluster_leader&lt;/code&gt; is 0) and reads stale data&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Some logins on one node get no reply&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;database&amp;quot;}&lt;/code&gt;: it cannot reach the cluster database; &lt;code&gt;reason=&amp;quot;no_leader&amp;quot;&lt;/code&gt;: &lt;code&gt;stop_without_leader_ms&lt;/code&gt; is set and it has been without a leader too long (&lt;a class=&#34;link&#34; href=&#34;../08-ha-cluster/&#34; &gt;chapter 8&lt;/a&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A restarted node takes a while to start answering&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Normal: it waits for its local replica to catch up with the cluster before answering, logging &lt;code&gt;has caught up with the cluster&lt;/code&gt;. After a long downtime the catch-up takes longer, up to &lt;code&gt;migrations_wait_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Data just written cannot be read&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;sql_query&lt;/code&gt; reads the local replica, which may lag slightly behind writes. To know whether a write succeeded, use &lt;code&gt;sql_execute&lt;/code&gt;&amp;rsquo;s return value instead of querying again&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Every write times out&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The majority was lost (one of three left). Read-only logins work as usual; logins that need to write get no reply and TACACS+ answers ERROR; accounting goes to the spool when there is one, until the nodes come back&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A node exits by itself with status 1, with &lt;code&gt;exiting so that a restart recovers it&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Its Raft core stopped (commonly because the cluster wrote more than &lt;code&gt;snapshot_every&lt;/code&gt; while it was disconnected), or hiqlite panicked internally. Restarting it lets it catch up; with automatic restarts set up there is nothing to do (&lt;a class=&#34;link&#34; href=&#34;../08-ha-cluster/&#34; &gt;chapter 8&lt;/a&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Stopping a node takes about 10 seconds&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Normal: with several nodes, hiqlite waits 9.5 seconds before closing&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Restarted while it was the last node, it never comes up (exiting with status 1 when there are migrations)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A restarted node waits for a leader. Bring the other nodes back first (&lt;a class=&#34;link&#34; href=&#34;../08-ha-cluster/&#34; &gt;chapter 8&lt;/a&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Startup is slow after an abnormal exit&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The writes since the last snapshot have to be replayed. See &lt;code&gt;snapshot_every&lt;/code&gt; in usage section 2.2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Features that behave differently on each node&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The accounting spool, EAP conversations, sessions without &lt;code&gt;shared_tickets&lt;/code&gt;, results remembered for dynamic clients and per-person passphrases, RadSec connections, and tracing timings all belong to each node&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;the-log-itself&#34;&gt;The log itself&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;rradius_log_dropped_lines_total&lt;/code&gt; rising:&lt;/strong&gt; the log is written faster than its destination takes it, or writing fails (a full disk, the receiving process exited). Dropped lines are gone; the service is unaffected. Check where stderr goes; with heavy traffic, turn off &lt;code&gt;[log] auth&lt;/code&gt;, or do not trace whole NAS.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Messages ending in &lt;code&gt;(N since the last line)&lt;/code&gt;:&lt;/strong&gt; messages anyone can trigger (unknown sources, failed handshakes) appear at most once per second of each kind, and N is the total for that period.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;WARN and ERROR from &lt;code&gt;hiqlite&lt;/code&gt;:&lt;/strong&gt; a few lines appear when the cluster starts and stops, such as &lt;code&gt;No metadata exists inside the DB yet&lt;/code&gt;, and are normal.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Lines starting with &lt;code&gt;script ...: ...&lt;/code&gt;&lt;/strong&gt; are written by scripts with &lt;code&gt;log()&lt;/code&gt;, and are not errors.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Every message goes to stderr.&lt;/strong&gt; The results of management commands (&lt;code&gt;user&lt;/code&gt;, &lt;code&gt;disconnect&lt;/code&gt;, &lt;code&gt;coa&lt;/code&gt;) go to stdout.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item></channel>
</rss>
