<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>RRadius (oss) User Manual on Embark Systems</title>
        <link>https://embark.systems/en/rradius/oss/</link>
        <description>Recent content in RRadius (oss) User Manual on Embark Systems</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en</language><atom:link href="https://embark.systems/en/rradius/oss/index.xml" rel="self" type="application/rss+xml" /><item>
            <title>01 Getting to know rradius</title>
            <link>https://embark.systems/en/rradius/oss/01-overview/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/01-overview/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Say what rradius does and what it does not do&lt;/li&gt;&#xA;&lt;li&gt;Follow a RADIUS request through the server and know which places it passes&lt;/li&gt;&#xA;&lt;li&gt;Tell the configuration file, the data directory and the dictionary apart, and what each one is for&lt;/li&gt;&#xA;&lt;li&gt;Decide whether the feature you need is in the core edition or needs the enterprise edition&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: none. This chapter only covers concepts. You do not need to install anything first.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#what-rradius-is&#34; &gt;What rradius is&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#supported-protocols&#34; &gt;Supported protocols&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#one-program-with-a-built-in-cluster-database&#34; &gt;One program, with a built-in cluster database&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#how-a-request-travels&#34; &gt;How a request travels&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#the-configuration-file-the-data-directory-and-the-dictionary&#34; &gt;The configuration file, the data directory and the dictionary&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#command-overview&#34; &gt;Command overview&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#testing-with-external-tools&#34; &gt;Testing with external tools&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#core-and-enterprise-editions&#34; &gt;Core and enterprise editions&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#how-to-read-this-manual&#34; &gt;How to read this manual&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;what-rradius-is&#34;&gt;What rradius is&#xA;&lt;/h2&gt;&lt;p&gt;rradius is an AAA server. It answers the question &amp;ldquo;can this user come in?&amp;rdquo; for a NAS (network access server, for example a Wi-Fi controller, a switch, a BNG or a VPN gateway), and it records how long each user stayed and how much traffic they used.&lt;/p&gt;&#xA;&lt;p&gt;It has three features that the later chapters rely on:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Login rules live in the configuration file, in SQL and in Lua scripts.&lt;/strong&gt; In simple cases you write one SQL query in the configuration file. When you need rules about time of day, quotas or groups, you write a Lua script (in practice the Luau dialect).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Data lives in a built-in cluster database.&lt;/strong&gt; Accounts, accounting and sessions are stored in a database that ships with the program. It runs on a single machine, and for high availability you join several machines into a cluster. You do not need a separate database server.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;There is only one executable.&lt;/strong&gt; The server and the management commands are both &lt;code&gt;rradiusd&lt;/code&gt;: &lt;code&gt;rradiusd serve&lt;/code&gt; starts the service, &lt;code&gt;rradiusd user add&lt;/code&gt; adds an account, and &lt;code&gt;rradiusd status&lt;/code&gt; shows the state.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;What rradius does &lt;strong&gt;not&lt;/strong&gt; do:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It has no web management interface. All management is done on the command line and in the configuration file.&lt;/li&gt;&#xA;&lt;li&gt;It does not decide what your tables look like. You create the tables yourself with migrations (SQL files), and you write the queries. The example scenarios include a set of tables you can use as they are.&lt;/li&gt;&#xA;&lt;li&gt;It does not manage certificates. You prepare the server certificate and the CA certificate that EAP needs (chapter 11).&lt;/li&gt;&#xA;&lt;li&gt;The management commands work through the cluster&amp;rsquo;s API port and the metrics port. There is no separate management API service.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;supported-protocols&#34;&gt;Supported protocols&#xA;&lt;/h2&gt;&lt;p&gt;The core edition of &lt;code&gt;rradiusd&lt;/code&gt; 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;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;Default port&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Described in&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 authentication (RFC 2865)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;User login: PAP, CHAP, MS-CHAP, MS-CHAPv2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;UDP 1812&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Chapters 05 and 07&lt;/td&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 accounting (RFC 2866)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting records such as Start, Interim-Update and Stop&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;UDP 1813&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;Status-Server (RFC 5997)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A monitoring system checks that the server is alive, without a test account&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The same two ports&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Chapter 05&lt;/td&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 over RADIUS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;802.1X: EAP-TLS, PEAP, EAP-TTLS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The RADIUS authentication port&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Chapter 11&lt;/td&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+ (RFC 8907)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Administrator login to network devices, command authorization, accounting&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TCP 49&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Chapter 12&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;There are also two ports that are not AAA protocols but that every node uses:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The metrics port: it is opened only when &lt;code&gt;[metrics]&lt;/code&gt; is set. It defaults to &lt;code&gt;127.0.0.1:9812&lt;/code&gt; and serves &lt;code&gt;/metrics&lt;/code&gt;, &lt;code&gt;/livez&lt;/code&gt; and &lt;code&gt;/readyz&lt;/code&gt; (chapter 17). The &lt;code&gt;status&lt;/code&gt; command reads this port.&lt;/li&gt;&#xA;&lt;li&gt;The cluster ports: the Raft port and the API port. The starting file that &lt;code&gt;config init&lt;/code&gt; produces uses &lt;code&gt;127.0.0.1:8100&lt;/code&gt; and &lt;code&gt;127.0.0.1:8200&lt;/code&gt;. Nodes synchronize data over them, and management commands write data through them (chapter 16).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The metrics port has no authentication, so bind it to an internal address only. The cluster ports are protected only by a shared secret, so do not expose them to the outside either.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;one-program-with-a-built-in-cluster-database&#34;&gt;One program, with a built-in cluster database&#xA;&lt;/h2&gt;&lt;p&gt;The rradius database is hiqlite. Each node has its own SQLite database, and the nodes synchronize with each other using the Raft protocol. For you, this means:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;A single machine is a cluster of one node.&lt;/strong&gt; The configuration always has a &lt;code&gt;[cluster]&lt;/code&gt; section, even with one machine. On a single machine you can ignore leaders and followers.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Writes go through the leader.&lt;/strong&gt; One node in the cluster is the leader, and every write needs its confirmation. While the cluster cannot elect a leader, requests that need to write get no result.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Tables are created by migrations.&lt;/strong&gt; &lt;code&gt;migrations_dir&lt;/code&gt; in &lt;code&gt;[cluster]&lt;/code&gt; points to a directory of SQL files. The server applies them in order of the number in the file name when it starts, and it does not run files it has already applied. To change the structure, add a file with the next number. Do not edit an old file. A single file cannot be larger than 2,000,000 bytes (the limit for one write to the cluster): put structure and a small amount of initial data in migrations, and do not write bulk data as a migration. If a file is larger, the server fails to start with the message &lt;code&gt;migration file &#39;3_big.sql&#39; is 3000001 bytes, more than the 2000000 the cluster takes in one write: …&lt;/code&gt;. &lt;code&gt;check&lt;/code&gt; does not find this, so you only learn about it at startup. It does not matter if several files add up to more than 2,000,000 bytes: the server writes them in batches by itself.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Management commands write through the API port.&lt;/strong&gt; Commands such as &lt;code&gt;user add&lt;/code&gt; do not open the database files directly. They connect to the cluster&amp;rsquo;s API port, so the server must be running first for the command to have something to talk to.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Besides the built-in database, you can also have the sql handler query an external PostgreSQL or MySQL (chapter 09), or authenticate with LDAP or Active Directory (chapter 08).&lt;/p&gt;&#xA;&lt;h2 id=&#34;how-a-request-travels&#34;&gt;How a request travels&#xA;&lt;/h2&gt;&lt;p&gt;If you know which checkpoints a request passes inside the server, you know where to look when something goes wrong. The following uses RADIUS as the example and follows the order the code actually uses.&lt;/p&gt;&#xA;&lt;h3 id=&#34;authentication-requests-access-request&#34;&gt;Authentication requests (Access-Request)&#xA;&lt;/h3&gt;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Status-Server is handled first.&lt;/strong&gt; If the packet is a Status-Server, the server answers it right away. It runs no script and does not go through retransmit detection.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Match the client.&lt;/strong&gt; The server uses the packet&amp;rsquo;s source IP address to find the matching client in &lt;code&gt;[[radius.clients]]&lt;/code&gt;. A client can be a single address or a whole network (chapter 05). If none is found, the packet is dropped without a reply, and the log records at most one line per second: &lt;code&gt;RADIUS packet from unknown client … discarded&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Check the packet.&lt;/strong&gt; The server checks the Message-Authenticator with this client&amp;rsquo;s shared secret. If the computed value is wrong (usually because the shared secret is set wrong), the packet is dropped. If the client is required to send a Message-Authenticator and the packet has none, it is also dropped (&lt;code&gt;require_message_authenticator&lt;/code&gt;, chapter 05).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Retransmit detection.&lt;/strong&gt; When a NAS gets no reply, it sends the same packet again (retransmit). The server remembers the requests it handled recently: a retransmit of a request that is still being processed is dropped, and a request that was already answered gets the same reply again.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;No reply when there is no leader.&lt;/strong&gt; If &lt;code&gt;cluster.stop_without_leader_ms&lt;/code&gt; is set and the cluster has had no leader for longer than that time, authentication requests get no reply, so the NAS asks another server (chapter 16).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;EAP.&lt;/strong&gt; If the packet carries an EAP-Message and &lt;code&gt;[radius.eap]&lt;/code&gt; is set, it goes to EAP handling. The server first completes a TLS handshake with the client, which involves several Access-Challenge round trips (chapter 11). The identity inside EAP is still passed to the next step to decide:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;EAP-TLS: after the certificate is verified, the server asks the auth chain using the name the certificate proves. If there is no auth chain, it asks the top-level Lua script.&lt;/li&gt;&#xA;&lt;li&gt;PEAP and EAP-TTLS: the password inside the tunnel must be checked by an auth chain. If the client has no auth chain, this kind of login is always rejected.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Auth chain or Lua script, one of the two.&lt;/strong&gt; Only one of these is used:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If &lt;code&gt;[auth]&lt;/code&gt; is set, the server uses an auth chain. If the client has &lt;code&gt;auth = &amp;quot;&amp;lt;name&amp;gt;&amp;quot;&lt;/code&gt;, it uses &lt;code&gt;[auth.chains.&amp;lt;name&amp;gt;]&lt;/code&gt;. Otherwise it uses the one in &lt;code&gt;[auth]&lt;/code&gt; itself (named &lt;code&gt;default&lt;/code&gt;). An auth chain is made of one or more handlers (sql, lua, ldap, netlogon), and &lt;code&gt;policy&lt;/code&gt; decides the result (chapter 07).&lt;/li&gt;&#xA;&lt;li&gt;If there is no &lt;code&gt;[auth]&lt;/code&gt;, the server runs the &lt;code&gt;script&lt;/code&gt; in &lt;code&gt;[lua]&lt;/code&gt; with &lt;code&gt;phase&lt;/code&gt; set to &lt;code&gt;authentication&lt;/code&gt;. The script returns &lt;code&gt;accept&lt;/code&gt;, &lt;code&gt;reject&lt;/code&gt; or &lt;code&gt;challenge&lt;/code&gt; (chapter 10).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;No reply when the database is unavailable.&lt;/strong&gt; If the database or an external backend cannot be used during authentication, the server does not send an Access-Reject. It sends no reply, and the log says &lt;code&gt;not answered: the authentication backend could not be used&lt;/code&gt;. The NAS then retransmits or asks another server, so a user is not treated as having a wrong password because a backend failed for a moment.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The reply.&lt;/strong&gt; If the result is accept, the server encodes the reply attributes (for example &lt;code&gt;Session-Timeout&lt;/code&gt; and &lt;code&gt;Filter-Id&lt;/code&gt;) according to the dictionary and sends an Access-Accept. If the result is reject, it sends an Access-Reject. Every authentication writes one authentication record to the log (&lt;code&gt;auth&lt;/code&gt; in &lt;code&gt;[log]&lt;/code&gt;, on by default). The record contains the client, the user, the auth chain, the handler and the result.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Once &lt;code&gt;[auth]&lt;/code&gt; is set, the top-level Lua script no longer takes part in RADIUS password authentication (except for EAP-TLS without an auth chain). Many people think the script runs once more after the auth chain, but it does not. To add rules inside the auth chain, use a lua handler (chapter 07).&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;accounting-requests-accounting-request&#34;&gt;Accounting requests (Accounting-Request)&#xA;&lt;/h3&gt;&lt;p&gt;Accounting takes a different, shorter path:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;As with authentication, the server first matches the client, then checks the Request Authenticator with the shared secret, then does retransmit detection.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;It always goes to the top-level Lua script&lt;/strong&gt;, with &lt;code&gt;phase&lt;/code&gt; set to &lt;code&gt;accounting&lt;/code&gt;. Accounting requests do not go through an auth chain.&lt;/li&gt;&#xA;&lt;li&gt;The server sends an Accounting-Response only if the script returns &lt;code&gt;accept&lt;/code&gt;. If there is no reply, the NAS retransmits, so the writes in your script must be safe to run more than once.&lt;/li&gt;&#xA;&lt;li&gt;If the script fails to write to the database and &lt;code&gt;[radius.accounting_spool]&lt;/code&gt; is set, the server first writes the request to the accounting spool (a temporary store on disk where requests wait to be replayed) and then replies to the NAS. When the database recovers, the server hands the requests in the spool back to the script by itself (chapter 13).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;tacacs&#34;&gt;TACACS+&#xA;&lt;/h3&gt;&lt;p&gt;TACACS+ runs over TCP, and the flow is similar. The server matches &lt;code&gt;[[tacacs.clients]]&lt;/code&gt; by source address. A login password goes to an auth chain or a script. Command authorization is decided by the rules in &lt;code&gt;authorize_groups&lt;/code&gt; or by a script. Accounting goes to a script. The details are in chapter 12.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-configuration-file-the-data-directory-and-the-dictionary&#34;&gt;The configuration file, the data directory and the dictionary&#xA;&lt;/h2&gt;&lt;p&gt;rradius needs three things to run, and each has a different role:&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&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What it is&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Who writes it&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Where it is&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 file&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A TOML file, plus the files it pulls in with &lt;code&gt;include&lt;/code&gt;. It holds the listening ports, the clients, the auth chains, the script location and the cluster settings&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;You&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/etc/rradius/rradius.toml&lt;/code&gt; when there is no &lt;code&gt;--config&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 directory&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;data_dir&lt;/code&gt; in &lt;code&gt;[cluster]&lt;/code&gt;: the cluster database and the Raft log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The server&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/var/lib/rradius&lt;/code&gt; for the packages and Docker; &lt;code&gt;data&lt;/code&gt; next to the configuration file for the example scenarios&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Dictionary&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The top-level &lt;code&gt;dictionary&lt;/code&gt;: the table of attribute names, numbers and types&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Do not change it&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/usr/share/rradius/dictionary&lt;/code&gt; for the packages and Docker&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;A few things are easy to get wrong:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Relative paths in the configuration file are relative to the directory that holds the configuration file.&lt;/strong&gt; They are not relative to the directory you ran the command from. So &lt;code&gt;data_dir = &amp;quot;data&amp;quot;&lt;/code&gt; means the &lt;code&gt;data&lt;/code&gt; directory next to the configuration file.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A data directory can be used by only one node.&lt;/strong&gt; It is the server&amp;rsquo;s own state. Do not edit the files inside by hand, and do not let two programs use the same directory at the same time.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The dictionary decides which attribute names scripts and the configuration can use.&lt;/strong&gt; The server reads the dictionary at startup, and names such as &lt;code&gt;Filter-Id&lt;/code&gt; and &lt;code&gt;Session-Timeout&lt;/code&gt; come from it. The dictionary that ships with rradius is an unmodified copy of the dictionary files of the FreeRADIUS project v3.2.x (licensed under CC-BY 4.0; see &lt;code&gt;NOTICE&lt;/code&gt; in the dictionary directory). To add your own attributes, see chapter 06.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Besides these three, you usually also have:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A Lua script (&lt;code&gt;script&lt;/code&gt; in &lt;code&gt;[lua]&lt;/code&gt;): the configuration must have a &lt;code&gt;[lua]&lt;/code&gt; section, and the script file must exist.&lt;/li&gt;&#xA;&lt;li&gt;A migration directory (&lt;code&gt;cluster.migrations_dir&lt;/code&gt;): SQL files that create the tables.&lt;/li&gt;&#xA;&lt;li&gt;Secret files: the shared secrets and the cluster secrets go in separate files, which you point to with &lt;code&gt;secret_file&lt;/code&gt;, &lt;code&gt;secret_raft_file&lt;/code&gt; and &lt;code&gt;secret_api_file&lt;/code&gt;. Set their permissions to 0600 or 0640 (chapter 04).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;command-overview&#34;&gt;Command overview&#xA;&lt;/h2&gt;&lt;p&gt;Run &lt;code&gt;rradiusd&lt;/code&gt; with no arguments, or run &lt;code&gt;rradiusd help&lt;/code&gt;, to print all the commands:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd help&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd serve [--config &amp;lt;path&amp;gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd check [--config &amp;lt;path&amp;gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd status [--config &amp;lt;path&amp;gt;] [--watch] [--json] [--cluster]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd --version&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd schema [--lang en|zh-TW]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd config show [--config &amp;lt;path&amp;gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd config diff &amp;lt;a.toml&amp;gt; &amp;lt;b.toml&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd config init [--full] [--lang en|zh-TW]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd tuning [--config &amp;lt;path&amp;gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd user add|passwd|enable|disable|delete|show [--config &amp;lt;path&amp;gt;] &amp;lt;name&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  add and passwd read the password from standard input&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd session list [--config &amp;lt;path&amp;gt;] [--json]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd session show [--config &amp;lt;path&amp;gt;] [--json] &amp;lt;name&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd query list [--config &amp;lt;path&amp;gt;] [--json]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd query &amp;lt;name&amp;gt; [--config &amp;lt;path&amp;gt;] [--json]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd cluster members|remove [--config &amp;lt;path&amp;gt;] [--force] [&amp;lt;node_id&amp;gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  remove takes a node id, and --force to leave one or two voters&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;without --config, the configuration is /etc/rradius/rradius.toml&#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;Command&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What it does&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Described in&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;serve&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Starts the server&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Chapter 03&lt;/td&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;check&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Checks the configuration file without starting any service&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Chapter 04&lt;/td&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;config show&lt;/code&gt;/&lt;code&gt;diff&lt;/code&gt;/&lt;code&gt;init&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Prints the full configuration with defaults, compares two configurations, produces a starting file&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Chapter 04&lt;/td&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;schema&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Prints the JSON Schema of the configuration file, with a description and default for every key&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Chapter 04&lt;/td&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;status&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reads the metrics port and summarizes it as a one-page status&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Chapter 17&lt;/td&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;tuning&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Gives performance tuning advice based on this machine&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Chapter 19&lt;/td&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;user&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Adds, changes the password of, disables, enables, deletes and shows accounts&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Chapter 07&lt;/td&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&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Lists the sessions that are online&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;query&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Runs a named query from the configuration&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Chapter 09&lt;/td&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;Shows and removes cluster members&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Chapter 16&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;There is also a separate load-testing program, &lt;code&gt;rradius-bench&lt;/code&gt;, which can send RADIUS and TACACS+ requests. This manual uses it as the login test tool in chapter 03 and for load testing in chapter 19.&lt;/p&gt;&#xA;&lt;h2 id=&#34;testing-with-external-tools&#34;&gt;Testing with external tools&#xA;&lt;/h2&gt;&lt;p&gt;All the login tests in this manual use &lt;code&gt;rradius-bench&lt;/code&gt; (chapter 03). If you want to use other client tools:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;RADIUS:&lt;/strong&gt; &lt;code&gt;radtest&lt;/code&gt; and &lt;code&gt;radclient&lt;/code&gt; from FreeRADIUS (in the &lt;code&gt;freeradius-utils&lt;/code&gt; package on Debian and Ubuntu; on macOS you can use &lt;code&gt;freeradius-server&lt;/code&gt; from Homebrew).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;802.1X:&lt;/strong&gt; &lt;code&gt;eapol_test&lt;/code&gt; from wpa_supplicant (chapter 11).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TACACS+:&lt;/strong&gt; &lt;code&gt;tacacs_client&lt;/code&gt; from the Python package &lt;code&gt;tacacs_plus&lt;/code&gt; (chapter 12).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;By default rradius drops Access-Requests that have no Message-Authenticator (&lt;code&gt;require_message_authenticator&lt;/code&gt;, chapter 05). A client tool that does not send one gets a timeout, and the server log says &lt;code&gt;discarded … Access-Requests lacking a Message-Authenticator&lt;/code&gt;. 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, and it 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-console&#34; data-lang=&#34;console&#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; &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 &amp;#34;$(cat localhost.secret)&amp;#34;&#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-console&#34; data-lang=&#34;console&#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; &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 localhost.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;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; &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 localhost.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;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; &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 &amp;#34;$(cat localhost.secret)&amp;#34;&#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 &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 localhost.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;The last line is a Status-Server request. &lt;code&gt;radius.status_server&lt;/code&gt; is on by default (chapter 05).&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; The external tool commands in this section were not run again for this version. The previous version of the manual tested them with &lt;code&gt;radclient&lt;/code&gt; from FreeRADIUS 3.2.10 (older versions may not add the Message-Authenticator automatically). The fact that &lt;code&gt;Message-Authenticator&lt;/code&gt; is required by default was checked against the code and the measurements in chapters 05 and 21.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;core-and-enterprise-editions&#34;&gt;Core and enterprise editions&#xA;&lt;/h2&gt;&lt;p&gt;rradius comes as two programs:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;rradiusd&lt;/code&gt; (the core edition):&lt;/strong&gt; the subject of this manual. The source code is public and the license is BSD-2-Clause.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;rradius-enterprise&lt;/code&gt; (the enterprise edition):&lt;/strong&gt; it includes everything in the core edition and adds some enterprise features. It has its own manual.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Both programs read the same configuration file format. When the core edition meets a setting or command that exists only in the enterprise edition, it &lt;strong&gt;does not ignore it silently&lt;/strong&gt;. It refuses it, explains why, and exits with code 2:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: proxy: not supported by this program (proxying needs rradius-enterprise)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd dpsk show alice&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dpsk: not supported by this program (DPSK needs rradius-enterprise)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The table below lists the items that the core edition refuses and that exist only in the enterprise edition. It is based on three lookup tables in the code:&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;Enterprise feature&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Setting&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Command&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;RadSec (RADIUS over TLS)&lt;/td&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;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Dynamic clients&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;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;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;Second factor (TOTP/HOTP)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[mfa]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;otp&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-AKA&amp;rsquo;, EAP-SIM&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius.eap.aka]&lt;/code&gt;, &lt;code&gt;[accounts.aka]&lt;/code&gt;, EAP method &lt;code&gt;aka-prime&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;aka&lt;/code&gt;, &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;Diameter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[diameter]&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;DPSK (one Wi-Fi password per person)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius.dpsk]&lt;/code&gt;, &lt;code&gt;[accounts.dpsk]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;dpsk&lt;/code&gt;, &lt;code&gt;dpsk-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;TACACS+ over TLS&lt;/td&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;—&lt;/td&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 export&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[accounting_export]&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;Proxying by realm&lt;/td&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;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;CoA and Disconnect&lt;/td&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;&lt;code&gt;coa&lt;/code&gt;, &lt;code&gt;disconnect&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;Cluster backup&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[cluster.backup]&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;Besides the table, &lt;code&gt;[radius.eap]&lt;/code&gt; and &lt;code&gt;[[radius.clients]]&lt;/code&gt; also have a few keys that only the enterprise edition can use, for example OCSP revocation checking and session resumption in EAP. The core edition refuses most of these too, with a message that also ends in &lt;code&gt;needs rradius-enterprise&lt;/code&gt;. A few are accepted but have no effect in the core edition. These keys are listed in &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt; and marked &amp;ldquo;not supported in core&amp;rdquo;. The main text of this manual does not describe them.&lt;/p&gt;&#xA;&lt;p&gt;The rule of thumb is simple: check your configuration with &lt;code&gt;rradiusd check&lt;/code&gt;. If it passes, the core edition can run it. If you see &lt;code&gt;needs rradius-enterprise&lt;/code&gt;, that item needs the enterprise edition.&lt;/p&gt;&#xA;&lt;h2 id=&#34;how-to-read-this-manual&#34;&gt;How to read this manual&#xA;&lt;/h2&gt;&lt;p&gt;Pick what you need for the job:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;First contact:&lt;/strong&gt; read chapters 01 to 03 in order, until the server gives you your first Access-Accept. Then read chapters 04 and 05 to learn to write the configuration file and add a NAS.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Connecting an account source:&lt;/strong&gt; chapter 07 (the built-in tables and auth chains), chapter 08 (LDAP, AD), chapter 09 (external databases), chapter 10 (Lua scripts).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Setting up 802.1X:&lt;/strong&gt; chapter 11.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Controlling logins to network devices:&lt;/strong&gt; chapter 12.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Recording accounting and seeing who is online:&lt;/strong&gt; chapter 13.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Following a ready-made scenario:&lt;/strong&gt; chapter 14 (broadband and ISP) and chapter 15 (organization network access). Each scenario matches one directory under &lt;code&gt;rradius-server/examples/scenarios/&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Going to production:&lt;/strong&gt; chapter 16 (clusters), chapter 17 (monitoring), chapter 18 (day-to-day operations), chapter 19 (performance), chapter 20 (security).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When something goes wrong:&lt;/strong&gt; chapter 21 (troubleshooting).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Looking up key names, commands, metrics and Lua functions:&lt;/strong&gt; appendices A to E.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The formats used in the book:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The first line of a configuration example says which file it belongs in, for example &lt;code&gt;# rradius.toml&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Commands start with &lt;code&gt;$ &lt;/code&gt;, and the actual output follows. Where long output is cut, the cut is marked with &lt;code&gt;…&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;&amp;gt; **Note:** &lt;/code&gt; marks things that are easy to get wrong. &lt;code&gt;&amp;gt; **Warning:** &lt;/code&gt; marks things that affect security or can interrupt service. &lt;code&gt;&amp;gt; **Not verified on real hardware:** &lt;/code&gt; means the passage was only checked against the code and the tests, and was not run on real devices or services.&lt;/li&gt;&#xA;&lt;li&gt;Shared secrets and cluster secrets always go in files, generated with &lt;code&gt;openssl rand -hex 32&lt;/code&gt;. The examples do not contain plain-text secrets.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;…: not supported by this program (… needs rradius-enterprise)&lt;/code&gt; and exits with code 2.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The configuration file or &lt;code&gt;conf.d/&lt;/code&gt; uses a setting that exists only in the enterprise edition, or you ran a command that exists only in the enterprise edition.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Remove that section, or switch to &lt;code&gt;rradius-enterprise&lt;/code&gt;. Use the table above to find out which item it is.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; After you set &lt;code&gt;[auth]&lt;/code&gt;, the authentication rules in your Lua script have no effect.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; With &lt;code&gt;[auth]&lt;/code&gt;, RADIUS password authentication goes only through the auth chain. The top-level script handles only accounting (and TACACS+ authorization and accounting).&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Rewrite the rules as a lua handler in the auth chain (chapter 07), or remove &lt;code&gt;[auth]&lt;/code&gt; and leave everything to the script (chapter 10).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; Every PEAP or EAP-TTLS login is rejected, and the log says &lt;code&gt;this client has no chain to check a password with&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The password inside the tunnel can be checked only by an auth chain, and this client has no auth chain.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Set &lt;code&gt;[auth]&lt;/code&gt; (chapter 07, chapter 11).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The NAS says the RADIUS server does not answer, but the server log has no authentication record.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The request was dropped while matching the client or checking the packet, for example because the source address is not in &lt;code&gt;[[radius.clients]]&lt;/code&gt;, or the shared secrets do not match.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Look in the log for &lt;code&gt;from unknown client&lt;/code&gt;, and look at the &lt;code&gt;Discarded: unknown client&lt;/code&gt; and &lt;code&gt;Discarded: invalid&lt;/code&gt; counters in &lt;code&gt;status&lt;/code&gt; (chapter 21).&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../02-install/&#34; &gt;02 Installation&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04 Configuration file basics&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05 RADIUS service and NAS clients&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;10 Writing policies in Lua&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16 Clusters and high availability&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../94-glossary/&#34; &gt;Appendix E: Glossary and RFC cross-reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>02 Installation</title>
            <link>https://embark.systems/en/rradius/oss/02-install/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/02-install/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Pick an installation method for your environment: source, deb, rpm, FreeBSD port, release tarball, Docker, Docker Compose or Synology&lt;/li&gt;&#xA;&lt;li&gt;Know where the program, dictionary, configuration, data and logs are after installation&lt;/li&gt;&#xA;&lt;li&gt;Write a first configuration file that passes &lt;code&gt;check&lt;/code&gt;, and start the service&lt;/li&gt;&#xA;&lt;li&gt;Use &lt;code&gt;--version&lt;/code&gt; to confirm the version and the default configuration file path&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: you have read &lt;a class=&#34;link&#34; href=&#34;../01-overview/&#34; &gt;chapter 01&lt;/a&gt; and know the roles of the configuration file, the data directory and the dictionary.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#choosing-an-installation-method&#34; &gt;Choosing an installation method&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#where-files-are-after-installation&#34; &gt;Where files are after installation&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#building-from-source&#34; &gt;Building from source&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#deb-package-debian-ubuntu&#34; &gt;deb package (Debian, Ubuntu)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#rpm-package-rhel-family&#34; &gt;rpm package (RHEL family)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#freebsd-port&#34; &gt;FreeBSD port&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#release-tarball&#34; &gt;Release tarball&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#docker-image&#34; &gt;Docker image&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#docker-compose&#34; &gt;Docker Compose&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#synology-nas&#34; &gt;Synology NAS&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#first-start-after-a-package-install&#34; &gt;First start after a package install&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#checking-the-version-and-default-configuration-path&#34; &gt;Checking the version and default configuration path&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#upgrading-and-removing&#34; &gt;Upgrading and removing&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;choosing-an-installation-method&#34;&gt;Choosing an installation method&#xA;&lt;/h2&gt;&lt;p&gt;The repository provides build scripts and definition files for each installation method. In this manual, every method assumes you &lt;strong&gt;build from source yourself&lt;/strong&gt; and then install the result on your machine:&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;Method&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Good for&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Build script or definition file&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Verification status in this manual&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;Source&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Development, testing, following the exercises in this manual&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;cargo&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Verified&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;deb&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Debian 12 and 13, Ubuntu 22.04 and later&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;packages/deb/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Not verified on real hardware&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;rpm&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RHEL family (for example Rocky, AlmaLinux)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;packages/rpm/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Not verified on real hardware&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;FreeBSD port&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;FreeBSD&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;packages/freebsd/net/rradius/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;rc.d script verified on real hardware, build not verified&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Release tarball&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;You do not want a package manager, or you want to try it on macOS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;packages/tarball/release.sh&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Not verified on real hardware&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Docker&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Container environments&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Dockerfile&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Verified&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Docker Compose&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Single-host container deployment&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;compose.yaml&lt;/code&gt;, &lt;code&gt;docker/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Verified&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Synology&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Container Manager on a Synology NAS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;deploy/synology/compose.yaml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Not verified on real hardware&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The cluster Compose file (&lt;code&gt;compose.cluster.yaml&lt;/code&gt;) and the Kubernetes manifests (&lt;code&gt;deploy/kubernetes/&lt;/code&gt;) are described in &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;chapter 16&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;All paths in this chapter are relative to the root of the rradius source repository.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The load-testing program &lt;code&gt;rradius-bench&lt;/code&gt; is not in any package, tarball or Docker image. Chapter 03 uses it to test logins and chapter 19 uses it for load tests. To use it, build it as described in &lt;a class=&#34;link&#34; href=&#34;#building-from-source&#34; &gt;Building from source&lt;/a&gt; and put it on a machine that can reach the server.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;where-files-are-after-installation&#34;&gt;Where files are after installation&#xA;&lt;/h2&gt;&lt;p&gt;The locations for each installation method are summarized below. The sources are &lt;code&gt;packages/deb/debian/rules&lt;/code&gt;, &lt;code&gt;packages/rpm/rradius.spec&lt;/code&gt;, &lt;code&gt;packages/freebsd/net/rradius/&lt;/code&gt; and &lt;code&gt;Dockerfile&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;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;deb, rpm&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;FreeBSD port&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Docker image&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;Executable&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/usr/bin/rradiusd&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/usr/local/bin/rradiusd&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/usr/local/bin/rradiusd&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;Dictionary&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/usr/share/rradius/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/usr/local/share/rradius/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/usr/share/rradius/&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;Configuration&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/etc/rradius/&lt;/code&gt; (&lt;code&gt;conf.d/&lt;/code&gt; is empty)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/usr/local/etc/rradius/&lt;/code&gt; (&lt;code&gt;conf.d/&lt;/code&gt; is empty)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/etc/rradius/&lt;/code&gt;, you mount it in yourself&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Default configuration file&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/etc/rradius/rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/usr/local/etc/rradius/rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/etc/rradius/rradius.toml&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&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/var/lib/rradius&lt;/code&gt; (0750)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/var/db/rradius&lt;/code&gt; (0750)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/var/lib/rradius&lt;/code&gt; (VOLUME)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Log directory&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/var/log/rradius&lt;/code&gt; (0750)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/var/log/rradius&lt;/code&gt; (0750)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;None, logs go to standard 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;Documents and examples&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/usr/share/doc/rradius/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/usr/local/share/doc/rradius/&lt;/code&gt; (DOCS option)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;Service&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;systemd &lt;code&gt;rradius.service&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rc.d&lt;/code&gt; &lt;code&gt;rradius&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The image &lt;code&gt;CMD&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;Runs as&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;System user &lt;code&gt;rradius&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;User &lt;code&gt;rradius&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;User &lt;code&gt;rradius&lt;/code&gt; (uid 10001)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Notes:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The default configuration file path is fixed at build time.&lt;/strong&gt; If the environment variable &lt;code&gt;RRADIUS_PREFIX=&amp;lt;prefix&amp;gt;&lt;/code&gt; is set when you build, the default path is &lt;code&gt;&amp;lt;prefix&amp;gt;/etc/rradius/rradius.toml&lt;/code&gt;. If it is unset, empty or &lt;code&gt;/&lt;/code&gt;, the path is &lt;code&gt;/etc/rradius/rradius.toml&lt;/code&gt;. Environment variables at run time cannot change it. When the configuration file has no &lt;code&gt;dictionary&lt;/code&gt;, the dictionary it reads follows the same prefix: &lt;code&gt;&amp;lt;prefix&amp;gt;/share/rradius/dictionary&lt;/code&gt;, or &lt;code&gt;/usr/share/rradius/dictionary&lt;/code&gt; when the prefix is unset. The FreeBSD port builds with &lt;code&gt;RRADIUS_PREFIX=/usr/local&lt;/code&gt;; the other methods do not set it. &lt;code&gt;--version&lt;/code&gt; shows the actual values (see &lt;a class=&#34;link&#34; href=&#34;#checking-the-version-and-default-configuration-path&#34; &gt;Checking the version&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Packages do not create a configuration file and do not enable the service.&lt;/strong&gt; After installation you generate the configuration file, check it and then enable the service. The steps are in &lt;a class=&#34;link&#34; href=&#34;#first-start-after-a-package-install&#34; &gt;First start after a package install&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Logs go to standard error.&lt;/strong&gt; Under systemd the journal collects them. &lt;code&gt;/var/log/rradius&lt;/code&gt; is for the accounting log file (&lt;code&gt;[radius.accounting_log]&lt;/code&gt;, chapter 13).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;building-from-source&#34;&gt;Building from source&#xA;&lt;/h2&gt;&lt;p&gt;Whichever method you end up using, it is worth doing this section once: the exercises in this manual use programs built from source.&lt;/p&gt;&#xA;&lt;h3 id=&#34;required-tools&#34;&gt;Required tools&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;The Rust toolchain (&lt;code&gt;cargo&lt;/code&gt;). The required version is newer than what Linux distributions ship, so install it with rustup. For the exact version, see the version used by &lt;code&gt;FROM rust:…&lt;/code&gt; on the first line of &lt;code&gt;Dockerfile&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;cmake, a C++ compiler (g++ or clang) and make.&lt;/li&gt;&#xA;&lt;li&gt;git.&lt;/li&gt;&#xA;&lt;li&gt;The build downloads dependencies from crates.io, so you need network access.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;build&#34;&gt;Build&#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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ git clone https://github.com/embark-systems/rradius.git&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cd rradius&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cargo build --locked --release -p rradius-server -p rradius-bench&#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;    Finished `release` profile [optimized] target(s) in …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The output is in:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;target/release/rradiusd&lt;/code&gt;: the server and the management commands&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;target/release/rradius-bench&lt;/code&gt;: the load-testing and login-testing tool&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Notes:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Always add &lt;code&gt;--locked&lt;/code&gt;.&lt;/strong&gt; It makes cargo build with the versions recorded in the repository&amp;rsquo;s &lt;code&gt;Cargo.lock&lt;/code&gt; and not upgrade dependencies on its own.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;.cargo/config.toml&lt;/code&gt; in the repository sets &lt;code&gt;LIBSQLITE3_FLAGS=-DSQLITE_ENABLE_QPSG&lt;/code&gt;, a compile option the built-in SQLite needs. You do not need to set it when you build inside the repository.&lt;/li&gt;&#xA;&lt;li&gt;On arm64 Linux, the &lt;code&gt;Dockerfile&lt;/code&gt;, deb, rpm and the FreeBSD port also set &lt;code&gt;JEMALLOC_SYS_WITH_LG_PAGE=16&lt;/code&gt;, so the program runs on kernels with 4, 16 and 64 KiB pages. If you build on arm64 Linux yourself and move the program to another machine, set it too.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;After the build, check that the program runs:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ ./target/release/rradiusd --version&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd 0.1.0 (community)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;default config: /etc/rradius/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The text in parentheses on the first line of &lt;code&gt;--version&lt;/code&gt; is the edition: &lt;code&gt;(community)&lt;/code&gt; for the core edition and &lt;code&gt;(enterprise)&lt;/code&gt; for the enterprise edition. Both editions&amp;rsquo; executables are named &lt;code&gt;rradiusd&lt;/code&gt; and share the same configuration, data directory, service and user, so install only one of them on a machine. To keep both side by side for comparison, put them in different directories and run them by full path.&lt;/p&gt;&#xA;&lt;p&gt;To try it with the example scenarios right away, continue with &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;chapter 03&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To use the program you built from source as a production service, copy &lt;code&gt;target/release/rradiusd&lt;/code&gt; to &lt;code&gt;/usr/local/bin&lt;/code&gt;, copy the dictionary directory &lt;code&gt;share/&lt;/code&gt; to a fixed location (for example &lt;code&gt;/usr/share/rradius&lt;/code&gt;), and write your own service file. &lt;code&gt;packages/common/rradius.service&lt;/code&gt; is a ready-made systemd unit you can use as a reference. An easier way, though, is to build a deb or an rpm.&lt;/p&gt;&#xA;&lt;h2 id=&#34;deb-package-debian-ubuntu&#34;&gt;deb package (Debian, Ubuntu)&#xA;&lt;/h2&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; This section was checked against the build scripts in &lt;code&gt;packages/deb/&lt;/code&gt; and the contents of the &lt;code&gt;debian/&lt;/code&gt; directory. The package was not rebuilt or installed while this manual was written.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;build-1&#34;&gt;Build&#xA;&lt;/h3&gt;&lt;p&gt;There are two ways to build. Both build from &lt;strong&gt;committed&lt;/strong&gt; source (using &lt;code&gt;git archive&lt;/code&gt;), so uncommitted changes do not go into the package.&lt;/p&gt;&#xA;&lt;p&gt;To build in a container, you only need docker on the machine:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ packages/deb/docker-build.sh --platform linux/amd64 --out dist&#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;--platform&lt;/code&gt; can be &lt;code&gt;linux/amd64&lt;/code&gt; or &lt;code&gt;linux/arm64&lt;/code&gt;. When it is not the local architecture, the build runs under emulation, which is slower but gives the same result.&lt;/li&gt;&#xA;&lt;li&gt;The container is Debian 12. The package depends on the build environment&amp;rsquo;s glibc; a package built on Debian 12 also installs on newer distributions.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;--commit &amp;lt;rev&amp;gt;&lt;/code&gt; selects which commit to build. The default is &lt;code&gt;HEAD&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;To build directly on the local machine, you need the Rust toolchain, cmake, g++, make, debhelper and dpkg-dev:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ packages/deb/build.sh --out dist&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The output is &lt;code&gt;dist/rradius_&amp;lt;version&amp;gt;_&amp;lt;architecture&amp;gt;.deb&lt;/code&gt;, where the architecture is amd64 or arm64.&lt;/p&gt;&#xA;&lt;h3 id=&#34;install&#34;&gt;Install&#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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ sudo apt install ./dist/rradius_0.1.0_amd64.deb&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;What the package does:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Installs &lt;code&gt;/usr/bin/rradiusd&lt;/code&gt;, the dictionary in &lt;code&gt;/usr/share/rradius/&lt;/code&gt;, and documents and examples in &lt;code&gt;/usr/share/doc/rradius/&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Creates the system user and group &lt;code&gt;rradius&lt;/code&gt;, and creates &lt;code&gt;/var/lib/rradius&lt;/code&gt; and &lt;code&gt;/var/log/rradius&lt;/code&gt;, owned by &lt;code&gt;rradius&lt;/code&gt; with mode 0750.&lt;/li&gt;&#xA;&lt;li&gt;Creates an empty &lt;code&gt;/etc/rradius/&lt;/code&gt; and &lt;code&gt;/etc/rradius/conf.d/&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Installs the systemd unit &lt;code&gt;rradius.service&lt;/code&gt; and the logrotate configuration &lt;code&gt;/etc/logrotate.d/rradius&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Does not enable or start the service.&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Next, follow &lt;a class=&#34;link&#34; href=&#34;#first-start-after-a-package-install&#34; &gt;First start after a package install&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;rpm-package-rhel-family&#34;&gt;rpm package (RHEL family)&#xA;&lt;/h2&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; This section was checked against &lt;code&gt;packages/rpm/rradius.spec&lt;/code&gt; and &lt;code&gt;packages/rpm/build.sh&lt;/code&gt;. The package was not rebuilt or installed while this manual was written.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;build-2&#34;&gt;Build&#xA;&lt;/h3&gt;&lt;p&gt;You need the Rust toolchain, cmake, gcc-c++, make, rpm-build and systemd-rpm-macros:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ packages/rpm/build.sh --out dist&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The output is &lt;code&gt;dist/rradius-&amp;lt;version&amp;gt;-1.&amp;lt;dist&amp;gt;.&amp;lt;architecture&amp;gt;.rpm&lt;/code&gt;, where the architecture is x86_64 or aarch64. The package depends on the build host&amp;rsquo;s glibc, so build it on the distribution (or in a container of the distribution) you want to install it on.&lt;/p&gt;&#xA;&lt;h3 id=&#34;install-1&#34;&gt;Install&#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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ sudo dnf install ./dist/rradius-0.1.0-1.el9.x86_64.rpm&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The installed files are the same as for deb: &lt;code&gt;/usr/bin/rradiusd&lt;/code&gt;, &lt;code&gt;/usr/share/rradius/&lt;/code&gt;, &lt;code&gt;/usr/share/doc/rradius/&lt;/code&gt;, &lt;code&gt;/etc/rradius/&lt;/code&gt; (with an empty &lt;code&gt;conf.d/&lt;/code&gt;), &lt;code&gt;/var/lib/rradius&lt;/code&gt; and &lt;code&gt;/var/log/rradius&lt;/code&gt; (0750, owned by &lt;code&gt;rradius&lt;/code&gt;), the systemd unit and the logrotate configuration.&lt;/p&gt;&#xA;&lt;p&gt;Whether the service is enabled automatically depends on the distribution&amp;rsquo;s systemd preset (the spec uses &lt;code&gt;%systemd_post&lt;/code&gt;). RHEL-family distributions usually do not enable it. Either way, the service does not start when the configuration file does not exist; the reason is in the next section.&lt;/p&gt;&#xA;&lt;p&gt;Next, follow &lt;a class=&#34;link&#34; href=&#34;#first-start-after-a-package-install&#34; &gt;First start after a package install&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;freebsd-port&#34;&gt;FreeBSD port&#xA;&lt;/h2&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Partly verified on real hardware:&lt;/strong&gt; This section was checked against the Makefile, &lt;code&gt;pkg-plist&lt;/code&gt; and rc.d script in &lt;code&gt;packages/freebsd/net/rradius/&lt;/code&gt;. The rc.d script was started as the &lt;code&gt;rradius&lt;/code&gt; user on FreeBSD 15.2-STABLE and ran stably. The port build and &lt;code&gt;pkg&lt;/code&gt; installation were not tested.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;build-3&#34;&gt;Build&#xA;&lt;/h3&gt;&lt;ol&gt;&#xA;&lt;li&gt;Copy &lt;code&gt;packages/freebsd/net/rradius&lt;/code&gt; to &lt;code&gt;net/rradius&lt;/code&gt; in the ports tree.&lt;/li&gt;&#xA;&lt;li&gt;Add &lt;code&gt;rradius&lt;/code&gt; to &lt;code&gt;UIDs&lt;/code&gt; and &lt;code&gt;GIDs&lt;/code&gt; in the ports tree. The port uses &lt;code&gt;USERS&lt;/code&gt; and &lt;code&gt;GROUPS&lt;/code&gt; to create this user.&lt;/li&gt;&#xA;&lt;li&gt;In the port directory, run &lt;code&gt;make makesum&lt;/code&gt; to generate &lt;code&gt;distinfo&lt;/code&gt;, then &lt;code&gt;make package&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The port fetches the source for the tag &lt;code&gt;v&amp;lt;version&amp;gt;&lt;/code&gt; from GitHub, so that version must already be tagged.&lt;/p&gt;&#xA;&lt;h3 id=&#34;after-installation&#34;&gt;After installation&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;The executable is &lt;code&gt;/usr/local/bin/rradiusd&lt;/code&gt; and the dictionary is &lt;code&gt;/usr/local/share/rradius/&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The data directory is &lt;code&gt;/var/db/rradius&lt;/code&gt; and the log directory is &lt;code&gt;/var/log/rradius&lt;/code&gt;, owned by &lt;code&gt;rradius&lt;/code&gt;, 0750.&lt;/li&gt;&#xA;&lt;li&gt;An empty &lt;code&gt;/usr/local/etc/rradius/&lt;/code&gt; and &lt;code&gt;conf.d/&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The default configuration file is &lt;code&gt;/usr/local/etc/rradius/rradius.toml&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;With the DOCS option on, documents and examples are in &lt;code&gt;/usr/local/share/doc/rradius/&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;rcd-service&#34;&gt;rc.d service&#xA;&lt;/h3&gt;&lt;p&gt;The rc.d script &lt;code&gt;rradius&lt;/code&gt; reads these &lt;code&gt;rc.conf&lt;/code&gt; variables:&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;Variable&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&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;&lt;code&gt;rradius_enable&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;NO&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Set to &lt;code&gt;YES&lt;/code&gt; to start the service&lt;/td&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_config&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/usr/local/etc/rradius/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;rradius_user&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;User to run as&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The service runs through &lt;code&gt;daemon(8)&lt;/code&gt;. When the program exits, it restarts automatically after 2 seconds, and output goes to syslog (tag &lt;code&gt;rradius&lt;/code&gt;). When &lt;code&gt;rradius_user&lt;/code&gt; is set, rc.subr already runs the whole command as that user with &lt;code&gt;su -m&lt;/code&gt;, so the script does not add &lt;code&gt;-u&lt;/code&gt; to &lt;code&gt;daemon&lt;/code&gt; (a non-root &lt;code&gt;daemon -u&lt;/code&gt; fails at initgroups). The PID file is in &lt;code&gt;/var/run/rradius/&lt;/code&gt;, which the script creates at start, owned by &lt;code&gt;rradius_user&lt;/code&gt;. &lt;code&gt;service rradius reload&lt;/code&gt; sends SIGHUP to the program, which reloads the configuration (chapter 04).&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# sysrc rradius_enable&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;YES&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# service rradius start&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The port&amp;rsquo;s program runs as the &lt;code&gt;rradius&lt;/code&gt; user and cannot bind ports below 1024. To serve TACACS+ on its standard port 49, use &lt;code&gt;mac_portacl(4)&lt;/code&gt;, set &lt;code&gt;net.inet.ip.portrange.reservedhigh&lt;/code&gt; to 0, or use a port above 1024. RADIUS ports 1812 and 1813 are not affected.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;You can have newsyslog rotate the accounting log file. The template is &lt;code&gt;/usr/local/etc/newsyslog.conf.d/rradius.conf.sample&lt;/code&gt;; it takes effect once you remove &lt;code&gt;.sample&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;release-tarball&#34;&gt;Release tarball&#xA;&lt;/h2&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; This section was checked against &lt;code&gt;packages/tarball/release.sh&lt;/code&gt;. A tarball was not generated or unpacked while this manual was written.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Generate the tarball with &lt;code&gt;packages/tarball/release.sh&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ packages/tarball/release.sh --target linux-x86_64 --out dist&#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;--target&lt;/code&gt; can be &lt;code&gt;macos-aarch64&lt;/code&gt;, &lt;code&gt;linux-x86_64&lt;/code&gt; or &lt;code&gt;linux-aarch64&lt;/code&gt;, and you can repeat it to give several. If you do not give it, the script builds for the local platform.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;macos-aarch64&lt;/code&gt; can only be built on an arm64 Mac. The Linux builds are made in Docker using the build stage of the &lt;code&gt;Dockerfile&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The script needs specific versions of &lt;code&gt;cargo-about&lt;/code&gt; and &lt;code&gt;cargo-deny&lt;/code&gt;, which it uses to check and list the licenses of dependencies. When the versions do not match, the script prints the install commands to run.&lt;/li&gt;&#xA;&lt;li&gt;Before it builds anything, the script checks with &lt;code&gt;gh&lt;/code&gt; that the Release workflow (&lt;code&gt;release.yml&lt;/code&gt;, which runs every other workflow for one commit) has passed for the commit. Start it with &lt;code&gt;gh workflow run release.yml --ref &amp;lt;ref&amp;gt;&lt;/code&gt;. For a build that is not a release, such as one from a fork, add &lt;code&gt;--no-ci-check&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The output is &lt;code&gt;dist/rradius-&amp;lt;version&amp;gt;-&amp;lt;platform&amp;gt;.tar.gz&lt;/code&gt; and the matching &lt;code&gt;.sha256&lt;/code&gt;. Before packaging finishes, the script unpacks the tarball and checks the example scenarios with the program inside; if a check fails, no output is produced.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The directory layout in the tarball is the same as in the source repository, so the relative paths in the example configurations still work:&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;Path&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;bin/rradiusd&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The server and the management 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;share/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The dictionary, plus the dictionary&amp;rsquo;s &lt;code&gt;LICENSE&lt;/code&gt; and &lt;code&gt;NOTICE&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-server/examples/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Example configurations, scripts and scenarios&lt;/td&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;docs/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Documentation&lt;/td&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;LICENSE&lt;/code&gt;, &lt;code&gt;THIRD-PARTY-LICENSES.md&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Licenses of rradius and its dependencies&lt;/td&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;VERSION&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The version and the commit used for the build; the Linux build has an extra line &lt;code&gt;glibc &amp;lt;version&amp;gt;&lt;/code&gt;, the minimum glibc it needs&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The tarball has no service file and does not create users or directories. If you use it as a production service, prepare all of these yourself.&lt;/p&gt;&#xA;&lt;h2 id=&#34;docker-image&#34;&gt;Docker image&#xA;&lt;/h2&gt;&lt;p&gt;The &lt;code&gt;Dockerfile&lt;/code&gt; in the repository root has two stages: it builds with &lt;code&gt;cargo build --release --locked -p rradius-server&lt;/code&gt; in a Rust image, then puts the program and the dictionary into a Debian slim image.&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ docker build -t rradius-server .&#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;$ docker run --rm rradius-server --version&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd 0.1.0 (community)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;default config: /etc/rradius/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;What is in the image:&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;Executable&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/usr/local/bin/rradiusd&lt;/code&gt;, which is the &lt;code&gt;ENTRYPOINT&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;Default command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;CMD [&amp;quot;serve&amp;quot;, &amp;quot;--config&amp;quot;, &amp;quot;/etc/rradius/rradius.toml&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;Dictionary&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/usr/share/rradius/&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;Runs as&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius&lt;/code&gt; (uid 10001), not root&lt;/td&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&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;VOLUME /var/lib/rradius&lt;/code&gt;, owned by &lt;code&gt;rradius&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;EXPOSE&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1812/udp&lt;/code&gt;, &lt;code&gt;1813/udp&lt;/code&gt;, &lt;code&gt;49/tcp&lt;/code&gt;, &lt;code&gt;8100/tcp&lt;/code&gt;, &lt;code&gt;8200/tcp&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;Other&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;ca-certificates&lt;/code&gt; is installed; LDAP over TLS uses the system CA certificates&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Because the &lt;code&gt;ENTRYPOINT&lt;/code&gt; is &lt;code&gt;rradiusd&lt;/code&gt;, whatever follows &lt;code&gt;docker run&lt;/code&gt; is a subcommand, for example &lt;code&gt;docker run --rm rradius-server --version&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The image has no configuration file. You must mount &lt;code&gt;/etc/rradius/rradius.toml&lt;/code&gt; from outside. The easiest way is to use Compose, described in the next section.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; EXPOSE lists the cluster ports 8100 and 8200, but without &lt;code&gt;[[cluster.nodes]]&lt;/code&gt; and without &lt;code&gt;cluster.listen&lt;/code&gt;, these two ports bind only to &lt;code&gt;127.0.0.1&lt;/code&gt; and cannot be reached from outside the container. A single node does not need these ports open to the outside.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;docker-compose&#34;&gt;Docker Compose&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;compose.yaml&lt;/code&gt; runs one node. The configuration is in &lt;code&gt;docker/config/&lt;/code&gt;, and the secret files are generated by &lt;code&gt;docker/init-secrets.sh&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;steps&#34;&gt;Steps&#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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ sh docker/init-secrets.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;created docker/secrets/raft.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;created docker/secrets/api.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;created docker/secrets/radius.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ docker compose up --build -d&#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; Container …-rradius-1 Started&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;init-secrets.sh&lt;/code&gt; uses &lt;code&gt;openssl rand -hex 32&lt;/code&gt; to generate three files: the cluster&amp;rsquo;s Raft password, the API password, and the shared secret for RADIUS clients. Files that already exist are not overwritten, so it is safe to run again.&lt;/p&gt;&#xA;&lt;p&gt;Check the logs to confirm the start succeeded:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ docker compose logs&#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;rradius-1  | … INFO rradius_core::cli: cluster node 1 started&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-1  | … INFO rradius_core::cli: cluster node 1 has caught up with the cluster&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-1  | … INFO rradius_core::cli: Servers started. Press Ctrl+C to stop.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-1  | … INFO rradius_core::radius: RADIUS Server listening on 0.0.0.0:1812 and 0.0.0.0:1813&#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;rradius-1  | … INFO rradius_core::metrics: Metrics listening on 127.0.0.1:9812&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Check the status inside the container:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ docker compose exec rradius rradiusd status --config /etc/rradius/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::common::seal: cluster.secret_raft_file: &amp;#39;/run/secrets/raft&amp;#39; has mode 644, which others can reach or its group can write; make it 0600 or 0640&#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;rradius status of 127.0.0.1:9812 over 1.0 s&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Node&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Ready                     ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Leader                    1&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The &lt;code&gt;has mode 644&lt;/code&gt; warning here is expected. &lt;code&gt;init-secrets.sh&lt;/code&gt; deliberately makes the secret files readable by everyone, because users inside the container are not users on the host and Compose does not change permissions when it mounts the files. What protects the secrets is the &lt;code&gt;docker/secrets/&lt;/code&gt; directory itself (mode 700).&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;To stop:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ docker compose down&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Adding &lt;code&gt;-v&lt;/code&gt; also deletes the data volume, and the accounts and accounting data go with it.&lt;/p&gt;&#xA;&lt;h3 id=&#34;what-this-compose-file-does&#34;&gt;What this Compose file does&#xA;&lt;/h3&gt;&lt;p&gt;Settings in &lt;code&gt;compose.yaml&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Only &lt;code&gt;1812/udp&lt;/code&gt; and &lt;code&gt;1813/udp&lt;/code&gt; are published. The TACACS+ and metrics ports are not published to the host.&lt;/li&gt;&#xA;&lt;li&gt;The configuration directory &lt;code&gt;./docker/config&lt;/code&gt; is mounted read-only at &lt;code&gt;/etc/rradius&lt;/code&gt;. Data is in a volume named &lt;code&gt;data&lt;/code&gt;, mounted at &lt;code&gt;/var/lib/rradius&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The three secret files are mounted as Compose secrets at &lt;code&gt;/run/secrets/raft&lt;/code&gt;, &lt;code&gt;/run/secrets/api&lt;/code&gt; and &lt;code&gt;/run/secrets/radius&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The root file system is read-only (&lt;code&gt;read_only: true&lt;/code&gt;), &lt;code&gt;/tmp&lt;/code&gt; is a tmpfs, all capabilities are dropped, and &lt;code&gt;no-new-privileges&lt;/code&gt; is set. The server writes only to the data volume and &lt;code&gt;/tmp&lt;/code&gt;, so this is enough.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;stop_grace_period: 30s&lt;/code&gt;: gives the database enough time to finish when stopping. Docker&amp;rsquo;s default of 10 seconds may not be enough.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;restart: unless-stopped&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;code&gt;docker/config/&lt;/code&gt; contains:&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 dictionary points to &lt;code&gt;/usr/share/rradius/dictionary&lt;/code&gt;; the data directory is &lt;code&gt;/var/lib/rradius&lt;/code&gt;; the sql handler queries the &lt;code&gt;users&lt;/code&gt; table; one client for each of the three private ranges (&lt;code&gt;10.0.0.0/8&lt;/code&gt;, &lt;code&gt;172.16.0.0/12&lt;/code&gt;, &lt;code&gt;192.168.0.0/16&lt;/code&gt;); the metrics port is &lt;code&gt;127.0.0.1:9812&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;auth.lua&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Handles accounting only: writes each accounting request to the &lt;code&gt;accounting&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;&lt;code&gt;migrations/1_schema.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Creates the two tables &lt;code&gt;users&lt;/code&gt; 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;cluster/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Configuration for a three-node cluster, see chapter 16&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; The default clients cover three entire private ranges, because the source addresses Docker gives containers fall in these ranges. Before production use, change them to the addresses or ranges where your NAS actually is (chapter 05).&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;adding-accounts&#34;&gt;Adding accounts&#xA;&lt;/h3&gt;&lt;p&gt;This configuration has no &lt;code&gt;[accounts]&lt;/code&gt;, so &lt;code&gt;user add&lt;/code&gt; cannot be used. The approach suggested in the comments of &lt;code&gt;1_schema.sql&lt;/code&gt; is to add a migration file with a higher number, for example &lt;code&gt;docker/config/migrations/2_users.sql&lt;/code&gt;, containing &lt;code&gt;INSERT INTO users …&lt;/code&gt;. For the format of the password column, see &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;chapter 07&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can also add &lt;code&gt;[accounts]&lt;/code&gt; to &lt;code&gt;rradius.toml&lt;/code&gt; as described in chapter 07, then manage accounts with &lt;code&gt;docker compose exec rradius rradiusd user add …&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; A migration file that has already been applied must not be changed. To change a table structure or add data, always add a file with the next number.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;synology-nas&#34;&gt;Synology NAS&#xA;&lt;/h2&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; This section was checked only against &lt;code&gt;deploy/synology/compose.yaml&lt;/code&gt; and has not been run on a Synology NAS. The way to move the image to the NAS is this manual&amp;rsquo;s recommendation; the repository has no ready-made script for it.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;code&gt;deploy/synology/compose.yaml&lt;/code&gt; lets Synology&amp;rsquo;s Container Manager run one node as a &amp;ldquo;project&amp;rdquo;. It is almost the same as the &lt;code&gt;compose.yaml&lt;/code&gt; in the previous section, with two differences:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The image is not on a registry.&lt;/strong&gt; &lt;code&gt;image: rradius-server:latest&lt;/code&gt; must be built beforehand on another machine with &lt;code&gt;docker build -t rradius-server .&lt;/code&gt; and then imported into the NAS. For example, on the build machine run &lt;code&gt;docker save rradius-server:latest -o rradius-server.tar&lt;/code&gt;, then import the file on the image page of Container Manager. Build the image for the same architecture as the NAS: x86_64 or arm64.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The secret files are mounted directly as files.&lt;/strong&gt; The three secret files are mounted read-only with ordinary bind mounts at &lt;code&gt;/run/secrets/&lt;/code&gt;, without Compose secrets, so the Compose version on the NAS does not matter.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Lay out the directories on the NAS like this:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/volume1/docker/rradius/compose.yaml   deploy/synology/compose.yaml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/volume1/docker/rradius/config/        a copy of docker/config/ (edit rradius.toml here)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/volume1/docker/rradius/secrets/       raft.secret, api.secret, radius.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can generate the secret files on the build machine with &lt;code&gt;sh docker/init-secrets.sh&lt;/code&gt; and then copy the three files in &lt;code&gt;docker/secrets/&lt;/code&gt; over.&lt;/p&gt;&#xA;&lt;p&gt;Data uses the named volume &lt;code&gt;data&lt;/code&gt;, which Docker makes writable for the container&amp;rsquo;s user (uid 10001). If you use a folder created in File Station instead, the container&amp;rsquo;s user usually has no write permission.&lt;/p&gt;&#xA;&lt;h3 id=&#34;pre-checks&#34;&gt;Pre-checks&#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;Item&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Notes&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;Model&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;It must be able to install Container Manager (called Docker in DSM 6 through 7.1). It must show up in a search in Synology&amp;rsquo;s Package Center; some entry-level models do not have it. Check your model on Synology&amp;rsquo;s website&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;CPU architecture&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Build a &lt;code&gt;linux/amd64&lt;/code&gt; image for x86_64 models and &lt;code&gt;linux/arm64&lt;/code&gt; for ARM models; the image must have the same architecture as the NAS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Memory&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Memory use of a single node was not measured on DSM. If the same NAS runs many other services, check the available memory 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;Network&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The NAS needs a fixed address (a DHCP reservation or a manual setting), and your devices&amp;rsquo; RADIUS server address must point to 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;Single point of failure&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RADIUS is the entry to the network: when the NAS reboots or DSM updates, nobody can connect. If you can, use the three nodes on different machines from &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;chapter 16&lt;/a&gt; instead of relying on one machine. Three containers on the same NAS are no more reliable than one&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;building-the-image-on-another-computer&#34;&gt;Building the image on another computer&#xA;&lt;/h3&gt;&lt;p&gt;The NAS CPU is slow and Rust takes a long time to compile, so build the image on another computer with Docker and move it over. &lt;code&gt;--platform&lt;/code&gt; must match the NAS architecture:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ docker buildx build --platform linux/amd64 -t rradius-server:latest --load .&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ docker save rradius-server:latest | gzip &amp;gt; rradius-server.tar.gz&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For an ARM NAS, replace &lt;code&gt;linux/amd64&lt;/code&gt; with &lt;code&gt;linux/arm64&lt;/code&gt;. When the &lt;code&gt;Dockerfile&lt;/code&gt; builds on arm64, it fixes jemalloc&amp;rsquo;s page size at 64 KiB, so the same arm64 image also runs on kernels with 4 KiB and 16 KiB pages. Building &lt;code&gt;linux/amd64&lt;/code&gt; on an Apple Silicon computer uses emulation and is very slow.&lt;/p&gt;&#xA;&lt;h3 id=&#34;steps-on-dsm&#34;&gt;Steps on DSM&#xA;&lt;/h3&gt;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Put the folders in place:&lt;/strong&gt; With File Station or SSH, create &lt;code&gt;/volume1/docker/rradius/&lt;/code&gt; (the location of the &lt;code&gt;docker&lt;/code&gt; shared folder depends on your setup), and put &lt;code&gt;compose.yaml&lt;/code&gt;, &lt;code&gt;config/&lt;/code&gt; and &lt;code&gt;secrets/&lt;/code&gt; in it.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Import the image:&lt;/strong&gt; Container Manager → &amp;ldquo;Image&amp;rdquo; → &amp;ldquo;Add&amp;rdquo; → &amp;ldquo;Add from file&amp;rdquo;, and choose &lt;code&gt;rradius-server.tar.gz&lt;/code&gt; (a plain &lt;code&gt;.tar&lt;/code&gt; from &lt;code&gt;docker save&lt;/code&gt; without gzip, as in the previous section, also works). After the import the name is &lt;code&gt;rradius-server:latest&lt;/code&gt;, the same as &lt;code&gt;image&lt;/code&gt; in &lt;code&gt;compose.yaml&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit the configuration:&lt;/strong&gt; Edit &lt;code&gt;config/rradius.toml&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;[[radius.clients]]&lt;/code&gt; accepts the three private ranges &lt;code&gt;10.0.0.0/8&lt;/code&gt;, &lt;code&gt;172.16.0.0/12&lt;/code&gt; and &lt;code&gt;192.168.0.0/16&lt;/code&gt; by default (see the warning in &lt;a class=&#34;link&#34; href=&#34;#docker-compose&#34; &gt;Docker Compose&lt;/a&gt;). Narrow it to your devices&amp;rsquo; addresses or ranges, and give each client a &lt;code&gt;name&lt;/code&gt; so the logs and metrics can tell the devices apart.&lt;/li&gt;&#xA;&lt;li&gt;If you want accounts, add &lt;code&gt;2_users.sql&lt;/code&gt; to &lt;code&gt;config/migrations/&lt;/code&gt; &lt;strong&gt;before the first start&lt;/strong&gt; (see &lt;a class=&#34;link&#34; href=&#34;#adding-accounts&#34; &gt;Adding accounts&lt;/a&gt;); a migration file that has been applied must not be changed.&lt;/li&gt;&#xA;&lt;li&gt;Keep &lt;code&gt;[metrics]&lt;/code&gt; bound to &lt;code&gt;127.0.0.1&lt;/code&gt; only. Do not change it to an externally reachable address (it has no authentication).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Create the project and start it:&lt;/strong&gt; Container Manager → &amp;ldquo;Project&amp;rdquo; → &amp;ldquo;Create&amp;rdquo;, with the project name &lt;code&gt;rradius&lt;/code&gt;, the path &lt;code&gt;/volume1/docker/rradius&lt;/code&gt;, and the source &amp;ldquo;Use existing docker-compose.yml&amp;rdquo;. Start it when done. At the first start, the server creates the database in the data volume and applies the migrations. When the project&amp;rsquo;s &amp;ldquo;Log&amp;rdquo; page shows &lt;code&gt;RADIUS Server listening on&lt;/code&gt;, it accepts requests.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Open the firewall:&lt;/strong&gt; If the firewall under DSM &amp;ldquo;Control Panel&amp;rdquo; → &amp;ldquo;Security&amp;rdquo; → &amp;ldquo;Firewall&amp;rdquo; is enabled, allow your devices&amp;rsquo; addresses to reach UDP 1812 and 1813.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Configure the devices:&lt;/strong&gt; Set the RADIUS server to the NAS address, the authentication port to 1812, the accounting port to 1813, and the shared secret to the contents of &lt;code&gt;secrets/radius.secret&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Try it once:&lt;/strong&gt; From another computer on the LAN that has &lt;code&gt;rradius-bench&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;#building-from-source&#34; &gt;Building from source&lt;/a&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server &amp;lt;NAS address&amp;gt; --auth-port &lt;span style=&#34;color:#ae81ff&#34;&gt;1812&lt;/span&gt; --secret &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 radius.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user &amp;lt;account&amp;gt; --password &amp;lt;password&amp;gt; --load pap,concurrency=1 --requests 1 | grep &amp;#39;pap:&amp;#39;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;accept 1&lt;/code&gt; means it works; &lt;code&gt;reject 1&lt;/code&gt; means the server answered and only the account or password is wrong. If there is no response, see the troubleshooting below.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; The DSM screen names and the order of operations above are written from Synology&amp;rsquo;s documentation and the general behavior of Docker. They have not been run on real hardware.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;troubleshooting-on-synology&#34;&gt;Troubleshooting on Synology&#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;Symptom&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause and fix&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 device gets no response, and the log shows no request&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The firewall is blocking it, or the device has the wrong NAS address. On the NAS, use &lt;code&gt;sudo tcpdump -ni any udp port 1812&lt;/code&gt; (if the tool is available) to see whether packets arrive&lt;/td&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 has &lt;code&gt;RADIUS packet from unknown client &amp;lt;address&amp;gt; discarded&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;. Look at the address in the log. Whether Docker keeps the original source address when it translates addresses for external packets under bridge networking was not verified on DSM. If every address shown is a Docker internal address (for example &lt;code&gt;172.17.0.1&lt;/code&gt;), see the next 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;All devices have the same source address&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Remove &lt;code&gt;ports:&lt;/code&gt; from &lt;code&gt;compose.yaml&lt;/code&gt; and use &lt;code&gt;network_mode: host&lt;/code&gt; instead, so the container uses the NAS network directly. Then the NAS&amp;rsquo;s own services must not use 1812 or 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;It exits right after starting, with a permission error&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The data directory was replaced with a folder created in File Station, and uid 10001 cannot write to it. Use the example&amp;rsquo;s named volume, or change the owner of that folder to uid 10001&lt;/td&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 &lt;code&gt;Read-only file system&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The example &lt;code&gt;compose.yaml&lt;/code&gt; makes the root file system read-only (&lt;code&gt;read_only: true&lt;/code&gt;), and only the data volume and &lt;code&gt;/tmp&lt;/code&gt; are writable. If the configuration has paths that point elsewhere (for example the accounting spool or the accounting log file), mount a volume for them, or point them under &lt;code&gt;/var/lib/rradius&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 project did not come up after the NAS rebooted&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;restart: unless-stopped&lt;/code&gt; brings the container up after Docker starts. If the package has not finished starting after the NAS reboot, wait a while and look again; if it still has not come up, start the project by hand&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;When there is a configuration error (for example &lt;code&gt;migration file … changed after it was applied&lt;/code&gt;), the container exits immediately, and the reason is in the project&amp;rsquo;s log; see &lt;a class=&#34;link&#34; href=&#34;../18-operations/&#34; &gt;chapter 18&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;why-there-is-no-synology-package&#34;&gt;Why there is no Synology package&#xA;&lt;/h3&gt;&lt;p&gt;The repository has only &lt;code&gt;deploy/synology/compose.yaml&lt;/code&gt;. It has no Synology package (SPK) definition and no registry that publishes the image. The reasons:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A package format needs a separate build for each architecture and DSM version, and there is no signing or distribution channel.&lt;/li&gt;&#xA;&lt;li&gt;It has not been verified whether the user permissions a package uses can bind a low port such as TACACS+ port 49.&lt;/li&gt;&#xA;&lt;li&gt;A Docker image is a single image and behaves the same as on other platforms. A native package would first need DSM&amp;rsquo;s glibc version, non-root port binding and the ARM page size verified.&lt;/li&gt;&#xA;&lt;li&gt;There is no public registry, so the image is moved with &lt;code&gt;docker save&lt;/code&gt;. When there is a registry in the future, change &lt;code&gt;image&lt;/code&gt; in &lt;code&gt;compose.yaml&lt;/code&gt; to its address and the NAS will pull it by itself.&lt;/li&gt;&#xA;&lt;li&gt;The secret files use a bind mount and not Compose &lt;code&gt;secrets&lt;/code&gt;, because the Docker Compose version on a NAS does not always support them.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;what-is-verified-and-what-is-not&#34;&gt;What is verified and what is not&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;deploy/synology/compose.yaml&lt;/code&gt; has &lt;code&gt;read_only&lt;/code&gt;, &lt;code&gt;tmpfs&lt;/code&gt;, &lt;code&gt;cap_drop&lt;/code&gt; and &lt;code&gt;no-new-privileges&lt;/code&gt;, and the same settings are in the &lt;code&gt;compose.yaml&lt;/code&gt; in the repository root. This manual did not actually start anything with &lt;code&gt;deploy/synology/compose.yaml&lt;/code&gt;. None of these are verified: the screens and behavior of DSM&amp;rsquo;s Container Manager and the older Docker package, support on each model, the DSM firewall, whether address translation keeps the source address, Hyper Backup, and automatic start after a NAS reboot.&lt;/p&gt;&#xA;&lt;h2 id=&#34;first-start-after-a-package-install&#34;&gt;First start after a package install&#xA;&lt;/h2&gt;&lt;p&gt;After you install the deb, the rpm or the FreeBSD port, you must create the configuration file yourself. The steps below are for Linux. On FreeBSD, replace &lt;code&gt;/etc/rradius&lt;/code&gt; with &lt;code&gt;/usr/local/etc/rradius&lt;/code&gt;, the dictionary with &lt;code&gt;/usr/local/share/rradius/dictionary&lt;/code&gt;, and the data directory with &lt;code&gt;/var/db/rradius&lt;/code&gt;, and start the service with the commands in the rc.d section above.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; The configuration below was verified locally with &lt;code&gt;check&lt;/code&gt; (with the paths changed to a temporary directory), but the service was not started on a Linux machine with the package installed.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;1-generate-the-starter-configuration&#34;&gt;1. Generate the starter 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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# rradiusd config init &amp;gt; /etc/rradius/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;config init&lt;/code&gt; prints a draft you can use as it is. The cluster password and the shared secret of the example client are randomly generated. &lt;code&gt;dictionary&lt;/code&gt; is set to the default dictionary location of this version (&lt;code&gt;/usr/share/rradius/dictionary&lt;/code&gt; for a package install). There is no &lt;code&gt;[[cluster.nodes]]&lt;/code&gt;, so it is a single node. It has &lt;code&gt;include = [&amp;quot;conf.d/*.toml&amp;quot;]&lt;/code&gt;, so the &lt;code&gt;.toml&lt;/code&gt; files in &lt;code&gt;conf.d/&lt;/code&gt; are read in as well. It has one &lt;code&gt;[metrics]&lt;/code&gt;. With &lt;code&gt;--lang zh-TW&lt;/code&gt;, the comments are in Chinese. The output is about 30 lines; to see every setting and its default value, use &lt;code&gt;config init --full&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;2-change-three-things&#34;&gt;2. Change three things&#xA;&lt;/h3&gt;&lt;p&gt;The service can write only to &lt;code&gt;/var/lib/rradius&lt;/code&gt; and &lt;code&gt;/var/log/rradius&lt;/code&gt; (the unit sets &lt;code&gt;ProtectSystem=strict&lt;/code&gt;), and relative paths in the configuration file are based on the directory the configuration file is in. So the draft&amp;rsquo;s &lt;code&gt;data_dir = &amp;quot;data&amp;quot;&lt;/code&gt; becomes &lt;code&gt;/etc/rradius/data&lt;/code&gt;, which the service cannot write to. Change it to:&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:#75715e&#34;&gt;# /etc/rradius/rradius.toml&lt;/span&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;# … (other settings omitted)&lt;/span&gt;&#xA;&lt;/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;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;data_dir&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/var/lib/rradius&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;# Single machine: bind the cluster ports to localhost only&lt;/span&gt;&#xA;&lt;/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;127.0.0.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;Cluster: the draft has no &lt;code&gt;[[cluster.nodes]]&lt;/code&gt;; it is a single node listening on &lt;code&gt;127.0.0.1&lt;/code&gt;, so you do not need to set &lt;code&gt;listen&lt;/code&gt;. Add &lt;code&gt;[[cluster.nodes]]&lt;/code&gt; and set &lt;code&gt;listen&lt;/code&gt; only when you build a cluster; see chapter 16.&lt;/li&gt;&#xA;&lt;li&gt;The draft&amp;rsquo;s &lt;code&gt;[lua]&lt;/code&gt; points to &lt;code&gt;auth.lua&lt;/code&gt;. You must create this file yourself, at &lt;code&gt;/etc/rradius/auth.lua&lt;/code&gt;. For how to write scripts, see chapter 10. If you only want the configuration to pass the check for now, you can write one line, &lt;code&gt;return &amp;quot;reject&amp;quot;&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Replace the example client &lt;code&gt;127.0.0.1&lt;/code&gt; with your NAS (chapter 05).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If you later use the accounting spool (&lt;code&gt;dir&lt;/code&gt; in &lt;code&gt;[radius.accounting_spool]&lt;/code&gt;), put it under &lt;code&gt;/var/lib/rradius&lt;/code&gt;. Put the accounting log file (&lt;code&gt;file&lt;/code&gt; in &lt;code&gt;[radius.accounting_log]&lt;/code&gt;) under &lt;code&gt;/var/log/rradius&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;3-permissions-of-the-configuration-files&#34;&gt;3. Permissions of the configuration files&#xA;&lt;/h3&gt;&lt;p&gt;The configuration file contains passwords, so let only the &lt;code&gt;rradius&lt;/code&gt; group read it:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# chown root:rradius /etc/rradius/rradius.toml /etc/rradius/auth.lua&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;640&lt;/span&gt; /etc/rradius/rradius.toml /etc/rradius/auth.lua&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Files in &lt;code&gt;conf.d/&lt;/code&gt; follow the same rule: only &lt;code&gt;rradius&lt;/code&gt; can read them and only root can write them. An included file can change who can log in, and the server warns about files that the group or others can write to.&lt;/p&gt;&#xA;&lt;h3 id=&#34;4-check-then-start&#34;&gt;4. Check, then 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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# rradiusd check&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# systemctl enable --now rradius&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Without &lt;code&gt;--config&lt;/code&gt;, &lt;code&gt;check&lt;/code&gt; reads the default configuration file &lt;code&gt;/etc/rradius/rradius.toml&lt;/code&gt;. On success it prints &lt;code&gt;configuration ok&lt;/code&gt; and exits with code 0; on an error it exits with code 2.&lt;/p&gt;&#xA;&lt;h3 id=&#34;key-points-of-the-systemd-unit&#34;&gt;Key points of the systemd unit&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;rradius.service&lt;/code&gt; (the source is &lt;code&gt;packages/common/rradius.service&lt;/code&gt;):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;ExecStart=/usr/bin/rradiusd serve&lt;/code&gt;: reads the default configuration file.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;ConditionPathExists=/etc/rradius/rradius.toml&lt;/code&gt;: when the configuration file does not exist, the service does not start.&lt;/li&gt;&#xA;&lt;li&gt;Runs as the &lt;code&gt;rradius&lt;/code&gt; user. &lt;code&gt;AmbientCapabilities=CAP_NET_BIND_SERVICE&lt;/code&gt; lets it bind the TACACS+ port 49.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Restart=on-failure&lt;/code&gt;, &lt;code&gt;RestartSec=2&lt;/code&gt;: when the program exits abnormally, it restarts after two seconds.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;TimeoutStopSec=60&lt;/code&gt;: gives a cluster node enough time to stop.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;ExecReload&lt;/code&gt; sends SIGHUP: &lt;code&gt;systemctl reload rradius&lt;/code&gt; reloads the configuration and reopens the accounting log file (chapter 04).&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;LimitNOFILE=65536&lt;/code&gt;, &lt;code&gt;ProtectSystem=strict&lt;/code&gt;, &lt;code&gt;ProtectHome=yes&lt;/code&gt;, &lt;code&gt;PrivateTmp=yes&lt;/code&gt;, &lt;code&gt;NoNewPrivileges=yes&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The logrotate configuration &lt;code&gt;/etc/logrotate.d/rradius&lt;/code&gt; rotates &lt;code&gt;/var/log/rradius/*.jsonl&lt;/code&gt; every day, keeps 30 copies, and sends SIGHUP after rotation so the program opens a new file. It does not use &lt;code&gt;copytruncate&lt;/code&gt;, because that would lose data.&lt;/p&gt;&#xA;&lt;h2 id=&#34;checking-the-version-and-default-configuration-path&#34;&gt;Checking the version and default configuration path&#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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd --version&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd 0.1.0 (community)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;default config: /etc/rradius/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;default dictionary: /usr/share/rradius/dictionary&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;The first line is the program name and version.&lt;/li&gt;&#xA;&lt;li&gt;The second line is the configuration file read when there is no &lt;code&gt;--config&lt;/code&gt;. For a program built by the FreeBSD port, this is &lt;code&gt;/usr/local/etc/rradius/rradius.toml&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The third line is the dictionary read when the configuration file has no &lt;code&gt;dictionary&lt;/code&gt;. For a program built by the FreeBSD port, this is &lt;code&gt;/usr/local/share/rradius/dictionary&lt;/code&gt;. The package installs the dictionary here, so you do not need to write it.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;code&gt;--version&lt;/code&gt; does not read the configuration file, does not open any port and does not create any directory, so it is always safe to run.&lt;/p&gt;&#xA;&lt;h2 id=&#34;upgrading-and-removing&#34;&gt;Upgrading and removing&#xA;&lt;/h2&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; This section is based on the deb &lt;code&gt;rules&lt;/code&gt; and &lt;code&gt;postrm&lt;/code&gt; and the rpm spec. No upgrade or removal was actually done.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Upgrade:&lt;/strong&gt; The package does not overwrite your edited &lt;code&gt;/etc/rradius/rradius.toml&lt;/code&gt; and does not touch &lt;code&gt;conf.d/&lt;/code&gt;. If the service is running, both deb and rpm restart it after the upgrade.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Removal:&lt;/strong&gt; The data (&lt;code&gt;/var/lib/rradius&lt;/code&gt;), the logs (&lt;code&gt;/var/log/rradius&lt;/code&gt;) and the &lt;code&gt;rradius&lt;/code&gt; user are kept, because they hold the cluster database and the accounting data.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;deb purge:&lt;/strong&gt; It deletes only &lt;code&gt;/etc/rradius/conf.d&lt;/code&gt; and &lt;code&gt;/etc/rradius&lt;/code&gt;, and only when they are empty directories.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Docker:&lt;/strong&gt; Replace the image and recreate the container; the data is in the volume. &lt;code&gt;docker compose down -v&lt;/code&gt; deletes the volume.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;rradiusd check&lt;/code&gt; prints:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/etc/rradius/rradius.toml: cannot read configuration: No such file or directory (os error 2)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The default configuration file does not exist. The package does not create it for you.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Generate it with &lt;code&gt;config init&lt;/code&gt; as in &lt;a class=&#34;link&#34; href=&#34;#first-start-after-a-package-install&#34; &gt;First start after a package install&lt;/a&gt;, or give another file with &lt;code&gt;--config&lt;/code&gt;. When you start with &lt;code&gt;serve&lt;/code&gt;, the error message has an extra line below it: &lt;code&gt;(the default configuration; give --config &amp;lt;path&amp;gt; for another)&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;systemctl start rradius&lt;/code&gt; shows no error, but the service is not running.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;/etc/rradius/rradius.toml&lt;/code&gt; does not exist, so the unit&amp;rsquo;s &lt;code&gt;ConditionPathExists&lt;/code&gt; is not met and the service is skipped.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Create the configuration file, and start the service after &lt;code&gt;check&lt;/code&gt; passes.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;/usr/share/rradius/dictionary: cannot read dictionary: No such file or directory (os error 2)&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; You are not using a package or Docker, and the dictionary is not at the default location from &lt;code&gt;config init&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change &lt;code&gt;dictionary&lt;/code&gt; to where the dictionary really is (&lt;code&gt;share/dictionary&lt;/code&gt; in the source and in the tarball), or put the dictionary at the default dictionary path and delete the &lt;code&gt;dictionary&lt;/code&gt; line.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;cannot read script &#39;auth.lua&#39;: No such file or directory (os error 2)&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The &lt;code&gt;config init&lt;/code&gt; draft points to &lt;code&gt;auth.lua&lt;/code&gt;, and you must create this file yourself.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Create &lt;code&gt;auth.lua&lt;/code&gt; next to the configuration file (chapter 10).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; passes, but &lt;code&gt;serve&lt;/code&gt; prints &lt;code&gt;cannot start cluster node 1: …&lt;/code&gt; and exits with code 2.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The data directory is not writable. The most common cause is keeping the draft&amp;rsquo;s &lt;code&gt;data_dir = &amp;quot;data&amp;quot;&lt;/code&gt;, which becomes &lt;code&gt;/etc/rradius/data&lt;/code&gt; in a package install. &lt;code&gt;check&lt;/code&gt; does not try to write to the data directory, so it cannot catch this.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change &lt;code&gt;data_dir&lt;/code&gt; to &lt;code&gt;/var/lib/rradius&lt;/code&gt; (&lt;code&gt;/var/db/rradius&lt;/code&gt; on FreeBSD), and make sure the owner is &lt;code&gt;rradius&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; or another command shows the warning &lt;code&gt;cluster.listen is not set, so the cluster&#39;s Raft and API ports are on all interfaces …&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The configuration has &lt;code&gt;[[cluster.nodes]]&lt;/code&gt; but &lt;code&gt;cluster.listen&lt;/code&gt; is not set (the &lt;code&gt;config init&lt;/code&gt; draft has no &lt;code&gt;[[cluster.nodes]]&lt;/code&gt;, so it does not show this).&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; On a single machine, set &lt;code&gt;listen = &amp;quot;127.0.0.1&amp;quot;&lt;/code&gt;, or remove &lt;code&gt;[[cluster.nodes]]&lt;/code&gt;. For clusters, see chapter 16.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; In a Compose deployment, command output keeps showing &lt;code&gt;has mode 644, which others can reach or its group can write&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;init-secrets.sh&lt;/code&gt; deliberately sets the secret files to 644; see the explanation in &lt;a class=&#34;link&#34; href=&#34;#docker-compose&#34; &gt;Docker Compose&lt;/a&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; In a Compose deployment you can ignore it. When you are not using Compose, change the secret files to 0600 or 0640.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; On FreeBSD, TACACS+ is not listening on port 49.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The port runs as an ordinary user and cannot bind ports below 1024.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; See the note in &lt;a class=&#34;link&#34; href=&#34;#freebsd-port&#34; &gt;FreeBSD port&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../01-overview/&#34; &gt;01 Getting to know rradius&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04 Configuration file basics&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05 RADIUS service and NAS clients&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;10 Writing policies in Lua&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16 Clusters and high availability&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../20-security/&#34; &gt;20 Security hardening&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>03 First start and first login</title>
            <link>https://embark.systems/en/rradius/oss/03-quick-start/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/03-quick-start/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Start rradius in ten minutes with the quick-start scenario&lt;/li&gt;&#xA;&lt;li&gt;Send a login with &lt;code&gt;rradius-bench&lt;/code&gt; and get your first Access-Accept&lt;/li&gt;&#xA;&lt;li&gt;Add an account with &lt;code&gt;user add&lt;/code&gt; and log in with it right away&lt;/li&gt;&#xA;&lt;li&gt;Send an accounting request and see it written to the table with &lt;code&gt;session list&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Check the server with &lt;code&gt;status&lt;/code&gt;, then stop it cleanly&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: build &lt;code&gt;rradiusd&lt;/code&gt; and &lt;code&gt;rradius-bench&lt;/code&gt; as described in &amp;ldquo;Build from source&amp;rdquo; in &lt;a class=&#34;link&#34; href=&#34;../02-install/&#34; &gt;chapter 02&lt;/a&gt;. Everything in this chapter runs on one machine. You do not need a real NAS.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#prepare-a-working-directory&#34; &gt;Prepare a working directory&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#read-the-quick-start-files&#34; &gt;Read the quick-start files&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#replace-the-example-secrets&#34; &gt;Replace the example secrets&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#make-the-user-commands-work&#34; &gt;Make the user commands work&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#check-the-configuration&#34; &gt;Check the configuration&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#start-the-server&#34; &gt;Start the server&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#first-login&#34; &gt;First login&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#add-an-account&#34; &gt;Add an account&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#send-an-accounting-request&#34; &gt;Send an accounting request&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#check-server-status&#34; &gt;Check server status&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#stop-the-server&#34; &gt;Stop the server&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#another-starting-point-config-init&#34; &gt;Another starting point: config init&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;prepare-a-working-directory&#34;&gt;Prepare a working directory&#xA;&lt;/h2&gt;&lt;p&gt;quick-start is a single-node scenario. Accounts live in a table in the cluster database, the sql handler checks passwords, and a Lua script writes accounting to a table. It is in the source tree at &lt;code&gt;rradius-server/examples/scenarios/quick-start/&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Do not run it inside the source tree: the server creates a &lt;code&gt;data/&lt;/code&gt; directory next to the configuration file, and the steps below edit the configuration file. Copy it to a working directory first. Run these commands from the root of the source 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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ export PATH&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$PWD&lt;span style=&#34;color:#e6db74&#34;&gt;/target/release:&lt;/span&gt;$PATH&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ mkdir -p ~/rradius-lab&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cp -R rradius-server/examples/scenarios/quick-start ~/rradius-lab/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ sed -i.bak &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;s#^dictionary = .*#dictionary = \&amp;#34;&lt;/span&gt;$PWD&lt;span style=&#34;color:#e6db74&#34;&gt;/share/dictionary\&amp;#34;#&amp;#34;&lt;/span&gt; ~/rradius-lab/quick-start/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cd ~/rradius-lab/quick-start&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;The first line makes the &lt;code&gt;rradiusd&lt;/code&gt; and &lt;code&gt;rradius-bench&lt;/code&gt; commands in this chapter available directly.&lt;/li&gt;&#xA;&lt;li&gt;The scenario&amp;rsquo;s &lt;code&gt;dictionary = &amp;quot;../../../../share/dictionary&amp;quot;&lt;/code&gt; is relative to its place in the repository. After you copy it, that relative path no longer works, so &lt;code&gt;sed&lt;/code&gt; changes it to the absolute path of the dictionary.&lt;/li&gt;&#xA;&lt;li&gt;If you installed from a deb or rpm package, the example is in &lt;code&gt;/usr/share/doc/rradius/examples/scenarios/quick-start/&lt;/code&gt; and the dictionary is &lt;code&gt;/usr/share/rradius/dictionary&lt;/code&gt;. The packages do not include &lt;code&gt;rradius-bench&lt;/code&gt;, so for the login tests you still need the one built from source.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;All commands from here on run in &lt;code&gt;~/rradius-lab/quick-start&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;read-the-quick-start-files&#34;&gt;Read the quick-start files&#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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ ls -1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;accounting.lua&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;api.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;localhost.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;migrations&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;raft.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml.bak&#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;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 configuration file (&lt;code&gt;rradius.toml.bak&lt;/code&gt; is the original that &lt;code&gt;sed&lt;/code&gt; left behind)&lt;/td&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;The accounting script: one row per session; Start inserts, Interim-Update and Stop update&lt;/td&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;Creates the &lt;code&gt;users&lt;/code&gt;, &lt;code&gt;user_reply&lt;/code&gt; and &lt;code&gt;accounting&lt;/code&gt; tables&lt;/td&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 and reply attributes&lt;/td&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;The cluster&amp;rsquo;s Raft secret and API 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;localhost.secret&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The shared secret of the client &lt;code&gt;localhost&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 contents of the configuration file (comments removed):&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:#75715e&#34;&gt;# rradius.toml&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;dictionary&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;…/share/dictionary&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;lua&lt;/span&gt;]&#xA;&lt;/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;accounting.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;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;data_dir&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;data&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_raft_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;raft.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;secret_api_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;api.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;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;&#xA;&lt;/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;]&#xA;&lt;/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;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;]&#xA;&lt;/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;127.0.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;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;status_server&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;localhost&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;127.0.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;localhost.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;metrics&lt;/span&gt;]&#xA;&lt;/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;127.0.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;port&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;9812&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;sessions&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;list&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT username, nas, session_id, started, updated FROM accounting WHERE stopped IS NULL AND updated &amp;gt; strftime(&amp;#39;%s&amp;#39;, &amp;#39;now&amp;#39;) - 900 ORDER BY started, session_id&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, nas, session_id, started, updated FROM accounting WHERE username = ?1 AND stopped IS NULL AND updated &amp;gt; strftime(&amp;#39;%s&amp;#39;, &amp;#39;now&amp;#39;) - 900 ORDER BY started, session_id&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Section by section (for defaults and whether each setting can be reloaded, see the full list in &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&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;Setting&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Value here&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&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;&lt;code&gt;dictionary&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Dictionary path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The default dictionary path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Restart needed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Where attribute names come from (chapter 06)&lt;/td&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.script&lt;/code&gt;&lt;/td&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;Required&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;The top-level script. This scenario has &lt;code&gt;[auth]&lt;/code&gt;, so the script handles only accounting&lt;/td&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.data_dir&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;data&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Required&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Restart needed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Directory of the cluster database, relative to 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;cluster.secret_raft_file&lt;/code&gt;, &lt;code&gt;secret_api_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;File names&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;None&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Restart needed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Which files hold the cluster secrets&lt;/td&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.migrations_dir&lt;/code&gt;&lt;/td&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;None&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Restart needed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SQL files applied in order at startup&lt;/td&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.policy&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;first_match&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;first_match&lt;/code&gt;&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;How the auth chain decides (chapter 07)&lt;/td&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.handlers&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One sql handler&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;None&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;code&gt;user_query&lt;/code&gt; looks up the password, &lt;code&gt;reply_query&lt;/code&gt; looks up the reply attributes&lt;/td&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.bind&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;127.0.0.1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;0.0.0.0&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Restart needed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The address RADIUS listens 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;&lt;code&gt;radius.auth_port&lt;/code&gt;, &lt;code&gt;acct_port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1812&lt;/code&gt;, &lt;code&gt;1813&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1812&lt;/code&gt;, &lt;code&gt;1813&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Restart needed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Authentication port, accounting port&lt;/td&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.status_server&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Restart needed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Answer Status-Server&lt;/td&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.clients&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;127.0.0.1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;None&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;The clients allowed to send requests (chapter 05)&lt;/td&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.bind&lt;/code&gt;, &lt;code&gt;port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;127.0.0.1&lt;/code&gt;, &lt;code&gt;9812&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;127.0.0.1&lt;/code&gt;, &lt;code&gt;9812&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Restart needed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The metrics port, which &lt;code&gt;status&lt;/code&gt; reads&lt;/td&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;sessions.list&lt;/code&gt;, &lt;code&gt;show&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Two SQL queries&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;None&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Only the commands read it, no reload needed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The queries that &lt;code&gt;session list&lt;/code&gt; and &lt;code&gt;session show&lt;/code&gt; run (chapter 13)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The demo accounts are in &lt;code&gt;migrations/2_demo_users.sql&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;Account&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Password&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;State&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Reply attributes&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;alice&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;alice-password&lt;/code&gt; (stored in clear text)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Enabled&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Session-Timeout = 3600&lt;/code&gt;, &lt;code&gt;Filter-Id = staff&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;bob&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;bob-password&lt;/code&gt; (stored as a bcrypt hash)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Enabled&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Reply-Message = Welcome, bob&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;carol&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;carol-password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Disabled (&lt;code&gt;enabled = 0&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;None&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;carol&lt;/code&gt; is disabled. &lt;code&gt;user_query&lt;/code&gt; has &lt;code&gt;AND enabled = 1&lt;/code&gt;, so it finds no row for her, which is the same as an account that does not exist.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; The accounts and passwords in &lt;code&gt;2_demo_users.sql&lt;/code&gt; are public demo values. If you turn this scenario into a production setup, delete this file and use your own data.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;replace-the-example-secrets&#34;&gt;Replace the example secrets&#xA;&lt;/h2&gt;&lt;p&gt;The three &lt;code&gt;.secret&lt;/code&gt; files that come with the scenario are public demo values, and their permissions are too open. See what &lt;code&gt;check&lt;/code&gt; says first:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::common::seal: cluster.secret_raft_file: &amp;#39;raft.secret&amp;#39; has mode 644, which others can reach or its group can write; make it 0600 or 0640&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::config: cluster.secret_raft is the public value shipped with the examples; replace it with a random one, for example from `openssl rand -hex 32`&#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;… WARN rradius_core::reload: RADIUS client &amp;#39;localhost&amp;#39; has the public shared secret shipped with the examples; replace it with a random one, for example from `openssl rand -hex 32`&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;These are only warnings. The configuration itself is fine. Replace the secrets as the warnings say:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; f in raft api localhost; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; openssl rand -hex &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt; &amp;gt; $f.secret; &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;$ chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;600&lt;/span&gt; *.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;make-the-user-commands-work&#34;&gt;Make the user commands work&#xA;&lt;/h2&gt;&lt;p&gt;Commands such as &lt;code&gt;user add&lt;/code&gt; need to know which SQL to run against the tables. That SQL is written in &lt;code&gt;[accounts]&lt;/code&gt;. quick-start does not have this section, so running &lt;code&gt;user add&lt;/code&gt; now gives &lt;code&gt;accounts.add is not set in rradius.toml&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The quick-start configuration also has no &lt;code&gt;include&lt;/code&gt;, so you cannot put this in &lt;code&gt;conf.d/&lt;/code&gt;. Add it directly at the end of &lt;code&gt;rradius.toml&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:#75715e&#34;&gt;# rradius.toml (add at the end of the file)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&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;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;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;?1&lt;/code&gt; is the account name. &lt;code&gt;?2&lt;/code&gt; is the password value to store in the table.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;scheme&lt;/code&gt; is how &lt;code&gt;user add&lt;/code&gt; and &lt;code&gt;user passwd&lt;/code&gt; store passwords. The default is already &lt;code&gt;bcrypt&lt;/code&gt;; it is written out here only so you can see it. For the other choices and their trade-offs, see &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;chapter 07&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Do not put the password column in &lt;code&gt;show&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Only the &lt;code&gt;user&lt;/code&gt; commands read &lt;code&gt;[accounts]&lt;/code&gt;. They read it once each time you run a command, so you do not need to reload the server after changing it.&lt;/p&gt;&#xA;&lt;h2 id=&#34;check-the-configuration&#34;&gt;Check the configuration&#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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#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; reads the configuration file, the dictionary, the scripts and the secret files, then exits. It opens no ports and creates no data directory. On success the exit code is 0. On an error it prints the reason and the exit code is 2.&lt;/p&gt;&#xA;&lt;h2 id=&#34;start-the-server&#34;&gt;Start the server&#xA;&lt;/h2&gt;&lt;p&gt;Open a terminal and start the server in the foreground:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd serve --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN hiqlite::store::state_machine::sqlite::writer: No metadata exists inside the DB yet&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN hiqlite::store::state_machine::sqlite::writer: No metadata exists inside the DB yet&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::cli: cluster node 1 started&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::cli: cluster node 1 has caught up with the cluster&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::cli: Servers started. Press Ctrl+C to stop.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::radius: RADIUS Server listening on 127.0.0.1:1812 and 127.0.0.1:1813&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::metrics: Metrics listening on 127.0.0.1:9812&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The order of the last two lines can differ from run to run. During startup this happened:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The server created the &lt;code&gt;data/&lt;/code&gt; directory and started cluster node 1. On the first start the database is empty, so hiqlite prints two &lt;code&gt;No metadata exists inside the DB yet&lt;/code&gt; lines. This is normal.&lt;/li&gt;&#xA;&lt;li&gt;The server applied the SQL files in &lt;code&gt;migrations/&lt;/code&gt; in file name order, which created the tables and inserted the demo accounts. On later starts, files that were already applied do not run again.&lt;/li&gt;&#xA;&lt;li&gt;The server opened the metrics port and the two RADIUS ports. Once you see &lt;code&gt;Servers started&lt;/code&gt;, you can send requests.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Leave the server running in this terminal. &lt;strong&gt;Open another terminal&lt;/strong&gt;, run &lt;code&gt;cd ~/rradius-lab/quick-start&lt;/code&gt;, and do the next steps there. The new terminal needs &lt;code&gt;PATH&lt;/code&gt; set again. You are not in the repository now, so use the absolute path of the repository: &lt;code&gt;export PATH=&amp;quot;&amp;lt;path to the repo&amp;gt;/target/release:$PATH&amp;quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Check that the server is ready:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s http://127.0.0.1:9812/readyz&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;/readyz&lt;/code&gt; answering &lt;code&gt;ok&lt;/code&gt; (HTTP 200) means the server can handle requests. &lt;code&gt;/livez&lt;/code&gt; also answers &lt;code&gt;ok&lt;/code&gt;. For the difference between them, see &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;chapter 17&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;first-login&#34;&gt;First login&#xA;&lt;/h2&gt;&lt;p&gt;Use &lt;code&gt;rradius-bench&lt;/code&gt; as the NAS and send an Access-Request with PAP:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --password alice-password --load pap,concurrency=1 --requests 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;measured 0.001 s after 0.000 s of warmup&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pap (fixed-concurrency): concurrency 1, 1 threads, 1 sockets, busiest worker 13%&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  pap: 1092/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    latency us: p50 802.8, p90 802.8, p99 802.8, p99.9 802.8, max 802.8&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Look at &lt;code&gt;accept 1&lt;/code&gt;: that is your first Access-Accept.&lt;/p&gt;&#xA;&lt;p&gt;The command&amp;rsquo;s options:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;--server&lt;/code&gt;, &lt;code&gt;--secret&lt;/code&gt;: the server address and the shared secret. The shared secret shows up in the process list, so use it only in test environments.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;--user&lt;/code&gt;, &lt;code&gt;--password&lt;/code&gt;: the account and password to log in with.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;--load pap,concurrency=1&lt;/code&gt;: send PAP logins with only one request in flight at a time. &lt;code&gt;--load&lt;/code&gt; must always have &lt;code&gt;concurrency=&lt;/code&gt; or &lt;code&gt;rate=&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;--requests 1&lt;/code&gt;: stop after sending one.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;code&gt;rradius-bench&lt;/code&gt; is a load-testing tool (chapter 19), so it prints rates and latencies. When you use it as a login test, look only at &lt;code&gt;accept&lt;/code&gt;, &lt;code&gt;reject&lt;/code&gt; and &lt;code&gt;timeouts&lt;/code&gt;. You can also use its exit code 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;Exit code&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;0&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;All requests were accepted (or all accounting requests got a response)&lt;/td&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;There was a Reject or a Challenge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&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;There was a timeout, an invalid response or a socket 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;3&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A bad argument; no request was sent&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Try a few more cases:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --password wrong --load pap,concurrency=1 --requests 1&#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;  pap: 3401/s, sent 1, accept 0, reject 1, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user carol --password carol-password --load pap,concurrency=1 --requests 1&#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;  pap: 4508/s, sent 1, accept 0, reject 1, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user bob --password bob-password --load pap,concurrency=1 --requests 1&#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;  pap: 20/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;Wrong password: &lt;code&gt;reject 1&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;carol&lt;/code&gt; is disabled: &lt;code&gt;reject 1&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;bob&lt;/code&gt; is stored as a bcrypt hash, which takes longer to compare, so the rate is much lower. The result is still &lt;code&gt;accept 1&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Back in the terminal that runs the server, every login has an authentication record line:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; account=&amp;#34;alice&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;sql&amp;#34; decision=&amp;#34;accept&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; account=&amp;#34;alice&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;sql&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;carol&amp;#34; account=&amp;#34;carol&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;none&amp;#34; decision=&amp;#34;reject&amp;#34;&#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;client&lt;/code&gt; is the name of the client that matched. &lt;code&gt;chain=&amp;quot;default&amp;quot;&lt;/code&gt; is the auth chain from &lt;code&gt;[auth]&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;handler=&amp;quot;sql&amp;quot;&lt;/code&gt; means the sql handler made the decision. &lt;code&gt;carol&lt;/code&gt; was not found, so no handler gave an answer and the record says &lt;code&gt;handler=&amp;quot;none&amp;quot;&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;code&gt;rradius-bench&lt;/code&gt; does not print reply attributes. To confirm that &lt;code&gt;alice&lt;/code&gt; got &lt;code&gt;Session-Timeout&lt;/code&gt; and &lt;code&gt;Filter-Id&lt;/code&gt;, use &lt;code&gt;[log.trace]&lt;/code&gt; to record the full request and response (chapter 17).&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;add-an-account&#34;&gt;Add an account&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;user add&lt;/code&gt; reads the password from standard input. When you run it directly in a terminal, it turns off echo and asks twice. When you feed it through a pipe, it reads only the first line:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ printf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;dave-password\n&amp;#39;&lt;/span&gt; | rradiusd user add --config rradius.toml dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;added dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd user show --config rradius.toml dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;username=dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;enabled=1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The account can log in right away. You do not need to reload the server:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user dave --password dave-password --load pap,concurrency=1 --requests 1&#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;  pap: 25/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Disable it, then enable it again:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd user disable --config rradius.toml dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;disabled dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user dave --password dave-password --load pap,concurrency=1 --requests 1&#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;  pap: 4187/s, sent 1, accept 0, reject 1, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;$ rradiusd user enable --config rradius.toml dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;enabled dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;user&lt;/code&gt; commands write to the tables through the cluster&amp;rsquo;s API port, so the server must be running. Exit codes: 0 is success; 1 is no matching account or a failed SQL statement; 2 is an argument or configuration error; 3 is that the cluster cannot be reached. The full description of the &lt;code&gt;user&lt;/code&gt; commands is in &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;chapter 07&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;send-an-accounting-request&#34;&gt;Send an accounting request&#xA;&lt;/h2&gt;&lt;p&gt;Use &lt;code&gt;acct-start&lt;/code&gt; to send an Accounting-Request (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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --load acct-start,concurrency=1 --requests 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;measured 0.001 s after 0.000 s of warmup&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;acct-start (fixed-concurrency): concurrency 1, 1 threads, 1 sockets, busiest worker 3%&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  acct-start: 1598/s, sent 1, accept 0, reject 0, challenge 0, accounting 1, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    latency us: p50 610.8, p90 610.8, p99 610.8, p99.9 610.8, max 610.8&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;accounting 1&lt;/code&gt; means an Accounting-Response came back: &lt;code&gt;accounting.lua&lt;/code&gt; wrote the request to the &lt;code&gt;accounting&lt;/code&gt; table and returned &lt;code&gt;accept&lt;/code&gt;, and only then did the server respond.&lt;/p&gt;&#xA;&lt;p&gt;Use &lt;code&gt;session list&lt;/code&gt; to see the online sessions:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd session list --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;username=alice&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nas=192.0.2.1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;session_id=2110000000000000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;started=1795365534&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;updated=1795365534&#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;nas&lt;/code&gt; is the &lt;code&gt;NAS-IP-Address&lt;/code&gt; that the NAS reported in the request. &lt;code&gt;rradius-bench&lt;/code&gt; uses &lt;code&gt;192.0.2.1&lt;/code&gt; by default.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;session_id&lt;/code&gt; is the Acct-Session-Id that &lt;code&gt;rradius-bench&lt;/code&gt; generated. Every run of &lt;code&gt;rradius-bench run&lt;/code&gt; generates a new session ID.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;started&lt;/code&gt; and &lt;code&gt;updated&lt;/code&gt; are Unix times.&lt;/li&gt;&#xA;&lt;li&gt;To see only one user: &lt;code&gt;session show --config rradius.toml alice&lt;/code&gt;. For JSON output, add &lt;code&gt;--json&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The SQL in &lt;code&gt;[sessions]&lt;/code&gt; decides what &amp;ldquo;online&amp;rdquo; means. This scenario counts a session as online if it has no Stop yet and was updated within the last 15 minutes. So this Start disappears from the list by itself after 15 minutes, even if no Stop arrives.&lt;/p&gt;&#xA;&lt;p&gt;To see the whole life of a session, use the &lt;code&gt;session&lt;/code&gt; load. It sends a login, a Start and a Stop in order, all with the same session ID:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user dave --password dave-password --load session,concurrency=1 --requests 1&#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;  pap: 26/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;  acct-start: 26/s, sent 1, accept 0, reject 0, challenge 0, accounting 1, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;  acct-stop: 26/s, sent 1, accept 0, reject 0, challenge 0, accounting 1, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;$ rradiusd session show --config rradius.toml dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;no sessions for dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;After the Stop, the session is no longer in the list, and the exit code of &lt;code&gt;session show&lt;/code&gt; is 1.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you run &lt;code&gt;acct-start&lt;/code&gt; and &lt;code&gt;acct-stop&lt;/code&gt; as two separate runs, the Stop carries a different session ID and cannot end the session that the earlier Start created. To test Start to Stop, use the &lt;code&gt;session&lt;/code&gt; load.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;How to design the accounting tables, how to write the script, and the accounting spool used when the database fails are all in &lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;chapter 13&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;check-server-status&#34;&gt;Check server status&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;status&lt;/code&gt; reads the metrics port and summarizes it on one page:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd status --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius status of 127.0.0.1:9812 over 1.0 s&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Node&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Ready                     ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Leader                    1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Has a leader              1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Caught up                 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Applied index             11&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Seconds without a leader  0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Version                   0.1.0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Seconds running           12&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&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:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;RADIUS&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Auth requests              0.0/s (7)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Acct requests              0.0/s (3)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Access-Accept              0.0/s (4)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Access-Reject              0.0/s (3)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Access-Challenge           0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Accounting-Response        0.0/s (3)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Duplicates                 0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Discarded: overload        0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Discarded: unknown client  0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Discarded: invalid         0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Discarded: database        0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Discarded: no leader       0.0/s (0)&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;In the &lt;code&gt;Node&lt;/code&gt; section, &lt;code&gt;Ready ok&lt;/code&gt; means the server is ready. On a single node, &lt;code&gt;Leader&lt;/code&gt; is the node itself (node 1).&lt;/li&gt;&#xA;&lt;li&gt;In the &lt;code&gt;RADIUS&lt;/code&gt; section, the number in parentheses is the total since startup, and the number before it is the rate over the last second.&lt;/li&gt;&#xA;&lt;li&gt;The lines that start with &lt;code&gt;Discarded&lt;/code&gt; count requests that got no response. When you troubleshoot, look here first. For example, if the shared secrets do not match, &lt;code&gt;Discarded: invalid&lt;/code&gt; goes up.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;code&gt;status&lt;/code&gt; also has &lt;code&gt;--watch&lt;/code&gt; (keep updating) and &lt;code&gt;--json&lt;/code&gt;. For the meaning of every line, see &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;chapter 17&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;stop-the-server&#34;&gt;Stop the server&#xA;&lt;/h2&gt;&lt;p&gt;In the terminal that runs the server, press Ctrl+C, or send SIGTERM from another terminal. The server&amp;rsquo;s log:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::cli: stopping: /readyz answers 503; requests are answered for 0 ms more, then those being handled are waited for, for at most 5000 ms&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::cli: stopping: no more requests taken&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::cli: stopping: every request taken was answered&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN hiqlite::store::state_machine::sqlite::writer: SQL writer is shutting down&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The stop sequence: &lt;code&gt;/readyz&lt;/code&gt; changes to 503 first; the server stops taking new requests; it waits for the requests being handled to finish, for at most 5000 milliseconds; then it closes the database. The waiting times are set by &lt;code&gt;[shutdown]&lt;/code&gt;; see &lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;chapter 04&lt;/a&gt;. If you press Ctrl+C again during the stop, the server does not wait for the requests being handled.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Let the server close the database itself before it exits. A node that you force to exit with &lt;code&gt;kill -9&lt;/code&gt; may have to rebuild its local database at the next start.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Start it again and the data is still there: &lt;code&gt;migrations/&lt;/code&gt; is not applied again, and &lt;code&gt;dave&lt;/code&gt; can still log in.&lt;/p&gt;&#xA;&lt;p&gt;To start over from scratch, stop the server and delete &lt;code&gt;data/&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rm -rf data&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;At the next start, the database is created again, the migrations are applied again, and the accounts go back to the three demo accounts.&lt;/p&gt;&#xA;&lt;h2 id=&#34;another-starting-point-config-init&#34;&gt;Another starting point: config init&#xA;&lt;/h2&gt;&lt;p&gt;quick-start is a ready-made scenario. If you want to start from a blank file, use &lt;code&gt;config init&lt;/code&gt; to generate a starting configuration:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ mkdir ~/rradius-lab/blank &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; cd ~/rradius-lab/blank&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd config init --lang zh-TW &amp;gt; rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;What this starting configuration contains:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The cluster secret and the shared secret of one example client (&lt;code&gt;127.0.0.1&lt;/code&gt;), both generated randomly.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;dictionary&lt;/code&gt; is the default dictionary location of this version (for a package install, &lt;code&gt;/usr/share/rradius/dictionary&lt;/code&gt;). If the dictionary is somewhere else, change it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;include = [&amp;quot;conf.d/*.toml&amp;quot;]&lt;/code&gt;: the &lt;code&gt;.toml&lt;/code&gt; files in the &lt;code&gt;conf.d/&lt;/code&gt; directory next to it are read as well.&lt;/li&gt;&#xA;&lt;li&gt;About 30 lines in total, with no &lt;code&gt;[[cluster.nodes]]&lt;/code&gt; (a single node). For every section with explanations and commented-out settings that show the defaults, use &lt;code&gt;rradiusd config init --full&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;It has no migrations, no &lt;code&gt;[auth]&lt;/code&gt; and no &lt;code&gt;[accounts]&lt;/code&gt;, and &lt;code&gt;[lua]&lt;/code&gt; points to an &lt;code&gt;auth.lua&lt;/code&gt; that does not exist yet. So running &lt;code&gt;check&lt;/code&gt; on it fails right away. First:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create &lt;code&gt;auth.lua&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;If the dictionary is not at the default location, change &lt;code&gt;dictionary&lt;/code&gt; to the real location.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;To grow this starting configuration into a full one, see &lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;chapter 04&lt;/a&gt; and &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;chapter 07&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;rradius-bench&lt;/code&gt; prints &lt;code&gt;rradius-bench: --load pap: needs concurrency or rate&lt;/code&gt;, exit code 3.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;--load&lt;/code&gt; has only the kind.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Write &lt;code&gt;--load pap,concurrency=1&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The &lt;code&gt;rradius-bench&lt;/code&gt; result is &lt;code&gt;timeouts 1&lt;/code&gt;, and the server log has no authentication record.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The server dropped the request. Most often &lt;code&gt;--secret&lt;/code&gt; does not match the client&amp;rsquo;s shared secret. It can also be that the server is not running, or the address or port is wrong.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Make sure &lt;code&gt;--secret &amp;quot;$(cat localhost.secret)&amp;quot;&lt;/code&gt; reads the same file. When the shared secrets do not match, &lt;code&gt;Discarded: invalid&lt;/code&gt; in &lt;code&gt;status&lt;/code&gt; goes up.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;user add&lt;/code&gt; prints &lt;code&gt;accounts.add is not set in rradius.toml&lt;/code&gt;, exit code 2.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The configuration file has no &lt;code&gt;[accounts]&lt;/code&gt;, or &lt;code&gt;[accounts]&lt;/code&gt; has no &lt;code&gt;add&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add &lt;code&gt;[accounts]&lt;/code&gt; as described in &lt;a class=&#34;link&#34; href=&#34;#make-the-user-commands-work&#34; &gt;Make the user commands work&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;user add&lt;/code&gt; prints &lt;code&gt;Connect: Error code 1555: constraint failed Some(&amp;quot;UNIQUE constraint failed: users.username&amp;quot;)&lt;/code&gt;, exit code 1.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The account already exists.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; To change the password, use &lt;code&gt;user passwd&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;user show&lt;/code&gt; prints &lt;code&gt;no account nobody&lt;/code&gt;, exit code 1.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; There is no such account.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Check the name. For &lt;code&gt;session show&lt;/code&gt;, the matching message is &lt;code&gt;no sessions for &amp;lt;name&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;user add&lt;/code&gt; hangs for 30 seconds and finally prints &lt;code&gt;the cluster did not answer within 30 s&lt;/code&gt;, exit code 3. While it waits, there are several &lt;code&gt;Error looking up DB metrics&lt;/code&gt; lines.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The server is not running, so the command cannot reach the cluster&amp;rsquo;s API port.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Start the server first.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;status&lt;/code&gt; prints &lt;code&gt;cannot reach the metrics port at 127.0.0.1:9812: Connection refused (os error 61)&lt;/code&gt;, exit code 3.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The server is not running, or the configuration has no &lt;code&gt;[metrics]&lt;/code&gt;. The error number depends on the operating system.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Start the server first, and make sure &lt;code&gt;[metrics]&lt;/code&gt; exists.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;cannot read dictionary: No such file or directory (os error 2)&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; You did not change &lt;code&gt;dictionary&lt;/code&gt; after copying the scenario, so the relative path points to a place that does not exist.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change it to the absolute path of the dictionary as described in &lt;a class=&#34;link&#34; href=&#34;#prepare-a-working-directory&#34; &gt;Prepare a working directory&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; With the &lt;code&gt;config init&lt;/code&gt; starting configuration, &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;cannot read script &#39;auth.lua&#39;: No such file or directory (os error 2)&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The script that &lt;code&gt;[lua]&lt;/code&gt; in the starting configuration points to has not been created.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Create &lt;code&gt;auth.lua&lt;/code&gt;. The configuration must have &lt;code&gt;[lua]&lt;/code&gt;; without it you get &lt;code&gt;the [lua] section is required&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;at least one of [radius] or [tacacs] must be configured&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The configuration file has neither &lt;code&gt;[radius]&lt;/code&gt; nor &lt;code&gt;[tacacs]&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add at least one (chapter 05, chapter 12).&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../02-install/&#34; &gt;02 Installation&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04 Configuration file basics&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05 RADIUS service and NAS clients&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;10 Writing policies in Lua&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13 Accounting and sessions&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;19 Performance tuning and load testing&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>04 Configuration file basics</title>
            <link>https://embark.systems/en/rradius/oss/04-configuration/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/04-configuration/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Read the structure of the configuration file and know which sections are required&lt;/li&gt;&#xA;&lt;li&gt;Split the configuration into several files with &lt;code&gt;include&lt;/code&gt;, and keep secrets in files with the right permissions&lt;/li&gt;&#xA;&lt;li&gt;Check and inspect the configuration with &lt;code&gt;check&lt;/code&gt;, &lt;code&gt;config show&lt;/code&gt;, &lt;code&gt;config diff&lt;/code&gt; and &lt;code&gt;schema&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Reload the configuration with SIGHUP, and tell which changes need a restart&lt;/li&gt;&#xA;&lt;li&gt;Decide how the server stops with &lt;code&gt;[shutdown]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: you have done &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;chapter 03&lt;/a&gt; and have a &lt;code&gt;rradiusd&lt;/code&gt; that starts. Every command in this chapter runs in one working directory. You do not need a real NAS.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#structure-of-the-configuration-file&#34; &gt;Structure of the configuration file&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#a-configuration-from-scratch&#34; &gt;A configuration from scratch&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#relative-paths&#34; &gt;Relative paths&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#splitting-the-configuration-into-several-files&#34; &gt;Splitting the configuration into several files&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#keeping-secrets-in-files&#34; &gt;Keeping secrets in files&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#checking-the-configuration-check&#34; &gt;Checking the configuration: check&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#viewing-the-effective-configuration-config-show&#34; &gt;Viewing the effective configuration: config show&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#comparing-two-configurations-config-diff&#34; &gt;Comparing two configurations: config diff&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#looking-up-setting-keys-schema&#34; &gt;Looking up setting keys: schema&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#applying-changes-without-downtime-reload&#34; &gt;Applying changes without downtime: reload&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#stopping-the-server-shutdown&#34; &gt;Stopping the server: shutdown&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#runtime-and-log&#34; &gt;runtime and log&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;structure-of-the-configuration-file&#34;&gt;Structure of the configuration file&#xA;&lt;/h2&gt;&lt;p&gt;rradius has one main configuration file, in TOML format. Commands take its path with &lt;code&gt;--config &amp;lt;path&amp;gt;&lt;/code&gt;. Without &lt;code&gt;--config&lt;/code&gt; they read &lt;code&gt;/etc/rradius/rradius.toml&lt;/code&gt; (the second line of &lt;code&gt;rradiusd --version&lt;/code&gt; prints this default path).&lt;/p&gt;&#xA;&lt;p&gt;TOML opens a table with &lt;code&gt;[table-name]&lt;/code&gt;, adds one entry to an array of tables with &lt;code&gt;[[table-name]]&lt;/code&gt;, and a table holds &lt;code&gt;key = value&lt;/code&gt; lines. The rradius configuration has the top-level keys and tables below. The list matches the top-level &lt;code&gt;properties&lt;/code&gt; in the output of &lt;code&gt;rradiusd schema&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;Key or table&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Purpose&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Main 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;code&gt;dictionary&lt;/code&gt;&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;Path of the main dictionary file; when absent, the default dictionary path is used (&lt;code&gt;/usr/share/rradius/dictionary&lt;/code&gt; for the package)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;06&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;include&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Other configuration files to read along with this one&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;This chapter&lt;/td&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;Yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The top-level Lua script and its resource limits&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#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;&lt;code&gt;[cluster]&lt;/code&gt;&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;The built-in cluster database; a single server needs it too&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#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;&lt;code&gt;[radius]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;At least one of this and &lt;code&gt;[tacacs]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RADIUS listeners and clients&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05&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;[tacacs]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;At least one of this and &lt;code&gt;[radius]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+ listeners and clients&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#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;&lt;code&gt;[auth]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The auth chain&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07&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;[accounts]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SQL run by the &lt;code&gt;user&lt;/code&gt; command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07&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;[sessions]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SQL run by the &lt;code&gt;session&lt;/code&gt; command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#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;&lt;code&gt;[databases.&amp;lt;name&amp;gt;]&lt;/code&gt;, &lt;code&gt;[queries.&amp;lt;name&amp;gt;]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;External databases and named queries&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09&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;[metrics]&lt;/code&gt;, &lt;code&gt;[log]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;HTTP port for metrics and health checks, and logging&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#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;&lt;code&gt;[runtime]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Worker thread settings&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../19-performance/&#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;&lt;code&gt;[shutdown]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wait times when stopping&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;This chapter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;A few rules you must know:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Every table rejects unknown keys.&lt;/strong&gt; When you mistype a key, &lt;code&gt;check&lt;/code&gt; names the file and line and lists the keys that table accepts. See &lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The server does not start without the required parts.&lt;/strong&gt; Without &lt;code&gt;[lua]&lt;/code&gt; you get &lt;code&gt;the [lua] section is required&lt;/code&gt;. Without &lt;code&gt;[cluster]&lt;/code&gt; you get &lt;code&gt;the [cluster] section is required&lt;/code&gt;. With neither &lt;code&gt;[radius]&lt;/code&gt; nor &lt;code&gt;[tacacs]&lt;/code&gt; you get &lt;code&gt;at least one of [radius] or [tacacs] must be configured&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A service exists only if its section exists.&lt;/strong&gt; Without &lt;code&gt;[tacacs]&lt;/code&gt; the TACACS+ port is not opened. Without &lt;code&gt;[metrics]&lt;/code&gt; there is no &lt;code&gt;/metrics&lt;/code&gt; or &lt;code&gt;/readyz&lt;/code&gt;, and the &lt;code&gt;status&lt;/code&gt; command has nothing to read.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Error messages never print values.&lt;/strong&gt; A value of the wrong type may be a password that lacks its quotes, so the message gives only the line number and the key name.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The type, default and reload behavior of every key are listed in full in &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt;. Each table in this chapter also states its defaults and its reload behavior.&lt;/p&gt;&#xA;&lt;h2 id=&#34;a-configuration-from-scratch&#34;&gt;A configuration from scratch&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; build a single-server configuration that starts and keeps all its secrets in files. The other sections of this chapter use it for their examples.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;rradiusd config init&lt;/code&gt; prints a minimal template of about 30 lines with randomly generated passwords, with English comments. &lt;code&gt;rradiusd config init --full&lt;/code&gt; prints the full version, where every section has an explanation (settings that are commented out show their defaults); add &lt;code&gt;--lang zh-TW&lt;/code&gt; to either command to get the comments in Traditional Chinese; it is a good way to find out which keys exist. You need to change one thing yourself: the template writes the cluster passwords and the shared secret of the example client directly in the file. This manual puts them in files that &lt;code&gt;*_file&lt;/code&gt; points to (see &lt;a class=&#34;link&#34; href=&#34;#keeping-secrets-in-files&#34; &gt;Keeping secrets in files&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;The version below is tidied up. Create a working directory and put these files in it:&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:#75715e&#34;&gt;# rradius.toml&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;dictionary&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/usr/share/rradius/dictionary&amp;#34;&lt;/span&gt;   &lt;span style=&#34;color:#75715e&#34;&gt;# where the dictionary really is, see chapter 06&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;include&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;conf.d/*.toml&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;lua&lt;/span&gt;]&#xA;&lt;/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;auth.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;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;data_dir&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;data&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_raft_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;raft.secret&amp;#34;&lt;/span&gt;   &lt;span style=&#34;color:#75715e&#34;&gt;# openssl rand -hex 32 &amp;gt; raft.secret&lt;/span&gt;&#xA;&lt;/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_api_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;api.secret&amp;#34;&lt;/span&gt;     &lt;span style=&#34;color:#75715e&#34;&gt;# openssl rand -hex 32 &amp;gt; api.secret&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;metrics&lt;/span&gt;]&#xA;&lt;/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;127.0.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;port&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;9812&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;]&#xA;&lt;/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;127.0.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;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;/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-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# conf.d/10-clients.toml&lt;/span&gt;&#xA;&lt;/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;localhost&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;127.0.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;localhost.secret&amp;#34;&lt;/span&gt;   &lt;span style=&#34;color:#75715e&#34;&gt;# openssl rand -hex 32 &amp;gt; localhost.secret&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;auth.lua&lt;/code&gt; is the top-level script. This configuration has no &lt;code&gt;[auth]&lt;/code&gt;, so the script alone decides every login. Start with a script that recognizes one demo account. How to write scripts is covered in &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;chapter 10&lt;/a&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-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;-- auth.lua&lt;/span&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; protocol &lt;span style=&#34;color:#f92672&#34;&gt;~=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;radius&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;  &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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; phase &lt;span style=&#34;color:#f92672&#34;&gt;~=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;authentication&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;  &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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Name&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;alice&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;and&lt;/span&gt; get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Password&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;alice-password&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;  &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;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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Generate the secret files, tighten their permissions, then check:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; f in raft api localhost; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; openssl rand -hex &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt; &amp;gt; $f.secret; &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;$ chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;600&lt;/span&gt; *.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This configuration has no &lt;code&gt;[[cluster.nodes]]&lt;/code&gt;, so it is a cluster of one node. The two cluster ports, Raft and API, use the defaults &lt;code&gt;127.0.0.1:8100&lt;/code&gt; and &lt;code&gt;127.0.0.1:8200&lt;/code&gt; and listen on the local machine only. Cluster settings are covered in &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;chapter 16&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;relative-paths&#34;&gt;Relative paths&#xA;&lt;/h2&gt;&lt;p&gt;Every relative path in the configuration is resolved against the &lt;strong&gt;directory of the main configuration file&lt;/strong&gt;, not against the directory you run the command from. If the configuration above lives in &lt;code&gt;/etc/rradius/rradius.toml&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;Setting&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Value you write&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;File actually read&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;lua.script&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;auth.lua&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/etc/rradius/auth.lua&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;cluster.data_dir&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;data&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/etc/rradius/data&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;cluster.secret_raft_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;raft.secret&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/etc/rradius/raft.secret&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;radius.clients[].secret_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;localhost.secret&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/etc/rradius/localhost.secret&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;An absolute path (one that starts with &lt;code&gt;/&lt;/code&gt;) is used as written.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Files read through &lt;code&gt;include&lt;/code&gt; work the same way: a relative path inside them is resolved against the directory of the &lt;strong&gt;main configuration file&lt;/strong&gt;, not the directory of the included file itself. The &lt;code&gt;conf.d/10-clients.toml&lt;/code&gt; above has &lt;code&gt;secret_file = &amp;quot;localhost.secret&amp;quot;&lt;/code&gt;; it reads the &lt;code&gt;localhost.secret&lt;/code&gt; next to the main file, not &lt;code&gt;conf.d/localhost.secret&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;splitting-the-configuration-into-several-files&#34;&gt;Splitting the configuration into several files&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; keep the settings that change often, such as clients and the auth chain, in files of their own, so you do not touch the main file each time. This also lets a configuration management tool deploy one file at a time.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Configure:&lt;/strong&gt; put &lt;code&gt;include&lt;/code&gt; at the top level of the main file and list the files to read along with it. The template from &lt;code&gt;config init&lt;/code&gt; already has this line:&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:#75715e&#34;&gt;# rradius.toml (excerpt)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;include&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;conf.d/*.toml&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;# … (other settings omitted)&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;include&lt;/code&gt; has no default; without it only the main file is read. It is read together with the main file, so a reload applies it. Then put files in &lt;code&gt;conf.d/&lt;/code&gt;. Every file must begin with a 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:#75715e&#34;&gt;# conf.d/20-lab.toml&lt;/span&gt;&#xA;&lt;/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-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;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;192.0.2.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.secret&amp;#34;&lt;/span&gt;   &lt;span style=&#34;color:#75715e&#34;&gt;# openssl rand -hex 32 &amp;gt; lab.secret&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;Verify:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ openssl rand -hex &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt; &amp;gt; lab.secret &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;600&lt;/span&gt; lab.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd config show --config rradius.toml | grep -A3 &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;radius.clients&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[radius.clients]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;name = &amp;#34;localhost&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;address = &amp;#34;127.0.0.1&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;secret_file = &amp;#34;localhost.secret&amp;#34;&#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;[[radius.clients]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;name = &amp;#34;lab-net&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;address = &amp;#34;192.0.2.0/24&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;secret_file = &amp;#34;lab.secret&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;What you should see:&lt;/strong&gt; &lt;code&gt;config show&lt;/code&gt; prints the contents of all files merged together. Both clients are there, the one from &lt;code&gt;10-&lt;/code&gt; first and the one from &lt;code&gt;20-&lt;/code&gt; after it.&lt;/p&gt;&#xA;&lt;p&gt;The rules for reading files (based on &lt;code&gt;config.rs&lt;/code&gt;):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The effect is as if the included files were appended to the main file in order, and the whole were read as one TOML document.&lt;/li&gt;&#xA;&lt;li&gt;A name can be a single file (&lt;code&gt;&amp;quot;clients.toml&amp;quot;&lt;/code&gt;), or it can use the wildcards &lt;code&gt;*&lt;/code&gt; and &lt;code&gt;?&lt;/code&gt;. Wildcards may appear only in the file name, the last component: &lt;code&gt;&amp;quot;conf.d/*.toml&amp;quot;&lt;/code&gt; works, &lt;code&gt;&amp;quot;*.d/*.toml&amp;quot;&lt;/code&gt; does not.&lt;/li&gt;&#xA;&lt;li&gt;The files that one name matches are sorted by path. Use file names that start with a number, such as &lt;code&gt;10-&lt;/code&gt; and &lt;code&gt;20-&lt;/code&gt;, to control the order.&lt;/li&gt;&#xA;&lt;li&gt;A wildcard does not match file names that start with &lt;code&gt;.&lt;/code&gt;, so temporary files left by editors are not read by mistake.&lt;/li&gt;&#xA;&lt;li&gt;A name with a wildcard that matches no file (for example when &lt;code&gt;conf.d/&lt;/code&gt; is empty or does not exist) is not an error. A name without a wildcard must be a readable file, or loading fails.&lt;/li&gt;&#xA;&lt;li&gt;A file matched by two names is read once. The main file itself is skipped.&lt;/li&gt;&#xA;&lt;li&gt;At most 1000 files, and each file at most 1048576 bytes (1 MiB).&lt;/li&gt;&#xA;&lt;li&gt;An included file cannot contain &lt;code&gt;include&lt;/code&gt; itself, and its first line that is not blank or a comment must be a &lt;code&gt;[table]&lt;/code&gt; or &lt;code&gt;[[array-of-tables]]&lt;/code&gt; header.&lt;/li&gt;&#xA;&lt;li&gt;Each file must be complete TOML on its own: an unclosed string in one file does not swallow the next file.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The same table cannot appear in two files.&lt;/strong&gt; If the main file already has &lt;code&gt;[radius]&lt;/code&gt;, no file in &lt;code&gt;conf.d/&lt;/code&gt; can have &lt;code&gt;[radius]&lt;/code&gt; again, or you get &lt;code&gt;duplicate key&lt;/code&gt;. Arrays of tables are not subject to this: &lt;code&gt;[[radius.clients]]&lt;/code&gt; can be spread over several files and is added in file order.&lt;/li&gt;&#xA;&lt;li&gt;For TOML syntax errors and type errors, the message names the file and the line number in that file, not a line number in the merged text. Checks that run after the merge (for example the client checks) start with the name of the main configuration file and have no line number. When such a message contains a name in single quotes (for example &lt;code&gt;&#39;core&#39;&lt;/code&gt;), it is followed by &lt;code&gt;(in &amp;lt;file&amp;gt; line &amp;lt;line&amp;gt;)&lt;/code&gt;, which lists the lines that have this name as a quoted string (at most three, the rest shown as &lt;code&gt;and N more&lt;/code&gt;). Lines of the main file are listed too, so when a name is duplicated you see both places. It is added only when at least one of the lines found is in an included file; when the name is only in the main file, or is not found, the message is the same as without &lt;code&gt;include&lt;/code&gt;. The match is by name, so when the name also appears in another setting value, one extra place is listed. See &lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;chapter 05&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; Included files can decide who may log in. When the file itself, or the directory it is in, can be written by its group or by others, &lt;code&gt;check&lt;/code&gt;, startup and every reload print a warning, for example &lt;code&gt;included configuration file conf.d/20-lab.toml can be written by its group or by others, which lets them change who may log in&lt;/code&gt;. It is only a warning and the configuration is still read. When you see it, change the permissions so that only the owner can write.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; After you move all clients into &lt;code&gt;conf.d/&lt;/code&gt;, an empty directory or a file name that does not match is not an error for the wildcard, but the result is a &lt;code&gt;[radius]&lt;/code&gt; with no clients, and &lt;code&gt;check&lt;/code&gt; fails: &lt;code&gt;[radius] is enabled but has no [[radius.clients]] entries&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;keeping-secrets-in-files&#34;&gt;Keeping secrets in files&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; you can show the configuration file to colleagues or keep it in version control without the secrets going with it.&lt;/p&gt;&#xA;&lt;p&gt;Many secrets have two forms: write the value directly, or point to a file with &lt;code&gt;*_file&lt;/code&gt;. Exactly one of the two must be set. For example, when a client&amp;rsquo;s &lt;code&gt;secret&lt;/code&gt; and &lt;code&gt;secret_file&lt;/code&gt; are both set or both missing, &lt;code&gt;check&lt;/code&gt; fails: &lt;code&gt;exactly one of secret or secret_file must be set&lt;/code&gt;. The examples in this manual always use files.&lt;/p&gt;&#xA;&lt;p&gt;The secret files that the core edition reads:&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;Content&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Main 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;code&gt;radius.clients[].secret_file&lt;/code&gt;, &lt;code&gt;tacacs.clients[].secret_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The shared secret of a client&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05&lt;/a&gt;, &lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#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;&lt;code&gt;cluster.secret_raft_file&lt;/code&gt;, &lt;code&gt;cluster.secret_api_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The passwords of the two cluster ports&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#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;&lt;code&gt;databases.&amp;lt;name&amp;gt;.password_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The password of an external database&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09&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;auth.handlers[ldap].bind_password_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The password of the LDAP service account&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;08&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;auth.handlers[netlogon].machine_password_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The password of the domain computer account&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;08&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;radius.eap.key_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The private key of the EAP server certificate&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;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;Generate a random shared secret and tighten its permissions:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ openssl rand -hex &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt; &amp;gt; nas1.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;600&lt;/span&gt; nas1.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Rules:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;For a client&amp;rsquo;s &lt;code&gt;secret_file&lt;/code&gt;, trailing newlines (&lt;code&gt;\n&lt;/code&gt;, &lt;code&gt;\r&lt;/code&gt;) are removed, so a file written with &lt;code&gt;echo&lt;/code&gt; or an editor works. An empty file (or one with only newlines) fails: &lt;code&gt;secret_file &#39;nas1.secret&#39; is empty&lt;/code&gt;. A file that cannot be read fails: &lt;code&gt;cannot read secret_file &#39;nas1.secret&#39;: No such file or directory (os error 2)&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Permission warning:&lt;/strong&gt; when a file in the table above gives &amp;ldquo;others&amp;rdquo; any permission, or lets the &amp;ldquo;group&amp;rdquo; write (any bit of &lt;code&gt;0o027&lt;/code&gt; is set in the mode), startup, &lt;code&gt;check&lt;/code&gt; and every reload each log one warning, and the file is used anyway. &lt;code&gt;0600&lt;/code&gt;, &lt;code&gt;0640&lt;/code&gt; and &lt;code&gt;0400&lt;/code&gt; do not warn; &lt;code&gt;0644&lt;/code&gt;, &lt;code&gt;0660&lt;/code&gt; and &lt;code&gt;0666&lt;/code&gt; do. The warning gives only the setting name, the path and the mode, never the content:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::common::seal: secret_file: &amp;#39;lab.secret&amp;#39; has mode 644, which others can reach or its group can write; make it 0600 or 0640&#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;Shared secret too short:&lt;/strong&gt; a secret shorter than 16 bytes gives the warning &lt;code&gt;RADIUS client &#39;lab-net&#39; has a shared secret shorter than 16 octets; use at least 24 random octets&lt;/code&gt;. TACACS+ clients are the same, with the message starting &lt;code&gt;TACACS+ client&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example secret in use:&lt;/strong&gt; every secret shipped with the examples contains &lt;code&gt;change-me&lt;/code&gt;. A client shared secret or a cluster secret that contains it (case-insensitive) gives a warning. For a client it is &lt;code&gt;RADIUS client &#39;lab-net&#39; has the public shared secret shipped with the examples; replace it with a random one, for example from `openssl rand -hex 32` &lt;/code&gt;, and for the cluster secret it is &lt;code&gt;cluster.secret_raft is the public value shipped with the examples; …&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;All three are only warnings and do not stop startup. They do appear in the output of &lt;code&gt;check&lt;/code&gt;, so a quick look before going live catches them.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The package version that runs under systemd runs as the &lt;code&gt;rradius&lt;/code&gt; user. With permissions at &lt;code&gt;0600&lt;/code&gt;, the owner of the file must be &lt;code&gt;rradius&lt;/code&gt;; or let root own the file, with group &lt;code&gt;rradius&lt;/code&gt; and permissions &lt;code&gt;0640&lt;/code&gt;. For the install paths and the user, see &lt;a class=&#34;link&#34; href=&#34;../02-install/&#34; &gt;chapter 02&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;checking-the-configuration-check&#34;&gt;Checking the configuration: check&#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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0&#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; runs the part of startup that reads the configuration: it reads the configuration file and every included file, reads the secret files, reads the dictionary, compiles the top-level script, reads the migration directory, checks the auth chain and the &lt;code&gt;[lua.http]&lt;/code&gt; settings, checks the accounting spool directory, and finally prints the shared-secret warnings. It &lt;strong&gt;opens no port, creates no data directory and connects to no host&lt;/strong&gt;, so it is safe to run on a production machine while the server is running.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Everything passes: stdout shows &lt;code&gt;configuration ok&lt;/code&gt; and the exit code is 0. Warnings (permissions, short secrets and so on) go to stderr and do not change the exit code.&lt;/li&gt;&#xA;&lt;li&gt;An error: stderr shows the reason and the exit code is 2. The message starts with the file where the error is, and adds the line number when it can find one.&lt;/li&gt;&#xA;&lt;li&gt;A wrong argument (for example &lt;code&gt;check --config a.toml extra&lt;/code&gt;): it prints &lt;code&gt;usage: rradiusd check [--config &amp;lt;path&amp;gt;]&lt;/code&gt; and the exit code is 2.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;What &lt;code&gt;check&lt;/code&gt; does not find: a port that another program already uses, other cluster nodes that cannot be reached, and wrong credentials for an external database or LDAP server. For these, read the log after startup.&lt;/p&gt;&#xA;&lt;p&gt;The recommended flow for changing the configuration: edit the file, run &lt;code&gt;check&lt;/code&gt;, look at the differences with &lt;code&gt;config diff&lt;/code&gt;, reload or restart, then read the result line in the log.&lt;/p&gt;&#xA;&lt;h2 id=&#34;viewing-the-effective-configuration-config-show&#34;&gt;Viewing the effective configuration: config show&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;config show&lt;/code&gt; reads the configuration the way the server does, fills in the defaults for the keys you did not write, and prints the whole thing. Below is the result for &lt;a class=&#34;link&#34; href=&#34;#a-configuration-from-scratch&#34; &gt;A configuration from scratch&lt;/a&gt; plus &lt;code&gt;conf.d/20-lab.toml&lt;/code&gt; (&lt;code&gt;…&lt;/code&gt; stands for two omitted lines of settings that have no effect in the core edition, see &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd config show --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# computed on this machine: radius.sockets &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 1, cluster.read_connections &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;28&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dictionary = &amp;#34;/usr/share/rradius/dictionary&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;include = [&amp;#34;conf.d/*.toml&amp;#34;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[lua]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;script = &amp;#34;auth.lua&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;max_execution_ms = 1000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;max_memory_mb = 256&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;query_timeout_ms = 5000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[cluster]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;data_dir = &amp;#34;data&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;secret_raft_file = &amp;#34;raft.secret&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;secret_api_file = &amp;#34;api.secret&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;migrations_wait_ms = 60000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node_id = 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;read_connections = 28&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;snapshot_every = 100000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[metrics]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;bind = &amp;#34;127.0.0.1&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;port = 9812&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[radius]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;bind = &amp;#34;127.0.0.1&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;auth_port = 1812&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;acct_port = 1813&#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;limit_proxy_state = &amp;#34;yes&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;max_acct_inflight = 4096&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;max_auth_inflight = 4096&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;require_message_authenticator = &amp;#34;yes&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;status_server = true&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sockets = 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[radius.clients]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;name = &amp;#34;localhost&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;address = &amp;#34;127.0.0.1&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;secret_file = &amp;#34;localhost.secret&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[[radius.clients]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;name = &amp;#34;lab-net&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;address = &amp;#34;192.0.2.0/24&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;secret_file = &amp;#34;lab.secret&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[shutdown]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ready_delay_ms = 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;drain_ms = 5000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;The comment on the first line lists the defaults computed for this machine. For example, &lt;code&gt;radius.sockets&lt;/code&gt; and &lt;code&gt;cluster.read_connections&lt;/code&gt; depend on the number of CPUs and may differ on another machine.&lt;/li&gt;&#xA;&lt;li&gt;The main file and all included files are printed together.&lt;/li&gt;&#xA;&lt;li&gt;A secret written directly in the configuration is printed as &lt;code&gt;&amp;lt;hidden&amp;gt;&lt;/code&gt;; for &lt;code&gt;*_file&lt;/code&gt;, only the path is printed, not the content of the file.&lt;/li&gt;&#xA;&lt;li&gt;Sections that have defaults (for example &lt;code&gt;[shutdown]&lt;/code&gt; here) are printed even when you did not write them. Optional sections (for example &lt;code&gt;[log]&lt;/code&gt; and &lt;code&gt;[auth]&lt;/code&gt;) do not appear when you did not write them.&lt;/li&gt;&#xA;&lt;li&gt;When the configuration has an error, &lt;code&gt;config show&lt;/code&gt; prints the error as &lt;code&gt;check&lt;/code&gt; does, and the exit code is 2.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;When you want to know what a key is right now, this is the most accurate way: it uses the same configuration-reading code as the server.&lt;/p&gt;&#xA;&lt;h2 id=&#34;comparing-two-configurations-config-diff&#34;&gt;Comparing two configurations: config diff&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; before a reload or a deployment, confirm what exactly changed this time; or compare the configuration of two nodes in a cluster.&lt;/p&gt;&#xA;&lt;p&gt;Below, the whole configuration (including &lt;code&gt;conf.d/&lt;/code&gt; and the secret files) is copied to a &lt;code&gt;new/&lt;/code&gt; directory, and four things are changed: &lt;code&gt;auth_port&lt;/code&gt; becomes 1822, &lt;code&gt;drain_ms = 10000&lt;/code&gt; is added to &lt;code&gt;[shutdown]&lt;/code&gt;, &lt;code&gt;listen = &amp;quot;127.0.0.2&amp;quot;&lt;/code&gt; is added to &lt;code&gt;[cluster]&lt;/code&gt;, and the &lt;code&gt;secret_file&lt;/code&gt; of &lt;code&gt;localhost&lt;/code&gt; is replaced by a &lt;code&gt;secret&lt;/code&gt; written directly.&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd config diff rradius.toml new/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radius.auth_port: 1812 | 1822&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radius.clients[localhost].secret: differs (hidden)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radius.clients[localhost].secret_file: &amp;#34;localhost.secret&amp;#34; | (absent)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;shutdown.drain_ms: 5000 | 10000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node-specific:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  cluster.listen: (absent) | &amp;#34;127.0.0.2&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd config diff rradius.toml rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;no differences&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;Both configurations get their defaults filled in before the comparison, so &amp;ldquo;not written&amp;rdquo; and &amp;ldquo;written with the default value&amp;rdquo; are not a difference.&lt;/li&gt;&#xA;&lt;li&gt;Each line is &lt;code&gt;key: left value | right value&lt;/code&gt;; when one side lacks the key, it shows &lt;code&gt;(absent)&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;For secrets it says only &lt;code&gt;differs (hidden)&lt;/code&gt; and prints no value. For &lt;code&gt;*_file&lt;/code&gt; it compares the path, not the content of the file: if you change the content of a shared secret file, &lt;code&gt;config diff&lt;/code&gt; does not see it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;radius.clients&lt;/code&gt; and &lt;code&gt;tacacs.clients&lt;/code&gt; are paired by the client&amp;rsquo;s &lt;code&gt;name&lt;/code&gt; (by &lt;code&gt;address&lt;/code&gt; when there is no &lt;code&gt;name&lt;/code&gt;), not by order, so reordering clients or moving them to another file shows no difference.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;cluster.node_id&lt;/code&gt; and &lt;code&gt;cluster.listen&lt;/code&gt; are meant to differ on every node, so they are listed at the end under &lt;code&gt;node-specific:&lt;/code&gt; and do not affect the exit code.&lt;/li&gt;&#xA;&lt;li&gt;Exit codes: 0 when there are no differences, 1 when there are, 2 when either configuration has an error. When there are only &lt;code&gt;node-specific&lt;/code&gt; differences, it prints &lt;code&gt;no differences&lt;/code&gt; first, then lists them, and the exit code is 0.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;looking-up-setting-keys-schema&#34;&gt;Looking up setting keys: schema&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;schema&lt;/code&gt; prints the JSON Schema of the configuration file: the type, default and description of every table and key. &lt;code&gt;--lang zh-TW&lt;/code&gt; prints the descriptions in Chinese; with no option or with &lt;code&gt;--lang en&lt;/code&gt; they are in English:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd schema --lang zh-TW &amp;gt; schema.json&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ jq -r &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;.properties | keys | join(&amp;#34; &amp;#34;)&amp;#39;&lt;/span&gt; schema.json&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;accounts auth cluster databases dictionary include log lua metrics queries radius runtime sessions shutdown tacacs&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ jq &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;.properties.shutdown.anyOf[0].properties.drain_ms&amp;#39;&lt;/span&gt; schema.json&#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;  &amp;#34;default&amp;#34;: 5000,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &amp;#34;description&amp;#34;: &amp;#34;停止接收新請求後，最多等處理中的請求多久，毫秒。&amp;#34;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &amp;#34;format&amp;#34;: &amp;#34;uint64&amp;#34;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &amp;#34;minimum&amp;#34;: 0,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &amp;#34;type&amp;#34;: [&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;#34;integer&amp;#34;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;#34;null&amp;#34;&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;This schema is generated from the code that reads the configuration, so it is updated whenever the program is. When the manual and the schema disagree, trust the output of the version you have.&lt;/li&gt;&#xA;&lt;li&gt;An editor that supports JSON Schema can use it to complete key names and check spelling.&lt;/li&gt;&#xA;&lt;li&gt;Defaults that depend on the machine (&lt;code&gt;radius.sockets&lt;/code&gt; and so on) show, in the schema, the value of the machine that built it. For the real value, read &lt;code&gt;config show&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;A wrong language prints &lt;code&gt;usage: rradiusd schema [--lang en|zh-TW]&lt;/code&gt; and the exit code is 2.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;applying-changes-without-downtime-reload&#34;&gt;Applying changes without downtime: reload&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; after you change clients, shared secrets, the auth chain or scripts, make the change take effect without interrupting service.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;How to trigger it:&lt;/strong&gt; send SIGHUP to the server process.&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kill -HUP &amp;lt;pid&amp;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;# the systemd unit sends SIGHUP with ExecReload&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ service rradius reload        &lt;span style=&#34;color:#75715e&#34;&gt;# the FreeBSD rc script&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;What happens:&lt;/strong&gt; the server reads the main file, the included files, the secret files and the scripts again, with the same code it used at startup.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;All or nothing.&lt;/strong&gt; The new configuration is fully built and checked first, and only then swapped in at once. If any step fails, one error line is logged, the server keeps serving with the old configuration, and the process does not exit.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Requests in progress are not affected.&lt;/strong&gt; A request already being handled finishes with the script, auth chain and clients it started with; only later requests use the new ones.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Repeated signals:&lt;/strong&gt; when another SIGHUP arrives during a reload, one more reload runs after this one finishes. A SIGHUP that arrives during startup takes effect once the server begins serving.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The result is one log line&lt;/strong&gt; and never quotes the contents of the configuration file (a line of the file may hold a password).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Verify:&lt;/strong&gt; while the server from &lt;a class=&#34;link&#34; href=&#34;#a-configuration-from-scratch&#34; &gt;A configuration from scratch&lt;/a&gt; is running, add &lt;code&gt;conf.d/20-lab.toml&lt;/code&gt; (see &lt;a class=&#34;link&#34; href=&#34;#splitting-the-configuration-into-several-files&#34; &gt;Splitting the configuration into several files&lt;/a&gt;) and send SIGHUP:&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-console&#34; data-lang=&#34;console&#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;pgrep -f &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;rradiusd serve&amp;#39;&lt;/span&gt;&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;$ curl -s http://127.0.0.1:9812/metrics | grep &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;^rradius_reload&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_reload_total{result=&amp;#34;ok&amp;#34;} 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_reload_total{result=&amp;#34;error&amp;#34;} 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_reload_last_success_timestamp_seconds 1795384713&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The server log:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::reload: configuration reloaded from rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;What you should see:&lt;/strong&gt; a reload has three possible results, and each one is visible:&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;Case&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Log&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Metrics&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;Success, everything applied&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;INFO … configuration reloaded from &amp;lt;file&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_reload_total{result=&amp;quot;ok&amp;quot;}&lt;/code&gt; goes up by 1, and &lt;code&gt;rradius_reload_last_success_timestamp_seconds&lt;/code&gt; is set to the Unix time of this reload&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Success, but some changes need a restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;WARN … configuration reloaded from &amp;lt;file&amp;gt;; these need a restart to apply: &amp;lt;list&amp;gt;&lt;/code&gt;&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;Failure, nothing swapped&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;ERROR … reload failed, keeping the running configuration: &amp;lt;reason&amp;gt;&lt;/code&gt;&lt;/td&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; goes up by 1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The reason for a failure is the same as the message from &lt;code&gt;check&lt;/code&gt;, for example a syntax error in an included file or a script that does not compile:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::reload: reload failed, keeping the running configuration: conf.d/20-lab.toml: line 6: `address`: invalid basic string, expected `&amp;#34;`&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::reload: reload failed, keeping the running configuration: cannot compile script &amp;#39;auth.lua&amp;#39;: syntax error: 11: Expected &amp;lt;eof&amp;gt;, got &amp;#39;retrun&amp;#39;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;After you fix the problem, send SIGHUP again and it is applied. To avoid this, run &lt;code&gt;check&lt;/code&gt; before you reload.&lt;/p&gt;&#xA;&lt;h3 id=&#34;what-reload-applies&#34;&gt;What reload applies&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;The top-level script (&lt;code&gt;lua.script&lt;/code&gt; and its content), &lt;code&gt;query_timeout_ms&lt;/code&gt; and &lt;code&gt;max_execution_ms&lt;/code&gt; in &lt;code&gt;[lua]&lt;/code&gt;, and &lt;code&gt;[lua.http]&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The whole &lt;code&gt;[auth]&lt;/code&gt;: the auth chain, handlers, scripts, &lt;code&gt;[auth.lockout]&lt;/code&gt;, &lt;code&gt;[auth.password_limits]&lt;/code&gt; and so on. Failure counts for lockout stay in the process, and a reload does not clear them.&lt;/li&gt;&#xA;&lt;li&gt;The RADIUS and TACACS+ client lists, including each client&amp;rsquo;s settings and shared secret (secret files are read again). For a removed client, later requests are dropped as coming from an unknown source.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;radius.require_message_authenticator&lt;/code&gt; and &lt;code&gt;radius.limit_proxy_state&lt;/code&gt;. What was learned with &lt;code&gt;auto&lt;/code&gt; is kept after a reload (chapter 05).&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;[radius.eap]&lt;/code&gt; (only new EAP logins use the new settings), &lt;code&gt;enable&lt;/code&gt; and &lt;code&gt;authorize_groups&lt;/code&gt; in &lt;code&gt;[tacacs]&lt;/code&gt;, &lt;code&gt;[log.trace]&lt;/code&gt;, and &lt;code&gt;[shutdown]&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;[radius.accounting_log]&lt;/code&gt; is reopened, which works with log rotation; you can also use it to change the file name (chapter 13).&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;[accounts]&lt;/code&gt; and &lt;code&gt;[sessions]&lt;/code&gt; do not need a reload at all: the &lt;code&gt;user&lt;/code&gt; and &lt;code&gt;session&lt;/code&gt; commands read them each time they run.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;what-needs-a-restart&#34;&gt;What needs a restart&#xA;&lt;/h3&gt;&lt;p&gt;The settings below are not applied on a reload. When one differs from the running value, the &lt;code&gt;WARN&lt;/code&gt; line of the reload lists its name, and all other changes are still applied:&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;Name&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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 path of the dictionary&lt;/td&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.max_memory_mb&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The memory limit of the Lua VM&lt;/td&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;The whole cluster configuration, including migrations&lt;/td&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;code&gt;[log]&lt;/code&gt;, &lt;code&gt;[runtime]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The whole table (except &lt;code&gt;[log.trace]&lt;/code&gt;, which can be reloaded)&lt;/td&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;[databases]&lt;/code&gt;, &lt;code&gt;[queries]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Adding, removing or changing any external database or named query&lt;/td&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.bind&lt;/code&gt;, &lt;code&gt;radius.auth_port&lt;/code&gt;, &lt;code&gt;radius.acct_port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The listening address and ports&lt;/td&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.max_auth_inflight&lt;/code&gt;, &lt;code&gt;radius.max_acct_inflight&lt;/code&gt;, &lt;code&gt;radius.status_server&lt;/code&gt;, &lt;code&gt;radius.sockets&lt;/code&gt;, &lt;code&gt;radius.recv_buffer_bytes&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;&lt;code&gt;queue&lt;/code&gt; in &lt;code&gt;[radius.accounting_spool]&lt;/code&gt; and &lt;code&gt;[radius.accounting_log]&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;&lt;code&gt;tacacs.bind&lt;/code&gt;, &lt;code&gt;tacacs.port&lt;/code&gt;, &lt;code&gt;tacacs.max_connections&lt;/code&gt;, &lt;code&gt;tacacs.max_connections_per_source&lt;/code&gt;, &lt;code&gt;tacacs.max_body_len&lt;/code&gt;, &lt;code&gt;tacacs.idle_timeout_ms&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;&lt;code&gt;[radius]&lt;/code&gt;, &lt;code&gt;[tacacs]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Adding or removing a whole section&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;For example, if you change the authentication port and the script together, then send SIGHUP:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::reload: configuration reloaded from rradius.toml; these need a restart to apply: radius.auth_port&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The script is already the new one, but the server is still on the old port. This warning appears again on every reload until you restart: the server compares against the configuration it started with.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; A change in the &lt;strong&gt;content of a dictionary file&lt;/strong&gt; does not count as a &amp;ldquo;different configuration&amp;rdquo;: a reload compares only the &lt;code&gt;dictionary&lt;/code&gt; path. But a reload does read the dictionary files again, and when their content differs from what was read at startup it logs one more &lt;code&gt;WARN&lt;/code&gt;: &lt;code&gt;dictionary files changed since the server started; restart to apply: &amp;lt;path&amp;gt;&lt;/code&gt; (at most five files, the rest shown as &lt;code&gt;and N more&lt;/code&gt;), and it logs again on every reload while they still differ. The server keeps using the dictionary it read at startup, so a script that uses a new attribute gets &lt;code&gt;unknown attribute&lt;/code&gt;. Always restart after you change the dictionary. See &lt;a class=&#34;link&#34; href=&#34;../06-dictionary/#restart-after-changing-a-dictionary&#34; &gt;chapter 06&lt;/a&gt; for details.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;stopping-the-server-shutdown&#34;&gt;Stopping the server: shutdown&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; stop without letting the NAS see timeouts: first let the load balancer move traffic away, then wait for the requests in progress to finish.&lt;/p&gt;&#xA;&lt;p&gt;After it receives SIGTERM (what &lt;code&gt;systemctl stop&lt;/code&gt; and &lt;code&gt;docker stop&lt;/code&gt; send) or SIGINT (Ctrl+C), the server does the following in order:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;/readyz&lt;/code&gt; switches back to 503 (body &lt;code&gt;stopping&lt;/code&gt;), while &lt;code&gt;/livez&lt;/code&gt; still returns 200. Requests are still answered, for &lt;code&gt;ready_delay_ms&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;It stops taking new requests.&lt;/li&gt;&#xA;&lt;li&gt;Drain: it waits for the requests in progress to finish, for at most &lt;code&gt;drain_ms&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;It shuts down the cluster database and the process exits.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;If another SIGTERM or SIGINT arrives during this time, the remaining waits are skipped and it goes straight to step 4.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;shutdown.ready_delay_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;0&lt;/code&gt; for a single node; &lt;code&gt;5000&lt;/code&gt; when &lt;code&gt;cluster.nodes&lt;/code&gt; has more than one&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;Duration of step 1, in milliseconds, 0 to 60000&lt;/td&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;shutdown.drain_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;5000&lt;/code&gt;&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;The longest wait in step 3, in milliseconds, 0 to 60000&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;0 means no wait. A value above 60000 makes &lt;code&gt;check&lt;/code&gt; fail: &lt;code&gt;shutdown.drain_ms must be at most 60000&lt;/code&gt;. The value in effect at the moment stopping begins is the one used, so a reload applies it. See &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Configure:&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:#75715e&#34;&gt;# conf.d/40-shutdown.toml&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;shutdown&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ready_delay_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;drain_ms&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;2000&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;Verify:&lt;/strong&gt; after the reload, send SIGTERM, look at &lt;code&gt;/readyz&lt;/code&gt; right away, and send one login within those 3 seconds:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kill -HUP &amp;lt;pid&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kill -TERM &amp;lt;pid&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s -w &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;%{http_code}\n&amp;#39;&lt;/span&gt; http://127.0.0.1:9812/readyz&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;stopping&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;503&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --password alice-password --load pap,concurrency=1 --requests 1&#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;  pap: 2626/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;What you should see:&lt;/strong&gt; a login sent while the server is stopping still gets &lt;code&gt;accept 1&lt;/code&gt;. The log:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::cli: stopping: /readyz answers 503; requests are answered for 3000 ms more, then those being handled are waited for, for at most 2000 ms&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; … decision=&amp;#34;accept&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::cli: stopping: no more requests taken&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::cli: stopping: every request taken was answered&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN hiqlite::store::state_machine::sqlite::writer: SQL writer is shutting down&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When you send another signal during stopping, the log shows &lt;code&gt;stopping: asked again; not waiting for the requests being handled&lt;/code&gt;. When &lt;code&gt;drain_ms&lt;/code&gt; runs out with requests still unfinished, one &lt;code&gt;WARN&lt;/code&gt; line is logged that says how many RADIUS requests and TACACS+ connections were cut off.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;With a load balancer in front, or in a cluster of several nodes, &lt;code&gt;ready_delay_ms&lt;/code&gt; must be longer than the interval at which the load balancer checks &lt;code&gt;/readyz&lt;/code&gt; times the number of failures it needs to mark the server down, so that traffic has time to move away.&lt;/li&gt;&#xA;&lt;li&gt;A single node has no other server to take over, so by default it does not delay.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Let the server close its database itself before it exits. The systemd unit shipped with the package sets &lt;code&gt;TimeoutStopSec=60&lt;/code&gt;; if you write your own way of starting it, give it enough time as well, and do not use &lt;code&gt;kill -9&lt;/code&gt; while it waits.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;runtime-and-log&#34;&gt;runtime and log&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;[runtime]&lt;/code&gt; has only &lt;code&gt;pin_threads&lt;/code&gt; (default &lt;code&gt;false&lt;/code&gt;, needs a restart). It pins each worker thread to one CPU and works only on Linux; set to &lt;code&gt;true&lt;/code&gt; on another platform, &lt;code&gt;check&lt;/code&gt; fails: &lt;code&gt;runtime.pin_threads is only supported on Linux&lt;/code&gt;. For when to use it, see &lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;chapter 19&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;[log]&lt;/code&gt; sets the log level (default &lt;code&gt;info&lt;/code&gt;), the format (default &lt;code&gt;text&lt;/code&gt;) and whether authentication records are written (default &lt;code&gt;true&lt;/code&gt;). The whole table needs a restart to take effect. &lt;code&gt;[log.trace]&lt;/code&gt; can be reloaded and is used to record the full requests of a given user or client for a while. See &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;chapter 17&lt;/a&gt; for details.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;rradius.toml: line 15: `prot`: unknown field `prot`, expected `bind` or `port` &lt;/code&gt; and exits with 2.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; a key name is mistyped. Every table rejects unknown keys.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; correct it using the line number in the message and the key names it lists.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;conf.d/30-shutdown.toml: line 3: `drain_ms`: invalid type: string, expected u64&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; a value has the wrong type, for example a number written as the string &lt;code&gt;&amp;quot;5s&amp;quot;&lt;/code&gt;. The message deliberately does not print the value.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; use the type after &lt;code&gt;expected&lt;/code&gt;; write numbers without quotes, and always write durations as integer milliseconds.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;conf.d/30-bad.toml: line 1: duplicate key&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; an included file declares a table that the main file (or another file) already has, for example a second &lt;code&gt;[radius]&lt;/code&gt; or &lt;code&gt;[lua]&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; move the settings back into the file where that table already is; or delete the table from the main file and keep the whole table in one file only. The array of tables &lt;code&gt;[[radius.clients]]&lt;/code&gt; is not affected.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;conf.d/30-bad.toml: line 2: an included file has to begin with a table (`[section]`), not a setting: a setting before its first table would belong to the file before it&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; an included file starts with a &lt;code&gt;key = value&lt;/code&gt;, for example &lt;code&gt;dictionary = …&lt;/code&gt;. Top-level keys can be written only in the main file.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; move the top-level keys to the main file; an included file begins with a &lt;code&gt;[table]&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;conf.d/30-bad.toml: line 1: an included file cannot have `include` &lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; an included file has &lt;code&gt;include&lt;/code&gt; itself; nesting is not supported.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; list all the names in the &lt;code&gt;include&lt;/code&gt; of the main file.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;extra.toml: cannot read included file: No such file or directory (os error 2)&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; a name in &lt;code&gt;include&lt;/code&gt; has no wildcard, and the file does not exist.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; correct the name, or use a wildcard (no match is not an error).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;rradius.toml: include: &#39;*.d/*.toml&#39; has a wildcard before its last component; only the file name may have one&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; a wildcard was used in a directory name.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; use &lt;code&gt;*&lt;/code&gt; and &lt;code&gt;?&lt;/code&gt; only in the file name, the last component; when you have several directories, write one name for each.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;rradius.toml: [radius] is enabled but has no [[radius.clients]] entries&lt;/code&gt;, although the clients are clearly written in &lt;code&gt;conf.d/&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; the wildcard in &lt;code&gt;include&lt;/code&gt; did not match those files (wrong directory or extension), and no match is not an error.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; use &lt;code&gt;config show&lt;/code&gt; to see what was read in; check the file extension, the directory, and that relative paths are resolved against the directory of the main file.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;nonexist.toml: cannot read configuration: No such file or directory (os error 2)&lt;/code&gt;; or, when &lt;code&gt;--config&lt;/code&gt; is not given, &lt;code&gt;/etc/rradius/rradius.toml: cannot read configuration: …&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; the configuration file path is wrong, or &lt;code&gt;--config&lt;/code&gt; was forgotten. In this case the &lt;code&gt;serve&lt;/code&gt; command also adds a line &lt;code&gt;(the default configuration; give --config &amp;lt;path&amp;gt; for another)&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; give the correct &lt;code&gt;--config&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; after a reload the log shows &lt;code&gt;these need a restart to apply: …&lt;/code&gt;, and what you changed did not take effect.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; the listed settings take effect only after a restart, see &lt;a class=&#34;link&#34; href=&#34;#what-needs-a-restart&#34; &gt;What needs a restart&lt;/a&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; schedule a restart. Until then, every reload lists them again.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; you added an attribute to the dictionary and reloaded, the log says &lt;code&gt;configuration reloaded&lt;/code&gt;, but the script gets &lt;code&gt;unknown attribute &#39;…&#39;&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; the dictionary is read only at startup. A reload compares only the &lt;code&gt;dictionary&lt;/code&gt; path to decide whether a restart is needed, but when the content of the dictionary files differs from startup, the log has a &lt;code&gt;WARN&lt;/code&gt; with &lt;code&gt;dictionary files changed&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; restart the server.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;shutdown.drain_ms must be at most 60000&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; both values in &lt;code&gt;[shutdown]&lt;/code&gt; have an upper limit of 60000 milliseconds.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; use 60000 or less.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05 RADIUS service and NAS clients&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;06 Dictionary and attributes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;10 Writing policies in Lua&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16 Clusters and high availability&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../18-operations/&#34; &gt;18 Day-to-day operations&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../20-security/&#34; &gt;20 Security hardening&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../91-command-reference/&#34; &gt;Appendix B: Command reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>05 RADIUS service and NAS clients</title>
            <link>https://embark.systems/en/rradius/oss/05-radius-clients/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/05-radius-clients/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Decide which addresses and ports RADIUS listens on&lt;/li&gt;&#xA;&lt;li&gt;Add NAS devices as clients, each with its own shared secret&lt;/li&gt;&#xA;&lt;li&gt;Understand how clients are matched and where packets from unknown sources go&lt;/li&gt;&#xA;&lt;li&gt;Configure the Message-Authenticator and Proxy-State checks&lt;/li&gt;&#xA;&lt;li&gt;Understand Status-Server, retransmits, the concurrency limit, and when the server &amp;ldquo;does not answer&amp;rdquo;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: a configuration that starts, built by following &lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;chapter 04&lt;/a&gt;. The checks in this chapter send requests from the local machine with &lt;code&gt;rradius-bench&lt;/code&gt;, so you do not need a real NAS.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#concept&#34; &gt;Concept&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#listen-addresses-and-ports&#34; &gt;Listen addresses and ports&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#adding-nas-clients&#34; &gt;Adding NAS clients&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#how-clients-are-matched&#34; &gt;How clients are matched&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#changing-a-shared-secret&#34; &gt;Changing a shared secret&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#message-authenticator-and-proxy-state&#34; &gt;Message-Authenticator and Proxy-State&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#status-server&#34; &gt;Status-Server&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#retransmits-and-duplicate-requests&#34; &gt;Retransmits and duplicate requests&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#concurrency-limit&#34; &gt;Concurrency limit&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#when-the-server-does-not-answer&#34; &gt;When the server does not answer&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#connecting-a-new-nas&#34; &gt;Connecting a new NAS&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;concept&#34;&gt;Concept&#xA;&lt;/h2&gt;&lt;p&gt;A NAS (Network Access Server) is the device a user actually connects to: a wireless AP, a switch, a VPN gateway, a BRAS. When a user logs in, the NAS wraps the account and password in a RADIUS request and sends it to rradius, then lets the user in or refuses them based on the answer.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Client&lt;/strong&gt;: a NAS that rradius is willing to answer. Packets from a source that is not on the list are dropped without an answer.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Shared secret&lt;/strong&gt;: each client and rradius each keep a copy. It encrypts User-Password, signs response packets, and is used to check Message-Authenticator. When the two sides differ, the NAS does not see a reject. It sees no response, or an invalid one.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Two ports&lt;/strong&gt;: the authentication port receives Access-Request, and the accounting port receives Accounting-Request. Both ports receive Status-Server.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;RADIUS runs over UDP. When a NAS gets no answer it retransmits, and after waiting some time without one it moves on to the next server. So when rradius cannot answer correctly, it prefers not to answer and lets the NAS ask another server (see &lt;a class=&#34;link&#34; href=&#34;#when-the-server-does-not-answer&#34; &gt;When the server does not answer&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;h2 id=&#34;listen-addresses-and-ports&#34;&gt;Listen addresses and 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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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.bind&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;0.0.0.0&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One address, or an array of addresses; every address opens both the authentication and the accounting port&lt;/td&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.auth_port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1812&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Authentication port&lt;/td&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.acct_port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1813&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting port&lt;/td&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.sockets&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;On Linux, the number of worker threads; &lt;code&gt;1&lt;/code&gt; on other platforms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How many receive sockets to open per address and port&lt;/td&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.recv_buffer_bytes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;System default&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Receive buffer of each socket, 4096 to 1073741824 bytes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;For the full types and limits, see &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt;. &lt;code&gt;sockets&lt;/code&gt; and &lt;code&gt;recv_buffer_bytes&lt;/code&gt; affect performance under heavy traffic; how to tune them is in &lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;chapter 19&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Listen on the local IPv4 and IPv6 addresses at the same time:&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:#75715e&#34;&gt;# rradius.toml (excerpt)&lt;/span&gt;&#xA;&lt;/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;]&#xA;&lt;/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;127.0.0.1&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;::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;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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;At startup one line is logged for each address:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::radius: RADIUS Server listening on 127.0.0.1:1812 and 127.0.0.1:1813&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::radius: RADIUS Server also listening on ::1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Rules for &lt;code&gt;bind&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The array has at least one address, and the same address cannot appear twice.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;0.0.0.0&lt;/code&gt; means all IPv4 addresses and &lt;code&gt;::&lt;/code&gt; means all IPv6 addresses. If you write &lt;code&gt;0.0.0.0&lt;/code&gt; you cannot also write another IPv4 address (the same goes for &lt;code&gt;::&lt;/code&gt;), but &lt;code&gt;[&amp;quot;0.0.0.0&amp;quot;, &amp;quot;::&amp;quot;]&lt;/code&gt; is allowed.&lt;/li&gt;&#xA;&lt;li&gt;An IPv4 address cannot be written in IPv6 form (&lt;code&gt;::ffff:10.0.0.1&lt;/code&gt;). Write &lt;code&gt;10.0.0.1&lt;/code&gt; instead.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For the error messages, see &lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The default &lt;code&gt;0.0.0.0&lt;/code&gt; listens on every network interface. When your NAS devices only come from a management network, set &lt;code&gt;bind&lt;/code&gt; to the address of that interface and add a firewall.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;adding-nas-clients&#34;&gt;Adding NAS clients&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; Let an AP with a fixed address and a whole network of switches send requests, each with its own shared secret.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Configuration:&lt;/strong&gt; Each client is one &lt;code&gt;[[radius.clients]]&lt;/code&gt;. A change to a client (including its shared secret) takes effect on reload.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;required&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An IP address or a CIDR network, for example &lt;code&gt;192.0.2.10&lt;/code&gt;, &lt;code&gt;198.51.100.0/24&lt;/code&gt;, &lt;code&gt;2001:db8::/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;&lt;code&gt;name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;the value of &lt;code&gt;address&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The name used in logs, metrics and &lt;code&gt;[log.trace]&lt;/code&gt;; it cannot repeat within one list (RADIUS or TACACS+), and when &lt;code&gt;name&lt;/code&gt; is not set the &lt;code&gt;address&lt;/code&gt; counts as the name, so a duplicate fails at load time (see &amp;ldquo;Common mistakes&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;&lt;code&gt;secret&lt;/code&gt;, &lt;code&gt;secret_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;set exactly one&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The shared secret, or the file that holds it (&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;chapter 04&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;auth&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;the default auth chain&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Which &lt;code&gt;[auth.chains.&amp;lt;name&amp;gt;]&lt;/code&gt; this client&amp;rsquo;s logins use instead (&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;chapter 07&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;eap_methods&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.eap.methods&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The EAP methods this client may use; needs &lt;code&gt;[radius.eap]&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;chapter 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;&lt;code&gt;require_message_authenticator&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;the value in &lt;code&gt;[radius]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Overrides the &lt;code&gt;[radius]&lt;/code&gt; setting, see the next section&lt;/td&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;limit_proxy_state&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;the value in &lt;code&gt;[radius]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Overrides the &lt;code&gt;[radius]&lt;/code&gt; setting, see the next section&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;For the details of each key, see &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&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:#75715e&#34;&gt;# conf.d/20-nas.toml&lt;/span&gt;&#xA;&lt;/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-ap&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;192.0.2.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;branch-ap.secret&amp;#34;&lt;/span&gt;   &lt;span style=&#34;color:#75715e&#34;&gt;# openssl rand -hex 32 &amp;gt; branch-ap.secret&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;campus&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.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;campus.secret&amp;#34;&lt;/span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;# openssl rand -hex 32 &amp;gt; campus.secret&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;Check:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; f in branch-ap campus; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; openssl rand -hex &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt; &amp;gt; $f.secret; &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;$ chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;600&lt;/span&gt; *.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kill -HUP &amp;lt;pid&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s http://127.0.0.1:9812/metrics | grep &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;client_responses_total{client=&amp;#34;campus&amp;#34;&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_radius_client_responses_total{client=&amp;#34;campus&amp;#34;,code=&amp;#34;access_accept&amp;#34;} 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_radius_client_responses_total{client=&amp;#34;campus&amp;#34;,code=&amp;#34;access_reject&amp;#34;} 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_radius_client_responses_total{client=&amp;#34;campus&amp;#34;,code=&amp;#34;access_challenge&amp;#34;} 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_radius_client_responses_total{client=&amp;#34;campus&amp;#34;,code=&amp;#34;accounting_response&amp;#34;} 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;What it looks like:&lt;/strong&gt; Every client has a set of &lt;code&gt;rradius_radius_client_responses_total&lt;/code&gt; counters, labelled with &lt;code&gt;name&lt;/code&gt;. Requests that arrive later from the NAS are counted here by response type, so you can see which NAS has traffic and whether rejects suddenly go up.&lt;/p&gt;&#xA;&lt;p&gt;When you give the same shared secret to the NAS, set rradius&amp;rsquo;s address, the authentication port, the accounting port and this secret on the NAS.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use &lt;code&gt;cat campus.secret&lt;/code&gt; to get the secret and paste it into the NAS&amp;rsquo;s configuration screen. The newline at the end of the file is removed, so you do not need to worry about it.&lt;/li&gt;&#xA;&lt;li&gt;A shared secret shorter than 16 bytes, or one that contains the &lt;code&gt;change-me&lt;/code&gt; from the examples, gets a warning; see &lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;chapter 04&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Some older devices limit the length or characters of the shared secret; &lt;code&gt;openssl rand -hex&lt;/code&gt; produces only 0-9 and a-f, which most devices accept.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;code&gt;authorize_group&lt;/code&gt; is only for TACACS+ clients. Writing it on a RADIUS client makes &lt;code&gt;check&lt;/code&gt; fail.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Enterprise edition:&lt;/strong&gt; The other client keys (RadSec, CoA, second factor) are enterprise features. In the core edition, writing them is either ignored or makes &lt;code&gt;check&lt;/code&gt; fail; see &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;how-clients-are-matched&#34;&gt;How clients are matched&#xA;&lt;/h2&gt;&lt;p&gt;The server finds the client by the packet&amp;rsquo;s &lt;strong&gt;source IP&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Longest prefix wins.&lt;/strong&gt; When one source matches several entries, the one with the smallest network is used. So you can give a whole network one client and set up another one for a single host in it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Networks are normalized.&lt;/strong&gt; &lt;code&gt;10.0.0.5/24&lt;/code&gt; equals &lt;code&gt;10.0.0.0/24&lt;/code&gt;. When two entries are the same after normalization, &lt;code&gt;check&lt;/code&gt; fails.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;An IPv4-mapped IPv6 source is matched as IPv4.&lt;/strong&gt; On a dual-stack socket, a packet from &lt;code&gt;::ffff:192.0.2.10&lt;/code&gt; is matched against &lt;code&gt;192.0.2.10&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The port, NAS-IP-Address and NAS-Identifier are not used.&lt;/strong&gt; Only the source address counts. When the NAS is behind NAT, write the address as it is after NAT.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;A packet with no matching client is dropped, counted in &lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;unknown_client&amp;quot;}&lt;/code&gt;, and a warning line is logged (at most one per second, so the log is not flooded):&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::radius: RADIUS packet from unknown client ::1 discarded&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Try it:&lt;/strong&gt; Confirm &amp;ldquo;longest prefix wins&amp;rdquo;. In a configuration where &lt;code&gt;127.0.0.1&lt;/code&gt; is already the client &lt;code&gt;localhost&lt;/code&gt;, add another client that covers it:&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:#75715e&#34;&gt;# conf.d/30-net.toml&lt;/span&gt;&#xA;&lt;/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;loopback-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;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;127.0.0.0/8&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;net.secret&amp;#34;&lt;/span&gt;   &lt;span style=&#34;color:#75715e&#34;&gt;# openssl rand -hex 32 &amp;gt; net.secret&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;After a reload, send once with each of the two secrets:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --password alice-password --load pap,concurrency=1 --requests 1&#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;  pap: 2109/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;$ rradius-bench run --server 127.0.0.1 --secret &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 net.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --password alice-password --load pap,concurrency=1 --requests 1 --timeout 1 --retries 0&#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;  pap: 0/s, sent 1, accept 0, reject 0, challenge 0, accounting 0, timeouts 1, invalid 0, late 0, socket errors 0, retransmits 0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;What it looks like:&lt;/strong&gt; A request from &lt;code&gt;127.0.0.1&lt;/code&gt; matches &lt;code&gt;localhost&lt;/code&gt;, the &lt;code&gt;/32&lt;/code&gt;, so only its secret works. When you send with the network&amp;rsquo;s secret, the Message-Authenticator does not match, the request is dropped as invalid (&lt;code&gt;reason=&amp;quot;invalid&amp;quot;&lt;/code&gt; goes up by 1), and the bench only sees a timeout.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; When the shared secret is wrong, the NAS usually sees &amp;ldquo;no response&amp;rdquo; rather than &amp;ldquo;reject&amp;rdquo;. When a NAS keeps timing out, first check whether &lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;invalid&amp;quot;}&lt;/code&gt; is going up with it.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;ipv6-nas&#34;&gt;IPv6 NAS&#xA;&lt;/h3&gt;&lt;p&gt;An IPv6 NAS is written as one client, like an IPv4 one. &lt;code&gt;address&lt;/code&gt; takes an IPv6 address or prefix, and &lt;code&gt;radius.bind&lt;/code&gt; must include an IPv6 address (or &lt;code&gt;::&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:#75715e&#34;&gt;# conf.d/40-v6.toml&lt;/span&gt;&#xA;&lt;/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;localhost-v6&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;::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;localhost-v6.secret&amp;#34;&lt;/span&gt;   &lt;span style=&#34;color:#75715e&#34;&gt;# openssl rand -hex 32 &amp;gt; localhost-v6.secret&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;On a server with &lt;code&gt;bind = [&amp;quot;127.0.0.1&amp;quot;, &amp;quot;::1&amp;quot;]&lt;/code&gt;, requests sent from &lt;code&gt;127.0.0.1&lt;/code&gt; and from &lt;code&gt;::1&lt;/code&gt; match &lt;code&gt;localhost&lt;/code&gt; and &lt;code&gt;localhost-v6&lt;/code&gt; respectively, and both are accepted. Without &lt;code&gt;localhost-v6&lt;/code&gt;, a request from &lt;code&gt;::1&lt;/code&gt; is dropped as an unknown source, and the log shows the &lt;code&gt;unknown client ::1&lt;/code&gt; line above.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; When the same NAS sends requests over both IPv4 and IPv6, write one client for each address (they can use the same &lt;code&gt;secret_file&lt;/code&gt;). The server does not treat them as the same NAS.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;changing-a-shared-secret&#34;&gt;Changing a shared secret&#xA;&lt;/h2&gt;&lt;p&gt;When a shared secret leaks, or when you rotate it on a schedule, both the server and the NAS must change. A client has only one shared secret at a time, and the server does not accept &amp;ldquo;both the old and the new one&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; Replace the shared secret of &lt;code&gt;localhost-v6&lt;/code&gt; and confirm the old one no longer works.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Configuration and check:&lt;/strong&gt; Generate a new secret and write it to the same file. Until a reload the server still uses the old secret in memory, so writing the file does not affect the service right away:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cp localhost-v6.secret old.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ openssl rand -hex &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt; &amp;gt; localhost-v6.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server ::1 --secret &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 old.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --password alice-password --load pap,concurrency=1 --requests 1 --timeout 1 --retries 0&#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;  pap: 1804/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;$ kill -HUP &amp;lt;pid&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server ::1 --secret &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 old.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; … --timeout &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --retries &lt;span style=&#34;color:#ae81ff&#34;&gt;0&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;  pap: 0/s, sent 1, accept 0, reject 0, challenge 0, accounting 0, timeouts 1, invalid 0, late 0, socket errors 0, retransmits 0&#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;$ rradius-bench run --server ::1 --secret &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 localhost-v6.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; … --timeout &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --retries &lt;span style=&#34;color:#ae81ff&#34;&gt;0&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;  pap: 2120/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;(The second and third commands leave out the parameters they share with the first.)&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What it looks like:&lt;/strong&gt; Before the reload the old secret still works. After the reload only the new secret works, and requests with the old one are dropped as invalid.&lt;/p&gt;&#xA;&lt;p&gt;The order to follow in practice:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Write the new secret file first and run &lt;code&gt;check&lt;/code&gt; once.&lt;/li&gt;&#xA;&lt;li&gt;Change to the new secret on the NAS, then send SIGHUP right away. Between the two steps the NAS&amp;rsquo;s requests time out and the NAS retransmits, so the closer together the two steps are, the better.&lt;/li&gt;&#xA;&lt;li&gt;Check that &lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;invalid&amp;quot;}&lt;/code&gt; stops going up and &lt;code&gt;rradius_radius_client_responses_total&lt;/code&gt; keeps going up as usual.&lt;/li&gt;&#xA;&lt;li&gt;Delete the copy of the old secret.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;When you change many at once, do not let them share one secret file: one file per client lets you change them one by one, and a mistake affects only one.&lt;/p&gt;&#xA;&lt;h2 id=&#34;message-authenticator-and-proxy-state&#34;&gt;Message-Authenticator and Proxy-State&#xA;&lt;/h2&gt;&lt;p&gt;Message-Authenticator is a signature attribute in an Access-Request. Without it, an attacker between the NAS and the server may be able to change a reject into an accept (the BlastRADIUS attack, which relies on Proxy-State together with an unsigned request). So by default rradius requires every Access-Request to carry it.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Reload&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;&lt;code&gt;radius.require_message_authenticator&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;yes&lt;/code&gt;&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;code&gt;yes&lt;/code&gt;, &lt;code&gt;no&lt;/code&gt;, &lt;code&gt;auto&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;radius.limit_proxy_state&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;yes&lt;/code&gt;&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;code&gt;yes&lt;/code&gt;, &lt;code&gt;no&lt;/code&gt;, &lt;code&gt;auto&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;Both keys can be overridden on each client, with the same key names. See &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;require_message_authenticator = &amp;quot;yes&amp;quot;&lt;/code&gt;: every Access-Request without a Message-Authenticator is dropped.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;require_message_authenticator = &amp;quot;no&amp;quot;&lt;/code&gt;: not required. Only then is &lt;code&gt;limit_proxy_state&lt;/code&gt; consulted.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;limit_proxy_state = &amp;quot;yes&amp;quot;&lt;/code&gt;: an Access-Request that carries Proxy-State but no Message-Authenticator is dropped. One without Proxy-State is handled as usual.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;limit_proxy_state = &amp;quot;no&amp;quot;&lt;/code&gt;: not checked.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;auto&lt;/code&gt;: decided by the &lt;strong&gt;first&lt;/strong&gt; Access-Request from this client after the server starts. If the first one has a Message-Authenticator, the setting is treated as &lt;code&gt;yes&lt;/code&gt; from then on. If it does not, the setting is treated as &lt;code&gt;no&lt;/code&gt;, and a warning is logged. What was learned is kept across reloads until the next restart. &lt;code&gt;auto&lt;/code&gt; works only on a client with a single address, not on a network.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Dropped requests are counted in &lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;invalid&amp;quot;}&lt;/code&gt;, and a combined warning is logged:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::radius: RADIUS: discarded 1 Access-Requests lacking a Message-Authenticator, the last from 127.0.0.1; see require_message_authenticator and limit_proxy_state&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Try it:&lt;/strong&gt; Make an older device that does not send Message-Authenticator work. First look at the default behavior:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --password alice-password --load pap,concurrency=1 --requests 1 \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --no-message-authenticator --timeout 1 --retries 0&#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;  pap: 0/s, sent 1, accept 0, reject 0, challenge 0, accounting 0, timeouts 1, invalid 0, late 0, socket errors 0, retransmits 0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Relax it for this client only:&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:#75715e&#34;&gt;# conf.d/10-clients.toml&lt;/span&gt;&#xA;&lt;/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;localhost&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;127.0.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;localhost.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;require_message_authenticator&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;no&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;After a reload, send the same request again and the result is &lt;code&gt;accept 1&lt;/code&gt;. Add &lt;code&gt;--attr 33=hex:0102&lt;/code&gt; (which carries one Proxy-State) and send again, and it is back to &lt;code&gt;timeouts 1&lt;/code&gt;: &lt;code&gt;limit_proxy_state&lt;/code&gt; is still the default &lt;code&gt;yes&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What it looks like:&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;Client setting&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Has Message-Authenticator&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;None, and no Proxy-State&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;None, but has Proxy-State&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;Default (&lt;code&gt;yes&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;handled&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;dropped&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;require_message_authenticator = &amp;quot;no&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;handled&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;handled&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;plus &lt;code&gt;limit_proxy_state = &amp;quot;no&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;handled&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;handled&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;handled&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Keep the last row only for devices where you are sure there is no proxy in between and which really cannot be updated.&lt;/p&gt;&#xA;&lt;p&gt;The warning when &lt;code&gt;auto&lt;/code&gt; learns &lt;code&gt;no&lt;/code&gt; from the first request:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::radius: RADIUS client &amp;#39;localhost-v6&amp;#39; (::1): the first request had no Message-Authenticator, so require_message_authenticator (auto) became no and stays no until the server restarts; …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; What &lt;code&gt;auto&lt;/code&gt; learns is &amp;ldquo;what the first request looked like&amp;rdquo;. If the first request is forged by an attacker, the result is &lt;code&gt;no&lt;/code&gt;. When you are sure the device supports it, write &lt;code&gt;yes&lt;/code&gt; directly.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;status-server&#34;&gt;Status-Server&#xA;&lt;/h2&gt;&lt;p&gt;Status-Server (RFC 5997) is the packet a NAS or a monitoring system uses to ask &amp;ldquo;is the server still alive&amp;rdquo;.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sent to the authentication port, it gets an Access-Accept with no attributes; sent to the accounting port, it gets an Accounting-Response. No script or auth chain runs, and no authentication record is written.&lt;/li&gt;&#xA;&lt;li&gt;It must carry a correct Message-Authenticator, whatever &lt;code&gt;require_message_authenticator&lt;/code&gt; is set to.&lt;/li&gt;&#xA;&lt;li&gt;The source must be a known client, with the right shared secret.&lt;/li&gt;&#xA;&lt;li&gt;It does not go into the duplicate-request cache. Every one is answered again.&lt;/li&gt;&#xA;&lt;li&gt;The number of answers is counted in &lt;code&gt;rradius_radius_status_server_total&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;With &lt;code&gt;radius.status_server = false&lt;/code&gt; (default &lt;code&gt;true&lt;/code&gt;, needs a restart), every Status-Server is dropped. See &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt;.&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --load status-auth,concurrency=1 --requests 1&#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;  status-auth: 4144/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --load status-acct,concurrency=1 --requests 1&#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;  status-acct: 5369/s, sent 1, accept 0, reject 0, challenge 0, accounting 1, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A cluster node that has lost the majority and stopped serving does not answer Status-Server on the authentication port, so the NAS asks another node instead (&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;chapter 16&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; The sentence above and &amp;ldquo;a Status-Server without Message-Authenticator is always dropped&amp;rdquo; come from the code and the specification. Only Status-Server with a Message-Authenticator was tested for this chapter.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;retransmits-and-duplicate-requests&#34;&gt;Retransmits and duplicate requests&#xA;&lt;/h2&gt;&lt;p&gt;When a NAS gets no answer within its timeout, it retransmits the same request. rradius recognizes retransmits with a cache:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A request is identified by &amp;ldquo;the socket that received it, the source address and port, the Identifier, and the Request Authenticator&amp;rdquo;.&lt;/li&gt;&#xA;&lt;li&gt;When a retransmit arrives while the original is still being handled: the retransmit is dropped and the answer is sent when the original finishes.&lt;/li&gt;&#xA;&lt;li&gt;When it has already been answered: the same response is sent again, without authenticating or accounting again.&lt;/li&gt;&#xA;&lt;li&gt;After answering, the entry is kept for 10 seconds, up to 500000 entries; when the cache is full, new requests are handled as usual, they just do not go into the cache.&lt;/li&gt;&#xA;&lt;li&gt;A packet with the same source and Identifier but a different Request Authenticator is a new request and replaces the old entry in the cache.&lt;/li&gt;&#xA;&lt;li&gt;Retransmits are counted in &lt;code&gt;rradius_radius_duplicates_total&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;So a slow login that the NAS retransmits many times still runs authentication once and writes one authentication record.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Check:&lt;/strong&gt; Use a script that takes a few hundred milliseconds (for example a loop run for &lt;code&gt;User-Name == &#39;slow&#39;&lt;/code&gt;) and make the bench retransmit after 0.1 seconds:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user slow --password x --load pap,concurrency=1 --requests 1 --timeout 0.1 --retries 3&#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;  pap: 6/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 1&#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;$ curl -s http://127.0.0.1:9812/metrics | grep &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;^rradius_radius_duplicates_total&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_radius_duplicates_total 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;What it looks like:&lt;/strong&gt; The bench retransmitted once, the server recognized the retransmit, and the log has only one authentication record for this user.&lt;/p&gt;&#xA;&lt;h2 id=&#34;concurrency-limit&#34;&gt;Concurrency limit&#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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Reload&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.max_auth_inflight&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;4096&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;&lt;code&gt;radius.max_acct_inflight&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;4096&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;p&gt;When the number of authentication (or accounting) requests being handled reaches the limit, new requests are dropped before any work is created, and not answered. This way the server does not spend memory and CPU on requests that are bound to time out when traffic surges, and the NAS retransmits or asks another server. See &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Dropped requests are counted in &lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;overload&amp;quot;}&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The log has at most one line per port per second, saying how many were dropped: &lt;code&gt;RADIUS authentication overloaded: discarded 1 packets&lt;/code&gt; (&lt;code&gt;accounting&lt;/code&gt; for accounting). For the exact count, use the metric.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;rradius_radius_requests_limit{kind=&amp;quot;auth&amp;quot;}&lt;/code&gt; is the configured limit, and &lt;code&gt;rradius_radius_requests_in_progress{kind=&amp;quot;auth&amp;quot;}&lt;/code&gt; is the number being handled now.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;When you set the limit to 1 and send 8 requests at the same time with a slow script, 1 is answered, 7 time out, and &lt;code&gt;reason=&amp;quot;overload&amp;quot;&lt;/code&gt; is 7. For what value to set and how to measure it, see &lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;chapter 19&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;when-the-server-does-not-answer&#34;&gt;When the server does not answer&#xA;&lt;/h2&gt;&lt;p&gt;Besides the drops described above, the server also deliberately does not answer in the cases below, so that the NAS retransmits or switches to another server instead of getting a wrong reject:&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;Case&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Counter&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 source is not a known client&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;reason=&amp;quot;unknown_client&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;The packet is malformed, or the Message-Authenticator is wrong or missing&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;reason=&amp;quot;invalid&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;The number of requests being handled has reached the limit&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;reason=&amp;quot;overload&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;The database is temporarily unusable when deciding an Access-Request (timeout, no leader found, write queue full)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;reason=&amp;quot;database&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;The cluster node has lost the majority and stopped serving&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;reason=&amp;quot;no_leader&amp;quot;&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 counters in the table are all labels of &lt;code&gt;rradius_radius_discarded_total&lt;/code&gt;. When the database cannot be used, the log line is &lt;code&gt;RADIUS Access-Request from client &amp;lt;name&amp;gt; not answered: the authentication backend could not be used&lt;/code&gt;. When the data says &amp;ldquo;no&amp;rdquo; (no such account, wrong password, the database was queried fine but a script rejects), an Access-Reject is still returned; only &amp;ldquo;cannot decide&amp;rdquo; gets no answer. For how accounting requests are handled when the database cannot be used, see &lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;chapter 13&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; The database-unusable and &lt;code&gt;no_leader&lt;/code&gt; rows come from the code and the specification. This chapter did not create a real database failure to verify them. For clusters, see &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;chapter 16&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Also, when a response packet exceeds the RADIUS limit of 4096 bytes, the server sends an Access-Reject with no attributes instead and logs an error line; see &lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;chapter 06&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;connecting-a-new-nas&#34;&gt;Connecting a new NAS&#xA;&lt;/h2&gt;&lt;p&gt;When a new NAS is connected for the first time, check in this order. Most problems show up in the first three steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Did the server receive it?&lt;/strong&gt; Look at &lt;code&gt;rradius_radius_discarded_total&lt;/code&gt;. If &lt;code&gt;unknown_client&lt;/code&gt; goes up, the source address is not on the list. If nothing changes at all, the packet did not reach the server (the firewall, the address or port set on the NAS is wrong, or &lt;code&gt;radius.bind&lt;/code&gt; does not listen on that interface).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Are the shared secret and Message-Authenticator right?&lt;/strong&gt; When &lt;code&gt;invalid&lt;/code&gt; goes up, first check whether the log has &lt;code&gt;lacking a Message-Authenticator&lt;/code&gt;: if it does, the NAS did not send it; if it does not, the shared secret most likely differs.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Did the server answer?&lt;/strong&gt; Look at &lt;code&gt;rradius_radius_client_responses_total{client=&amp;quot;&amp;lt;name&amp;gt;&amp;quot;}&lt;/code&gt;. If &lt;code&gt;access_accept&lt;/code&gt; or &lt;code&gt;access_reject&lt;/code&gt; goes up, the server answered, and the problem is in the authentication itself or on the NAS side that receives the response.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Why was it rejected?&lt;/strong&gt; Every decision has one authentication record line (&lt;code&gt;decision=&lt;/code&gt; of &lt;code&gt;rradius_auth&lt;/code&gt;), which says which auth chain and which handler were used. When that is not enough, use &lt;code&gt;[log.trace]&lt;/code&gt; to temporarily record the full requests and responses of this NAS (&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;chapter 17&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Is accounting arriving?&lt;/strong&gt; Requests on the accounting port are counted per client too, and &lt;code&gt;code=&amp;quot;accounting_response&amp;quot;&lt;/code&gt; goes up. For how accounting data is handled, see &lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;chapter 13&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The settings you usually find on a NAS are named differently by each vendor, but mean roughly this:&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 on the NAS&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Value to enter&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 server address&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The address of rradius (one of the &lt;code&gt;radius.bind&lt;/code&gt; addresses, or the address of the load balancer in front of 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;Authentication port, accounting port&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.auth_port&lt;/code&gt;, &lt;code&gt;radius.acct_port&lt;/code&gt;, by default 1812, 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;Shared secret&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The contents of this client&amp;rsquo;s &lt;code&gt;secret_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;Message-Authenticator&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;Timeout and retransmits&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The NAS defaults; the server recognizes retransmits and does not handle them twice&lt;/td&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 status check&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Can be turned on when Status-Server is supported; the NAS uses it to decide whether the server can still 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;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The NAS keeps timing out, &lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;unknown_client&amp;quot;}&lt;/code&gt; is going up, and the log has &lt;code&gt;RADIUS packet from unknown client 203.0.113.7 discarded&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The packet&amp;rsquo;s source address is not in the client list. This is common when the NAS is behind NAT or sends from another interface.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add a &lt;code&gt;[[radius.clients]]&lt;/code&gt; for the address in the log, or fix the NAS&amp;rsquo;s source interface.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The NAS keeps timing out, &lt;code&gt;reason=&amp;quot;invalid&amp;quot;&lt;/code&gt; is going up, and the log has &lt;code&gt;discarded … Access-Requests lacking a Message-Authenticator&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The NAS does not send Message-Authenticator, and it is required by default.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; First turn on Message-Authenticator on the NAS. When the device does not support it, write &lt;code&gt;require_message_authenticator = &amp;quot;no&amp;quot;&lt;/code&gt; for that client only.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The NAS keeps timing out, &lt;code&gt;reason=&amp;quot;invalid&amp;quot;&lt;/code&gt; is going up, but there is no warning line like the one above.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The shared secret differs on the two sides.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Copy the secret from &lt;code&gt;secret_file&lt;/code&gt; to the NAS again; make sure the packet is not being matched by another, more specific client entry (&lt;a class=&#34;link&#34; href=&#34;#how-clients-are-matched&#34; &gt;How clients are matched&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;rradius.toml: radius client &#39;127.0.0.1&#39;: authorize_group applies only to TACACS+ clients&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;authorize_group&lt;/code&gt;, which exists only for TACACS+, was written on a RADIUS client.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Remove it. To set policy per client, use &lt;code&gt;auth&lt;/code&gt; to pick the auth chain for RADIUS, or read &lt;code&gt;client&lt;/code&gt; in a script.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;rradius.toml: radius client &#39;127.0.0.1&#39;: unknown auth chain &#39;vpn&#39; (no [auth.chains.vpn])&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;auth&lt;/code&gt; points to an auth chain that does not exist.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add &lt;code&gt;[auth.chains.vpn]&lt;/code&gt;, or change it to the right name.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;rradius.toml: radius client &#39;127.0.0.1&#39;: eap_methods needs [radius.eap]&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;eap_methods&lt;/code&gt; was written without configuring EAP.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Configure &lt;code&gt;[radius.eap]&lt;/code&gt; first (&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;chapter 11&lt;/a&gt;), or remove &lt;code&gt;eap_methods&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;radius clients: duplicate client name &#39;core&#39;&lt;/code&gt; (the TACACS+ list says &lt;code&gt;tacacs clients: …&lt;/code&gt;).&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; Two clients in the same list have the same name. A client without &lt;code&gt;name&lt;/code&gt; is named by its &lt;code&gt;address&lt;/code&gt;, so one unnamed &lt;code&gt;10.0.0.5&lt;/code&gt; and another with &lt;code&gt;name = &amp;quot;10.0.0.5&amp;quot;&lt;/code&gt; also count as the same name. The name is used to separate metrics and logs, and to find the client when the accounting spool is replayed, so it cannot repeat. Names that differ in case are different names, and the RADIUS and TACACS+ lists may use the same name.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change the &lt;code&gt;name&lt;/code&gt; of one of them. After renaming, the metric counters of the two clients are separate. &lt;strong&gt;Check before upgrading:&lt;/strong&gt; older versions accepted a configuration with duplicate names; after the upgrade, startup and &lt;code&gt;check&lt;/code&gt; fail with exit code 2.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;radius clients: duplicate client network &#39;10.0.0.0/24&#39;&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; Two entries are the same network after normalization, for example &lt;code&gt;10.0.0.5/24&lt;/code&gt; and &lt;code&gt;10.0.0.0/24&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Keep one. To set up one host separately, write a single address (&lt;code&gt;/32&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;radius clients: client &#39;127.0.0.0/8&#39;: require_message_authenticator = &amp;quot;auto&amp;quot; needs a single host, not a network&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;auto&lt;/code&gt; was written on a network client.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change it to &lt;code&gt;yes&lt;/code&gt; or &lt;code&gt;no&lt;/code&gt;, or split the host that needs &lt;code&gt;auto&lt;/code&gt; out into a single-address client.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;invalid client address &#39;nas1.example.com&#39;&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;address&lt;/code&gt; accepts only an IP address or CIDR, not a host name.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Write the NAS&amp;rsquo;s IP address.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;exactly one of secret or secret_file must be set&lt;/code&gt;, &lt;code&gt;secret_file &#39;empty.secret&#39; is empty&lt;/code&gt;, &lt;code&gt;cannot read secret_file &#39;missing.secret&#39;: No such file or directory (os error 2)&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The shared secret is not set, both are set, or the file is empty or does not exist.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Keep only &lt;code&gt;secret_file&lt;/code&gt;, and make sure the file exists and has content.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;rradius.toml: radius.bind lists 0.0.0.0, which takes all of its family, beside another of them&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;bind&lt;/code&gt; has both &lt;code&gt;0.0.0.0&lt;/code&gt; and another IPv4 address.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Keep only &lt;code&gt;0.0.0.0&lt;/code&gt;, or list only the addresses you want to listen on. Other &lt;code&gt;bind&lt;/code&gt; errors: &lt;code&gt;radius.bind must list at least one address&lt;/code&gt; (an empty array), &lt;code&gt;&#39;nowhere&#39; is not an address&lt;/code&gt;, &lt;code&gt;lists 127.0.0.1 twice&lt;/code&gt;, &lt;code&gt;::ffff:10.0.0.1, an IPv4 address written as IPv6: list it as IPv4&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;radius.sockets = 4: only Linux shares UDP packets out over several sockets on one port, so it must be 1 here&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;sockets&lt;/code&gt; was set above 1 on a platform other than Linux.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Remove the line and use the default.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; When a client is written in a file that is read in, the client errors above still start with the name of the main configuration file (for example &lt;code&gt;rradius.toml:&lt;/code&gt;), not that file. Use &lt;code&gt;name&lt;/code&gt; to find which client it is.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04 Configuration file basics&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;06 Dictionary and attributes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;11 802.1X and EAP&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13 Accounting and sessions&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16 Clusters and high availability&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;19 Performance tuning and load testing&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../20-security/&#34; &gt;20 Security hardening&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../92-metrics-reference/&#34; &gt;Appendix C: Metrics reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>06 Dictionary and attributes</title>
            <link>https://embark.systems/en/rradius/oss/06-dictionary/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/06-dictionary/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Explain what a dictionary is and which dictionaries rradius ships&lt;/li&gt;&#xA;&lt;li&gt;Read the dictionary file syntax and the attribute types&lt;/li&gt;&#xA;&lt;li&gt;Add your own vendor-specific attributes (VSAs) and read and write them from a script&lt;/li&gt;&#xA;&lt;li&gt;Set reply attributes from the database or from a script, and stay within the value and packet size limits&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: build a configuration that starts, as in &lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;chapter 04&lt;/a&gt;. This chapter uses &lt;code&gt;[log.trace]&lt;/code&gt; to see the attributes that are actually sent. It is described in full in &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;chapter 17&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#concepts&#34; &gt;Concepts&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#setting-the-dictionary-location&#34; &gt;Setting the dictionary location&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#bundled-dictionaries&#34; &gt;Bundled dictionaries&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#dictionary-file-syntax&#34; &gt;Dictionary file syntax&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#attribute-types&#34; &gt;Attribute types&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#extended-attributes-tlvs-and-vendor-formats&#34; &gt;Extended attributes, TLVs and vendor formats&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#adding-your-own-vendor-attributes&#34; &gt;Adding your own vendor attributes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#setting-reply-attributes&#34; &gt;Setting reply attributes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#value-and-packet-size-limits&#34; &gt;Value and packet size limits&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#restart-after-changing-a-dictionary&#34; &gt;Restart after changing a dictionary&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;concepts&#34;&gt;Concepts&#xA;&lt;/h2&gt;&lt;p&gt;An attribute in a RADIUS packet is just &amp;ldquo;number + length + value&amp;rdquo;. The &lt;strong&gt;dictionary&lt;/strong&gt; maps the number to a name and a type: number 1 is &lt;code&gt;User-Name&lt;/code&gt;, type &lt;code&gt;string&lt;/code&gt;; number 27 is &lt;code&gt;Session-Timeout&lt;/code&gt;, type &lt;code&gt;integer&lt;/code&gt;. With a dictionary, scripts, the database and logs can write &lt;code&gt;Session-Timeout = 3600&lt;/code&gt; instead of a string of bytes.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Standard attributes&lt;/strong&gt;: defined by RFCs, numbers 1 to 255, plus the extended attributes of RFC 6929.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Vendor-specific attributes (VSAs)&lt;/strong&gt;: carried inside number 26 (&lt;code&gt;Vendor-Specific&lt;/code&gt;), prefixed with the vendor&amp;rsquo;s IANA enterprise number. Each NAS vendor uses them to pass its own settings for VLANs, bandwidth, privilege levels and so on.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;VALUE&lt;/strong&gt;: gives a name to a value of an integer attribute, for example 2 of &lt;code&gt;Service-Type&lt;/code&gt; is called &lt;code&gt;Framed-User&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The server only knows the attributes that are in the dictionary. An attribute in a request that the dictionary does not have is invisible to scripts; using a name the dictionary does not have in a reply is an error.&lt;/p&gt;&#xA;&lt;h2 id=&#34;setting-the-dictionary-location&#34;&gt;Setting the dictionary location&#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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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 default dictionary path decided at build time (&lt;code&gt;/usr/share/rradius/dictionary&lt;/code&gt;; if the build set &lt;code&gt;RRADIUS_PREFIX=&amp;lt;prefix&amp;gt;&lt;/code&gt;, it is &lt;code&gt;&amp;lt;prefix&amp;gt;/share/rradius/dictionary&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Path of the main dictionary file; a relative path is relative to the directory of the main configuration file; may be omitted&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&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:#75715e&#34;&gt;# rradius.toml (excerpt)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;dictionary&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/usr/share/rradius/dictionary&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is a top-level key. It can only be written in the main configuration file, and it must come before the first &lt;code&gt;[table]&lt;/code&gt;. See &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;bundled-dictionaries&#34;&gt;Bundled dictionaries&#xA;&lt;/h2&gt;&lt;p&gt;rradius ships a full set of dictionaries. After installation they are here:&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;Installation method&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Location&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;deb and rpm packages and the Docker image&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/usr/share/rradius/&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;FreeBSD port&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/usr/local/share/rradius/&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;Source code&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;share/&lt;/code&gt; in the repo&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The directory contains:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;dictionary&lt;/code&gt;: the main file. The directory has 246 &lt;code&gt;dictionary.*&lt;/code&gt; files, and the main file reads 232 of them with &lt;code&gt;$INCLUDE&lt;/code&gt;; for the ones it does not read, &lt;code&gt;$INCLUDE&lt;/code&gt; them yourself when you need them.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;dictionary.rfc2865&lt;/code&gt;, &lt;code&gt;dictionary.rfc2866&lt;/code&gt; and so on: the standard attributes of each RFC.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;dictionary.&amp;lt;vendor&amp;gt;&lt;/code&gt;: the VSAs of each vendor, for example &lt;code&gt;dictionary.cisco&lt;/code&gt;, &lt;code&gt;dictionary.mikrotik&lt;/code&gt;, &lt;code&gt;dictionary.microsoft&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;NOTICE&lt;/code&gt;, &lt;code&gt;LICENSE&lt;/code&gt;: source and license.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;These dictionaries are unmodified copies of the &lt;code&gt;share/&lt;/code&gt; directory of the FreeRADIUS project&amp;rsquo;s v3.2.x branch. They are licensed under CC-BY 4.0 (not the license of rradius itself). The full text is in &lt;code&gt;LICENSE&lt;/code&gt; in the same directory, and the source and copyright holders are in &lt;code&gt;NOTICE&lt;/code&gt;. When you distribute them, include both files.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Do not edit the bundled files directly: they belong to the package and are replaced on upgrade. To add attributes, write a separate file as described in &lt;a class=&#34;link&#34; href=&#34;#adding-your-own-vendor-attributes&#34; &gt;Adding your own vendor attributes&lt;/a&gt;, and use your own main file to read both.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;dictionary-file-syntax&#34;&gt;Dictionary file syntax&#xA;&lt;/h2&gt;&lt;p&gt;A dictionary is plain text with one directive per line; fields are separated by spaces or tabs. From &lt;code&gt;#&lt;/code&gt; to the end of the line is a comment, and it can appear anywhere on a line.&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;Directive&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Syntax&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;ATTRIBUTE&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;ATTRIBUTE &amp;lt;name&amp;gt; &amp;lt;number&amp;gt; &amp;lt;type&amp;gt; [options]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Defines an attribute&lt;/td&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;VALUE&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;VALUE &amp;lt;attribute&amp;gt; &amp;lt;value name&amp;gt; &amp;lt;number&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Gives a name to one value of an integer attribute&lt;/td&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;VENDOR&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;VENDOR &amp;lt;name&amp;gt; &amp;lt;enterprise number&amp;gt; [format=t,l[,c]]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Defines a vendor&lt;/td&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;BEGIN-VENDOR&lt;/code&gt;, &lt;code&gt;END-VENDOR&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;BEGIN-VENDOR &amp;lt;name&amp;gt; [format=&amp;lt;attribute&amp;gt;]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The &lt;code&gt;ATTRIBUTE&lt;/code&gt; lines in between belong to this vendor&lt;/td&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;BEGIN-TLV&lt;/code&gt;, &lt;code&gt;END-TLV&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;BEGIN-TLV &amp;lt;attribute&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The &lt;code&gt;ATTRIBUTE&lt;/code&gt; lines in between are sub-attributes of this &lt;code&gt;tlv&lt;/code&gt; attribute&lt;/td&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;$INCLUDE&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;$INCLUDE &amp;lt;file&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reads another dictionary file&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;Numbers can be decimal or hexadecimal with a &lt;code&gt;0x&lt;/code&gt; prefix; nested attribute numbers are written with dots (for example &lt;code&gt;241.1&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;A relative path in &lt;code&gt;$INCLUDE&lt;/code&gt; is relative to the directory of &lt;strong&gt;the file that contains the line&lt;/strong&gt; (unlike the rule for configuration files). A loop of files that &lt;code&gt;$INCLUDE&lt;/code&gt; each other is detected.&lt;/li&gt;&#xA;&lt;li&gt;When &lt;code&gt;VALUE&lt;/code&gt; refers to an attribute that is not defined yet, that line is skipped and it is not an error.&lt;/li&gt;&#xA;&lt;li&gt;The options of &lt;code&gt;ATTRIBUTE&lt;/code&gt; are separated by commas:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;has_tag&lt;/code&gt;: the attribute carries a tag (used by the tunnel attributes of RFC 2868).&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;encrypt=1&lt;/code&gt;: encrypted the way User-Password is.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;encrypt=2&lt;/code&gt;: encrypted with the salted method of Tunnel-Password.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;encrypt=3&lt;/code&gt;: can be read, but &lt;code&gt;set_attr&lt;/code&gt; cannot send it.&lt;/li&gt;&#xA;&lt;li&gt;Any other value is an error.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;format=t,l&lt;/code&gt; of &lt;code&gt;VENDOR&lt;/code&gt;: t is how many bytes the vendor attribute number takes (1, 2 or 4), and l is how many bytes the length field takes (0, 1 or 2). The default is &lt;code&gt;1,1&lt;/code&gt;. &lt;code&gt;c&lt;/code&gt; (the continuation bit) can only be used with &lt;code&gt;1,1&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;An error names the file and line; when the error is in an &lt;code&gt;$INCLUDE&lt;/code&gt;d file, the chain is listed level by level, for example &lt;code&gt;dictionary:3: dictionary.example:14: unsupported directive &#39;FLAGS&#39;&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;attribute-types&#34;&gt;Attribute types&#xA;&lt;/h2&gt;&lt;p&gt;The type decides what &lt;code&gt;get_attr&lt;/code&gt; returns and what &lt;code&gt;set_attr&lt;/code&gt; expects:&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;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Length&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;code&gt;get_attr&lt;/code&gt; returns&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;code&gt;set_attr&lt;/code&gt; accepts&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;integer&lt;/code&gt;, &lt;code&gt;date&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;4&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A number&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A number, a string of digits, or a &lt;code&gt;VALUE&lt;/code&gt; name of this attribute&lt;/td&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;byte&lt;/code&gt;, &lt;code&gt;short&lt;/code&gt;, &lt;code&gt;integer64&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1, 2, 8&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A number&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same; out of range is an 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;signed&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;4&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A number (can be negative)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A number or a string of digits&lt;/td&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;ipaddr&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;4&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;quot;192.0.2.1&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A string with an IPv4 address&lt;/td&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;ipv6addr&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;16&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;quot;2001:db8::1&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A string with an IPv6 address&lt;/td&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;ipv6prefix&lt;/code&gt;, &lt;code&gt;ipv4prefix&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;variable&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;quot;2001:db8:1::/64&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A string with a prefix; the host part must be 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;ifid&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;8&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;quot;0011:2233:4455:6677&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A string in the same 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;&lt;code&gt;ether&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;6&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;quot;00:11:22:33:44:55&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A string with a MAC address&lt;/td&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;combo-ip&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;4 or 16&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A string with an IPv4 or IPv6 address&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A string with an IPv4 or IPv6 address&lt;/td&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;string&lt;/code&gt;, &lt;code&gt;text&lt;/code&gt;, &lt;code&gt;octets&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;variable&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The byte string as is&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A string, sent as is; for a number, its decimal text is sent&lt;/td&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;octets[N]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;N&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The byte string as is&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A string of exactly N bytes&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;For integer-type attributes, &lt;code&gt;get_attr&lt;/code&gt; always returns a &lt;strong&gt;number&lt;/strong&gt;, not a &lt;code&gt;VALUE&lt;/code&gt; name: to test &lt;code&gt;Service-Type&lt;/code&gt;, write &lt;code&gt;get_attr(&#39;Service-Type&#39;) == 2&lt;/code&gt;. &lt;code&gt;set_attr&lt;/code&gt; accepts both: &lt;code&gt;set_attr(&#39;Service-Type&#39;, &#39;Framed-User&#39;)&lt;/code&gt; and &lt;code&gt;set_attr(&#39;Service-Type&#39;, 2)&lt;/code&gt; are the same.&lt;/li&gt;&#xA;&lt;li&gt;For a value whose length does not match its type (for example a 5-byte &lt;code&gt;integer&lt;/code&gt;), &lt;code&gt;get_attr&lt;/code&gt; returns the bytes as they are.&lt;/li&gt;&#xA;&lt;li&gt;Container types such as &lt;code&gt;tlv&lt;/code&gt;, &lt;code&gt;evs&lt;/code&gt; and &lt;code&gt;vsa&lt;/code&gt; cannot be set with &lt;code&gt;set_attr&lt;/code&gt; themselves; you set the attributes under them.&lt;/li&gt;&#xA;&lt;li&gt;For an attribute with a tag, write the tag as &lt;code&gt;name:tag&lt;/code&gt;, with the tag from 1 to 31, for example &lt;code&gt;Tunnel-Type:1&lt;/code&gt;. Only attributes marked &lt;code&gt;has_tag&lt;/code&gt; in the dictionary can be written this way.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;extended-attributes-tlvs-and-vendor-formats&#34;&gt;Extended attributes, TLVs and vendor formats&#xA;&lt;/h2&gt;&lt;p&gt;Standard attributes have only 255 numbers, and each vendor formats its attributes differently. The dictionary describes them in the ways below. Scripts do not need to know how they are laid out in the packet; they always read and write by attribute name.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Extended attributes (RFC 6929).&lt;/strong&gt; Numbers 241 to 246 are containers, of type &lt;code&gt;extended&lt;/code&gt; (241 to 244) or &lt;code&gt;long-extended&lt;/code&gt; (245, 246). The real attributes are written as &amp;ldquo;container number.sub-number&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# bundled dictionary.rfc* (excerpt)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ATTRIBUTE&#x9;Extended-Attribute-1&#x9;&#x9;&#x9;241&#x9;extended&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ATTRIBUTE&#x9;Frag-Status&#x9;&#x9;&#x9;&#x9;241.1&#x9;integer&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ATTRIBUTE&#x9;Operator-NAS-Identifier&#x9;&#x9;&#x9;241.8&#x9;octets&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;When the value of a &lt;code&gt;long-extended&lt;/code&gt; attribute is longer than one attribute can hold, it is cut into pieces of 251 bytes when sent and joined again when received.&lt;/li&gt;&#xA;&lt;li&gt;An &lt;code&gt;evs&lt;/code&gt; (Extended-Vendor-Specific) under a container carries vendor attributes; define them with &lt;code&gt;BEGIN-VENDOR &amp;lt;vendor&amp;gt; format=&amp;lt;evs attribute&amp;gt;&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;TLV.&lt;/strong&gt; An attribute of type &lt;code&gt;tlv&lt;/code&gt; contains sub-attributes. Write a sub-attribute as &amp;ldquo;parent number.sub-number&amp;rdquo;, or between &lt;code&gt;BEGIN-TLV &amp;lt;parent attribute&amp;gt;&lt;/code&gt; and &lt;code&gt;END-TLV&lt;/code&gt;. For example, the bundled WiMAX dictionary:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# bundled dictionary.wimax (excerpt)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ATTRIBUTE&#x9;WiMAX-Capability&#x9;&#x9;&#x9;1&#x9;tlv&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ATTRIBUTE&#x9;WiMAX-Release&#x9;&#x9;&#x9;&#x9;1.1&#x9;string&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ATTRIBUTE&#x9;WiMAX-Accounting-Capabilities&#x9;&#x9;1.2&#x9;byte&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;A script sets the sub-attribute directly: &lt;code&gt;set_attr(&#39;WiMAX-Release&#39;, &#39;2.1&#39;)&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;When you set sub-attributes of the same TLV one after another, they are packed into the same TLV; a new one is started only when they do not fit.&lt;/li&gt;&#xA;&lt;li&gt;The value of a sub-attribute must also fit in the TLV and attribute around it. When it does not, &lt;code&gt;set_attr&lt;/code&gt; fails: &lt;code&gt;value of &#39;WiMAX-Release&#39; is too long&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;When a received TLV is malformed, the whole attribute is skipped; sub-attributes that are not recognized are skipped.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Vendor formats.&lt;/strong&gt; For most vendors the attribute number and length take 1 byte each, which is the default &lt;code&gt;format=1,1&lt;/code&gt;. Some vendors differ, and the &lt;code&gt;VENDOR&lt;/code&gt; line says so:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# bundled dictionaries (excerpt)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;VENDOR&#x9;&#x9;Lucent&#x9;&#x9;&#x9;&#x9;4846&#x9;format=2,1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;VENDOR&#x9;&#x9;WiMAX&#x9;&#x9;&#x9;&#x9;24757&#x9;format=1,1,c&#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;format=2,1&lt;/code&gt;: the attribute number takes 2 bytes.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;format=1,1,c&lt;/code&gt;: has a continuation bit; a value too long for one Vendor-Specific is sent in several and joined again when received.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Verify:&lt;/strong&gt; have a script set all of these kinds of attributes, then look at the response with trace:&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;-- auth.lua (excerpt)&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;WiMAX-Release&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;2.1&amp;#39;&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;WiMAX-Accounting-Capabilities&amp;#39;&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;set_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Operator-NAS-Identifier&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;nas-01&amp;#39;&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;Lucent-PPP-Circuit-Name&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;circuit-7&amp;#39;&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;WiMAX-AAA-Session-Id&amp;#39;&lt;/span&gt;, string.rep(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;s&amp;#39;&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:#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;/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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_trace: response client=&amp;#34;localhost&amp;#34; … code=2 attributes=&amp;#34;Message-Authenticator = &amp;lt;hidden&amp;gt;, WiMAX-Release = 2.1, WiMAX-Accounting-Capabilities = 1, Operator-NAS-Identifier = nas-01, Lucent-PPP-Circuit-Name = circuit-7, WiMAX-AAA-Session-Id = sss…&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;What it looks like:&lt;/strong&gt; the login is accepted. &lt;code&gt;WiMAX-AAA-Session-Id&lt;/code&gt; is 300 bytes, more than the 253 bytes of an ordinary attribute, and it is sent in pieces using the WiMAX continuation bit; with a vendor that has no continuation bit, the same value gives &lt;code&gt;value of &#39;…&#39; is too long&lt;/code&gt;. Trace shows only the attributes and values, not how they are split in the packet.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; whether a NAS joins the split packets correctly depends on the NAS implementation. This chapter did not verify it with a real NAS.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;adding-your-own-vendor-attributes&#34;&gt;Adding your own vendor attributes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; a NAS sends a VSA of its own that says which group the user belongs to. The server decides the privilege level from it and sends it back to the NAS. The bundled dictionaries do not have this vendor.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Setup:&lt;/strong&gt; write your own main dictionary file that reads the bundled dictionary and then your own file. The vendor and the number 32473 below are an enterprise number that IANA reserves for documentation examples; replace them with the number and attribute definitions of your NAS vendor (usually in the vendor&amp;rsquo;s documentation or in the dictionary file it ships).&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# dictionary: the main dictionary file of this server&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$INCLUDE /usr/share/rradius/dictionary&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$INCLUDE dictionary.example&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# dictionary.example: your own vendor attributes&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;VENDOR&#x9;&#x9;Example-Corp&#x9;32473&#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;BEGIN-VENDOR&#x9;Example-Corp&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ATTRIBUTE&#x9;Example-Group&#x9;&#x9;1&#x9;string&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ATTRIBUTE&#x9;Example-Level&#x9;&#x9;2&#x9;integer&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ATTRIBUTE&#x9;Example-Gateway&#x9;&#x9;3&#x9;ipaddr&#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;VALUE&#x9;Example-Level&#x9;&#x9;Guest&#x9;&#x9;&#x9;1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;VALUE&#x9;Example-Level&#x9;&#x9;Staff&#x9;&#x9;&#x9;2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;VALUE&#x9;Example-Level&#x9;&#x9;Admin&#x9;&#x9;&#x9;3&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;END-VENDOR&#x9;Example-Corp&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Put both files next to the main configuration file, and point &lt;code&gt;dictionary&lt;/code&gt; to your own main 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-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# rradius.toml (excerpt)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;dictionary&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;dictionary&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 script reads &lt;code&gt;Example-Group&lt;/code&gt; from the request, and replies with &lt;code&gt;Example-Level&lt;/code&gt;, &lt;code&gt;Example-Gateway&lt;/code&gt; and the standard &lt;code&gt;Session-Timeout&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-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;-- auth.lua&lt;/span&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; protocol &lt;span style=&#34;color:#f92672&#34;&gt;~=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;radius&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;  &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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; phase &lt;span style=&#34;color:#f92672&#34;&gt;~=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;authentication&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;  &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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Name&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;alice&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Password&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;alice-password&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;  &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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Example-Group&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;staff&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;  &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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;set_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Example-Level&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Staff&amp;#39;&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;Example-Gateway&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;192.0.2.254&amp;#39;&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;Session-Timeout&amp;#39;&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:#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To see the attributes that are actually sent, turn on trace for this user for a while:&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:#75715e&#34;&gt;# conf.d/90-trace.toml&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&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;alice&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;&lt;strong&gt;Verify:&lt;/strong&gt; run &lt;code&gt;check&lt;/code&gt; first, then start the server. &lt;code&gt;rradius-bench&lt;/code&gt; does not know dictionary names, so use &lt;code&gt;--attr 26=hex:…&lt;/code&gt; to send a VSA directly: &lt;code&gt;00007ed9&lt;/code&gt; is the enterprise number 32473, &lt;code&gt;01&lt;/code&gt; is the attribute number, &lt;code&gt;07&lt;/code&gt; is the length, and the rest is the ASCII of &lt;code&gt;staff&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --password alice-password --load pap,concurrency=1 --requests 1 \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --attr 26=hex:00007ed901077374616666&#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;  pap: 1844/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --password alice-password --load pap,concurrency=1 --requests 1&#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;  pap: 4417/s, sent 1, accept 0, reject 1, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;What it looks like:&lt;/strong&gt; the request with &lt;code&gt;Example-Group = staff&lt;/code&gt; is accepted, and the one without it is rejected. The trace log:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_trace: request client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; code=1 attributes=&amp;#34;Message-Authenticator = &amp;lt;hidden&amp;gt;, User-Name = alice, User-Password = &amp;lt;hidden&amp;gt;, NAS-IP-Address = 192.0.2.1, NAS-Identifier = rradius-bench, Example-Group = staff&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_trace: response client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; code=2 attributes=&amp;#34;Message-Authenticator = &amp;lt;hidden&amp;gt;, Example-Level = 2, Example-Gateway = 192.0.2.254, Session-Timeout = 3600&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;The VSA in the request is shown with its dictionary name.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;&#39;Staff&#39;&lt;/code&gt; written in the reply is sent as 2 according to &lt;code&gt;VALUE&lt;/code&gt;, and trace shows the number.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;When you are done, remember to delete &lt;code&gt;90-trace.toml&lt;/code&gt; and reload: trace writes personal data to the log.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; trace shows attributes with a tag as raw values. For example, &lt;code&gt;Tunnel-Type:1&lt;/code&gt; set to &lt;code&gt;VLAN&lt;/code&gt; (13) is shown as &lt;code&gt;Tunnel-Type = 16777229&lt;/code&gt;, which is tag 1 in the highest byte and the value 13 in the low three bytes; a string with a tag is shown in hexadecimal, for example &lt;code&gt;Tunnel-Private-Group-Id = 0x01313030&lt;/code&gt; (tag 1 plus &lt;code&gt;100&lt;/code&gt;). Encrypted attributes are always shown as &lt;code&gt;&amp;lt;hidden&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;encrypted-attributes&#34;&gt;Encrypted attributes&#xA;&lt;/h3&gt;&lt;p&gt;Some VSAs carry keys or passwords. The dictionary marks them with &lt;code&gt;encrypt=1&lt;/code&gt; or &lt;code&gt;encrypt=2&lt;/code&gt; after the type. &lt;code&gt;set_attr&lt;/code&gt; takes the plain text as usual, and the server encrypts it with the shared secret of this client before sending it:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# dictionary.example (add before END-VENDOR)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ATTRIBUTE&#x9;Example-Key&#x9;&#x9;5&#x9;string&#x9;encrypt=1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The script writes &lt;code&gt;set_attr(&#39;Example-Key&#39;, &#39;session-key-0123&#39;)&lt;/code&gt;, the login is accepted, and trace shows &lt;code&gt;Example-Key = &amp;lt;hidden&amp;gt;&lt;/code&gt;, so the plain text is not written to the log.&lt;/p&gt;&#xA;&lt;h2 id=&#34;setting-reply-attributes&#34;&gt;Setting reply attributes&#xA;&lt;/h2&gt;&lt;p&gt;Reply attributes (the attributes sent to the NAS in an Accept) have two sources, and you can use both together:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Scripts&lt;/strong&gt;: &lt;code&gt;set_attr(name, value)&lt;/code&gt;, as in the previous section. For how to write scripts, see &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;chapter 10&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The database query of the auth chain&lt;/strong&gt;: the &lt;code&gt;reply_query&lt;/code&gt; of the &lt;code&gt;sql&lt;/code&gt; handler returns rows with two columns, &amp;ldquo;attribute name, value&amp;rdquo;, and each row becomes one reply attribute (&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;chapter 07&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The values that &lt;code&gt;reply_query&lt;/code&gt; returns are always text, converted according to the dictionary type: an integer attribute can be written as a number or as a &lt;code&gt;VALUE&lt;/code&gt; name, and an attribute with a tag is written &lt;code&gt;name:tag&lt;/code&gt;. For example, with this data:&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;-- migrations/1_users.sql (excerpt)&#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; user_reply &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;alice&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Session-Timeout&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;3600&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;alice&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Example-Level&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Staff&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;alice&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Tunnel-Type:1&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;VLAN&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;alice&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Tunnel-Medium-Type:1&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;IEEE-802&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;alice&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Tunnel-Private-Group-Id:1&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;100&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;alice&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Framed-IP-Address&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;192.0.2.10&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;bad&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Example-Level&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Boss&amp;#39;&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;With &lt;code&gt;reply_query = &amp;quot;SELECT attribute, value FROM user_reply WHERE username = ?&amp;quot;&lt;/code&gt;, &lt;code&gt;alice&lt;/code&gt; gets these six attributes when she logs in (&lt;code&gt;Example-Level&lt;/code&gt; is sent as 2).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;When a value does not fit the dictionary, the whole login becomes a reject.&lt;/strong&gt; &lt;code&gt;Boss&lt;/code&gt; for &lt;code&gt;bad&lt;/code&gt; is not a &lt;code&gt;VALUE&lt;/code&gt; of &lt;code&gt;Example-Level&lt;/code&gt;, so the result is an Access-Reject and one error line in the log:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::radius: RADIUS response attribute error: &amp;#39;Boss&amp;#39; is not a value of &amp;#39;Example-Level&amp;#39;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The server prefers to reject rather than send an Accept that is missing an attribute: an accept without the VLAN or bandwidth limit could let a user into a network they should not be in.&lt;/p&gt;&#xA;&lt;p&gt;When &lt;code&gt;set_attr&lt;/code&gt; in a script hits an error, it raises a Lua error. If you do not catch it with &lt;code&gt;pcall&lt;/code&gt;, the script stops there and the login is rejected:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR … Lua script error (radius/authentication): runtime error: unknown attribute &amp;#39;Example-Nope&amp;#39;…&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Common &lt;code&gt;set_attr&lt;/code&gt; error messages:&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;Call&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Message&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;set_attr(&#39;Example-Nope&#39;, &#39;x&#39;)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;unknown attribute &#39;Example-Nope&#39;&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;set_attr(&#39;Example-Level&#39;, &#39;Boss&#39;)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&#39;Boss&#39; is not a value of &#39;Example-Level&#39;&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;set_attr(&#39;Example-Gateway&#39;, &#39;gateway&#39;)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&#39;Example-Gateway&#39; needs an IPv4 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;&lt;code&gt;set_attr(&#39;Filter-Id:1&#39;, &#39;x&#39;)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;attribute &#39;Filter-Id&#39; takes no tag&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;set_attr(&#39;Framed-IPv6-Prefix&#39;, &#39;2001:db8::1/64&#39;)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&#39;2001:db8::1/64&#39; is not a valid ipv6prefix for &#39;Framed-IPv6-Prefix&#39;&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;value-and-packet-size-limits&#34;&gt;Value and packet size limits&#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;Limit&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;When exceeded&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 value of an ordinary attribute is at most 253 bytes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;set_attr&lt;/code&gt; error &lt;code&gt;value of &#39;Reply-Message&#39; is too long&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 value of &lt;code&gt;encrypt=1&lt;/code&gt; is 1 to 128 bytes and cannot carry a tag&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;set_attr&lt;/code&gt; 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;The value of &lt;code&gt;encrypt=2&lt;/code&gt; is at most 239 bytes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;set_attr&lt;/code&gt; error, for example &lt;code&gt;&#39;WiMAX-MSK&#39;: value is longer than 239 octets&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 value of a TLV sub-attribute must fit in the TLV and attribute around it&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;set_attr&lt;/code&gt; error &lt;code&gt;value of &#39;…&#39; is too long&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 whole response packet is at most 4096 bytes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An Access-Reject with no attributes is sent instead, and one error line is logged&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;&#xA;&lt;p&gt;&lt;code&gt;long-extended&lt;/code&gt; attributes, and vendor attributes of a vendor whose dictionary marks the continuation bit (&lt;code&gt;format=1,1,c&lt;/code&gt;), are not subject to the 253-byte limit and are split automatically (see &lt;a class=&#34;link&#34; href=&#34;#extended-attributes-tlvs-and-vendor-formats&#34; &gt;Extended attributes, TLVs and vendor formats&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;An example of a response that is too large is an Accept that carries 20 &lt;code&gt;Reply-Message&lt;/code&gt; attributes of 250 bytes each:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::radius: RADIUS response to localhost is longer than 4096 octets&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The NAS receives a reject. Split the many attributes up, or use shorter values.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;restart-after-changing-a-dictionary&#34;&gt;Restart after changing a dictionary&#xA;&lt;/h2&gt;&lt;p&gt;The dictionary is read only once, when the server starts.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Change the &lt;strong&gt;path&lt;/strong&gt; of &lt;code&gt;dictionary&lt;/code&gt; and reload: the reload still succeeds, and a &lt;code&gt;WARN&lt;/code&gt; in the log lists &lt;code&gt;these need a restart to apply: dictionary&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Change only the &lt;strong&gt;contents&lt;/strong&gt; of a dictionary file (for example, add an &lt;code&gt;Example-Room&lt;/code&gt; to &lt;code&gt;dictionary.example&lt;/code&gt;) and reload: after &lt;code&gt;configuration reloaded&lt;/code&gt;, the log has one more &lt;code&gt;WARN&lt;/code&gt; line: &lt;code&gt;dictionary files changed since the server started; restart to apply: &amp;lt;file path&amp;gt;&lt;/code&gt; (at most five files are listed, and the rest are written as &lt;code&gt;and N more&lt;/code&gt;; it is written on every reload as long as a file still differs from what it was at startup). The server still uses the old dictionary, and a script that uses the new attribute gets &lt;code&gt;unknown attribute &#39;Example-Room&#39;&lt;/code&gt;. It takes effect after a restart.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; after changing a dictionary, always restart the server; do not just send SIGHUP. First use &lt;code&gt;check&lt;/code&gt; to confirm that the new dictionary can be read: &lt;code&gt;check&lt;/code&gt; reads the dictionary from the files every time.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;dictionary:3: dictionary.example:14: unsupported directive &#39;FLAGS&#39;&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; the dictionary uses a directive that rradius does not support. The message lists the levels: it was read through the &lt;code&gt;$INCLUDE&lt;/code&gt; on line 3 of the main file, and the problem is on line 14 of &lt;code&gt;dictionary.example&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; delete or rewrite that line; for the supported directives see &lt;a class=&#34;link&#34; href=&#34;#dictionary-file-syntax&#34; &gt;Dictionary file syntax&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;… unknown vendor &#39;Nobody&#39;&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;BEGIN-VENDOR&lt;/code&gt; or &lt;code&gt;ATTRIBUTE&lt;/code&gt; uses a vendor that has no &lt;code&gt;VENDOR&lt;/code&gt; definition yet.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; add the &lt;code&gt;VENDOR&lt;/code&gt; line before it, or correct the name.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;… cannot include &#39;dictionary.missing&#39;: No such file or directory (os error 2)&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; the file in &lt;code&gt;$INCLUDE&lt;/code&gt; does not exist. A relative path is relative to the directory of the dictionary file that contains the &lt;code&gt;$INCLUDE&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; correct the path, or use an absolute path.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;… unknown encryption &#39;encrypt=9&#39; in: ATTRIBUTE Example-Secret 9 string encrypt=9&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;encrypt=&lt;/code&gt; can only be 1, 2 or 3.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; correct it according to the definition of the NAS vendor.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;… invalid vendor format &#39;format=3,1&#39;&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; in &lt;code&gt;format=&lt;/code&gt;, the attribute number length can only be 1, 2 or 4, and the length field can only be 0, 1 or 2.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; correct it according to the definition of the vendor.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;… ATTRIBUTE needs a name, number and type: ATTRIBUTE Short 9&lt;/code&gt;, &lt;code&gt;… END-TLV without matching BEGIN-TLV&lt;/code&gt;, &lt;code&gt;… include cycle: &#39;dictionary&#39; is already being loaded&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; a field is missing, &lt;code&gt;BEGIN-TLV&lt;/code&gt;/&lt;code&gt;END-TLV&lt;/code&gt; are not paired, or dictionaries &lt;code&gt;$INCLUDE&lt;/code&gt; each other.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; correct it according to the file and line in the message.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; the script test &lt;code&gt;get_attr(&#39;Service-Type&#39;) == &#39;Framed-User&#39;&lt;/code&gt; is never true.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; for an integer attribute, &lt;code&gt;get_attr&lt;/code&gt; returns a number, not a &lt;code&gt;VALUE&lt;/code&gt; name.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; compare with the number: &lt;code&gt;get_attr(&#39;Service-Type&#39;) == 2&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; a user is rejected, and the log has &lt;code&gt;RADIUS response attribute error: …&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; a reply attribute in the database has a value or name that does not fit the dictionary.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; correct the data of that row according to the message; the name must match the dictionary exactly (including case).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; you added a new attribute and the reload succeeded, but the script gets &lt;code&gt;unknown attribute&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; the contents of the dictionary are read only at startup.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; restart the server.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04 Configuration file basics&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05 RADIUS service and NAS clients&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;10 Writing policies in Lua&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../14-isp-recipes/&#34; &gt;14 Scenarios: broadband and ISP&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../15-access-recipes/&#34; &gt;15 Scenarios: network access for organizations&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../93-lua-reference/&#34; &gt;Appendix D: Lua API reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>07 User accounts and auth chains</title>
            <link>https://embark.systems/en/rradius/oss/07-users-and-chains/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/07-users-and-chains/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Add, change the password of, disable and delete local accounts with the &lt;code&gt;user&lt;/code&gt; command&lt;/li&gt;&#xA;&lt;li&gt;Choose a password format to match the authentication protocol your NAS uses, and bring hashes over from an old system unchanged&lt;/li&gt;&#xA;&lt;li&gt;Combine several handlers in an auth chain, and send different NAS to different chains&lt;/li&gt;&#xA;&lt;li&gt;Normalize the case and realm of user names&lt;/li&gt;&#xA;&lt;li&gt;Limit password guessing with login failure lockout and a cap on hash cost&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: you finished &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;Chapter 03&lt;/a&gt; and have a working copy of quick-start (&lt;code&gt;~/rradius-lab/quick-start&lt;/code&gt;) that starts, with the &lt;code&gt;[accounts]&lt;/code&gt; section added as in Chapter 03. The LDAP and Active Directory handlers are in &lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;Chapter 08&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#how-the-auth-chain-decides&#34; &gt;How the auth chain decides&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#manage-accounts-with-the-user-command&#34; &gt;Manage accounts with the user command&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#choose-a-password-format&#34; &gt;Choose a password format&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#migrate-password-hashes-from-an-old-system&#34; &gt;Migrate password hashes from an old system&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#limit-the-cost-of-hashing&#34; &gt;Limit the cost of hashing&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#authentication-protocols-and-the-ms-chapv1-switch&#34; &gt;Authentication protocols and the MS-CHAPv1 switch&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#sql-handler&#34; &gt;sql handler&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#lua-handler&#34; &gt;lua handler&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#all_accept-add-a-policy-on-top-of-the-password&#34; &gt;all_accept: add a policy on top of the password&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#let-different-nas-use-different-chains&#34; &gt;Let different NAS use different chains&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#normalize-user-names-and-realms&#34; &gt;Normalize user names and realms&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#login-failure-lockout&#34; &gt;Login failure lockout&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Run the commands in this chapter in the directory of the quick-start copy, with the server running in another terminal. Test logins use &lt;code&gt;rradius-bench&lt;/code&gt; as in Chapter 03. Below, the shared options are shortened to &lt;code&gt;…&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --password alice-password --load pap,concurrency=1 --requests 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Only the &lt;code&gt;accept&lt;/code&gt; and &lt;code&gt;reject&lt;/code&gt; part of the output is copied.&lt;/p&gt;&#xA;&lt;h2 id=&#34;how-the-auth-chain-decides&#34;&gt;How the auth chain decides&#xA;&lt;/h2&gt;&lt;p&gt;When the configuration file has &lt;code&gt;[auth]&lt;/code&gt;, every RADIUS Access-Request and every TACACS+ login goes to the auth chain for a decision. Without &lt;code&gt;[auth]&lt;/code&gt;, the top-level script in &lt;code&gt;[lua]&lt;/code&gt; decides on its own; that style is in &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;Chapter 10&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A chain is a series of handlers that run in order. The core has four kinds of handler:&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;type&lt;/code&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What it does&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Covered in&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;Looks up the account in the cluster database or an external database and checks the password&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;This chapter, &lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;Chapter 09&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;lua&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Runs a Lua script, which decides&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;This chapter, &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;Chapter 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;&lt;code&gt;ldap&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Finds the user in an LDAP directory and verifies the password&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;Chapter 08&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;netlogon&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Passes MS-CHAPv2 to an Active Directory domain controller for verification&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;Chapter 08&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;For each request, every handler gives one of four answers:&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;Answer&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;Example&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;accept&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;The password is correct&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reject&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reject; the chain stops at once&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wrong password; two accounts with the same name found&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;ignore&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Cannot tell; pass to the next handler&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The account is not found; this login method is not its job&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;challenge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Ask the NAS to question the user once more (Access-Challenge); the chain stops at once&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A Lua script asks for a verification code&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;policy&lt;/code&gt; in &lt;code&gt;[auth]&lt;/code&gt; decides how the answers are combined:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;first_match&lt;/code&gt; (default): the first answer that is not ignore is the result.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;all_accept&lt;/code&gt;: every handler must run; any reject means reject; at the end there must be at least one accept.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;When every handler ignores, the result is reject. So &amp;ldquo;account not found&amp;rdquo; and &amp;ldquo;wrong password&amp;rdquo; both look like Access-Reject to the NAS; the difference is only in the log. The server writes one authentication log line for every decision, and &lt;code&gt;handler&lt;/code&gt; names who decided.&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; account=&amp;#34;alice&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;sql&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;nobody&amp;#34; account=&amp;#34;nobody&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;none&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In the first line the sql handler rejected &lt;code&gt;alice&lt;/code&gt; (wrong password). In the second, no handler knew &lt;code&gt;nobody&lt;/code&gt;, so &lt;code&gt;handler=&amp;quot;none&amp;quot;&lt;/code&gt;. &lt;code&gt;handler&lt;/code&gt; can also take the values below, all of which come up later in this chapter:&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;handler&lt;/code&gt;&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;&lt;code&gt;sql&lt;/code&gt;, &lt;code&gt;lua&lt;/code&gt;, &lt;code&gt;ldap&lt;/code&gt;, &lt;code&gt;netlogon&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;This handler made the decision&lt;/td&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 ignored&lt;/td&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 user name does not match &lt;code&gt;[auth.username]&lt;/code&gt;; no handler ran&lt;/td&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;In an &lt;code&gt;all_accept&lt;/code&gt; chain, no handler that checks passwords accepted&lt;/td&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;lockout&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The account is blocked by &lt;a class=&#34;link&#34; href=&#34;#login-failure-lockout&#34; &gt;login failure lockout&lt;/a&gt;; the password was not checked&lt;/td&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;mschapv1_refused&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;MS-CHAPv1 is refused by default (not set, or &lt;code&gt;allow_mschapv1 = 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;length&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The RADIUS User-Password is not 16 to 128 octets or not a multiple of 16; no handler ran (see &lt;a class=&#34;link&#34; href=&#34;#password-length&#34; &gt;Password length&lt;/a&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;rejection-and-backend-unavailable&#34;&gt;Rejection and &amp;ldquo;backend unavailable&amp;rdquo;&#xA;&lt;/h3&gt;&lt;p&gt;There is one more kind of result that is neither accept nor an ordinary reject: a handler fails because its backend is unavailable. For example, a query to the cluster database or an external database fails, all LDAP servers are unreachable, no domain controller answers, or a slow hash waits in the queue past the handler&amp;rsquo;s &lt;code&gt;timeout_ms&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In that case:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;RADIUS &lt;strong&gt;does not answer&lt;/strong&gt; the request, and adds one to &lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;database&amp;quot;}&lt;/code&gt; (the label is always &lt;code&gt;database&lt;/code&gt;, whatever kind of backend it was). The NAS gets no response and retransmits or asks another server.&lt;/li&gt;&#xA;&lt;li&gt;TACACS+ replies ERROR.&lt;/li&gt;&#xA;&lt;li&gt;This does not count as a failed login, so &lt;a class=&#34;link&#34; href=&#34;#login-failure-lockout&#34; &gt;login failure lockout&lt;/a&gt; does not count it.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The reason for this design: if the server answered Access-Reject while a backend was down, the NAS would treat it as &amp;ldquo;wrong password&amp;rdquo;. The user would be shut out, and might even be locked by the NAS&amp;rsquo;s own failure counter. Staying silent lets the NAS ask another server. The &lt;code&gt;Discarded: database&lt;/code&gt; line of &lt;code&gt;status&lt;/code&gt; is this counter (&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;Chapter 17&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-received-name-and-the-account-name&#34;&gt;The received name and the account name&#xA;&lt;/h3&gt;&lt;p&gt;The authentication log has two fields, &lt;code&gt;user&lt;/code&gt; and &lt;code&gt;account&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;user&lt;/code&gt; is the &lt;code&gt;User-Name&lt;/code&gt; in the request, recorded as received.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;account&lt;/code&gt; is the account name the handler used for the lookup. With &lt;code&gt;[auth.username]&lt;/code&gt;, it is the name after the realm is removed and the case is lowered (see &lt;a class=&#34;link&#34; href=&#34;#normalize-user-names-and-realms&#34; &gt;Normalize user names and realms&lt;/a&gt;); when &lt;code&gt;default_user&lt;/code&gt; was used, it is the account that stood in.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;manage-accounts-with-the-user-command&#34;&gt;Manage accounts with the user command&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;rradiusd user&lt;/code&gt; has six subcommands:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd user add|passwd|enable|disable|delete|show [--config &amp;lt;path&amp;gt;] &amp;lt;name&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;They do not touch the table structure themselves. They only run the SQL you wrote in &lt;code&gt;[accounts]&lt;/code&gt;. So you decide what the account table looks like, and the &lt;code&gt;user&lt;/code&gt; command writes to your 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:#75715e&#34;&gt;# rradius.toml (the section added in Chapter 03)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&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;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;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Used by&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;accounts.scheme&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;bcrypt&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;add&lt;/code&gt;, &lt;code&gt;passwd&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The format the password is stored in; see the next section&lt;/td&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.add&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;user add&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;?1&lt;/code&gt; is the account name, &lt;code&gt;?2&lt;/code&gt; the password value to store&lt;/td&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.passwd&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;user passwd&lt;/code&gt;&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;&lt;code&gt;accounts.enable&lt;/code&gt;, &lt;code&gt;disable&lt;/code&gt;, &lt;code&gt;delete&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The subcommand of the same name&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;?1&lt;/code&gt; 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;&lt;code&gt;accounts.show&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;user show&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The query result is printed as it is, one column per line&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;A subcommand whose statement is not set cannot be used. Only the &lt;code&gt;user&lt;/code&gt; command reads &lt;code&gt;[accounts]&lt;/code&gt;, and it reads it once each time it runs, independent of reload (Appendix A marks it &amp;ldquo;command&amp;rdquo;). See &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt; for the full fields.&lt;/p&gt;&#xA;&lt;p&gt;Things to watch for:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;disable&lt;/code&gt; only changes a column. For it to have any effect, the &lt;code&gt;user_query&lt;/code&gt; of the sql handler must skip disabled accounts, for example &lt;code&gt;… WHERE username = ? AND enabled = 1&lt;/code&gt; in quick-start.&lt;/li&gt;&#xA;&lt;li&gt;Do not select the password column in &lt;code&gt;show&lt;/code&gt;; it is printed to the terminal as it is.&lt;/li&gt;&#xA;&lt;li&gt;The command writes through the cluster API port, so &lt;strong&gt;the server must be running&lt;/strong&gt;. The write goes through the cluster, every node sees it at once, and the next login uses the new data; no reload is needed. The command does not start a node and does not create &lt;code&gt;data_dir&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;With &lt;code&gt;[auth.username]&lt;/code&gt;, the command normalizes the name first, as a login does (see &lt;a class=&#34;link&#34; href=&#34;#normalize-user-names-and-realms&#34; &gt;Normalize user names and realms&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;goal-add-change-the-password-of-disable-and-delete-an-account&#34;&gt;Goal: add, change the password of, disable and delete an account&#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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ printf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;erin-password\n&amp;#39;&lt;/span&gt; | rradiusd user add --config rradius.toml erin&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;added erin&#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;erin-new-password\n&amp;#39;&lt;/span&gt; | rradiusd user passwd --config rradius.toml erin&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;password changed for erin&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd user disable --config rradius.toml erin&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;disabled erin&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd user enable --config rradius.toml erin&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;enabled erin&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd user delete --config rradius.toml erin&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;deleted erin&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd user show --config rradius.toml erin&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;no account erin&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The password is always read from standard input, never from a command-line argument (arguments show up in the process list). When you run &lt;code&gt;add&lt;/code&gt; or &lt;code&gt;passwd&lt;/code&gt; directly on a terminal, the command turns echo off and asks twice; if the two entries differ, nothing is written and the exit code is 2. When input comes through a pipe, only the first line is read, without its trailing newline. An empty password is always refused.&lt;/p&gt;&#xA;&lt;p&gt;Exit codes:&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;Exit code&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;Example&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;0&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Done&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;added erin&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;1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No matching account, or the database rejected the SQL&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;no account nobody&lt;/code&gt;; &lt;code&gt;add&lt;/code&gt; fails when the account already exists&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&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;Error in the command, configuration or input; nothing was sent&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accounts.add is not set in rradius.toml&lt;/code&gt;, &lt;code&gt;the password is empty; nothing was changed&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;3&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Cannot reach the cluster&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;the cluster did not answer within 30 s&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;strong&gt;Verified:&lt;/strong&gt; every line of output above, and exit code 1 when &lt;code&gt;user add&lt;/code&gt; is run for an account that already exists, with the database&amp;rsquo;s error as the message (&lt;code&gt;Connect: Error code 1555: constraint failed Some(&amp;quot;UNIQUE constraint failed: users.username&amp;quot;)&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;h2 id=&#34;choose-a-password-format&#34;&gt;Choose a password format&#xA;&lt;/h2&gt;&lt;h3 id=&#34;the-four-formats-the-user-command-stores&#34;&gt;The four formats the user command stores&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;accounts.scheme&lt;/code&gt; decides what &lt;code&gt;user add&lt;/code&gt; and &lt;code&gt;user passwd&lt;/code&gt; store. It only affects passwords written afterwards; values already stored are not changed.&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;scheme&lt;/code&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Stored as&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;PAP&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;CHAP&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;MS-CHAPv1, MS-CHAPv2, PEAP&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;bcrypt&lt;/code&gt; (default)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;{crypt}$2b$…&lt;/code&gt;&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;&#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;sha512-crypt&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;{crypt}$6$…&lt;/code&gt;&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;&#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;nthash&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;{nthash}&lt;/code&gt; plus 32 hexadecimal digits&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;&#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;clear&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;{clear}&lt;/code&gt; plus the plaintext&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;Yes&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;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Why these limits exist:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The CHAP response is computed from the plaintext password, so the server must hold the plaintext.&lt;/li&gt;&#xA;&lt;li&gt;MS-CHAPv1 and MS-CHAPv2 (also the inner method of PEAP) use the NT hash of the password, so storing the NT hash or the plaintext both work.&lt;/li&gt;&#xA;&lt;li&gt;bcrypt and SHA-512 crypt are one-way hashes and can only verify the plaintext password that PAP sends.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;How to choose:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The NAS uses only PAP (most VPN gateways, web logins, TACACS+ PAP): use the default &lt;code&gt;bcrypt&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Wi-Fi 802.1X with PEAP, or a NAS that uses MS-CHAPv2: use &lt;code&gt;nthash&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;CHAP is required: only &lt;code&gt;clear&lt;/code&gt; works.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;bcrypt&lt;/code&gt; costs a lot of CPU on every check (cost 10). With a large login volume and PAP only, &lt;code&gt;sha512-crypt&lt;/code&gt; checks much faster.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;strong&gt;Verified:&lt;/strong&gt; one account was added with each of the four formats, and the stored values start as in the table; then each was tried with PAP, CHAP and MS-CHAPv2, with the results in the table (&lt;code&gt;rradius-bench&lt;/code&gt; has no MS-CHAPv1 load, so that column follows the code and the spec).&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; Anyone who gets the database can log in with &lt;code&gt;nthash&lt;/code&gt; and &lt;code&gt;clear&lt;/code&gt;: the NT hash alone is enough to compute the MS-CHAPv2 response, without knowing the original password. Use them only when needed, and protect the cluster&amp;rsquo;s data directory and backups.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;all-formats-the-server-understands&#34;&gt;All formats the server understands&#xA;&lt;/h3&gt;&lt;p&gt;The &lt;code&gt;user&lt;/code&gt; command writes only the four formats above, but the sql handler understands more when it checks a password, which makes it easier to bring accounts over from other systems. A stored value is written as &lt;code&gt;{format}value&lt;/code&gt;, and the prefix is not case-sensitive.&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;Prefix&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Content of the value&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Protocols it can verify&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 prefix), &lt;code&gt;{clear}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Plaintext&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PAP, CHAP, MS-CHAPv1, MS-CHAPv2&lt;/td&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;{nthash}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;32 hexadecimal digits (MD4 of UTF-16LE)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PAP, MS-CHAPv1, MS-CHAPv2&lt;/td&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;{crypt}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The result of crypt(3): traditional DES, &lt;code&gt;$1$&lt;/code&gt; (MD5-crypt), &lt;code&gt;$5$&lt;/code&gt;, &lt;code&gt;$6$&lt;/code&gt;, &lt;code&gt;$2a$&lt;/code&gt;/&lt;code&gt;$2b$&lt;/code&gt;/&lt;code&gt;$2y$&lt;/code&gt; (bcrypt)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PAP&lt;/td&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;{argon2}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A PHC string, for example &lt;code&gt;$argon2id$v=19$…&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PAP&lt;/td&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;{SHA}&lt;/code&gt;, &lt;code&gt;{MD5}&lt;/code&gt;, &lt;code&gt;{SHA224}&lt;/code&gt;, &lt;code&gt;{SHA256}&lt;/code&gt;, &lt;code&gt;{SHA384}&lt;/code&gt;, &lt;code&gt;{SHA512}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Base64 of the digest&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PAP&lt;/td&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;{SSHA}&lt;/code&gt;, &lt;code&gt;{SMD5}&lt;/code&gt;, &lt;code&gt;{SSHA224}&lt;/code&gt;, &lt;code&gt;{SSHA256}&lt;/code&gt;, &lt;code&gt;{SSHA384}&lt;/code&gt;, &lt;code&gt;{SSHA512}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Base64 of the digest followed by the salt; the digest is computed over the password followed by the salt, and the salt is at least 1 octet&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PAP&lt;/td&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;{PBKDF2}&lt;/code&gt;, &lt;code&gt;{PBKDF2-SHA1}&lt;/code&gt;, &lt;code&gt;{PBKDF2-SHA256}&lt;/code&gt;, &lt;code&gt;{PBKDF2-SHA512}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;lt;iterations&amp;gt;$&amp;lt;salt&amp;gt;$&amp;lt;digest&amp;gt;&lt;/code&gt;, with the salt and digest in adapted Base64 (&lt;code&gt;.&lt;/code&gt; in place of &lt;code&gt;+&lt;/code&gt;, no &lt;code&gt;=&lt;/code&gt; padding); &lt;code&gt;{PBKDF2}&lt;/code&gt; is the same as &lt;code&gt;{PBKDF2-SHA1}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PAP&lt;/td&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}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;lt;algorithm&amp;gt;:&amp;lt;iterations&amp;gt;:&amp;lt;salt&amp;gt;:&amp;lt;digest&amp;gt;&lt;/code&gt;; the algorithm is &lt;code&gt;HMACSHA1&lt;/code&gt; or &lt;code&gt;HMACSHA2+224&lt;/code&gt;/&lt;code&gt;+256&lt;/code&gt;/&lt;code&gt;+384&lt;/code&gt;/&lt;code&gt;+512&lt;/code&gt;, and the iterations are 4 octets in Base64&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PAP&lt;/td&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;{NS-MTA-MD5}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;32 hexadecimal digits followed by a 32-character salt (a format of old mail servers)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PAP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Rules:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;An unknown prefix, or a value that cannot be parsed, always fails the check and never makes the server fail.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;{clear}&lt;/code&gt; with nothing after it, a NULL column and an empty string all mean &amp;ldquo;no password&amp;rdquo;, and every login is rejected. An empty PAP password does not get through because of that either.&lt;/li&gt;&#xA;&lt;li&gt;The deliberately slow formats, &lt;code&gt;{crypt}&lt;/code&gt;, &lt;code&gt;{argon2}&lt;/code&gt; and PBKDF2, are checked on threads other than the request-handling ones, with at most as many checks at the same time as there are CPUs. If queueing plus checking exceeds the &lt;code&gt;timeout_ms&lt;/code&gt; of the sql handler (default 5000 ms), the request counts as &amp;ldquo;backend unavailable&amp;rdquo; and gets no answer (see &lt;a class=&#34;link&#34; href=&#34;#rejection-and-backend-unavailable&#34; &gt;Rejection and &amp;ldquo;backend unavailable&amp;rdquo;&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;a-hash-without-a-prefix-is-not-a-password&#34;&gt;A hash without a prefix is not a password&#xA;&lt;/h3&gt;&lt;p&gt;If a value has no prefix but starts with &lt;code&gt;$2a$&lt;/code&gt;, &lt;code&gt;$2b$&lt;/code&gt;, &lt;code&gt;$2y$&lt;/code&gt;, &lt;code&gt;$1$&lt;/code&gt;, &lt;code&gt;$5$&lt;/code&gt;, &lt;code&gt;$6$&lt;/code&gt; or &lt;code&gt;$argon2&lt;/code&gt;, the server does &lt;strong&gt;not&lt;/strong&gt; compare it as plaintext, and every login is rejected. Such a value usually comes from an import that forgot &lt;code&gt;{crypt}&lt;/code&gt;. If it were compared as plaintext, anyone who got hold of the hash could log in by sending the hash itself as the password.&lt;/p&gt;&#xA;&lt;p&gt;The first time the server meets such an account, it writes one warning to the log (once per account, and without the stored 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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::auth_chain: the stored password looks like a hash with no scheme prefix and is refused; add {crypt} or {argon2} before it, or {clear} if it is the password itself user=&amp;#34;gina&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Fix: add &lt;code&gt;{crypt}&lt;/code&gt; or &lt;code&gt;{argon2}&lt;/code&gt; in front of the value. If the string really is someone&amp;rsquo;s plaintext password, write it as &lt;code&gt;{clear}$2y$…&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Another case: the value has no prefix and looks like a digest (32, 40, 56, 64, 96 or 128 hexadecimal digits, or Base64 that decodes to 16, 20, 28, 32, 48 or 64 octets). Such a value is still &lt;strong&gt;compared as plaintext&lt;/strong&gt;, but the first time it produces a warning:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::auth_chain: the stored password looks like a digest with no scheme prefix and is compared as plaintext; add its prefix ({nthash}, {MD5}, {SHA}, {SHA256}, ...), or {clear} if it is the password itself user=&amp;#34;frank&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;frank&lt;/code&gt; has a hexadecimal MD5 stored, and the user sends the original password. Compared as plaintext, they naturally do not match, so the login is rejected. Add the right prefix (a hexadecimal MD5 must first be converted to Base64; see the next section) and it works.&lt;/p&gt;&#xA;&lt;p&gt;This rule is the same for PAP, CHAP, MS-CHAPv1 and MS-CHAPv2: CHAP and MS-CHAP also use the string as the plaintext password to compute the value to compare. The warning list remembers at most 1024 users per process; after that, no more warnings are written, but the check goes on as before. So &amp;ldquo;no such warning in the log&amp;rdquo; does not mean the database has no such values. To find them, check whether &lt;code&gt;ok&lt;/code&gt; for &lt;code&gt;rradius_password_checks_total{scheme=&amp;quot;none&amp;quot;}&lt;/code&gt; is unreasonably high.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Verified:&lt;/strong&gt; both warnings and the refusals were tested after adding test accounts to the quick-start copy.&lt;/p&gt;&#xA;&lt;h3 id=&#34;metrics-that-show-check-results&#34;&gt;Metrics that show check results&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;rradius_password_checks_total&lt;/code&gt; counts every check by the format of the stored value and by result:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s http://127.0.0.1:9812/metrics | grep &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;password_checks_total{scheme=&amp;#34;crypt&amp;#34;&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_password_checks_total{scheme=&amp;#34;crypt&amp;#34;,result=&amp;#34;failed&amp;#34;} 6&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_password_checks_total{scheme=&amp;#34;crypt&amp;#34;,result=&amp;#34;ok&amp;#34;} 4&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;scheme&lt;/code&gt; takes a fixed set of values: &lt;code&gt;clear&lt;/code&gt;, &lt;code&gt;none&lt;/code&gt; (no prefix), &lt;code&gt;crypt&lt;/code&gt;, &lt;code&gt;md5&lt;/code&gt;, &lt;code&gt;smd5&lt;/code&gt;, &lt;code&gt;sha&lt;/code&gt;, &lt;code&gt;ssha&lt;/code&gt;, &lt;code&gt;sha224&lt;/code&gt;, &lt;code&gt;ssha224&lt;/code&gt;, &lt;code&gt;sha256&lt;/code&gt;, &lt;code&gt;ssha256&lt;/code&gt;, &lt;code&gt;sha384&lt;/code&gt;, &lt;code&gt;ssha384&lt;/code&gt;, &lt;code&gt;sha512&lt;/code&gt;, &lt;code&gt;ssha512&lt;/code&gt;, &lt;code&gt;pbkdf2-sha1&lt;/code&gt; (&lt;code&gt;{PBKDF2}&lt;/code&gt; counts here too), &lt;code&gt;pbkdf2-sha256&lt;/code&gt;, &lt;code&gt;pbkdf2-sha512&lt;/code&gt;, &lt;code&gt;x-pbkdf2&lt;/code&gt;, &lt;code&gt;ns-mta-md5&lt;/code&gt;, &lt;code&gt;nthash&lt;/code&gt;, &lt;code&gt;argon2&lt;/code&gt; and &lt;code&gt;unknown&lt;/code&gt; (an unknown prefix). &lt;code&gt;result&lt;/code&gt; is &lt;code&gt;ok&lt;/code&gt; or &lt;code&gt;failed&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;While you migrate old accounts, use it to see how many logins still use the old formats. For the full list of metrics see &lt;a class=&#34;link&#34; href=&#34;../92-metrics-reference/&#34; &gt;Appendix C&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;migrate-password-hashes-from-an-old-system&#34;&gt;Migrate password hashes from an old system&#xA;&lt;/h2&gt;&lt;p&gt;Goal: put the password hashes from an old directory, an old RADIUS server or &lt;code&gt;/etc/shadow&lt;/code&gt; into the table as they are, so users do not have to reset their passwords; when a user later changes the password, it is stored in the new format.&lt;/p&gt;&#xA;&lt;p&gt;The example scenario &lt;code&gt;migrate-users&lt;/code&gt; does exactly this. Copy it to a working directory as in Chapter 03 (change the &lt;code&gt;dictionary&lt;/code&gt; path and replace the &lt;code&gt;.secret&lt;/code&gt; files). The key parts are the configuration and the 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-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# rradius.toml (migrate-users, excerpt)&lt;/span&gt;&#xA;&lt;/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;]&#xA;&lt;/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;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;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;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;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;add&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;INSERT INTO users (username, password, origin) VALUES (?1, ?2, &amp;#39;rradius&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;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;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, origin 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:#75715e&#34;&gt;# …(other settings omitted)&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;The account table has an extra column &lt;code&gt;origin&lt;/code&gt;, which records where the password of this account came from. When the password is changed, &lt;code&gt;passwd&lt;/code&gt; also sets it to &lt;code&gt;rradius&lt;/code&gt;. Later, the rows whose &lt;code&gt;origin&lt;/code&gt; is not &lt;code&gt;rradius&lt;/code&gt; tell you how many accounts are still in the old format.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;[auth.username]&lt;/code&gt; unifies the case and removes the domain, because names in old systems are often written inconsistently (see &lt;a class=&#34;link&#34; href=&#34;#normalize-user-names-and-realms&#34; &gt;Normalize user names and realms&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;code&gt;migrations/2_imported_users.sql&lt;/code&gt; holds a demo account for each source; every password is &amp;ldquo;account name-password&amp;rdquo;:&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;Account&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Source&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Stored value (start)&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;ldap1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;userPassword&lt;/code&gt; of an old LDAP directory&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;{SSHA}…&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;ldap2&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same as above&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;{SSHA512}…&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;ldap3&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same as above&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;{PBKDF2-SHA256}10000$…&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;ldap4&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same as above&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;{X-PBKDF2}HMACSHA2+256:…&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;shell1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The second field of &lt;code&gt;/etc/shadow&lt;/code&gt;, with &lt;code&gt;{crypt}&lt;/code&gt; in front&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;{crypt}$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;mail1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An old mail server&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;{NS-MTA-MD5}…&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;old1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A hexadecimal MD5 stored in an old database, converted to Base64&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;{MD5}kfiBqWi4k+QJLsoSpSKT7w==&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;win1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An NT hash stored by an old system&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;{nthash}…&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;check-it&#34;&gt;Check it&#xA;&lt;/h3&gt;&lt;p&gt;After the server starts, log in with PAP, one account at a time:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run … --user ldap3 --password ldap3-password --load pap,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;  pap: …, sent 1, accept 1, reject 0, …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Verified:&lt;/strong&gt; all eight accounts get &lt;code&gt;accept 1&lt;/code&gt; with PAP; &lt;code&gt;win1&lt;/code&gt; also gets &lt;code&gt;accept 1&lt;/code&gt; with MS-CHAPv2, while &lt;code&gt;ldap1&lt;/code&gt; (&lt;code&gt;{SSHA}&lt;/code&gt;) gets &lt;code&gt;reject 1&lt;/code&gt; with MS-CHAPv2; &lt;code&gt;CORP\Shell1&lt;/code&gt; and &lt;code&gt;win1@corp&lt;/code&gt; both log in after name normalization.&lt;/p&gt;&#xA;&lt;p&gt;Change a password once and watch &lt;code&gt;origin&lt;/code&gt; change with it:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd user show --config rradius.toml ldap1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;username=ldap1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;enabled=1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;origin=ldap&#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;new-pass\n&amp;#39;&lt;/span&gt; | rradiusd user passwd --config rradius.toml ldap1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;password changed for ldap1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd user show --config rradius.toml ldap1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;username=ldap1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;enabled=1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;origin=rradius&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;conversions-when-exporting-old-data&#34;&gt;Conversions when exporting old data&#xA;&lt;/h3&gt;&lt;p&gt;For most formats you only add the prefix in front of the original value. The ones that need conversion:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Hexadecimal digests:&lt;/strong&gt; after prefixes such as &lt;code&gt;{MD5}&lt;/code&gt; and &lt;code&gt;{SHA}&lt;/code&gt;, Base64 is expected, not hexadecimal. Convert with &lt;code&gt;xxd&lt;/code&gt; and &lt;code&gt;base64&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-console&#34; data-lang=&#34;console&#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;kfiBqWi4k+QJLsoSpSKT7w==&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Store it as &lt;code&gt;{MD5}kfiBqWi4k+QJLsoSpSKT7w==&lt;/code&gt;. This is exactly the value of &lt;code&gt;old1&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;code&gt;/etc/shadow&lt;/code&gt;:&lt;/strong&gt; add &lt;code&gt;{crypt}&lt;/code&gt; in front of the second field (&lt;code&gt;$1$…&lt;/code&gt;, &lt;code&gt;$5$…&lt;/code&gt;, &lt;code&gt;$6$…&lt;/code&gt;, &lt;code&gt;$2y$…&lt;/code&gt;). Without the prefix it is treated as a &lt;a class=&#34;link&#34; href=&#34;#a-hash-without-a-prefix-is-not-a-password&#34; &gt;hash without a prefix&lt;/a&gt; and rejected.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Systems that store only an NT hash:&lt;/strong&gt; add &lt;code&gt;{nthash}&lt;/code&gt; in front. These accounts work with both PAP and MS-CHAPv2.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The old formats can verify only PAP (except &lt;code&gt;{nthash}&lt;/code&gt; and plaintext). If a NAS of the old system logs these accounts in with CHAP or MS-CHAPv2, they are rejected after the move. Have the users change their passwords once, and set &lt;code&gt;scheme&lt;/code&gt; to a suitable format.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;what-can-and-cannot-be-migrated&#34;&gt;What can and cannot be migrated&#xA;&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;A hash can only be used with login methods that send the plaintext password to the server.&lt;/strong&gt; Before you migrate, check which one your devices use:&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 a hash be used?&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, most web logins, TACACS+ PAP and ASCII)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;All formats&lt;/td&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; see &lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;Chapter 11&lt;/a&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;All formats&lt;/td&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 in PPPoE)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Plaintext only (&lt;code&gt;{clear}&lt;/code&gt; or no prefix)&lt;/td&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 account-and-password method on Wi-Fi)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Plaintext or &lt;code&gt;{nthash}&lt;/code&gt; 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;MS-CHAPv1 (PPTP and old dial-up devices; refused by default, enabled with &lt;code&gt;[auth] allow_mschapv1 = true&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Plaintext or &lt;code&gt;{nthash}&lt;/code&gt; only&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;(This table follows the rules in &amp;ldquo;Choose a password format&amp;rdquo; above and in &lt;a class=&#34;link&#34; href=&#34;#authentication-protocols-and-the-ms-chapv1-switch&#34; &gt;Authentication protocols and the MS-CHAPv1 switch&lt;/a&gt;; for TACACS+ see &lt;a class=&#34;link&#34; href=&#34;../12-tacacs/#authentication-types-ascii-pap-chap-ms-chap&#34; &gt;Chapter 12&lt;/a&gt;.) So:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The old system stores NT hashes:&lt;/strong&gt; the migrated accounts can use PEAP right away (&lt;code&gt;win1&lt;/code&gt; in the example).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The old system has only other hashes, and Wi-Fi must use account and password:&lt;/strong&gt; there are two ways. Switch Wi-Fi to EAP-TTLS with inner PAP (support differs between operating systems, so check first; not verified in this chapter), or ask users to change their password once, with &lt;code&gt;scheme&lt;/code&gt; set to &lt;code&gt;nthash&lt;/code&gt; when they do.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;CHAP for PPPoE:&lt;/strong&gt; without plaintext it cannot be done; the only way is to reset the passwords.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;For salted hashes, the salt must come after.&lt;/strong&gt; Formats like &lt;code&gt;{SSHA}&lt;/code&gt; are Base64 of &amp;ldquo;digest followed by salt&amp;rdquo;, where the digest is computed over the password followed by the salt. If the old system uses &amp;ldquo;salt followed by password&amp;rdquo;, or mixes them another way, there is no matching format, and those accounts can only be reset.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When you are not sure it is right, try a test account whose password you know first.&lt;/strong&gt; A value in the wrong format fails the check and lets nobody in.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Verified&lt;/strong&gt; (scenario test of &lt;code&gt;migrate-users&lt;/code&gt;, see the example directory): all eight demo accounts are accepted with PAP, and the &lt;code&gt;{SSHA}&lt;/code&gt; account is rejected with CHAP.&lt;/p&gt;&#xA;&lt;h3 id=&#34;import-sql&#34;&gt;Import SQL&#xA;&lt;/h3&gt;&lt;p&gt;Turn the data exported from the old system into a new numbered migration file (in the example, &lt;code&gt;migrations/2_imported_users.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:#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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  (&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;o&amp;#39;&amp;#39;brien&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;{nthash}9d232eea31049319fc8ab84300855a34&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;nt&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 that has been applied cannot be changed (a change gives &lt;code&gt;migration file &#39;…&#39; changed after it was applied&lt;/code&gt;; see &lt;a class=&#34;link&#34; href=&#34;../18-operations/&#34; &gt;Chapter 18&lt;/a&gt;); to add accounts later, add a file with the next number.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Convert account names to lower case and remove the domain first,&lt;/strong&gt; to match the settings in &lt;a class=&#34;link&#34; href=&#34;#normalize-user-names-and-realms&#34; &gt;Normalize user names and realms&lt;/a&gt;. If names with different case stay in the table, the lookup does not find them: with &lt;code&gt;lowercase = true&lt;/code&gt;, the row &lt;code&gt;Alice&lt;/code&gt; is never matched.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Two accounts that differ only in case&lt;/strong&gt; become the same name after lowercasing. In the example, &lt;code&gt;users.username&lt;/code&gt; is a &lt;code&gt;PRIMARY KEY&lt;/code&gt;, so the &lt;code&gt;INSERT&lt;/code&gt; of the row that is now a duplicate fails (&lt;code&gt;UNIQUE constraint failed&lt;/code&gt;), and the whole migration file fails with it. Find them before the import and decide which to keep.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Single quotes in SQL strings are written twice&lt;/strong&gt; (&lt;code&gt;o&#39;&#39;brien&lt;/code&gt; above). When a program generates the file, handle the quotes in both account names and hashes.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The &lt;code&gt;origin&lt;/code&gt; column is not required.&lt;/strong&gt; The example uses it to record where each account&amp;rsquo;s password came from, so that you can count how many old formats remain.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When the file is very large&lt;/strong&gt; (hundreds of thousands of rows), the import takes time: raise &lt;code&gt;[cluster] migrations_wait_ms&lt;/code&gt; (default &lt;code&gt;60000&lt;/code&gt;) to more than the import time. If the wait runs out at startup, it fails with &lt;code&gt;cluster was not ready to apply migrations: … (the limit is migrations_wait_ms; raise it if a migration file takes longer)&lt;/code&gt;. Note that a cluster node waits only 30 seconds for the write of one migration file: past that, the message changes to &lt;code&gt;the cluster node gives one migration file 30 s to be answered, whatever migrations_wait_ms is&lt;/code&gt;, the file keeps running inside the cluster, and once it finishes you start again with a longer &lt;code&gt;migrations_wait_ms&lt;/code&gt;. This chapter did not measure how long an import of hundreds of thousands of rows takes.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The exported file holds everyone&amp;rsquo;s password hash.&lt;/strong&gt; 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 applied migration file, which stays in &lt;code&gt;migrations_dir&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;user add&lt;/code&gt; cannot be used to move existing hashes.&lt;/strong&gt; It accepts only a plaintext password (from standard input) and hashes it itself according to &lt;code&gt;scheme&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;plaintext-without-a-prefix-mysql-and-concat&#34;&gt;Plaintext without a prefix: MySQL and &lt;code&gt;CONCAT&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;When an old system stores plaintext in a column, a value without a prefix is used directly as plaintext. The exceptions are plaintext that itself starts with &lt;code&gt;{&lt;/code&gt; (it would be mistaken for a format prefix), or starts with something like &lt;code&gt;$2a$&lt;/code&gt;, &lt;code&gt;$1$&lt;/code&gt; or &lt;code&gt;$argon2&lt;/code&gt; (it would be treated as a hash with a missing prefix; see &lt;a class=&#34;link&#34; href=&#34;#a-hash-without-a-prefix-is-not-a-password&#34; &gt;A hash without a prefix is not a password&lt;/a&gt;). In that case add &lt;code&gt;{clear}&lt;/code&gt; in the SQL:&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;-- SQLite, PostgreSQL: concatenate with ||&#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;SELECT&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;{clear}&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; value &lt;span style=&#34;color:#66d9ef&#34;&gt;FROM&lt;/span&gt; radcheck &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:#f92672&#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;-- MySQL: use CONCAT&#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;SELECT&lt;/span&gt; CONCAT(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;{clear}&amp;#39;&lt;/span&gt;, value) &lt;span style=&#34;color:#66d9ef&#34;&gt;FROM&lt;/span&gt; radcheck &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:#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;(In MySQL, &lt;code&gt;||&lt;/code&gt; is a logical OR by default, not concatenation, so write &lt;code&gt;CONCAT&lt;/code&gt;. The two lines above come from an older version of the manual and were not run again on a real database.)&lt;/p&gt;&#xA;&lt;h3 id=&#34;before-going-live&#34;&gt;Before going live&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Run both in parallel for a while.&lt;/strong&gt; Point a few NAS at rradius and leave the others on the old system; when the login results match, switch all of them.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Reply attributes from the old system&lt;/strong&gt; (VLAN, rate, privilege) must be moved too; put them in &lt;code&gt;user_reply&lt;/code&gt; (the example&amp;rsquo;s table, which &lt;code&gt;reply_query&lt;/code&gt; reads). Attribute names must be names in the rradius dictionary (&lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;Chapter 06&lt;/a&gt;); after the move, try a few accounts with real logins, and do not rely on &lt;code&gt;check&lt;/code&gt; alone.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Shared secrets from the old system&lt;/strong&gt; can be kept, and the NAS only needs the new server address; better still, use this chance to switch to long secrets that differ per device.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Slow hashes queue.&lt;/strong&gt; &lt;code&gt;{crypt}&lt;/code&gt;, &lt;code&gt;{argon2}&lt;/code&gt; and PBKDF2 are slow on purpose, so many simultaneous logins queue up and get slower at peak. Values with too high a cost are stopped by &lt;code&gt;[auth.password_limits]&lt;/code&gt; (see &lt;a class=&#34;link&#34; href=&#34;#limit-the-cost-of-hashing&#34; &gt;Limit the cost of hashing&lt;/a&gt;); if the migrated hashes naturally cost a lot, raise the limits first.&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 the deadline, use a new migration file to set the password to &lt;code&gt;NULL&lt;/code&gt; (for example &lt;code&gt;UPDATE users SET password = NULL WHERE origin &amp;lt;&amp;gt; &#39;rradius&#39;&lt;/code&gt;). An account whose password column is &lt;code&gt;NULL&lt;/code&gt; can never log in (log: &lt;code&gt;no stored password; rejecting&lt;/code&gt;), and the user must ask an administrator for a reset. This &lt;code&gt;UPDATE&lt;/code&gt; is written for the example table and was not run.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Not tested:&lt;/strong&gt; the actual flow of exporting from, and importing out of, any specific old system. The hashes in the example were computed from the definition of each format, and the scenario test confirms that rradius verifies them.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If you want the accounts to stay in their original PostgreSQL or MySQL and keep being maintained by the old system, the sql handler can query the external database directly with &lt;code&gt;database&lt;/code&gt;; &lt;code&gt;external-db.toml&lt;/code&gt; in the scenario is written this way, see &lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;Chapter 09&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; The accounts and passwords in &lt;code&gt;2_imported_users.sql&lt;/code&gt; are public demo values. When you turn this scenario into a production setup, delete this file and replace it with the data you exported yourself.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;limit-the-cost-of-hashing&#34;&gt;Limit the cost of hashing&#xA;&lt;/h2&gt;&lt;p&gt;The value of a slow hash itself carries its computation cost, for example the iteration count of PBKDF2, the cost of bcrypt and the memory use of argon2. Someone who can write to the account table can put in a value with an extremely high cost, so that every login holds a check slot for a very long time or uses a lot of memory.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;[auth.password_limits]&lt;/code&gt; sets limits. Before the check, the cost in the value is read, and if it exceeds the limit the hash is not computed and the password is simply treated as wrong:&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Format it limits&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;auth.password_limits.pbkdf2_iterations&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;5000000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Iterations of &lt;code&gt;{PBKDF2*}&lt;/code&gt; and &lt;code&gt;{X-PBKDF2}&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;auth.password_limits.crypt_rounds&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1000000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rounds of &lt;code&gt;$5$&lt;/code&gt;, &lt;code&gt;$6$&lt;/code&gt;, &lt;code&gt;$sha1$&lt;/code&gt; and extended DES in &lt;code&gt;{crypt}&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;auth.password_limits.bcrypt_cost&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;15&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The bcrypt cost in &lt;code&gt;{crypt}&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;auth.password_limits.argon2_memory_kib&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;262144&lt;/code&gt; (256 MiB)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Memory of &lt;code&gt;{argon2}&lt;/code&gt;, in KiB&lt;/td&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.password_limits.argon2_iterations&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;10&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Iterations of &lt;code&gt;{argon2}&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;auth.password_limits.argon2_lanes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;16&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Parallelism of &lt;code&gt;{argon2}&lt;/code&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;Without this section, the limits are still these defaults. Every value must be greater than 0.&lt;/li&gt;&#xA;&lt;li&gt;It can be reloaded; if a reload fails, the old limits stay.&lt;/li&gt;&#xA;&lt;li&gt;Formats with a fixed cost (DES, &lt;code&gt;$1$&lt;/code&gt;, the SHA and MD5 digests, &lt;code&gt;{nthash}&lt;/code&gt;) are not limited.&lt;/li&gt;&#xA;&lt;li&gt;Going over a limit counts as one failed login: &lt;code&gt;rradius_password_checks_total&lt;/code&gt; records it as &lt;code&gt;failed&lt;/code&gt;, and &lt;a class=&#34;link&#34; href=&#34;#login-failure-lockout&#34; &gt;login failure lockout&lt;/a&gt; counts it too. It is not &amp;ldquo;backend unavailable&amp;rdquo;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;goal-lower-the-pbkdf2-limit-to-100000-iterations&#34;&gt;Goal: lower the PBKDF2 limit to 100,000 iterations&#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:#75715e&#34;&gt;# rradius.toml (add after [[auth.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;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;password_limits&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;pbkdf2_iterations&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;100000&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The account &lt;code&gt;erin&lt;/code&gt;, which stores &lt;code&gt;{PBKDF2-SHA256}&lt;/code&gt; with 200,000 iterations, can log in before the limit is lowered; after a reload, even the correct password is rejected, and the log gets one warning (once per account, without the stored 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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::auth_chain: the stored password asks for more than [auth.password_limits].pbkdf2_iterations allows and is refused; raise the limit if the hash is meant to be used user=&amp;#34;erin&amp;#34; format=&amp;#34;pbkdf2-sha256&amp;#34; parameter=&amp;#34;pbkdf2_iterations&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Verified.&lt;/strong&gt; To keep such an account able to log in, raise the limit, or have the user change the password so that it is stored in the &lt;code&gt;scheme&lt;/code&gt; format.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;code&gt;argon2_memory_kib&lt;/code&gt; is the limit for one check. The number of simultaneous checks equals the number of CPUs, so the worst-case memory use is about this value times the number of CPUs.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;authentication-protocols-and-the-ms-chapv1-switch&#34;&gt;Authentication protocols and the MS-CHAPv1 switch&#xA;&lt;/h2&gt;&lt;p&gt;The auth chain decides which kind of login it is from what the request carries:&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;Attributes in the request&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Stored values it can verify&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&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;User-Password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;All formats in the previous section&lt;/td&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&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;CHAP-Password&lt;/code&gt; (&lt;code&gt;CHAP-Challenge&lt;/code&gt; or the Request Authenticator)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Plaintext, &lt;code&gt;{clear}&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;MS-CHAPv2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The Microsoft vendor attributes &lt;code&gt;MS-CHAP-Challenge&lt;/code&gt; (16 octets) and &lt;code&gt;MS-CHAP2-Response&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Plaintext, &lt;code&gt;{clear}&lt;/code&gt;, &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;MS-CHAPv1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;MS-CHAP-Challenge&lt;/code&gt; (8 octets) and &lt;code&gt;MS-CHAP-Response&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Plaintext, &lt;code&gt;{clear}&lt;/code&gt;, &lt;code&gt;{nthash}&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;TACACS+ logins go through the same chain; for the &lt;code&gt;[tacacs]&lt;/code&gt; settings see &lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;Chapter 12&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;When MS-CHAPv2 succeeds, the Access-Accept carries &lt;code&gt;MS-CHAP2-Success&lt;/code&gt;, &lt;code&gt;MS-MPPE-Send-Key&lt;/code&gt; and &lt;code&gt;MS-MPPE-Recv-Key&lt;/code&gt;; when it fails, the Access-Reject carries &lt;code&gt;MS-CHAP-Error&lt;/code&gt; (error 691). When the user name is written as &lt;code&gt;domain\account&lt;/code&gt;, the response is computed with the part after the backslash. MS-CHAPv1 checks only the NT-Response and does not accept a response that has only an LM-Response.&lt;/p&gt;&#xA;&lt;p&gt;MS-CHAPv1 is a very old protocol, and with an &lt;code&gt;[auth]&lt;/code&gt; chain it is &lt;strong&gt;not accepted by default&lt;/strong&gt; (a setup without &lt;code&gt;[auth]&lt;/code&gt;, where a Lua script handles everything, is outside the scope of this switch). Turn it on explicitly only when a NAS cannot do without it (for example an older PPTP gateway):&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:#75715e&#34;&gt;# rradius.toml (inside [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;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;&lt;span style=&#34;color:#a6e22e&#34;&gt;allow_mschapv1&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;auth.allow_mschapv1&lt;/code&gt; is &lt;code&gt;false&lt;/code&gt; by default and can be reloaded. When the key is not set, or is &lt;code&gt;false&lt;/code&gt;, an MS-CHAPv1 login is rejected before any handler runs, and &lt;code&gt;handler&lt;/code&gt; in the authentication log is &lt;code&gt;mschapv1_refused&lt;/code&gt;; the database is not queried, and it does not count as a failed login. PAP, CHAP, MS-CHAPv2 and EAP are not affected.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Upgrade note:&lt;/strong&gt; This default used to be &lt;code&gt;true&lt;/code&gt;. After an upgrade, old devices that use only MS-CHAPv1 fail every login; &lt;code&gt;handler=&amp;quot;mschapv1_refused&amp;quot;&lt;/code&gt; in the authentication log shows which NAS they are, and you set &lt;code&gt;allow_mschapv1 = true&lt;/code&gt; only after confirming it is needed.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; &lt;code&gt;rradius-bench&lt;/code&gt; has no MS-CHAPv1 load, so this part was checked only against the code and tests; the setting itself passed &lt;code&gt;check&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;sql-handler&#34;&gt;sql handler&#xA;&lt;/h2&gt;&lt;p&gt;The sql handler is the most commonly used handler: it looks up the account&amp;rsquo;s password with one SQL statement, and after the check passes, looks up the reply attributes with another.&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:#75715e&#34;&gt;# rradius.toml&lt;/span&gt;&#xA;&lt;/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;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;user_query&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (required)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Exactly one &lt;code&gt;?&lt;/code&gt;, filled with the account name. The first column is the stored password&lt;/td&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;reply_query&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Exactly one &lt;code&gt;?&lt;/code&gt;. Each row is &lt;code&gt;(attribute name, value)&lt;/code&gt;, added to the Access-Accept in order&lt;/td&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;certificate_query&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The query used instead after an EAP-TLS certificate passes; if it finds a row, the login is accepted (&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;Chapter 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;&lt;code&gt;default_user&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;When the account is not found, verify against this account&amp;rsquo;s password instead&lt;/td&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;database&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (cluster database)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Query a &lt;code&gt;[databases.&amp;lt;name&amp;gt;]&lt;/code&gt; instead (&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;Chapter 09&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;timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;5000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Time limit for one query, in milliseconds; it also covers the queueing and checking time of slow hashes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The whole of &lt;code&gt;[auth]&lt;/code&gt; can be reloaded (except the connection that &lt;code&gt;database&lt;/code&gt; points to: a change in &lt;code&gt;[databases]&lt;/code&gt; needs a restart).&lt;/p&gt;&#xA;&lt;p&gt;How the query results are read:&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 of &lt;code&gt;user_query&lt;/code&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Answer of the handler&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 row&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;ignore (with &lt;code&gt;default_user&lt;/code&gt;, that account is used instead)&lt;/td&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 row, password check passes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;accept, then &lt;code&gt;reply_query&lt;/code&gt; runs&lt;/td&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 row, password does not match&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;One row, the password column is NULL or empty&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reject (log: &lt;code&gt;no stored password; rejecting&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;Two or more rows&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reject (log: &lt;code&gt;user_query returned 2 rows; rejecting&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;Query fails or times out&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Backend unavailable; no answer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The account name is always bound as a parameter and never joined into the SQL string.&lt;/p&gt;&#xA;&lt;p&gt;The attribute names in &lt;code&gt;reply_query&lt;/code&gt; must be in the dictionary (&lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;Chapter 06&lt;/a&gt;). &lt;code&gt;alice&lt;/code&gt; in quick-start has two rows, &lt;code&gt;Session-Timeout = 3600&lt;/code&gt; and &lt;code&gt;Filter-Id = staff&lt;/code&gt;, and the Access-Accept of a successful login carries these two attributes, in the order the query returns them.&lt;/p&gt;&#xA;&lt;h3 id=&#34;default_user-a-shared-account-when-none-is-found&#34;&gt;default_user: a shared account when none is found&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;default_user&lt;/code&gt; makes a name that is not found verify against the password of a shared account, for example one shared password for a guest network:&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:#75715e&#34;&gt;# rradius.toml (excerpt)&lt;/span&gt;&#xA;&lt;/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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;default_user&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;DEFAULT&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 table needs a &lt;code&gt;DEFAULT&lt;/code&gt; account. In the test it stores &lt;code&gt;{clear}guest-password&lt;/code&gt;, and the handler is in the &lt;code&gt;lab&lt;/code&gt; chain of the next section:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Name &lt;code&gt;visitor&lt;/code&gt;, password &lt;code&gt;guest-password&lt;/code&gt;: &lt;code&gt;accept 1&lt;/code&gt;. In the authentication log &lt;code&gt;user&lt;/code&gt; is &lt;code&gt;visitor&lt;/code&gt; and &lt;code&gt;account&lt;/code&gt; is &lt;code&gt;DEFAULT&lt;/code&gt;, and &lt;code&gt;reply_query&lt;/code&gt; also looks up the reply attributes of &lt;code&gt;DEFAULT&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Name &lt;code&gt;visitor&lt;/code&gt;, wrong password: &lt;code&gt;reject 1&lt;/code&gt;. Note that the result is reject, not ignore: with &lt;code&gt;default_user&lt;/code&gt;, any name that is not found becomes a check against the &lt;code&gt;DEFAULT&lt;/code&gt; password, and the handlers after it never get a chance.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Verified.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; Anyone who knows the &lt;code&gt;DEFAULT&lt;/code&gt; password can log in with any name. &lt;code&gt;default_user&lt;/code&gt; does not apply inside EAP (the EAP name is recorded and returned to the device), nor to EAP-TLS certificate logins.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;lua-handler&#34;&gt;lua handler&#xA;&lt;/h2&gt;&lt;p&gt;The lua handler runs a separate Lua script, for rules that tables and SQL cannot express. For how to write scripts and the functions available, see &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;Chapter 10&lt;/a&gt; and &lt;a class=&#34;link&#34; href=&#34;../93-lua-reference/&#34; &gt;Appendix D&lt;/a&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:#75715e&#34;&gt;# rradius.toml (excerpt)&lt;/span&gt;&#xA;&lt;/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;policy.lua&amp;#34;&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;script&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (required)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The script file, relative to the directory of 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;verifies_password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Set to &lt;code&gt;true&lt;/code&gt; when the script checks the password itself&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The return value of the script maps to the handler&amp;rsquo;s answer: &lt;code&gt;&amp;quot;accept&amp;quot;&lt;/code&gt;, &lt;code&gt;&amp;quot;ignore&amp;quot;&lt;/code&gt;, &lt;code&gt;&amp;quot;challenge&amp;quot;&lt;/code&gt; (RADIUS only); any other value, or a script error, is reject. The global variable &lt;code&gt;auth_user&lt;/code&gt; in the script is the normalized account name, while &lt;code&gt;get_attr(&#39;User-Name&#39;)&lt;/code&gt; is still the name as received.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;verifies_password&lt;/code&gt; matters:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The default is &lt;code&gt;false&lt;/code&gt;, meaning the script only checks policy (for example the time of day or the source device), and its accept does not mean the password is correct.&lt;/li&gt;&#xA;&lt;li&gt;With &lt;code&gt;true&lt;/code&gt;, the script verifies the password itself (for example with &lt;code&gt;password_verify&lt;/code&gt;). In &lt;code&gt;all_accept&lt;/code&gt;, only then does its accept count as &amp;ldquo;someone checked the password&amp;rdquo;; in EAP, only then does its accept count as proof of the password.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;code&gt;check&lt;/code&gt; reads and compiles the script of every lua handler, and reports an error if it cannot be read or does not compile.&lt;/p&gt;&#xA;&lt;h2 id=&#34;all_accept-add-a-policy-on-top-of-the-password&#34;&gt;all_accept: add a policy on top of the password&#xA;&lt;/h2&gt;&lt;p&gt;Goal: the sql handler checks the password, and a script then blocks one NAS. The login is let through only when both conditions pass.&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;-- policy.lua&lt;/span&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; get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;NAS-Identifier&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;lab-blocked&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;  &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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;set_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Reply-Message&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;policy ok&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;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;/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-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# rradius.toml (excerpt)&lt;/span&gt;&#xA;&lt;/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;lab&lt;/span&gt;]&#xA;&lt;/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;chains&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;lab&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;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;lab&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;policy.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;This is a named chain &lt;code&gt;lab&lt;/code&gt;; the next section explains how to make a client use it. For the test, set the &lt;code&gt;localhost&lt;/code&gt; client to &lt;code&gt;auth = &amp;quot;lab&amp;quot;&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run … --user bob --password bob-password --load pap,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;…  accept 1, reject 0 …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run … --user bob --password bob-password --nas-identifier lab-blocked --load pap,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;…  accept 0, reject 1 …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The server&amp;rsquo;s authentication log:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… user=&amp;#34;bob&amp;#34; account=&amp;#34;bob&amp;#34; chain=&amp;#34;lab&amp;#34; handler=&amp;#34;lua&amp;#34; decision=&amp;#34;accept&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… user=&amp;#34;bob&amp;#34; account=&amp;#34;bob&amp;#34; chain=&amp;#34;lab&amp;#34; handler=&amp;#34;lua&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When both handlers accept, the Access-Accept carries the reply attributes of both, in the order they ran (the &lt;code&gt;reply_query&lt;/code&gt; ones first, then the &lt;code&gt;set_attr&lt;/code&gt; ones).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Verified.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;when-nobody-checks-the-password&#34;&gt;When nobody checks the password&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;all_accept&lt;/code&gt; has a protective rule: if the chain has any handler that checks passwords (sql, ldap, netlogon, or lua with &lt;code&gt;verifies_password = true&lt;/code&gt;), one of them must accept for the result to be accept. Otherwise, in a chain like the one above, the sql handler would not find the account (ignore) and the policy script would accept anyone, so the result would be &amp;ldquo;everyone gets in&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;So, with the same chain, log in with a name that does not exist:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::lua_engine: auth chain: rejecting a request from client localhost: all_accept without checking a password&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… user=&amp;#34;visitor&amp;#34; account=&amp;#34;visitor&amp;#34; chain=&amp;#34;lab&amp;#34; handler=&amp;#34;no_password_check&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The result is reject, and the policy script does not run at all: no handler that checks passwords is left after it, and any data the script wrote would stay with a request that is bound to be rejected.&lt;/p&gt;&#xA;&lt;p&gt;Other details:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If the policy script returns &lt;code&gt;challenge&lt;/code&gt; before a handler that checks passwords has accepted, it is also rejected, and no Access-Challenge is sent.&lt;/li&gt;&#xA;&lt;li&gt;If the chain has only lua handlers that do not check passwords, their answers decide.&lt;/li&gt;&#xA;&lt;li&gt;This kind of rejection does not count as a failed login.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Verified&lt;/strong&gt; (a name that does not exist is rejected, &lt;code&gt;handler=&amp;quot;no_password_check&amp;quot;&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;h2 id=&#34;let-different-nas-use-different-chains&#34;&gt;Let different NAS use different chains&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;[[auth.handlers]]&lt;/code&gt; is the default chain, called &lt;code&gt;default&lt;/code&gt; in the authentication log. You can also define any number of named chains, and a client picks one with &lt;code&gt;auth&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:#75715e&#34;&gt;# rradius.toml (excerpt)&lt;/span&gt;&#xA;&lt;/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;lab&lt;/span&gt;]&#xA;&lt;/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;&lt;span style=&#34;color:#75715e&#34;&gt;# …(handlers as in the previous section)&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;localhost&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;127.0.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;localhost.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;lab&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Rules:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A client without &lt;code&gt;auth&lt;/code&gt; uses the default chain. When there is no default chain (&lt;code&gt;[auth]&lt;/code&gt; has only named chains), this client is decided by the top-level script of &lt;code&gt;[lua]&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;An &lt;code&gt;auth&lt;/code&gt; that points to a chain that does not exist makes &lt;code&gt;check&lt;/code&gt; fail: &lt;code&gt;radius client &#39;localhost&#39;: unknown auth chain &#39;vpn&#39; (no [auth.chains.vpn])&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;TACACS+ clients also pick a chain with &lt;code&gt;auth&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;Chapter 12&lt;/a&gt;). When RADIUS and TACACS+ clients point to the same chain, they share one set of handlers, including the LDAP connection pool.&lt;/li&gt;&#xA;&lt;li&gt;Each chain is built once, at startup and at reload.&lt;/li&gt;&#xA;&lt;li&gt;A named chain must set its own &lt;code&gt;policy&lt;/code&gt; and &lt;code&gt;username&lt;/code&gt;; it does not inherit them from &lt;code&gt;[auth]&lt;/code&gt;. If &lt;code&gt;[auth]&lt;/code&gt; sets &lt;code&gt;policy&lt;/code&gt; or &lt;code&gt;[auth.username]&lt;/code&gt; but has no &lt;code&gt;[[auth.handlers]]&lt;/code&gt;, &lt;code&gt;check&lt;/code&gt; fails.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The example scenario &lt;code&gt;remote-access&lt;/code&gt; works this way: the VPN gateway uses the &lt;code&gt;vpn&lt;/code&gt; chain (LDAP), and the jump host uses the &lt;code&gt;mfa&lt;/code&gt; chain (Lua two-step verification). For the LDAP part see &lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;Chapter 08&lt;/a&gt;, and for two-step verification see &lt;a class=&#34;link&#34; href=&#34;../15-access-recipes/&#34; &gt;Chapter 15&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A change of chain only needs a reload. Run it outside the terminal that runs the server:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kill -HUP &amp;lt;server PID&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The server log writes &lt;code&gt;configuration reloaded from rradius.toml&lt;/code&gt;, and later requests use the new chain. For the details of reload see &lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;Chapter 04&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;normalize-user-names-and-realms&#34;&gt;Normalize user names and realms&#xA;&lt;/h2&gt;&lt;p&gt;The names users send are often inconsistent: &lt;code&gt;alice&lt;/code&gt;, &lt;code&gt;Alice&lt;/code&gt;, &lt;code&gt;CORP\alice&lt;/code&gt;, &lt;code&gt;alice@corp.example&lt;/code&gt;. Before handing it to the handlers, &lt;code&gt;[auth.username]&lt;/code&gt; turns the received name into the account name:&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:#75715e&#34;&gt;# rradius.toml (add after [[auth.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;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;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;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;strip_realm&lt;/code&gt;&lt;/td&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;The realm to remove: &lt;code&gt;none&lt;/code&gt;, &lt;code&gt;suffix&lt;/code&gt;, &lt;code&gt;prefix&lt;/code&gt;, &lt;code&gt;both&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;lowercase&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Convert to lower case&lt;/td&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;allowed&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A regular expression that the normalized name must match &lt;strong&gt;entirely&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 order is fixed: remove the realm first, then lower the case, and check &lt;code&gt;allowed&lt;/code&gt; last.&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;strip_realm&lt;/code&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;code&gt;lowercase&lt;/code&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Received&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Account name&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;none&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Alice@Corp&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Alice@Corp&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;suffix&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Alice@Corp&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Alice&lt;/code&gt; (removed from the last &lt;code&gt;@&lt;/code&gt; 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;&lt;code&gt;suffix&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;a@b@c&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;a@b&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;suffix&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;CORP\Alice&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;CORP\Alice&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;prefix&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;CORP\Alice&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Alice&lt;/code&gt; (removed up to the last backslash)&lt;/td&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;prefix&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;A\B\c&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;c&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;both&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;CORP\Alice@Corp&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;alice&lt;/code&gt; (prefix first, then suffix)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;If the result is an empty string, or does not match &lt;code&gt;allowed&lt;/code&gt;, the chain rejects at once, runs no handler, and &lt;code&gt;handler&lt;/code&gt; in the authentication log is &lt;code&gt;normalization&lt;/code&gt;. The log gives only the reason and not the received name, because it comes from outside and may contain control characters:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::lua_engine: auth chain: rejecting a request from client localhost: the user name does not match the allowed pattern&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… user=&amp;#34;alice smith&amp;#34; account=&amp;#34;&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;normalization&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::lua_engine: auth chain: rejecting a request from client localhost: the user name is empty after normalization&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… user=&amp;#34;@corp&amp;#34; account=&amp;#34;&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;normalization&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Tested with the settings above: &lt;code&gt;CORP\Alice@corp.example&lt;/code&gt; and &lt;code&gt;ALICE&lt;/code&gt; both log in as &lt;code&gt;alice&lt;/code&gt;; &lt;code&gt;alice smith&lt;/code&gt; (it has a space) and &lt;code&gt;@corp&lt;/code&gt; (empty after normalization) are rejected. &lt;strong&gt;Verified.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;effects-elsewhere&#34;&gt;Effects elsewhere&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Handlers look up the account name:&lt;/strong&gt; &lt;code&gt;user_query&lt;/code&gt; and &lt;code&gt;reply_query&lt;/code&gt; of sql and the search condition of ldap all use the normalized name. Always store lower case in the table.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The password check uses the received name:&lt;/strong&gt; the MS-CHAPv2 response is computed over the name the user sent, so verification uses it as it was.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The &lt;code&gt;user&lt;/code&gt; command applies it too:&lt;/strong&gt; when the default chain has &lt;code&gt;[auth.username]&lt;/code&gt;, &lt;code&gt;user add &#39;CORP\Henry@Corp&#39;&lt;/code&gt; stores &lt;code&gt;henry&lt;/code&gt; (the output is &lt;code&gt;added henry&lt;/code&gt;); a name that does not match &lt;code&gt;allowed&lt;/code&gt;, for example &lt;code&gt;user add &#39;bad name&#39;&lt;/code&gt;, prints &lt;code&gt;&#39;bad name&#39;: the user name does not match the allowed pattern&lt;/code&gt;, exits with code 2 and writes nothing. The &lt;code&gt;username&lt;/code&gt; of a named chain does not affect the &lt;code&gt;user&lt;/code&gt; command.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;lua handler:&lt;/strong&gt; &lt;code&gt;auth_user&lt;/code&gt; is the account name, and &lt;code&gt;get_attr(&#39;User-Name&#39;)&lt;/code&gt; is the received name.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;EAP-TLS certificates:&lt;/strong&gt; the certificate proves the whole name. If normalization changes anything besides ASCII case (for example removing the realm), the login is rejected (&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;Chapter 11&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;code&gt;allowed&lt;/code&gt; gets anchors at the start and end automatically. Writing &lt;code&gt;[a-z0-9._-]+&lt;/code&gt; already means &amp;ldquo;the whole name can have only these characters&amp;rdquo;, so you do not need to write &lt;code&gt;^…$&lt;/code&gt; yourself.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;password-length&#34;&gt;Password length&#xA;&lt;/h2&gt;&lt;p&gt;According to section 5.2 of RFC 2865, the RADIUS User-Password is always 16 to 128 octets, and a multiple of 16 (the NAS pads the password with zeros to whole blocks). When a request arrives with a wrong length, rradius answers Access-Reject before decrypting, runs no handler or script, and does not count it in &lt;a class=&#34;link&#34; href=&#34;#login-failure-lockout&#34; &gt;login failure lockout&lt;/a&gt;, because this is not password guessing; &lt;code&gt;handler&lt;/code&gt; in the authentication log is &lt;code&gt;length&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Each rejection writes one WARN line with only the client name and the length, without the password, and it is rate limited, so a flood of requests does not flood the log:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::radius: RADIUS client nas1: Access-Request refused, its User-Password is 240 octets, not 16 to 128 in whole blocks of 16&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Upgrade note:&lt;/strong&gt; A User-Password longer than 128 octets used to be decrypted and verified as usual; now it is rejected. A NAS that does not pad to a multiple of 16 is rejected too. Before you upgrade, check the authentication log for lines with &lt;code&gt;handler=&amp;quot;length&amp;quot;&lt;/code&gt;; if there are any, it is a NAS configuration problem, not a wrong password.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;login-failure-lockout&#34;&gt;Login failure lockout&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;[auth.lockout]&lt;/code&gt; limits password guessing: when the same account fails too many times from the same origin within a period, it is locked first, and during the lock logins are rejected at once, without even checking the password.&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:#75715e&#34;&gt;# rradius.toml (add after [[auth.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;auth&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;lockout&lt;/span&gt;]&#xA;&lt;/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_failures&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:#a6e22e&#34;&gt;lock_seconds&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;60&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;max_failures&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;10&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How many failures within the window cause a lock&lt;/td&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;window_seconds&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;300&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The window, counted from the first failure, in 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;lock_seconds&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;300&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How long the lock lasts, in 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;max_entries&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;100000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The most keys each node remembers&lt;/td&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;account_max_failures&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (no total limit per account)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The limit on the total failures of one account from all origins; must be greater than &lt;code&gt;max_failures&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;max_in_flight&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;5 times &lt;code&gt;max_failures&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The most logins that can wait for a result at the same time for one key&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Every value must be greater than 0; it can be reloaded. Without this section nothing is counted at all.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-unit-of-counting&#34;&gt;The unit of counting&#xA;&lt;/h3&gt;&lt;p&gt;The lockout &amp;ldquo;key&amp;rdquo; is the &lt;strong&gt;account name plus the origin&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The account name is the name the chain normalized and looks up, then converted to ASCII lower case. So &lt;code&gt;Alice&lt;/code&gt; and &lt;code&gt;alice&lt;/code&gt; are the same key, and changing the case does not get around it.&lt;/li&gt;&#xA;&lt;li&gt;The origin is the &lt;code&gt;Calling-Station-Id&lt;/code&gt; of the RADIUS request (usually the MAC address of the user&amp;rsquo;s device), or the &lt;code&gt;rem_addr&lt;/code&gt; of TACACS+. If there is none, it is empty.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;So if &lt;code&gt;alice&lt;/code&gt; is locked on her own laptop, a login from her phone (another &lt;code&gt;Calling-Station-Id&lt;/code&gt;) is not affected. With &lt;code&gt;account_max_failures&lt;/code&gt; set, the failures of one account from all origins are also added up separately, and when the limit is reached, the account is locked for all origins.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;code&gt;account_max_failures&lt;/code&gt; lets an attacker lock someone else&amp;rsquo;s account for all origins just by sending wrong passwords on purpose. Set it only when you are sure you need it.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;What counts as one failure: a login the chain rejects, and not because the backend is unavailable. These do &lt;strong&gt;not&lt;/strong&gt; count:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The backend is unavailable (a database, LDAP or domain controller failure, or a slow-hash queue timeout)&lt;/li&gt;&#xA;&lt;li&gt;The name does not match &lt;code&gt;[auth.username]&lt;/code&gt; (&lt;code&gt;normalization&lt;/code&gt;), no one checked the password in &lt;code&gt;all_accept&lt;/code&gt; (&lt;code&gt;no_password_check&lt;/code&gt;), &lt;code&gt;mschapv1_refused&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Access-Challenge, and EAP-TLS certificate logins&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;A successful login clears the failure count of this key. Accounts that do not exist are counted and locked just the same, so you cannot tell from the responses whether an account exists.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;max_in_flight&lt;/code&gt; deals with another way of guessing: send a large batch at once, so that all of them arrive before any one fails. Every login takes a slot before the handlers run and returns it when the result is out; when one key has used all &lt;code&gt;max_in_flight&lt;/code&gt; slots, later logins are rejected at once.&lt;/p&gt;&#xA;&lt;h3 id=&#34;goal-lock-a-device-that-keeps-entering-wrong-passwords&#34;&gt;Goal: lock a device that keeps entering wrong passwords&#xA;&lt;/h3&gt;&lt;p&gt;With the &lt;code&gt;max_failures = 3&lt;/code&gt; settings above, &lt;code&gt;--attr 31=text:…&lt;/code&gt; makes &lt;code&gt;rradius-bench&lt;/code&gt; send &lt;code&gt;Calling-Station-Id&lt;/code&gt; (attribute 31):&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run … --user alice --password wrong --attr 31&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;text:aa-bb-cc-dd-ee-01 --load pap,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;…  accept 0, reject 1 …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Three wrong passwords lock it. After that, even the &lt;strong&gt;correct&lt;/strong&gt; password from the same device is rejected; with another &lt;code&gt;Calling-Station-Id&lt;/code&gt; the login 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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run … --user alice --password alice-password --attr 31&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;text:aa-bb-cc-dd-ee-01 --load pap,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;…  accept 0, reject 1 …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run … --user alice --password alice-password --attr 31&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;text:aa-bb-cc-dd-ee-02 --load pap,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;…  accept 1, reject 0 …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The server log; the lock starts at the third failure:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::auth_chain: auth lockout: client localhost: account &amp;#34;alice&amp;#34; from &amp;#34;aa-bb-cc-dd-ee-01&amp;#34; is locked (this origin)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… user=&amp;#34;alice&amp;#34; account=&amp;#34;alice&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;lockout&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Metrics:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s http://127.0.0.1:9812/metrics | grep &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;^rradius_auth_lockout&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_auth_lockout_rejected_total 2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_auth_lockouts_total 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_auth_lockout_untracked_total 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_auth_lockout_untracked_total 0&#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;Metric&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;&lt;code&gt;rradius_auth_lockouts_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How many locks have started&lt;/td&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_auth_lockout_rejected_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Logins rejected because of a lock or too many simultaneous logins&lt;/td&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_auth_lockout_untracked_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Failures not counted because the table was full of locked keys&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;These three metrics appear only when &lt;code&gt;[auth.lockout]&lt;/code&gt; is set. &lt;strong&gt;Verified.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;where-the-counts-are-kept&#34;&gt;Where the counts are kept&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;The counts are kept in &lt;strong&gt;each node&amp;rsquo;s own memory&lt;/strong&gt;. With three cluster nodes and a NAS that asks them in turn, the number of tries an attacker really gets is at most the limit of each of the three nodes.&lt;/li&gt;&#xA;&lt;li&gt;A reload keeps the counts; a restart resets them to zero.&lt;/li&gt;&#xA;&lt;li&gt;When the table is full (&lt;code&gt;max_entries&lt;/code&gt;), expired entries go first, then the oldest unlocked ones; locked keys are never dropped. When all of them are locked, new keys are not tracked and are counted in &lt;code&gt;rradius_auth_lockout_untracked_total&lt;/code&gt;, and the log writes at most once a minute.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; When a Lua script checks the password itself (for example &lt;code&gt;two-step-totp.lua&lt;/code&gt; uses &lt;code&gt;password_verify&lt;/code&gt;), &lt;code&gt;[auth.lockout]&lt;/code&gt; has no control over that check inside the script. To limit password guessing, let the password be checked in the auth chain.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The user is sure the password is right, the authentication log shows &lt;code&gt;handler=&amp;quot;sql&amp;quot; decision=&amp;quot;reject&amp;quot;&lt;/code&gt;, and the log has &lt;code&gt;looks like a hash with no scheme prefix and is refused&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The stored hash has no &lt;code&gt;{crypt}&lt;/code&gt; or &lt;code&gt;{argon2}&lt;/code&gt; prefix.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add the prefix; see &lt;a class=&#34;link&#34; href=&#34;#a-hash-without-a-prefix-is-not-a-password&#34; &gt;A hash without a prefix is not a password&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; PAP logs in, but CHAP or MS-CHAPv2 (including PEAP) is rejected, and the Access-Reject of MS-CHAPv2 carries &lt;code&gt;MS-CHAP-Error&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; A one-way hash is stored (bcrypt, SHA-512 crypt, &lt;code&gt;{SSHA}&lt;/code&gt; and so on). CHAP can check only plaintext, and MS-CHAP only plaintext or &lt;code&gt;{nthash}&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change &lt;code&gt;accounts.scheme&lt;/code&gt; to &lt;code&gt;nthash&lt;/code&gt; (MS-CHAP) or &lt;code&gt;clear&lt;/code&gt; (CHAP), and have the user reset the password once with &lt;code&gt;user passwd&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; A migrated account has the right password but is rejected.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The prefix is wrong (for example &lt;code&gt;{MD5}&lt;/code&gt; was added directly to a hexadecimal MD5, without converting to Base64); the position of the salt or the format differs from the definition; or the hash was truncated or got extra spaces in the import.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Take an account whose password you know and go through &lt;a class=&#34;link&#34; href=&#34;#all-formats-the-server-understands&#34; &gt;All formats the server understands&lt;/a&gt; item by item.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; Only accounts whose names have capital letters cannot log in.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;lowercase&lt;/code&gt; is on, but the names in the table were not converted to lower case.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Make the table all lower case (see &lt;a class=&#34;link&#34; href=&#34;#import-sql&#34; &gt;Import SQL&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; PAP works, but PEAP on Wi-Fi or CHAP for PPPoE does not.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; PEAP needs plaintext or &lt;code&gt;{nthash}&lt;/code&gt;, and CHAP needs plaintext; other hashes cannot do it.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; See &lt;a class=&#34;link&#34; href=&#34;#what-can-and-cannot-be-migrated&#34; &gt;What can and cannot be migrated&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;user disable&lt;/code&gt; prints &lt;code&gt;disabled erin&lt;/code&gt;, but &lt;code&gt;erin&lt;/code&gt; can still log in.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;user_query&lt;/code&gt; does not skip disabled accounts.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add &lt;code&gt;AND enabled = 1&lt;/code&gt; to &lt;code&gt;user_query&lt;/code&gt; (according to your table).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;user add&lt;/code&gt; prints &lt;code&gt;bad.toml: accounts.scheme: &#39;md5&#39; is not one of bcrypt, sha512-crypt, nthash, clear&lt;/code&gt; and exits with code 2.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;scheme&lt;/code&gt; can be only these four values. The server understands formats such as &lt;code&gt;{MD5}&lt;/code&gt;, but the &lt;code&gt;user&lt;/code&gt; command does not write them.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change it to one of the four values.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;radius client &#39;localhost&#39;: unknown auth chain &#39;vpn&#39; (no [auth.chains.vpn])&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The &lt;code&gt;auth&lt;/code&gt; of a client points to a chain that is not defined.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add &lt;code&gt;[auth.chains.vpn]&lt;/code&gt;, or correct the name in &lt;code&gt;auth&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;auth.username is set but the default chain has no [[auth.handlers]] entries&lt;/code&gt;, or &lt;code&gt;auth.policy is set but …&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;[auth]&lt;/code&gt; has only named chains, but &lt;code&gt;[auth.username]&lt;/code&gt; or &lt;code&gt;policy&lt;/code&gt; is written in &lt;code&gt;[auth]&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Write them in the named chain: &lt;code&gt;[auth.chains.&amp;lt;name&amp;gt;.username]&lt;/code&gt;, &lt;code&gt;[auth.chains.&amp;lt;name&amp;gt;] policy = …&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;[auth] needs [[auth.handlers]] entries or at least one [auth.chains.&amp;lt;name&amp;gt;] (auth.handlers is empty)&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; There is an &lt;code&gt;[auth]&lt;/code&gt;, but no handler at all.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add handlers; if you do not want an auth chain, remove &lt;code&gt;[auth]&lt;/code&gt; altogether and let the script in &lt;code&gt;[lua]&lt;/code&gt; decide.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;auth.chains.lab.handlers[0].user_query must contain exactly one ? placeholder, found 2&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;user_query&lt;/code&gt;, &lt;code&gt;reply_query&lt;/code&gt; and &lt;code&gt;certificate_query&lt;/code&gt; can each have only one &lt;code&gt;?&lt;/code&gt;; the account name is filled in only once.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Rewrite the query to keep only one &lt;code&gt;?&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;auth.lockout.account_max_failures must be greater than max_failures (3), not 2&lt;/code&gt;, or &lt;code&gt;auth.password_limits.pbkdf2_iterations must be greater than 0&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; A value is out of range.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; &lt;code&gt;account_max_failures&lt;/code&gt; must be greater than &lt;code&gt;max_failures&lt;/code&gt;; every limit must be greater than 0.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;auth.username.strip_realm: &#39;left&#39; is not none, suffix, prefix or both&lt;/code&gt;, or &lt;code&gt;auth.username.allowed: regex parse error: …&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The value of &lt;code&gt;strip_realm&lt;/code&gt; is wrong, or &lt;code&gt;allowed&lt;/code&gt; is not a valid regular expression.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Correct it according to &lt;a class=&#34;link&#34; href=&#34;#normalize-user-names-and-realms&#34; &gt;Normalize user names and realms&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;auth.chains.lab: cannot read auth handler script &#39;missing.lua&#39;: No such file or directory (os error 2)&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The &lt;code&gt;script&lt;/code&gt; of a lua handler cannot be found. A relative path is relative to the directory of the configuration file.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Correct the path.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; Some accounts occasionally get no answer, &lt;code&gt;Discarded: database&lt;/code&gt; in &lt;code&gt;status&lt;/code&gt; goes up, and those accounts store bcrypt or PBKDF2.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The number of slow-hash checks at the same time equals the number of CPUs; at peak, queueing plus checking exceeds &lt;code&gt;timeout_ms&lt;/code&gt; and counts as backend unavailable.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Check whether the cost of the stored values is too high (&lt;code&gt;[auth.password_limits]&lt;/code&gt;); switch accounts that use only PAP to the faster &lt;code&gt;sha512-crypt&lt;/code&gt;; or add CPUs or nodes.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; A device is locked, the lock time is not over, and you want to unlock it now.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The counts are only in the node&amp;rsquo;s memory, and there is no unlock command.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Wait for &lt;code&gt;lock_seconds&lt;/code&gt; to pass; or remove &lt;code&gt;[auth.lockout]&lt;/code&gt; and reload (this clears all counts), then add it back later.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04 Configuration file basics&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05 RADIUS service and NAS clients&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;06 Dictionary and attributes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;08 LDAP and Active Directory&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09 External databases and named queries&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;10 Writing policies in Lua&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;11 802.1X and EAP&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;12 TACACS+ device administration&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../92-metrics-reference/&#34; &gt;Appendix C: Metrics reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>08 LDAP and Active Directory</title>
            <link>https://embark.systems/en/rradius/oss/08-ldap-and-ad/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/08-ldap-and-ad/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Let users log in with their account and password from the company directory (LDAP or Active Directory)&lt;/li&gt;&#xA;&lt;li&gt;Decide by directory group who may log in and which reply attributes they get&lt;/li&gt;&#xA;&lt;li&gt;Connect to the directory securely with TLS, and know what the server does when the directory fails&lt;/li&gt;&#xA;&lt;li&gt;Verify MS-CHAPv2 and PEAP with Netlogon in an Active Directory environment&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: you have read &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;chapter 07&lt;/a&gt; and know auth chains, handlers and &lt;code&gt;first_match&lt;/code&gt;/&lt;code&gt;all_accept&lt;/code&gt;. You need an LDAP server or an Active Directory domain controller, and a service account that can search for users.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#which-handler-to-choose&#34; &gt;Which handler to choose&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#the-test-directory-used-in-this-chapter&#34; &gt;The test directory used in this chapter&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#logging-in-with-directory-accounts&#34; &gt;Logging in with directory accounts&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#connection-encryption-ldaps-starttls-and-the-ca&#34; &gt;Connection encryption: ldaps, StartTLS and the CA&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#deciding-by-group-who-can-log-in&#34; &gt;Deciding by group who can log in&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#giving-reply-attributes-by-group&#34; &gt;Giving reply attributes by group&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#comparing-a-password-attribute-in-the-directory&#34; &gt;Comparing a password attribute in the directory&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#search-filter-for-certificate-logins&#34; &gt;Search filter for certificate logins&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#when-the-directory-cannot-be-reached&#34; &gt;When the directory cannot be reached&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#the-remote-access-scenario-vpn-with-ad-accounts&#34; &gt;The remote-access scenario: VPN with AD accounts&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#active-directory-ms-chapv2-the-netlogon-handler&#34; &gt;Active Directory MS-CHAPv2: the netlogon handler&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#putting-ldap-and-netlogon-in-the-same-chain&#34; &gt;Putting LDAP and netlogon in the same chain&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;which-handler-to-choose&#34;&gt;Which handler to choose&#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;ldap handler&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;netlogon handler&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;Connects to&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Any LDAP server, including the LDAP of AD&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The Netlogon service of an AD domain controller&lt;/td&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 it verifies&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Binds as the user (default), or reads the password attribute and compares&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Hands the MS-CHAPv2 response to the domain controller to verify&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Supported logins&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;bind: PAP only. Read attribute: PAP, CHAP, MS-CHAPv1, MS-CHAPv2, depending on the stored format (MS-CHAPv1 not verified on real equipment)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;MS-CHAPv2 only (including the inner method of 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;Groups&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;DN, for example &lt;code&gt;CN=vpn,OU=Groups,DC=corp,…&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SID, for example &lt;code&gt;S-1-5-21-…-1106&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;Fits&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;VPN, web login, and devices that send PAP such as TACACS+&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wi-Fi 802.1X (PEAP-MSCHAPv2) with AD accounts&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Why AD needs a separate handler: PEAP on Wi-Fi sends an MS-CHAPv2 response, not a clear-text password, so there is nothing to bind with. AD also never hands out the user&amp;rsquo;s NT hash over LDAP, so the server cannot compare it itself. The netlogon handler gives the response to the domain controller, which answers whether it is correct.&lt;/p&gt;&#xA;&lt;p&gt;You can put both handlers in the same chain. Each one handles its own kind of login. See &lt;a class=&#34;link&#34; href=&#34;#putting-ldap-and-netlogon-in-the-same-chain&#34; &gt;Putting LDAP and netlogon in the same chain&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-test-directory-used-in-this-chapter&#34;&gt;The test directory used in this chapter&#xA;&lt;/h2&gt;&lt;p&gt;The output in this chapter comes from an OpenLDAP server running in Docker (an alpine image with the OpenLDAP packages, the &lt;code&gt;memberof&lt;/code&gt; overlay enabled, ldaps and StartTLS with a self-signed CA), and from the Samba AD domain controller image in &lt;code&gt;docker/interop-netlogon/&lt;/code&gt; in the rradius source. They are test environments only, and your directory may be structured differently.&lt;/p&gt;&#xA;&lt;p&gt;Data in the directory:&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;DN&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Password&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Groups&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Other&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;cn=radius,ou=services,dc=example,dc=com&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;svc-password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Service account, can read &lt;code&gt;userPassword&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;uid=alice,ou=people,dc=example,dc=com&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;alice-password&lt;/code&gt; (clear text)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;vpn-users&lt;/code&gt;, &lt;code&gt;it-staff&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;description: std.ppp&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;uid=bob,ou=people,dc=example,dc=com&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;bob-password&lt;/code&gt; (clear text)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;none&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;&lt;code&gt;uid=dave,ou=people,dc=example,dc=com&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;dave-password&lt;/code&gt; (stored as &lt;code&gt;{SSHA}&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;vpn-users&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;The groups are &lt;code&gt;groupOfNames&lt;/code&gt; entries under &lt;code&gt;ou=groups,dc=example,dc=com&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The rest of the server configuration follows the quick-start in &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;chapter 03&lt;/a&gt; (single-node cluster, one client at &lt;code&gt;127.0.0.1&lt;/code&gt;). Login tests use &lt;code&gt;rradius-bench&lt;/code&gt;; the shared arguments are shortened to &lt;code&gt;…&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; This has not been tested on a real Windows Server Active Directory. The LDAP part was tested on OpenLDAP. The netlogon part was tested on a Samba AD domain controller.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;logging-in-with-directory-accounts&#34;&gt;Logging in with directory accounts&#xA;&lt;/h2&gt;&lt;p&gt;Goal: users log in with PAP using their directory account and password.&lt;/p&gt;&#xA;&lt;p&gt;How the ldap handler works:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It binds with the service account (&lt;code&gt;bind_dn&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;It searches for the user under &lt;code&gt;base_dn&lt;/code&gt; with &lt;code&gt;filter&lt;/code&gt;, replacing &lt;code&gt;{user}&lt;/code&gt; with the account name.&lt;/li&gt;&#xA;&lt;li&gt;It binds again with the DN it found and the password the user sent. If that succeeds, it accepts.&lt;/li&gt;&#xA;&lt;/ol&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:#75715e&#34;&gt;# rradius.toml (excerpt)&lt;/span&gt;&#xA;&lt;/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;]&#xA;&lt;/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;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://ldap1.example.com&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ldaps://ldap2.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=radius,ou=services,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=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;(uid={user})&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;corp-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;reply_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;description&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;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;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;urls&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (required)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Start with &lt;code&gt;ldap://&lt;/code&gt; or &lt;code&gt;ldaps://&lt;/code&gt;, at least one, tried in order&lt;/td&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;bind_dn&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (required)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;DN of the service 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;bind_password_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;File with the service account password; the trailing newline is removed&lt;/td&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;bind_password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The password written directly. Set exactly one of this and &lt;code&gt;bind_password_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;base_dn&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (required)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Where the user search starts, the whole subtree below 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;filter&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (required)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Search filter, with exactly one &lt;code&gt;{user}&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;password_check&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;bind&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;bind&lt;/code&gt; or &lt;code&gt;attribute&lt;/code&gt; (see &lt;a class=&#34;link&#34; href=&#34;#comparing-a-password-attribute-in-the-directory&#34; &gt;Comparing a password attribute in the directory&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;reply_attributes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Maps reply attribute names to LDAP attributes of the user&lt;/td&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;ca_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;CA certificates to trust (see the next section)&lt;/td&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;allow_plaintext&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Allow unencrypted &lt;code&gt;ldap://&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;pool_size&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;4&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Connections kept open per URL&lt;/td&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;timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;5000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Time limit for connecting to one URL plus the whole query, in milliseconds&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Every key can be reloaded. The group keys are in the next two sections. For the full list of fields see &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Create the password 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-console&#34; data-lang=&#34;console&#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;&amp;lt;service account password&amp;gt;&amp;#39;&lt;/span&gt; &amp;gt; ldap.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;600&lt;/span&gt; ldap.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;Before &lt;code&gt;{user}&lt;/code&gt; is substituted, it is escaped as in RFC 4515 (&lt;code&gt;*&lt;/code&gt;, &lt;code&gt;(&lt;/code&gt;, &lt;code&gt;)&lt;/code&gt;, &lt;code&gt;\&lt;/code&gt; and NUL become forms such as &lt;code&gt;\2a&lt;/code&gt;), so a user name cannot change the structure of the filter. (According to the code; this chapter did not test it separately.)&lt;/li&gt;&#xA;&lt;li&gt;The value substituted is the account name after the auth chain has normalized it. The &lt;code&gt;[auth.username]&lt;/code&gt; above makes both &lt;code&gt;CORP\Alice&lt;/code&gt; and &lt;code&gt;alice@example.com&lt;/code&gt; search for &lt;code&gt;alice&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;chapter 07&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;When a &lt;code&gt;reply_attributes&lt;/code&gt; value has several values, each value adds one attribute, in the order the directory returned them.&lt;/li&gt;&#xA;&lt;li&gt;The service account password cannot be empty: a bind with an empty password is an anonymous bind, and &lt;code&gt;check&lt;/code&gt; rejects it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Exclude disabled accounts with &lt;code&gt;filter&lt;/code&gt;.&lt;/strong&gt; A user the search cannot find is treated as not existing, so you can exclude disabled accounts directly in the filter. For AD the form is &lt;code&gt;(&amp;amp;(sAMAccountName={user})(!(userAccountControl:1.2.840.113556.1.4.803:=2)))&lt;/code&gt; (bit 2 of &lt;code&gt;userAccountControl&lt;/code&gt; means disabled). If OpenLDAP has the password policy (ppolicy) enabled, you can use &lt;code&gt;(&amp;amp;(uid={user})(!(pwdAccountLockedTime=*)))&lt;/code&gt; to exclude locked accounts. &lt;code&gt;check&lt;/code&gt; only counts the &lt;code&gt;{user}&lt;/code&gt; placeholders. Whether the filter itself works, you have to try on your own directory first.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; The directory-side behavior of the two exclusion forms (the &lt;code&gt;userAccountControl&lt;/code&gt; bit, ppolicy&amp;rsquo;s &lt;code&gt;pwdAccountLockedTime&lt;/code&gt;) has not been tested on a real AD or on OpenLDAP with ppolicy enabled. The code only sends the filter as written, and &lt;code&gt;check&lt;/code&gt; confirmed that the OpenLDAP one passes.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;verification&#34;&gt;Verification&#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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run … --user alice --password alice-password --load pap,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;…  accept 1, reject 0 …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run … --user alice --password wrong --load pap,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;…  accept 0, reject 1 …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run … --user nobody --password x --load pap,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;…  accept 0, reject 1 …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run … --user &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;EXAMPLE\Alice&amp;#39;&lt;/span&gt; --password alice-password --load pap,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;…  accept 1, reject 0 …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Authentication log:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… user=&amp;#34;alice&amp;#34; account=&amp;#34;alice&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;ldap&amp;#34; decision=&amp;#34;accept&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… user=&amp;#34;alice&amp;#34; account=&amp;#34;alice&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;ldap&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… user=&amp;#34;nobody&amp;#34; account=&amp;#34;nobody&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;none&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… user=&amp;#34;EXAMPLE\\Alice&amp;#34; account=&amp;#34;alice&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;ldap&amp;#34; decision=&amp;#34;accept&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;A wrong password is a reject from &lt;code&gt;handler=&amp;quot;ldap&amp;quot;&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;For a name the directory cannot find, the ldap handler ignores it and passes it to the next handler. There is none here, so it shows &lt;code&gt;handler=&amp;quot;none&amp;quot;&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;If the search finds two or more entries, the handler rejects and the log says &lt;code&gt;filter matched 2 entries; rejecting&lt;/code&gt; (according to the code and its tests; the test directory in this chapter has no duplicate accounts).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Use &lt;code&gt;[log.trace]&lt;/code&gt; to see the Access-Accept for &lt;code&gt;alice&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;chapter 17&lt;/a&gt;). The value of &lt;code&gt;description&lt;/code&gt; became &lt;code&gt;Filter-Id&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_trace: response client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; code=2 attributes=&amp;#34;Message-Authenticator = &amp;lt;hidden&amp;gt;, Filter-Id = std.ppp, Class = it-staff, Session-Timeout = 28800&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;(&lt;code&gt;Class&lt;/code&gt; and &lt;code&gt;Session-Timeout&lt;/code&gt; come from &lt;a class=&#34;link&#34; href=&#34;#giving-reply-attributes-by-group&#34; &gt;Giving reply attributes by group&lt;/a&gt;.)&lt;/p&gt;&#xA;&lt;p&gt;Bind mode cannot verify CHAP or MS-CHAPv2: these logins have no clear-text password to bind with, and the handler rejects them outright (it does not ignore them). In the test, &lt;code&gt;alice&lt;/code&gt; with CHAP and with MS-CHAPv2 both gave &lt;code&gt;reject 1&lt;/code&gt;, and the MS-CHAPv2 Access-Reject carried &lt;code&gt;MS-CHAP-Error&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Verified&lt;/strong&gt;: the four logins &lt;code&gt;alice&lt;/code&gt;, wrong password, &lt;code&gt;nobody&lt;/code&gt; and &lt;code&gt;EXAMPLE\Alice&lt;/code&gt;, the response in the trace, and the rejection of CHAP and MS-CHAPv2.&lt;/p&gt;&#xA;&lt;p&gt;Also according to the code: an empty PAP password is rejected without sending a bind, because a bind with an empty password is an anonymous login in LDAP and would succeed.&lt;/p&gt;&#xA;&lt;h3 id=&#34;how-connections-are-reused&#34;&gt;How connections are reused&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;Each URL has its own connection pool of at most &lt;code&gt;pool_size&lt;/code&gt; connections. A new connection finishes TLS and the service account bind before it is used.&lt;/li&gt;&#xA;&lt;li&gt;When a connection is returned to the pool and taken out again, it first binds again as the service account (time limit is half of &lt;code&gt;timeout_ms&lt;/code&gt;), so the bind identity of the previous user never carries over to the next request.&lt;/li&gt;&#xA;&lt;li&gt;A connection is dropped, not returned to the pool, after a failed search, a bind error other than a wrong password, or when it goes over &lt;code&gt;timeout_ms&lt;/code&gt;. A connection with a wrong password (invalidCredentials) is returned as usual.&lt;/li&gt;&#xA;&lt;li&gt;RADIUS and TACACS+ clients that point to the same chain share these pools.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;connection-encryption-ldaps-starttls-and-the-ca&#34;&gt;Connection encryption: ldaps, StartTLS and the CA&#xA;&lt;/h2&gt;&lt;p&gt;The user&amp;rsquo;s password is sent to the directory to bind, so the connection must be encrypted.&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;urls&lt;/code&gt; form&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;code&gt;allow_plaintext&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;ldaps://host[:port]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;either&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TLS from the start (default port 636)&lt;/td&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://host[:port]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt; (default)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After connecting, it does StartTLS first, then binds&lt;/td&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://host[:port]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Not encrypted. The service account and user passwords are sent in clear text&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Both kinds of TLS verify the server certificate and host name. The trusted CAs are the operating system root certificates plus the certificates in &lt;code&gt;ca_file&lt;/code&gt; (PEM, can hold several). If the company directory uses a certificate signed by its own CA, put that CA in &lt;code&gt;ca_file&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Verified&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;ldaps://&lt;/code&gt; with &lt;code&gt;ca_file&lt;/code&gt;: login succeeds.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;ldap://&lt;/code&gt; with StartTLS and &lt;code&gt;ca_file&lt;/code&gt;: login succeeds.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Without &lt;code&gt;ca_file&lt;/code&gt;: both &lt;code&gt;ldaps://&lt;/code&gt; and StartTLS fail to connect, and the log says&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::ldap_handler: auth ldap handler: ldaps://localhost:636: I/O error: invalid peer certificate: UnknownIssuer&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::ldap_handler: auth ldap handler: no server reachable; rejecting&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This login gets no response (see &lt;a class=&#34;link&#34; href=&#34;#when-the-directory-cannot-be-reached&#34; &gt;When the directory cannot be reached&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;ldap://&lt;/code&gt; with &lt;code&gt;allow_plaintext = true&lt;/code&gt;: login succeeds, but without encryption.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; &lt;code&gt;allow_plaintext = true&lt;/code&gt; sends passwords over the network in clear text. Use it only in a test environment, or when the connection is already inside an encrypted tunnel (for example WireGuard).&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;The host name in &lt;code&gt;urls&lt;/code&gt; must match the name on the directory certificate. If you write an IP address, the certificate needs a SAN for that IP.&lt;/p&gt;&#xA;&lt;h2 id=&#34;deciding-by-group-who-can-log-in&#34;&gt;Deciding by group who can log in&#xA;&lt;/h2&gt;&lt;p&gt;Goal: the password must be correct and the user must also belong to a certain group to be let in.&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:#75715e&#34;&gt;# rradius.toml (add inside the ldap handler)&lt;/span&gt;&#xA;&lt;/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=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;p&gt;The user must belong to &lt;strong&gt;one&lt;/strong&gt; of the groups in &lt;code&gt;required_groups&lt;/code&gt; to be accepted. Group DNs are compared without regard to case or to spaces around commas, so &lt;code&gt;CN=VPN-Users, OU=Groups, DC=example, DC=com&lt;/code&gt; counts as the same as the line above.&lt;/p&gt;&#xA;&lt;p&gt;The handler can find out the user&amp;rsquo;s groups in two ways:&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;Way&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Setting&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Fits&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;Read an attribute of the user&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;group_attribute&lt;/code&gt;, default &lt;code&gt;memberOf&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;AD; OpenLDAP with the &lt;code&gt;memberof&lt;/code&gt; overlay&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Search for groups&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;group_base_dn&lt;/code&gt; plus &lt;code&gt;group_filter&lt;/code&gt;, for example &lt;code&gt;(member={dn})&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Membership is recorded on the group side (&lt;code&gt;groupOfNames&lt;/code&gt;) and the user has no &lt;code&gt;memberOf&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&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:#75715e&#34;&gt;# The second way: search for groups (add inside the ldap handler)&lt;/span&gt;&#xA;&lt;/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_base_dn&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ou=groups,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;group_filter&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;(member={dn})&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=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;code&gt;group_filter&lt;/code&gt; has exactly one &lt;code&gt;{dn}&lt;/code&gt;, replaced with the DN of the user&amp;rsquo;s entry (escaped). The search runs as the service account, and the DNs in the result are compared.&lt;/li&gt;&#xA;&lt;li&gt;Choose only one of &lt;code&gt;group_attribute&lt;/code&gt; and &lt;code&gt;group_filter&lt;/code&gt;; &lt;code&gt;group_filter&lt;/code&gt; must be paired with &lt;code&gt;group_base_dn&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;These keys only mean something when &lt;code&gt;required_groups&lt;/code&gt; or &lt;code&gt;group_reply&lt;/code&gt; is present. If only they are written, &lt;code&gt;check&lt;/code&gt; fails, because it looks like a restriction but restricts nothing.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Nested groups:&lt;/strong&gt; both &lt;code&gt;memberOf&lt;/code&gt; and &lt;code&gt;(member={dn})&lt;/code&gt; count direct membership only. Membership a user has through a child group does not count. To count nested groups in AD, use the group search way with &lt;code&gt;group_filter = &amp;quot;(member:1.2.840.113556.1.4.1941:={dn})&amp;quot;&lt;/code&gt; (AD&amp;rsquo;s &lt;code&gt;LDAP_MATCHING_RULE_IN_CHAIN&lt;/code&gt;), together with &lt;code&gt;group_base_dn&lt;/code&gt;. This is an AD-specific matching rule, and the domain controller expands the nested groups.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; accepts this &lt;code&gt;group_filter&lt;/code&gt; (exactly one &lt;code&gt;{dn}&lt;/code&gt;), but it has not been run against AD.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;verification-1&#34;&gt;Verification&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;bob&lt;/code&gt; has the right password but is not in &lt;code&gt;vpn-users&lt;/code&gt;; &lt;code&gt;alice&lt;/code&gt; and &lt;code&gt;dave&lt;/code&gt; are:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run … --user bob --password bob-password --load pap,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;…  accept 0, reject 1 …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run … --user dave --password dave-password --load pap,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;…  accept 1, reject 0 …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Verified&lt;/strong&gt;: reading &lt;code&gt;memberOf&lt;/code&gt; (default) and searching for groups give the same result.&lt;/p&gt;&#xA;&lt;p&gt;A rejection for not being in the group looks exactly the same to the NAS as a rejection for a wrong password. An outsider cannot tell which one it was. The handler looks up the groups with the service account before it compares the password, and decides after the password result is in.&lt;/p&gt;&#xA;&lt;h2 id=&#34;giving-reply-attributes-by-group&#34;&gt;Giving reply attributes by group&#xA;&lt;/h2&gt;&lt;p&gt;Goal: IT staff get different rules after connecting to the VPN and may stay connected longer.&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:#75715e&#34;&gt;# rradius.toml (after the ldap handler)&lt;/span&gt;&#xA;&lt;/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;.&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=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;Class&amp;#34;&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;it-staff&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;When the user belongs to &lt;code&gt;group&lt;/code&gt;, the reply attributes in &lt;code&gt;attributes&lt;/code&gt; are added. You can write several &lt;code&gt;group_reply&lt;/code&gt; entries; they are added in the configured order, after &lt;code&gt;reply_attributes&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The attribute name must be in the dictionary and the value must have the right format: &lt;code&gt;check&lt;/code&gt; encodes every value once, so a mistake is reported right away and does not wait for a user to log in.&lt;/li&gt;&#xA;&lt;li&gt;With &lt;code&gt;group_reply&lt;/code&gt; but without &lt;code&gt;required_groups&lt;/code&gt;, anyone can log in, and the group only decides which extra attributes they get.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;code&gt;alice&lt;/code&gt; is in &lt;code&gt;it-staff&lt;/code&gt;, and the response in the &lt;code&gt;[log.trace]&lt;/code&gt; entry above has &lt;code&gt;Class = it-staff, Session-Timeout = 28800&lt;/code&gt;. &lt;code&gt;dave&lt;/code&gt; is not, and his Access-Accept has neither attribute. &lt;strong&gt;Verified&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A reply attribute only has an effect if the NAS has a matching setting, for example a filter or group policy with the same name on the VPN gateway.&lt;/p&gt;&#xA;&lt;h2 id=&#34;comparing-a-password-attribute-in-the-directory&#34;&gt;Comparing a password attribute in the directory&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;password_check = &amp;quot;attribute&amp;quot;&lt;/code&gt; makes the handler not bind as the user, but read the user&amp;rsquo;s password attribute and compare it itself:&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:#75715e&#34;&gt;# rradius.toml (inside the ldap handler)&lt;/span&gt;&#xA;&lt;/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;attribute&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_attribute&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;userPassword&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 comparison rules are the same as for the sql handler (the format table in &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;chapter 07&lt;/a&gt;): formats such as &lt;code&gt;{SSHA}&lt;/code&gt; and &lt;code&gt;{crypt}&lt;/code&gt; can only verify PAP; clear text or &lt;code&gt;{nthash}&lt;/code&gt; can also verify MS-CHAPv2, and clear text can additionally verify CHAP. MS-CHAPv1 is compared by the same rules (&lt;code&gt;allow_mschapv1 = false&lt;/code&gt; in &lt;code&gt;[auth]&lt;/code&gt; rejects it before it reaches the handler, see &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;chapter 07&lt;/a&gt;); this point is &lt;strong&gt;not verified on real equipment&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Uses:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The directory stores clear text or NT hashes, and the NAS sends MS-CHAPv2 or CHAP.&lt;/li&gt;&#xA;&lt;li&gt;The directory does not allow ordinary users to bind, but allows the service account to read the password attribute.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Verified&lt;/strong&gt;: &lt;code&gt;alice&lt;/code&gt; (stored as clear text in the directory) gets &lt;code&gt;accept 1&lt;/code&gt; with PAP, CHAP and MS-CHAPv2; &lt;code&gt;dave&lt;/code&gt; (&lt;code&gt;{SSHA}&lt;/code&gt;) gets &lt;code&gt;accept 1&lt;/code&gt; with PAP and &lt;code&gt;reject 1&lt;/code&gt; with MS-CHAPv2.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; This mode requires the service account to be able to read everyone&amp;rsquo;s password attribute. If this account leaks, every password leaks (a clear-text password or NT hash can be used to log in directly). Use bind mode whenever you can.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If the user&amp;rsquo;s entry has no value for &lt;code&gt;password_attribute&lt;/code&gt;, the handler rejects.&lt;/li&gt;&#xA;&lt;li&gt;The value is read out and compared afterwards, and the comparison does not hold a connection. A comparison that goes over &lt;code&gt;timeout_ms&lt;/code&gt; counts as &amp;ldquo;backend unavailable&amp;rdquo;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;search-filter-for-certificate-logins&#34;&gt;Search filter for certificate logins&#xA;&lt;/h2&gt;&lt;p&gt;When EAP-TLS logs in with a certificate, there is no password to bind with. The ldap handler handles this kind of login only if it has &lt;code&gt;certificate_filter&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:#75715e&#34;&gt;# rradius.toml (inside the ldap handler)&lt;/span&gt;&#xA;&lt;/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_filter&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;(&amp;amp;(uid={user})(!(nsAccountLock=TRUE)))&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;After the certificate passes, the handler searches for the name on the certificate with &lt;code&gt;certificate_filter&lt;/code&gt;. If it finds the entry (and the entry matches &lt;code&gt;required_groups&lt;/code&gt;), it accepts, without binding as the user.&lt;/li&gt;&#xA;&lt;li&gt;Without &lt;code&gt;certificate_filter&lt;/code&gt;, the handler ignores certificate logins and does not ask the directory. It writes a warning line &lt;code&gt;ignoring a certificate login: this handler has no certificate_filter&lt;/code&gt;. The reason: a plain search cannot tell whether an account is disabled or locked, so you have to say so in the filter.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;nsAccountLock&lt;/code&gt; above is only an example; use whichever attribute your directory uses to mark disabled accounts. For the AD form, see the remote-access scenario below.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For the EAP-TLS configuration see &lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;chapter 11&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; The part of a certificate login that goes through the ldap handler was not run on the test directory in this chapter. It was only checked against the code and tests.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;when-the-directory-cannot-be-reached&#34;&gt;When the directory cannot be reached&#xA;&lt;/h2&gt;&lt;p&gt;The ldap handler tries &lt;code&gt;urls&lt;/code&gt; in order:&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 the handler does&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;Cannot connect, TLS fails, connection drops, timeout&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Moves to the next URL&lt;/td&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 service account bind is refused, or the server returns an error during the search&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Does not try other URLs; counts as &amp;ldquo;directory unavailable&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;All URLs have been tried&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Counts as &amp;ldquo;directory unavailable&amp;rdquo;; the log says &lt;code&gt;no server reachable; rejecting&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 bind returns busy (51), unavailable (52) or serverDown (81)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Counts as &amp;ldquo;directory unavailable&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;The user bind is refused (wrong password, or another reason such as a disabled account)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rejects this user; not a directory 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;Not in &lt;code&gt;required_groups&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rejects; not a directory problem&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;When the &amp;ldquo;directory is unavailable&amp;rdquo;, RADIUS &lt;strong&gt;does not respond&lt;/strong&gt; to the request and counts it in &lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;database&amp;quot;}&lt;/code&gt;; TACACS+ replies ERROR; the &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;login failure lockout&lt;/a&gt; does not count it. The NAS then retransmits or asks another RADIUS server, instead of telling the user the password is wrong.&lt;/p&gt;&#xA;&lt;h3 id=&#34;verification-2&#34;&gt;Verification&#xA;&lt;/h3&gt;&lt;p&gt;The first URL deliberately points to port 1389 where nothing is listening, and the second is the working directory:&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;urls&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ldap://localhost:1389&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ldap://localhost:389&amp;#34;&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Logins succeed. Every one tries the first URL first, and the log has one line for each:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::ldap_handler: auth ldap handler: ldap://localhost:1389: I/O error: Connection refused (os error 61)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Stop the directory container and log in again: the &lt;code&gt;rradius-bench&lt;/code&gt; result is &lt;code&gt;timeouts 1&lt;/code&gt; (the server did not respond), and the log says:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::ldap_handler: auth ldap handler: ldaps://localhost:636: timeout: deadline has elapsed&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::ldap_handler: auth ldap handler: no server reachable; rejecting&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;database&amp;quot;}&lt;/code&gt; in &lt;code&gt;/metrics&lt;/code&gt; goes up with it. &lt;strong&gt;Verified&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Requests try the URLs in the order of &lt;code&gt;urls&lt;/code&gt;. For 30 seconds after a URL fails to connect (connection refused, TLS failure, drop, timeout), requests try the other URLs first and come back to it last. After 30 seconds it gets another chance, and if it has recovered, requests go back to it. So when the first server is down for a long time, only the one request every 30 seconds has to wait for it to fail (a refused connection is fast; a host that does not answer is waited for up to &lt;code&gt;timeout_ms&lt;/code&gt;), and the others are answered directly by the later URLs. When all URLs have failed within those 30 seconds, they are tried in the listed order, and when several do not answer, one request waits &amp;ldquo;number of URLs × &lt;code&gt;timeout_ms&lt;/code&gt;&amp;rdquo;. An error reply from the server (for example a refused service account bind) does not count as unreachable and is not moved to the back. This memory lives only inside the handler and starts over after a reload. Put the most reliable server first. If a server will be down for a long time, you should still remove it from &lt;code&gt;urls&lt;/code&gt; and reload first.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;the-remote-access-scenario-vpn-with-ad-accounts&#34;&gt;The remote-access scenario: VPN with AD accounts&#xA;&lt;/h2&gt;&lt;p&gt;The &lt;code&gt;vpn&lt;/code&gt; chain of the example scenario &lt;code&gt;remote-access&lt;/code&gt; is the form for connecting to AD with the ldap handler:&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:#75715e&#34;&gt;# rradius.toml (remote-access, excerpt)&lt;/span&gt;&#xA;&lt;/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;]&#xA;&lt;/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;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=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;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;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;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;vpn-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;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.60.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;vpn-gw.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;vpn&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Key points:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The AD account name is in &lt;code&gt;sAMAccountName&lt;/code&gt;. The second part of &lt;code&gt;filter&lt;/code&gt; excludes disabled accounts (bit 2 of &lt;code&gt;userAccountControl&lt;/code&gt;). A disabled account cannot be found by the search and is the same as not existing.&lt;/li&gt;&#xA;&lt;li&gt;Groups use the default &lt;code&gt;memberOf&lt;/code&gt;, which AD writes on the user.&lt;/li&gt;&#xA;&lt;li&gt;Users may type &lt;code&gt;CORP\alice&lt;/code&gt; or &lt;code&gt;alice@corp.example.com&lt;/code&gt;; &lt;code&gt;strip_realm = &amp;quot;both&amp;quot;&lt;/code&gt; normalizes both to &lt;code&gt;alice&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;This is a named chain, and only the VPN gateway with &lt;code&gt;auth = &amp;quot;vpn&amp;quot;&lt;/code&gt; goes through it. The jump host in the same scenario goes through a different &lt;code&gt;mfa&lt;/code&gt; chain (&lt;a class=&#34;link&#34; href=&#34;../15-access-recipes/&#34; &gt;chapter 15&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;If the directory server certificate is not signed by a CA the system trusts, add &lt;code&gt;ca_file&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This configuration passes &lt;code&gt;check&lt;/code&gt; (&lt;code&gt;check&lt;/code&gt; does not connect to the directory). &lt;strong&gt;Verified&lt;/strong&gt;: copy &lt;code&gt;rradius-server/examples/scenarios/remote-access/&lt;/code&gt; as described in chapter 03, change &lt;code&gt;dictionary&lt;/code&gt; to the real path of the dictionary and the password files to 0600, and &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;configuration ok&lt;/code&gt; (plus a warning that two clients still use the public secret that comes with the example).&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; This scenario has not been run against a real AD. The filter that excludes disabled accounts is AD syntax and does not apply in the OpenLDAP test directory of this chapter.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;active-directory-ms-chapv2-the-netlogon-handler&#34;&gt;Active Directory MS-CHAPv2: the netlogon handler&#xA;&lt;/h2&gt;&lt;p&gt;Goal: Wi-Fi uses PEAP-MSCHAPv2, and users connect by typing their AD account and password, without installing Samba on the server.&lt;/p&gt;&#xA;&lt;p&gt;The netlogon handler sets up a Netlogon secure channel with the domain controller as a &lt;strong&gt;computer account&lt;/strong&gt;, and hands every MS-CHAPv2 response to the domain controller to verify. When the domain controller answers accept, it also returns the data needed to compute the MPPE keys. &lt;code&gt;MS-CHAP2-Success&lt;/code&gt;, &lt;code&gt;MS-MPPE-Send-Key&lt;/code&gt; and &lt;code&gt;MS-MPPE-Recv-Key&lt;/code&gt; in the Access-Accept are exactly the same as when verified locally, so PEAP&amp;rsquo;s EAP-Success produces the MSK as usual.&lt;/p&gt;&#xA;&lt;h3 id=&#34;prepare-the-computer-account&#34;&gt;Prepare the computer account&#xA;&lt;/h3&gt;&lt;p&gt;The handler needs:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A computer account in the domain. Its name has at most 15 characters and in the configuration it is written &lt;strong&gt;without&lt;/strong&gt; the trailing &lt;code&gt;$&lt;/code&gt; (for example it is called &lt;code&gt;RRADIUS1$&lt;/code&gt; in the domain and &lt;code&gt;RRADIUS1&lt;/code&gt; in the configuration).&lt;/li&gt;&#xA;&lt;li&gt;The password of this computer account, in a file (&lt;code&gt;machine_password_file&lt;/code&gt;); the trailing newline is removed.&lt;/li&gt;&#xA;&lt;li&gt;We recommend each node use its own computer account. The domain controller keeps only one set of secure channel state per computer account. When several hosts share one account, the one set up later invalidates the one set up earlier. This comes from the behavior of the Netlogon protocol itself; the code and spec do not say it, and it is &lt;strong&gt;not verified on real equipment&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Creating the computer account and setting a known password in the domain is done with your domain administration tools. The Samba domain controller used for the tests in this chapter was set up like this (a test environment method only):&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ samba-tool computer create RRADIUS1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ samba-tool user setpassword &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;RRADIUS1$&amp;#39;&lt;/span&gt; --newpassword&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;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In a Windows domain (this needs the ActiveDirectory module of RSAT) you can create it with PowerShell. The name has at most 15 characters, and each node uses its own account:&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-powershell&#34; data-lang=&#34;powershell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$pw = Read-Host -AsSecureString &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Password for RRADIUS1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;New-ADComputer -Name RRADIUS1 -SamAccountName &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;RRADIUS1$&amp;#39;&lt;/span&gt; -AccountPassword $pw -Enabled $true&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; This &lt;code&gt;New-ADComputer&lt;/code&gt; snippet comes from the previous version of the manual and has not been run on Windows Server.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;A Samba AD domain controller does not accept MS-CHAPv2 by default. On every domain controller, add the following line to &lt;code&gt;[global]&lt;/code&gt; in &lt;code&gt;/etc/samba/smb.conf&lt;/code&gt;, then restart samba:&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-ini&#34; data-lang=&#34;ini&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ntlm auth&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;mschapv2-and-ntlmv2-only&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The test image of this chapter (&lt;code&gt;docker/interop-netlogon/dc-start.sh&lt;/code&gt;) provisions the domain with this option. Without it, Samba may return &lt;code&gt;STATUS_WRONG_PASSWORD&lt;/code&gt; even for a correct password (see &lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Store the computer account password on the node, readable only by the account that runs rradius:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ install -m &lt;span style=&#34;color:#ae81ff&#34;&gt;600&lt;/span&gt; -o rradius /dev/null /etc/rradius/netlogon-rradius1.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ read -rs pw &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; printf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;%s&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$pw&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &amp;gt; /etc/rradius/netlogon-rradius1.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; The computer account password is this server&amp;rsquo;s identity in the domain. Set the file permissions to 0600; &lt;code&gt;check&lt;/code&gt; and &lt;code&gt;serve&lt;/code&gt; warn when others can read the file.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;configuration&#34;&gt;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-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# rradius.toml (excerpt)&lt;/span&gt;&#xA;&lt;/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;]&#xA;&lt;/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;netlogon&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;domain&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;CORP&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;dc1.corp.example&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;dc2.corp.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;computer_name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;RRADIUS1&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;machine_password_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;machine.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;required_groups&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;S-1-5-21-3266951882-2843208589-237589800-1106&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;.&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;S-1-5-21-3266951882-2843208589-237589800-1106&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;staff&amp;#34;&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;domain&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (required)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;NetBIOS name of the 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;&lt;code&gt;servers&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (required)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;DNS or NetBIOS names of the domain controllers, tried in order&lt;/td&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;port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (asks the endpoint mapper on port 135 first)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Fixed Netlogon port&lt;/td&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;computer_name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (required)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Computer account, without &lt;code&gt;$&lt;/code&gt;, at most 15 characters&lt;/td&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;machine_password_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (required)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;File with the computer account password&lt;/td&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;connections&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;4&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Most connections kept open per domain controller&lt;/td&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;timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;2000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Time limit for one call to a domain controller, in milliseconds&lt;/td&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;required_groups&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Group SIDs; the user must belong to one of them&lt;/td&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;group_reply&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reply attributes added when the user belongs to a SID&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Every key can be reloaded.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;servers&lt;/code&gt; &lt;strong&gt;cannot be IP addresses&lt;/strong&gt;: the logon request has to carry the name of the domain controller, and a Windows domain controller refuses requests that name it by address. &lt;code&gt;check&lt;/code&gt; reports an error when it finds an address.&lt;/li&gt;&#xA;&lt;li&gt;Without &lt;code&gt;port&lt;/code&gt;, the handler first connects to port 135 of the domain controller to ask the endpoint mapper where Netlogon is. If the domain controller changes its port, the handler asks again. When there is a firewall in between, open port 135 and the port it answers with, or fix the Netlogon port on the domain controller and write it in &lt;code&gt;port&lt;/code&gt;. The dynamic RPC ports of a Windows domain controller default to TCP 49152 to 65535, and without a fixed port the whole range must be open (not verified on real equipment; the Samba test image fixes it at 49200).&lt;/li&gt;&#xA;&lt;li&gt;Groups are written as SIDs of the form &lt;code&gt;S-1-5-21-…&lt;/code&gt;. If you write a group name (for example &lt;code&gt;Domain Users&lt;/code&gt;), &lt;code&gt;check&lt;/code&gt; fails. You can look up the SID of a group with your domain administration tools: on Windows use &lt;code&gt;Get-ADGroup wifi-staff | Select SID&lt;/code&gt; (not verified on real equipment); the test used &lt;code&gt;samba-tool group show wifi-staff --attributes=objectSid&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;check&lt;/code&gt; only checks the configuration and reads the password file. It does &lt;strong&gt;not&lt;/strong&gt; connect to the domain controller. The secure channel is set up when the first request arrives.&lt;/li&gt;&#xA;&lt;li&gt;The secure channel always uses AES. If the domain controller does not agree to AES, or the server certificate that comes back fails verification, the handler treats that domain controller as unavailable and does not fall back to RC4 or DES.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;verification-3&#34;&gt;Verification&#xA;&lt;/h3&gt;&lt;p&gt;Test environment: a Samba AD domain controller, domain &lt;code&gt;CORP&lt;/code&gt;; &lt;code&gt;alice&lt;/code&gt; is in the &lt;code&gt;wifi-staff&lt;/code&gt; group; &lt;code&gt;bob&lt;/code&gt; is not; &lt;code&gt;carol&lt;/code&gt; is disabled. The Netlogon port is fixed, so the configuration has &lt;code&gt;port&lt;/code&gt;. The &lt;code&gt;mschapv2&lt;/code&gt; load of &lt;code&gt;rradius-bench&lt;/code&gt; sends MS-CHAPv2 Access-Requests directly:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run … --user alice --password Alice-Pass-1 --load mschapv2,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;…  accept 1, reject 0 …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run … --user &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;CORP\alice&amp;#39;&lt;/span&gt; --password Alice-Pass-1 --load mschapv2,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;…  accept 1, reject 0 …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run … --user alice --password Wrong-Pass-1 --load mschapv2,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;…  accept 0, reject 1 …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run … --user carol --password Carol-Pass-1 --load mschapv2,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;…  accept 0, reject 1 …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run … --user bob --password Bob-Pass-1 --load mschapv2,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;…  accept 0, reject 1 …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run … --user nobody --password Any-Pass-1 --load mschapv2,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;…  accept 0, reject 1 …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run … --user alice --password Alice-Pass-1 --load pap,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;…  accept 0, reject 1 …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Server log (excerpt):&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; account=&amp;#34;alice&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;netlogon&amp;#34; decision=&amp;#34;accept&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_trace: response client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; code=2 attributes=&amp;#34;Message-Authenticator = &amp;lt;hidden&amp;gt;, MS-CHAP2-Success = &amp;lt;hidden&amp;gt;, MS-MPPE-Send-Key = &amp;lt;hidden&amp;gt;, MS-MPPE-Recv-Key = &amp;lt;hidden&amp;gt;, Filter-Id = staff&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::netlogon::handler: auth netlogon handler: localhost: STATUS_WRONG_PASSWORD; rejecting account=&amp;#34;alice&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::netlogon::handler: auth netlogon handler: localhost: STATUS_ACCOUNT_DISABLED; rejecting account=&amp;#34;carol&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::netlogon::handler: auth netlogon handler: localhost: not in any of required_groups; rejecting account=&amp;#34;bob&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;nobody&amp;#34; account=&amp;#34;nobody&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;none&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; account=&amp;#34;alice&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;none&amp;#34; decision=&amp;#34;reject&amp;#34;&#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;alice&lt;/code&gt; passes, and the response carries the MS-CHAPv2 proof, the MPPE keys, and the &lt;code&gt;Filter-Id&lt;/code&gt; from &lt;code&gt;group_reply&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The name written as &lt;code&gt;CORP\alice&lt;/code&gt; also passes: the handler always uses the configured &lt;code&gt;domain&lt;/code&gt; and drops the domain part of the name.&lt;/li&gt;&#xA;&lt;li&gt;When the domain controller answers &lt;code&gt;STATUS_NO_SUCH_USER&lt;/code&gt;, the handler ignores it (&lt;code&gt;nobody&lt;/code&gt; ends up as &lt;code&gt;handler=&amp;quot;none&amp;quot;&lt;/code&gt;), which gives later handlers a chance.&lt;/li&gt;&#xA;&lt;li&gt;PAP is not the netlogon handler&amp;rsquo;s business: it ignores it and does not ask the domain controller.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Verified&lt;/strong&gt; (Samba AD domain controller). For the EAP part of PEAP-MSCHAPv2 going through this handler, see &lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;chapter 11&lt;/a&gt;; this chapter did not run PEAP separately.&lt;/p&gt;&#xA;&lt;h3 id=&#34;domain-controller-replies&#34;&gt;Domain controller replies&#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;Domain controller reply&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Handler result&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;code&gt;result&lt;/code&gt; of &lt;code&gt;rradius_netlogon_logons_total&lt;/code&gt;&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;Success&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;accept (reject if not in &lt;code&gt;required_groups&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accept&lt;/code&gt; (&lt;code&gt;reject&lt;/code&gt; if not in the 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;STATUS_NO_SUCH_USER&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;ignore&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;no_such_user&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;STATUS_WRONG_PASSWORD&lt;/code&gt;, &lt;code&gt;STATUS_ACCOUNT_DISABLED&lt;/code&gt;, &lt;code&gt;STATUS_ACCOUNT_LOCKED_OUT&lt;/code&gt;, &lt;code&gt;STATUS_PASSWORD_EXPIRED&lt;/code&gt;, &lt;code&gt;STATUS_PASSWORD_MUST_CHANGE&lt;/code&gt;, &lt;code&gt;STATUS_ACCOUNT_EXPIRED&lt;/code&gt;, &lt;code&gt;STATUS_INVALID_LOGON_HOURS&lt;/code&gt;, &lt;code&gt;STATUS_INVALID_WORKSTATION&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reject; the log gives the status name&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;reject&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;Any other failure&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reject; the log gives the status code in hexadecimal&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;reject&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;Success as a guest account&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;&lt;code&gt;reject&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;No domain controller could answer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;backend unavailable: RADIUS does not respond&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;unavailable&lt;/code&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;A user who is locked out or whose password has expired in AD is rejected here as well, and the log gives the reason.&lt;/li&gt;&#xA;&lt;li&gt;When an answer is marked &amp;ldquo;not authoritative&amp;rdquo;, the handler asks the next domain controller. The account states in the table above are an exception: they are rejected directly, because every domain controller gives the same answer.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;connections-fault-tolerance-and-metrics&#34;&gt;Connections, fault tolerance and metrics&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;Each domain controller keeps at most &lt;code&gt;connections&lt;/code&gt; connections, which are reused. When the domain controller invalidates the secure channel or the connection drops, the handler sets it up again and retries; if that still fails, it moves to the next domain controller.&lt;/li&gt;&#xA;&lt;li&gt;An idle connection in the pool that does not answer within &lt;code&gt;timeout_ms&lt;/code&gt; (for example because a firewall dropped it silently) is closed, together with the other idle connections of that domain controller, and the handler retries with a new connection.&lt;/li&gt;&#xA;&lt;li&gt;The computer account password, the session key, the NT-Response and the MPPE keys do not appear in the log at any level.&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s http://127.0.0.1:9812/metrics | grep &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;^rradius_netlogon&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_netlogon_logons_total{result=&amp;#34;accept&amp;#34;} 2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_netlogon_logons_total{result=&amp;#34;reject&amp;#34;} 3&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_netlogon_logons_total{result=&amp;#34;no_such_user&amp;#34;} 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_netlogon_logons_total{result=&amp;#34;unavailable&amp;#34;} 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_netlogon_channel_setups_total{result=&amp;#34;ok&amp;#34;} 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_netlogon_channel_setups_total{result=&amp;#34;failed&amp;#34;} 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_netlogon_open_connections 1&#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;Metric&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;&lt;code&gt;rradius_netlogon_logons_total{result}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;MS-CHAPv2 logins that were sent to the domain controller, by result&lt;/td&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_netlogon_channel_setups_total{result}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Number of secure channel setups, &lt;code&gt;ok&lt;/code&gt; or &lt;code&gt;failed&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_netlogon_open_connections&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Netlogon connections currently open&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The seven logins above set up the secure channel only once and reused it afterwards. &lt;code&gt;status&lt;/code&gt; also has a &lt;code&gt;Netlogon&lt;/code&gt; section:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd status --config rradius.toml&#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;Netlogon&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Open connections         1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Logons accepted          0.0/s (2)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Logons rejected          0.0/s (3)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Logons of unknown users  0.0/s (1)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Logons without a DC      0.0/s (0)&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Verified&lt;/strong&gt;. These metrics appear whether or not a netlogon handler is configured, and are all 0 when none is.&lt;/p&gt;&#xA;&lt;h3 id=&#34;wrong-computer-account-password&#34;&gt;Wrong computer account password&#xA;&lt;/h3&gt;&lt;p&gt;Replace &lt;code&gt;machine_password_file&lt;/code&gt; with a wrong password and start the server. On the first login:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::lua_engine: auth netlogon handler: localhost: cannot set up the secure channel as RRADIUS1$: the domain controller refused the computer account&amp;#39;s password (STATUS_ACCESS_DENIED)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::netlogon::handler: auth netlogon handler: localhost: cannot set up the secure channel as RRADIUS1$: the domain controller refused the computer account&amp;#39;s password (STATUS_ACCESS_DENIED)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::lua_engine: auth netlogon handler: no domain controller of CORP could answer; rejecting&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This login gets no response (&lt;code&gt;rradius-bench&lt;/code&gt; shows &lt;code&gt;timeouts 1&lt;/code&gt;), and &lt;code&gt;rradius_netlogon_channel_setups_total{result=&amp;quot;failed&amp;quot;}&lt;/code&gt; and &lt;code&gt;rradius_netlogon_logons_total{result=&amp;quot;unavailable&amp;quot;}&lt;/code&gt; each go up by one. &lt;strong&gt;Verified&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; AD periodically asks computer accounts to change their password. This handler only reads &lt;code&gt;machine_password_file&lt;/code&gt; and does not change it on its own. If the password of the computer account is changed on the domain side, update this file at the same time and reload.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;putting-ldap-and-netlogon-in-the-same-chain&#34;&gt;Putting LDAP and netlogon in the same chain&#xA;&lt;/h2&gt;&lt;p&gt;The same AD users send PAP from the VPN and PEAP-MSCHAPv2 from Wi-Fi. Put both handlers in the same &lt;code&gt;first_match&lt;/code&gt; chain, with &lt;strong&gt;netlogon first&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:#75715e&#34;&gt;# rradius.toml (excerpt)&lt;/span&gt;&#xA;&lt;/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;]&#xA;&lt;/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;netlogon&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;domain&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;CORP&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;dc1.corp.example&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;dc2.corp.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;computer_name&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;RRADIUS1&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;machine_password_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;machine.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;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;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&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ldaps://dc2.corp.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;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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The reasons for the order:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A PAP login: the netlogon handler ignores it and passes it to the ldap handler to bind.&lt;/li&gt;&#xA;&lt;li&gt;An MS-CHAPv2 login: the netlogon handler decides. If you put ldap first instead, the ldap handler in bind mode &lt;strong&gt;rejects&lt;/strong&gt; MS-CHAPv2 (it cannot verify it, but it does not ignore it), and netlogon never gets its turn.&lt;/li&gt;&#xA;&lt;li&gt;When the domain controller says there is no such user (&lt;code&gt;STATUS_NO_SUCH_USER&lt;/code&gt;), netlogon ignores it. Then the ldap handler cannot find the person in the directory and also rejects MS-CHAPv2, so the result is a reject.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;You can also split this into two named chains, one for the VPN gateway and one for the Wi-Fi controller (&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;chapter 07&lt;/a&gt;), each with only one kind of handler. That is easier to understand.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; This combination has only passed &lt;code&gt;check&lt;/code&gt;. It has not been run with an LDAP server and a domain controller connected at the same time; the handler order rules come from the code.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; LDAP users can log in with PAP, but Wi-Fi (PEAP) or MS-CHAPv2 is always rejected, and the authentication record shows &lt;code&gt;handler=&amp;quot;ldap&amp;quot; decision=&amp;quot;reject&amp;quot;&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; bind mode can only verify PAP.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; For AD, use the netlogon handler. For other directories that store clear text or NT hashes, use &lt;code&gt;password_check = &amp;quot;attribute&amp;quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The login gets no response, and the log has &lt;code&gt;invalid peer certificate: UnknownIssuer&lt;/code&gt; and &lt;code&gt;no server reachable; rejecting&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The directory certificate was not signed by a trusted CA.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Put the issuing CA in &lt;code&gt;ca_file&lt;/code&gt;. If the name does not match, write &lt;code&gt;urls&lt;/code&gt; with the host name on the certificate.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The login gets no response, and the log has &lt;code&gt;service account bind failed: …&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The DN or password of the service account is wrong, or the account is disabled.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Check &lt;code&gt;bind_dn&lt;/code&gt; and the contents of &lt;code&gt;ldap.secret&lt;/code&gt;. In this case the handler does not try the next URL.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The password is correct but the login is still rejected, and the log has no error.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The user is not in &lt;code&gt;required_groups&lt;/code&gt;; or the groups are read from &lt;code&gt;memberOf&lt;/code&gt;, but the directory does not maintain &lt;code&gt;memberOf&lt;/code&gt; on users.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Check the group DN; if the directory has no &lt;code&gt;memberOf&lt;/code&gt;, use &lt;code&gt;group_base_dn&lt;/code&gt; and &lt;code&gt;group_filter&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;auth.handlers[0].filter must contain exactly one {user} placeholder, found 0&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;filter&lt;/code&gt; (or &lt;code&gt;certificate_filter&lt;/code&gt;) has no &lt;code&gt;{user}&lt;/code&gt;, or has two or more.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Write exactly one &lt;code&gt;{user}&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;auth.handlers[0].urls: &#39;localhost:636&#39; must start with ldap:// or ldaps://&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The URL has no scheme.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Write it as &lt;code&gt;ldaps://host:port&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;auth.handlers[0].bind_password must not be empty: an empty password makes an anonymous bind&lt;/code&gt;, or &lt;code&gt;bind_password: exactly one of bind_password or bind_password_file must be set&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The service account password is empty, or both keys are written (or neither).&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Keep only &lt;code&gt;bind_password_file&lt;/code&gt;, with a non-empty password in the file.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;auth.handlers[0].group_attribute has no effect without required_groups or group_reply&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; A way to look up groups is written, but no group setting uses it.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add &lt;code&gt;required_groups&lt;/code&gt; or &lt;code&gt;group_reply&lt;/code&gt;, or remove the key. &lt;code&gt;group_filter needs group_base_dn&lt;/code&gt; and &lt;code&gt;required_groups must list at least one group; leave it out to require none&lt;/code&gt; are the same kind of error.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;auth.handlers: group_reply: unknown attribute &#39;No-Such-Attr&#39;&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The attribute name in &lt;code&gt;group_reply&lt;/code&gt; is not in the dictionary.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Correct the name (&lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;chapter 06&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;auth.handlers[0].password_attribute is required when password_check = &amp;quot;attribute&amp;quot;&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; Attribute mode is used without saying which attribute.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add &lt;code&gt;password_attribute = &amp;quot;userPassword&amp;quot;&lt;/code&gt; (according to your directory).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;auth.handlers[0].servers: &#39;192.0.2.10&#39; is an address or has a port; give the domain controller&#39;s DNS or NetBIOS name, which the logon names it by (a fixed port goes in port)&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;servers&lt;/code&gt; of netlogon has an IP address or &lt;code&gt;host:port&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Write the name of the domain controller; write a fixed port in &lt;code&gt;port&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;auth.handlers[0].computer_name &#39;RRADIUS1$&#39; must have 1 to 15 characters and no trailing $&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;computer_name&lt;/code&gt; has a &lt;code&gt;$&lt;/code&gt;, or is longer than 15 characters.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Remove the &lt;code&gt;$&lt;/code&gt;; if the name is too long, create a shorter computer account in the domain.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;auth.handlers[0].required_groups: &#39;Domain Users&#39; is not a SID of the form S-1-&amp;lt;authority&amp;gt;-&amp;lt;sub-authority&amp;gt;...&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; Groups for netlogon must be SIDs, not names.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Look up the SID of the group and write it.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; MS-CHAPv2 logins get no response, and the log has &lt;code&gt;cannot set up the secure channel as RRADIUS1$: the domain controller refused the computer account&#39;s password (STATUS_ACCESS_DENIED)&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The password in &lt;code&gt;machine_password_file&lt;/code&gt; differs from the password of the computer account in the domain.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Reset the computer account password in the domain, update the file, and reload.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The log has &lt;code&gt;cannot set up the secure channel as RRADIUS1$: the domain controller has no such computer account (STATUS_NO_TRUST_SAM_ACCOUNT)&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The domain has no such computer account, or &lt;code&gt;computer_name&lt;/code&gt; is mistyped.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Create the computer account in the domain (&lt;a class=&#34;link&#34; href=&#34;#prepare-the-computer-account&#34; &gt;Prepare the computer account&lt;/a&gt;), or correct &lt;code&gt;computer_name&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The log has &lt;code&gt;no Netlogon endpoint registered yet; the domain controller may still be starting&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; Port 135 of the domain controller already answers, but the Netlogon service has not registered yet. This is common right after the domain controller boots.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Wait for it to come up; it usually recovers on its own. If it keeps appearing, check the Netlogon service on the domain controller.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; Two nodes take turns showing &lt;code&gt;STATUS_ACCESS_DENIED&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The two nodes share the same computer account.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Each node uses its own computer account. (This follows the previous version of the manual and is not verified on real equipment; for the reason see &lt;a class=&#34;link&#34; href=&#34;#prepare-the-computer-account&#34; &gt;Prepare the computer account&lt;/a&gt;.)&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; On a Samba domain controller, a correct password is still rejected, and the log has &lt;code&gt;STATUS_WRONG_PASSWORD&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;smb.conf&lt;/code&gt; does not have &lt;code&gt;ntlm auth = mschapv2-and-ntlmv2-only&lt;/code&gt;, so Samba does not accept MS-CHAPv2.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add this line and restart samba. (Not verified on real hardware: the test image has this option from the start, and the result without it was not tried.)&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The log has &lt;code&gt;not in any of required_groups&lt;/code&gt;, although the password is correct.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The user is not in a group listed in &lt;code&gt;required_groups&lt;/code&gt;, or the SID was copied wrongly.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Compare with the group SIDs of the user.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;06 Dictionary and attributes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;11 802.1X and EAP&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;12 TACACS+ device administration&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../15-access-recipes/&#34; &gt;15 Scenarios: network access for organizations&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../20-security/&#34; &gt;20 Security hardening&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../92-metrics-reference/&#34; &gt;Appendix C: Metrics reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>09 External databases and named queries</title>
            <link>https://embark.systems/en/rradius/oss/09-external-databases/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/09-external-databases/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Connect to an existing PostgreSQL or MySQL database and let the auth chain use the account table in it directly&lt;/li&gt;&#xA;&lt;li&gt;Read and write an external database from a Lua script with &lt;code&gt;db_query&lt;/code&gt; and &lt;code&gt;db_execute&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Watch the health of an external database with &lt;code&gt;/readyz&lt;/code&gt;, metrics and &lt;code&gt;status&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Turn a piece of SQL into a Prometheus metric, and run it directly with the &lt;code&gt;query&lt;/code&gt; command&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: you have run the quick-start from &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;Chapter 03&lt;/a&gt;, and you have read the sql handler in &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;Chapter 07&lt;/a&gt;. To use an external database from a script, read &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;Chapter 10&lt;/a&gt; first.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#cluster-database-and-external-databases&#34; &gt;Cluster database and external databases&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#set-up-an-external-database&#34; &gt;Set up an external database&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#let-the-sql-handler-use-an-external-database&#34; &gt;Let the sql handler use an external database&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#read-and-write-an-external-database-from-a-script&#34; &gt;Read and write an external database from a script&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#when-the-database-is-unreachable&#34; &gt;When the database is unreachable&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#monitor-health&#34; &gt;Monitor health&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#named-queries-turn-sql-into-metrics&#34; &gt;Named queries: turn SQL into metrics&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#after-changing-the-configuration&#34; &gt;After changing the configuration&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#accounts-in-another-system-http-api&#34; &gt;Accounts in another system: HTTP API&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;cluster-database-and-external-databases&#34;&gt;Cluster database and external databases&#xA;&lt;/h2&gt;&lt;p&gt;rradius has a database of its own: the cluster database (the built-in hiqlite, a SQLite that every node holds a copy of and that is replicated with Raft). The quick-start account table and accounting table are in it. An external database is a PostgreSQL or MySQL database that you set up separately and that rradius connects to over the network.&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;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cluster database&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;External database&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;Where&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One copy on every node, replicated automatically&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;On another server; rradius connects with a connection pool&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Configuration&lt;/td&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;&lt;code&gt;[databases.&amp;lt;name&amp;gt;]&lt;/code&gt;, and there can be several&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Creating tables&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Migrations in &lt;code&gt;cluster.migrations_dir&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;You create them on the database yourself&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;sql handler&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No &lt;code&gt;database&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;database = &amp;quot;&amp;lt;name&amp;gt;&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;Lua&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;sql_query&lt;/code&gt;, &lt;code&gt;sql_execute&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;db_query&lt;/code&gt;, &lt;code&gt;db_execute&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;Named queries&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;code&gt;[queries]&lt;/code&gt; only queries the cluster 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;Read latency&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Local read, no network&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One network round trip each 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;Write restrictions&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Cannot use functions such as time or random that give a different result on each node&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No such restriction&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;When to use an external database:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The accounts are already in another system (for example a membership system, or the account table of an old RADIUS server), and you do not want to move or synchronize them.&lt;/li&gt;&#xA;&lt;li&gt;You want to write accounting data to a place that a report or billing system reads directly.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;When rradius manages the accounts entirely, use the cluster database: logins read locally and are not affected by the network or by another server. Chapter 07 describes how to move the accounts and password hashes of an old system into the cluster database.&lt;/p&gt;&#xA;&lt;h2 id=&#34;set-up-an-external-database&#34;&gt;Set up an external database&#xA;&lt;/h2&gt;&lt;p&gt;Each external database gets one &lt;code&gt;[databases.&amp;lt;name&amp;gt;]&lt;/code&gt; section. You choose &lt;code&gt;&amp;lt;name&amp;gt;&lt;/code&gt;; it may only contain ASCII letters, digits and &lt;code&gt;_&lt;/code&gt;. The sql handler and scripts use this name to refer to the database.&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:#75715e&#34;&gt;# rradius.toml&lt;/span&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;# … (other settings omitted)&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;databases&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;billing&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;kind&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;postgresql&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;host&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;db.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;database&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;radius&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&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;rradius&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_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;p&gt;Put the password in a file, with permissions that only the account running rradius can read:&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-console&#34; data-lang=&#34;console&#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;&amp;lt;database password&amp;gt;&amp;#39;&lt;/span&gt; &amp;gt; billing.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;600&lt;/span&gt; billing.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The newline at the end of the file is removed. If the file is empty, &lt;code&gt;check&lt;/code&gt; fails: &lt;code&gt;databases.billing.password_file: &#39;billing.secret&#39; is empty&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The keys (see &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt; for the full description; any change to &lt;code&gt;[databases]&lt;/code&gt; needs a restart):&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;kind&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;postgresql&lt;/code&gt; or &lt;code&gt;mysql&lt;/code&gt;; required&lt;/td&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;host&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Host name or address; required&lt;/td&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;port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PostgreSQL &lt;code&gt;5432&lt;/code&gt;, MySQL &lt;code&gt;3306&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;&lt;code&gt;database&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Database name; required&lt;/td&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;user&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Account; required&lt;/td&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;password&lt;/code&gt;, &lt;code&gt;password_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Set at most one; if neither is set, no password is sent. The examples always use &lt;code&gt;password_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;tls&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;verify&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;verify&lt;/code&gt; encrypts and verifies the certificate and the host name; &lt;code&gt;off&lt;/code&gt; does not encrypt&lt;/td&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;ca_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;System root certificates&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An additional CA (PEM) to trust when &lt;code&gt;tls = &amp;quot;verify&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;pool_size&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;8&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The maximum number of connections to keep&lt;/td&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;connect_timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;5000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Time limit for opening one connection, in milliseconds&lt;/td&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;required_for_ready&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Whether &lt;code&gt;/readyz&lt;/code&gt; answers 503 when the database is unreachable; see &lt;a class=&#34;link&#34; href=&#34;#monitor-health&#34; &gt;Monitor health&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;code&gt;rradiusd config show&lt;/code&gt; prints the configuration with the defaults filled in, so you can use it to check values you did not write, such as &lt;code&gt;pool_size&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;how-many-connections-to-plan-for&#34;&gt;How many connections to plan for&#xA;&lt;/h3&gt;&lt;p&gt;Each node has its own connection pool and connects to the external database on its own. The most connections the database sees is:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pool_size × number of nodes, plus 1 health-check connection per node (only when required_for_ready = true)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For example, with three nodes, &lt;code&gt;pool_size = 8&lt;/code&gt; and &lt;code&gt;required_for_ready = true&lt;/code&gt;, that is at most 27 connections. Leave this many under the database&amp;rsquo;s connection limit (&lt;code&gt;max_connections&lt;/code&gt; in PostgreSQL, &lt;code&gt;max_connections&lt;/code&gt; in MySQL), and leave room for other systems too.&lt;/p&gt;&#xA;&lt;p&gt;The pool is created at startup and connects the first time it is used, so it does not fill up the moment the server starts; idle connections are kept for reuse. When &lt;code&gt;pool_size&lt;/code&gt; is too small, requests wait in a queue for a connection at peak times, and if they wait too long, the result is the same as when the database is unreachable (see &lt;a class=&#34;link&#34; href=&#34;#when-the-database-is-unreachable&#34; &gt;When the database is unreachable&lt;/a&gt;). Start with the default 8, and tune it by looking at whether &lt;code&gt;rradius_external_db_connections{state=&amp;quot;in_use&amp;quot;}&lt;/code&gt; reaches the limit at peak times.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-database-account-for-rradius&#34;&gt;The database account for rradius&#xA;&lt;/h3&gt;&lt;p&gt;Give it only the privileges it needs. To only read the account tables, you can create it like this in PostgreSQL:&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;-- On the radius database, run as an administrator&#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;ROLE&lt;/span&gt; rradius_ro LOGIN PASSWORD &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;lt;database password&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:#66d9ef&#34;&gt;GRANT&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;SELECT&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;ON&lt;/span&gt; radcheck, radreply &lt;span style=&#34;color:#66d9ef&#34;&gt;TO&lt;/span&gt; rradius_ro;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When a script needs to write an accounting copy, create a separate account that has only &lt;code&gt;INSERT&lt;/code&gt; and &lt;code&gt;UPDATE&lt;/code&gt; on that table, and set it up as another &lt;code&gt;[databases.&amp;lt;name&amp;gt;]&lt;/code&gt;. One account for one purpose means that less can be done if the account leaks.&lt;/p&gt;&#xA;&lt;p&gt;Tested (PostgreSQL 17): with this account, the sql handler logs users in as usual; a script that runs &lt;code&gt;DELETE&lt;/code&gt; on &lt;code&gt;radcheck&lt;/code&gt; gets &lt;code&gt;permission denied for table radcheck&lt;/code&gt;, and reading a table it was not granted gets &lt;code&gt;permission denied for table acct_copy&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;tls&#34;&gt;TLS&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;tls = &amp;quot;verify&amp;quot;&lt;/code&gt; is the default: the connection is encrypted, the database certificate must be issued by a trusted CA, and the name on the certificate must be the one written in &lt;code&gt;host&lt;/code&gt;. When the database uses its own CA:&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:#75715e&#34;&gt;# rradius.toml (excerpt)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;databases&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;billing&lt;/span&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;# … (kind, host and so on as above)&lt;/span&gt;&#xA;&lt;/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;db-ca.pem&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;ca_file&lt;/code&gt; is read by &lt;code&gt;check&lt;/code&gt; and at startup. If the file does not exist or contains no certificate, it fails right away instead of waiting for the first login.&lt;/p&gt;&#xA;&lt;p&gt;Tested (PostgreSQL 17, the server certificate is issued by a self-made CA, and the only name on the certificate is &lt;code&gt;localhost&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;Setting&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;host = &amp;quot;localhost&amp;quot;&lt;/code&gt;, &lt;code&gt;ca_file = &amp;quot;db-ca.pem&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Connects; logins work&lt;/td&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;host = &amp;quot;127.0.0.1&amp;quot;&lt;/code&gt;, &lt;code&gt;ca_file = &amp;quot;db-ca.pem&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Cannot connect: &lt;code&gt;invalid peer certificate: certificate not valid for name &amp;quot;127.0.0.1&amp;quot;; certificate is only valid for DnsName(&amp;quot;localhost&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;host = &amp;quot;localhost&amp;quot;&lt;/code&gt;, no &lt;code&gt;ca_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Cannot connect: &lt;code&gt;invalid peer certificate: UnknownIssuer&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;A certificate that fails verification is handled like an unreachable database: with &lt;code&gt;required_for_ready = true&lt;/code&gt;, startup logs &lt;code&gt;not reachable at startup: …&lt;/code&gt;, and logins get no answer (see &lt;a class=&#34;link&#34; href=&#34;#when-the-database-is-unreachable&#34; &gt;When the database is unreachable&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;tls = &amp;quot;off&amp;quot;&lt;/code&gt; is only suitable when the database is on the same machine (&lt;code&gt;host&lt;/code&gt; is a loopback address such as &lt;code&gt;127.0.0.1&lt;/code&gt;). When &lt;code&gt;host&lt;/code&gt; is not a loopback address, startup and &lt;code&gt;check&lt;/code&gt; both warn:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::external_db: databases.legacy: tls = &amp;#34;off&amp;#34; sends the password and the data to db.example.com unencrypted&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; With &lt;code&gt;tls = &amp;quot;off&amp;quot;&lt;/code&gt;, the database password and the content of every query (including account names and password hashes) travel over the network in clear text.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;With MySQL and &lt;code&gt;tls = &amp;quot;off&amp;quot;&lt;/code&gt;, the database account must use &lt;code&gt;mysql_native_password&lt;/code&gt;. The &lt;code&gt;caching_sha2_password&lt;/code&gt; that MySQL 8 gives new accounts by default needs an RSA exchange on an unencrypted connection, which rradius does not include, so the connection fails. Tested (MySQL 8.4, server started with &lt;code&gt;--mysql-native-password=ON&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;Authentication method of the account&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;code&gt;tls&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;mysql_native_password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;off&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Connects; logins work&lt;/td&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;caching_sha2_password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;off&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Cannot connect, logins get no answer: &lt;code&gt;error with configuration: RSA auth backend disabled; enable feature `mysql-rsa` (or `rsa` if using sqlx-mysql directly) or use 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;caching_sha2_password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;verify&lt;/code&gt; (&lt;code&gt;ca_file&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Connects; logins work&lt;/td&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;mysql_native_password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;verify&lt;/code&gt; (&lt;code&gt;ca_file&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Connects; logins work&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;To create an account with &lt;code&gt;mysql_native_password&lt;/code&gt;: &lt;code&gt;CREATE USER &#39;rradius&#39;@&#39;%&#39; IDENTIFIED WITH mysql_native_password BY &#39;&amp;lt;database password&amp;gt;&#39;;&lt;/code&gt;. MySQL 8.4 disables this authentication method by default, so the server must be started with &lt;code&gt;--mysql-native-password=ON&lt;/code&gt; (the tests for this book were started that way). When you can use TLS, &lt;code&gt;verify&lt;/code&gt; is better than changing the authentication method of the account.&lt;/p&gt;&#xA;&lt;h2 id=&#34;let-the-sql-handler-use-an-external-database&#34;&gt;Let the sql handler use an external database&#xA;&lt;/h2&gt;&lt;p&gt;Add &lt;code&gt;database&lt;/code&gt; to the sql handler, and its queries go to that external database instead of the cluster database. The example uses the &lt;code&gt;radcheck&lt;/code&gt; and &lt;code&gt;radreply&lt;/code&gt; tables of an old system (&lt;code&gt;rradius-server/examples/scenarios/migrate-users/external-db.toml&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:#75715e&#34;&gt;# rradius.toml&lt;/span&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;# … (other settings omitted)&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;databases&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;legacy&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;kind&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;postgresql&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;host&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;db.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;database&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;radius&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&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;rradius_ro&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_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;legacy-db.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;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;database&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;legacy&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 radcheck WHERE username = ?&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 radreply 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;Always write &lt;code&gt;?&lt;/code&gt; for values in SQL. When sending to PostgreSQL, rradius rewrites them in order to &lt;code&gt;$1&lt;/code&gt;, &lt;code&gt;$2&lt;/code&gt; …; when sending to MySQL, they are sent unchanged. Forms such as &lt;code&gt;?1&lt;/code&gt; and &lt;code&gt;:name&lt;/code&gt; are not accepted.&lt;/li&gt;&#xA;&lt;li&gt;The format of the password column is the same as in the account table of the cluster database (prefixes such as &lt;code&gt;{crypt}&lt;/code&gt; and &lt;code&gt;{clear}&lt;/code&gt;; see Chapter 07).&lt;/li&gt;&#xA;&lt;li&gt;You only read, so give rradius a read-only account that can read these two tables.&lt;/li&gt;&#xA;&lt;li&gt;If the plaintext passwords of the old system need the &lt;code&gt;{clear}&lt;/code&gt; prefix added, concatenate it in SQL: in PostgreSQL use &lt;code&gt;SELECT &#39;{clear}&#39; || value FROM radcheck WHERE username = ?&lt;/code&gt;, in MySQL use &lt;code&gt;SELECT CONCAT(&#39;{clear}&#39;, value) FROM radcheck WHERE username = ?&lt;/code&gt; (in MySQL &lt;code&gt;||&lt;/code&gt; is a logical OR by default). For when you need this, see &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/#plaintext-without-a-prefix-mysql-and-concat&#34; &gt;Chapter 07&lt;/a&gt;. These two statements were not run again on a real database.&lt;/li&gt;&#xA;&lt;li&gt;Limits on placeholders: rradius scans the SQL of the sql handler for &lt;code&gt;?&lt;/code&gt;, so PostgreSQL &lt;code&gt;$$ … $$&lt;/code&gt; strings and the &lt;code&gt;$1&lt;/code&gt; form are rejected (&lt;code&gt;only plain ? placeholders are supported, found $$…&lt;/code&gt;, &lt;code&gt;sql_placeholders&lt;/code&gt; in &lt;code&gt;rradius-core/src/lua_engine.rs&lt;/code&gt;), and the jsonb &lt;code&gt;?&lt;/code&gt; operator is treated as a placeholder. To use them, rewrite the SQL (for example with the &lt;code&gt;jsonb_exists(…)&lt;/code&gt; function).&lt;/li&gt;&#xA;&lt;li&gt;If the account table of the old system is still maintained by the old system, you only read it here; to write accounting back to the old system, use &lt;code&gt;db_execute&lt;/code&gt; in a script (see the next section).&lt;/li&gt;&#xA;&lt;li&gt;If &lt;code&gt;database&lt;/code&gt; names something that is not in &lt;code&gt;[databases]&lt;/code&gt;, &lt;code&gt;check&lt;/code&gt; fails: &lt;code&gt;auth.handlers[0].database: there is no [databases.nosuch]&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Tested (PostgreSQL 17 and MySQL 8.4, with tables identical to the quick-start accounts): &lt;code&gt;bob&lt;/code&gt; (bcrypt) and &lt;code&gt;alice&lt;/code&gt; (plaintext) get &lt;code&gt;accept 1&lt;/code&gt; with the correct password, and a wrong password gets &lt;code&gt;reject 1&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;read-and-write-an-external-database-from-a-script&#34;&gt;Read and write an external database from a script&#xA;&lt;/h2&gt;&lt;p&gt;A script uses an external database through two functions. The first argument is the name of the &lt;code&gt;[databases.&amp;lt;name&amp;gt;]&lt;/code&gt; section:&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;Function&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What it does&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Returns&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;db_query(name, sql, params)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Read&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An array with one table per row, with the column names as 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;db_execute(name, sql, params)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Write&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The number of rows affected&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The parameter rules are the same as for &lt;code&gt;sql_query&lt;/code&gt;: always pass values with &lt;code&gt;?&lt;/code&gt; and a parameter array, and never build them into the SQL string. The error messages of each function are in &lt;a class=&#34;link&#34; href=&#34;../93-lua-reference/&#34; &gt;Appendix D&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Example: write a copy of the accounting data to the PostgreSQL of a billing system. In the quick-start &lt;code&gt;accounting.lua&lt;/code&gt;, add this before the final &lt;code&gt;return &#39;accept&#39;&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-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;-- accounting.lua (excerpt, placed before the final return &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;db_execute(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;billing&amp;#39;&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;  INSERT INTO acct_copy (nas, session_id, username, updated, session_time)&#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;  VALUES (?, ?, ?, ?, ?)&#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;  ON CONFLICT (nas, session_id) DO UPDATE SET&#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;    updated = GREATEST(acct_copy.updated, excluded.updated),&#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;    session_time = GREATEST(acct_copy.session_time, excluded.session_time)&#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;]]&lt;/span&gt;, {nas, session, get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Name&amp;#39;&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;#39;&lt;/span&gt;, seen, seconds})&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;nas&lt;/code&gt;, &lt;code&gt;session&lt;/code&gt;, &lt;code&gt;seen&lt;/code&gt; and &lt;code&gt;seconds&lt;/code&gt; are variables that the quick-start script has already computed earlier. Note two things:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This write must be safe to run more than once. When the external database is unreachable, the script fails, and afterwards, whether the NAS retransmits or the request is replayed from the accounting spool (a temporary store on disk where requests wait to be sent again), the script runs again from the start, and the record already written to the cluster database is written again. So use an &amp;ldquo;update if it already exists&amp;rdquo; form on both sides.&lt;/li&gt;&#xA;&lt;li&gt;An external database does not have the cluster replication problem, so functions such as &lt;code&gt;now()&lt;/code&gt; can be used; but it is still better to use the values the script computed, so the data on both sides agree.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;On the PostgreSQL side, create the table first:&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;-- Run on the billing database&#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; acct_copy (&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  nas TEXT &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;  session_id TEXT &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;  username TEXT &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;  updated BIGINT &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;  session_time BIGINT &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;PRIMARY&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;KEY&lt;/span&gt; (nas, session_id)&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;value-types&#34;&gt;Value types&#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;Database column&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What Lua gets&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;Integer, floating point&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A number&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Boolean&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1&lt;/code&gt; or &lt;code&gt;0&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;Text&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Binary&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A string of bytes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PostgreSQL &lt;code&gt;NUMERIC&lt;/code&gt;, MySQL &lt;code&gt;DECIMAL&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A decimal string, not rounded (the result of &lt;code&gt;SUM&lt;/code&gt; and &lt;code&gt;AVG&lt;/code&gt; is often of this kind)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;NULL&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;nil&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;A type that cannot be read gives an error and a hint to convert it to text in the SQL. Tested: &lt;code&gt;DATE&lt;/code&gt; columns in both PostgreSQL and MySQL cannot be read: &lt;code&gt;db_query: database billing: column created has a type that cannot be read; CAST it to text in the SQL&lt;/code&gt;; after changing it to &lt;code&gt;CAST(created AS TEXT) AS created&lt;/code&gt;, you get &lt;code&gt;&#39;2026-11-23&#39;&lt;/code&gt;. A MySQL &lt;code&gt;BIGINT UNSIGNED&lt;/code&gt; that holds a value larger than a signed 64-bit integer also gives an error: &lt;code&gt;column u_big holds 18446744073709551615, more than a script number can hold; CAST it to text in the SQL&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Other tested mappings: a PostgreSQL &lt;code&gt;NUMERIC(8,2)&lt;/code&gt; column with &lt;code&gt;12.50&lt;/code&gt; gives the string &lt;code&gt;&#39;12.50&#39;&lt;/code&gt;, and &lt;code&gt;SUM&lt;/code&gt; also gives &lt;code&gt;&#39;12.50&#39;&lt;/code&gt;; a &lt;code&gt;BOOLEAN&lt;/code&gt; &lt;code&gt;true&lt;/code&gt; gives &lt;code&gt;1&lt;/code&gt;; &lt;code&gt;BYTEA&lt;/code&gt; gives a byte string; a MySQL &lt;code&gt;DECIMAL(8,2)&lt;/code&gt; gives &lt;code&gt;&#39;12.50&#39;&lt;/code&gt;, and &lt;code&gt;TINYINT(1)&lt;/code&gt; gives &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Script numbers are double-precision floating point, so integers above 2^53 (9007199254740992) lose precision. Tested: a PostgreSQL &lt;code&gt;BIGINT&lt;/code&gt; of &lt;code&gt;9007199254740993&lt;/code&gt; gives &lt;code&gt;9007199254740992&lt;/code&gt;. Always &lt;code&gt;CAST&lt;/code&gt; IDs this large to text before reading them.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;time-limit&#34;&gt;Time limit&#xA;&lt;/h3&gt;&lt;p&gt;All database calls in one request share &lt;code&gt;lua.query_timeout_ms&lt;/code&gt; (default 5000 milliseconds): &lt;code&gt;sql_query&lt;/code&gt;, &lt;code&gt;sql_execute&lt;/code&gt;, &lt;code&gt;db_query&lt;/code&gt; and &lt;code&gt;db_execute&lt;/code&gt; count together. When an accounting script waits for an external database, it gives up its place in accounting, so it does not block other accounting requests.&lt;/p&gt;&#xA;&lt;p&gt;Tested (PostgreSQL 17): &lt;code&gt;db_query(&#39;billing&#39;, &#39;SELECT username FROM radcheck WHERE username = ? OR username = ?&#39;, {&#39;alice&#39;, &#39;bob&#39;})&lt;/code&gt; returns two rows, which shows that the two &lt;code&gt;?&lt;/code&gt; were rewritten in order to &lt;code&gt;$1&lt;/code&gt; and &lt;code&gt;$2&lt;/code&gt;; a &lt;code&gt;&#39;?&#39;&lt;/code&gt; inside an SQL string literal is not treated as a parameter. With the accounting excerpt above writing to &lt;code&gt;acct_copy&lt;/code&gt;: writing &lt;code&gt;updated = 100&lt;/code&gt; for a session, then an older &lt;code&gt;90&lt;/code&gt;, still leaves &lt;code&gt;100&lt;/code&gt;; writing &lt;code&gt;200&lt;/code&gt; then updates it to &lt;code&gt;200&lt;/code&gt;, so a replay does not make the data go backwards.&lt;/p&gt;&#xA;&lt;h2 id=&#34;when-the-database-is-unreachable&#34;&gt;When the database is unreachable&#xA;&lt;/h2&gt;&lt;p&gt;When an external database is unreachable, rradius starts as usual, and the connection pool only connects the first time it is used. You can try this out in the quick-start without a real database, and it is worth looking at once before going to production.&lt;/p&gt;&#xA;&lt;h3 id=&#34;try-it-in-the-quick-start&#34;&gt;Try it in the quick-start&#xA;&lt;/h3&gt;&lt;p&gt;Goal: make the sql handler use an unreachable external database, and see how logins, &lt;code&gt;/readyz&lt;/code&gt; and the log react.&lt;/p&gt;&#xA;&lt;p&gt;Setup: in the quick-start &lt;code&gt;rradius.toml&lt;/code&gt;, add one line &lt;code&gt;database = &amp;quot;billing&amp;quot;&lt;/code&gt; to the sql handler, and add at the end a database that points to a port nothing listens on (15432 is used here on purpose):&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:#75715e&#34;&gt;# rradius.toml (add one line to the sql handler)&lt;/span&gt;&#xA;&lt;/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;database&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:#75715e&#34;&gt;# … (user_query and reply_query unchanged)&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-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# rradius.toml (add at the end)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;databases&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;billing&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;kind&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;postgresql&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;host&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;127.0.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;port&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;15432&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;database&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;radius&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&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;rradius&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_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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;tls&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;off&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_for_ready&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;Any value will do in &lt;code&gt;billing.secret&lt;/code&gt; (&lt;code&gt;printf &#39;unused\n&#39; &amp;gt; billing.secret&lt;/code&gt;). Start the server. The log has:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::external_db: databases.billing: not reachable at startup: error communicating with database: Connection refused (os error 61); /readyz answers 503 until it is&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This line only appears for a database with &lt;code&gt;required_for_ready = true&lt;/code&gt;; &lt;code&gt;host&lt;/code&gt; is a loopback address, so there is no warning about &lt;code&gt;tls = &amp;quot;off&amp;quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Check: log in once as &lt;code&gt;bob&lt;/code&gt;, then look at &lt;code&gt;/readyz&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user bob --password bob-password --load pap,concurrency=1 --requests 1&#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;  pap: 0/s, sent 1, accept 0, reject 0, challenge 0, accounting 0, timeouts 1, invalid 0, late 0, socket errors 0, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s -w &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39; %{http_code}\n&amp;#39;&lt;/span&gt; http://127.0.0.1:9812/readyz&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;database billing unreachable 503&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Result: the login gets no answer (&lt;code&gt;timeouts 1&lt;/code&gt;); it is not rejected. After about 5 seconds (the default &lt;code&gt;connect_timeout_ms&lt;/code&gt;; about 1 second when set to &lt;code&gt;1000&lt;/code&gt;) the log says:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::auth_chain: auth sql handler error: database billing: pool timed out while waiting for an open connection&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::lua_engine: RADIUS Access-Request from client localhost not answered: the authentication backend could not be used&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;An accounting Start sent at the same time is answered as usual, because the quick-start accounting script writes to the cluster database and does not go through &lt;code&gt;billing&lt;/code&gt;. When you have finished, remove these two pieces.&lt;/p&gt;&#xA;&lt;h3 id=&#34;who-is-affected&#34;&gt;Who is affected&#xA;&lt;/h3&gt;&lt;p&gt;A login that uses the unreachable external database:&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;Who uses it&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;sql handler&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No answer; the log says &lt;code&gt;auth sql handler error: database billing: pool timed out while waiting for an open connection&lt;/code&gt; and &lt;code&gt;RADIUS Access-Request from client localhost not answered: the authentication backend could not be used&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;db_query&lt;/code&gt; in a &lt;code&gt;lua&lt;/code&gt; handler or the top-level script&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No answer. Even when the script catches the error with &lt;code&gt;pcall&lt;/code&gt; and returns &lt;code&gt;&#39;reject&#39;&lt;/code&gt;, there is still no 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;db_execute&lt;/code&gt; in an accounting script&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;With an accounting spool (&lt;code&gt;[radius.accounting_spool]&lt;/code&gt;), the request is first written to the spool and an Accounting-Response is sent, and it is replayed when the database recovers; without a spool, there is no answer and the NAS retransmits&lt;/td&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+&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Answers ERROR, so the device asks the next server&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Why no answer instead of a reject: an unreachable database is not the user&amp;rsquo;s fault. A reject would get the user kicked out or locked out; with no answer, the NAS retransmits or asks another RADIUS server. So it is best to configure two or more RADIUS servers on the NAS, and make sure they do not depend on the same external database.&lt;/p&gt;&#xA;&lt;p&gt;Failed calls are recorded by cause in the &lt;code&gt;reason&lt;/code&gt; label of the metric &lt;code&gt;rradius_external_db_failures_total&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;reason&lt;/code&gt;&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;&lt;code&gt;unavailable&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Cannot connect, the pool cannot get a connection, timeout, or the database says it is busy right now (connection limit reached, deadlock and so on). Trying again later may work&lt;/td&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;mistake&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The SQL or the parameters are wrong, and the database rejects the statement. Trying again gives the same result&lt;/td&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;unknown&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Anything else&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Only &lt;code&gt;unavailable&lt;/code&gt; turns a login into no answer; &lt;code&gt;mistake&lt;/code&gt; is an error in the script or the configuration, and logins are rejected as usual, so you need to fix the SQL.&lt;/p&gt;&#xA;&lt;h2 id=&#34;monitor-health&#34;&gt;Monitor health&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;required_for_ready = true&lt;/code&gt; means &amp;ldquo;if this database is unreachable, this node should not receive traffic&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-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# rradius.toml (excerpt)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;databases&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;billing&lt;/span&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;# … (kind, host and so on as above)&lt;/span&gt;&#xA;&lt;/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_for_ready&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;Once it is set, every 5 seconds rradius runs &lt;code&gt;SELECT 1&lt;/code&gt; on a dedicated connection that is not in the pool: two failures in a row count as unreachable, and one success counts as recovered. While it is unreachable, &lt;code&gt;/readyz&lt;/code&gt; answers 503, so a load balancer or Kubernetes stops sending traffic; &lt;code&gt;/livez&lt;/code&gt; is not affected, so the program is not restarted because of it. Tested:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s -w &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39; %{http_code}\n&amp;#39;&lt;/span&gt; http://127.0.0.1:9812/readyz&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;database billing unreachable 503&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s -w &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39; %{http_code}\n&amp;#39;&lt;/span&gt; http://127.0.0.1:9812/livez&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ok 200&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Tested (PostgreSQL 17, the database was stopped and started again while running): about 10 seconds after it was stopped, &lt;code&gt;/readyz&lt;/code&gt; became 503, and the log says:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::external_db: databases.legacy: unreachable after 2 failed checks, the last: error communicating with database: Connection refused (os error 61); /readyz answers 503&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;About 5 seconds after the database started again, it recovered to 200, and the log says &lt;code&gt;databases.legacy: reachable&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Set &lt;code&gt;required_for_ready&lt;/code&gt; only for a database that every node needs in order to work. For a database used only for a secondary purpose such as an accounting copy, setting it makes the whole cluster stop receiving traffic because of it.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Every external database has these metrics in &lt;code&gt;/metrics&lt;/code&gt; (tested output):&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_external_db_failures_total{database=&amp;#34;billing&amp;#34;,reason=&amp;#34;unavailable&amp;#34;} 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_external_db_failures_total{database=&amp;#34;billing&amp;#34;,reason=&amp;#34;mistake&amp;#34;} 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_external_db_failures_total{database=&amp;#34;billing&amp;#34;,reason=&amp;#34;unknown&amp;#34;} 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_external_db_connections{database=&amp;#34;billing&amp;#34;,state=&amp;#34;in_use&amp;#34;} 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_external_db_connections{database=&amp;#34;billing&amp;#34;,state=&amp;#34;idle&amp;#34;} 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_external_db_connections_max{database=&amp;#34;billing&amp;#34;} 8&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_external_db_reachable{database=&amp;#34;billing&amp;#34;} 0&#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;Metric&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;&lt;code&gt;rradius_external_db_failures_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The number of failed calls, by &lt;code&gt;reason&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_external_db_connections&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The current connections of the pool: &lt;code&gt;in_use&lt;/code&gt; is in use or being opened, &lt;code&gt;idle&lt;/code&gt; is open and not in use&lt;/td&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_external_db_connections_max&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Equal to &lt;code&gt;pool_size&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_external_db_reachable&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1 if the health check can connect, otherwise 0; only present for a database with &lt;code&gt;required_for_ready = true&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;If &lt;code&gt;in_use&lt;/code&gt; stays equal to &lt;code&gt;max&lt;/code&gt;, there are not enough connections and requests are queuing for a connection: first check whether the queries on the database side are too slow, and then consider raising &lt;code&gt;pool_size&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;rradiusd status&lt;/code&gt; has an &lt;code&gt;External databases&lt;/code&gt; section:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd status&#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;External databases&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  billing connections in use      0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  billing connections idle        0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  billing connections max         8&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  billing failures (unavailable)  0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  billing failures (mistake)      0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  billing failures (unknown)      0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  billing reachable               no&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can set alerts like this: &lt;code&gt;rradius_external_db_reachable == 0&lt;/code&gt; for one minute, or &lt;code&gt;rate(rradius_external_db_failures_total{reason=&amp;quot;unavailable&amp;quot;}[5m]) &amp;gt; 0&lt;/code&gt;. The full list of metrics is in &lt;a class=&#34;link&#34; href=&#34;../92-metrics-reference/&#34; &gt;Appendix C&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;named-queries-turn-sql-into-metrics&#34;&gt;Named queries: turn SQL into metrics&#xA;&lt;/h2&gt;&lt;p&gt;A named query is read-only SQL that you write in the configuration. Every node runs it periodically, and the result becomes the Prometheus gauge &lt;code&gt;rradius_query_&amp;lt;name&amp;gt;&lt;/code&gt;. It suits questions such as &amp;ldquo;how many accounts are disabled now&amp;rdquo; or &amp;ldquo;how much is left in the address pool&amp;rdquo;, without writing a separate exporter.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Named queries only query the cluster database. They cannot query an external database.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Add this at the end of the quick-start &lt;code&gt;rradius.toml&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:#75715e&#34;&gt;# rradius.toml (add at the end)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;queries&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;users_by_state&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;sql&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT CASE enabled WHEN 1 THEN &amp;#39;enabled&amp;#39; ELSE &amp;#39;disabled&amp;#39; END AS state, count(*) AS n FROM users GROUP BY state&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;help&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Accounts in the users table, by state&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;labels&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;state&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;value&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;n&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;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;queries&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;open_sessions&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;sql&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT count(*) AS value FROM accounting WHERE stopped IS NULL&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;help&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Sessions without a Stop&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 keys (see Appendix A for the full description; any change to &lt;code&gt;[queries]&lt;/code&gt; needs a restart):&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Required. It must begin with &lt;code&gt;SELECT&lt;/code&gt; or &lt;code&gt;WITH&lt;/code&gt;, and cannot have parameters&lt;/td&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;value&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;value&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The column for the sample value; it must be an integer or a real number&lt;/td&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;labels&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The columns to use as labels; the label name is the column name; the value must be text or an integer&lt;/td&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;help&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A text that gives the query name&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The &lt;code&gt;# HELP&lt;/code&gt; of the metric&lt;/td&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;interval_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;30000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The interval between the starts of two runs, in milliseconds, at least 5000&lt;/td&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;timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;5000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The time limit of one run, in milliseconds, from 1 to &lt;code&gt;interval_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;&lt;code&gt;max_rows&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;200&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The maximum number of rows that become samples, from 1 to 10000&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;A query name begins with a lowercase letter and may only contain lowercase letters, digits and &lt;code&gt;_&lt;/code&gt;. Names that clash with a command or with another metric, such as &lt;code&gt;list&lt;/code&gt; and &lt;code&gt;failures_total&lt;/code&gt;, cannot be used.&lt;/p&gt;&#xA;&lt;p&gt;After a restart, &lt;code&gt;/metrics&lt;/code&gt; has these extra lines (tested):&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s http://127.0.0.1:9812/metrics | grep rradius_query_users_by_state&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# HELP rradius_query_users_by_state Accounts in the users table, by state&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# TYPE rradius_query_users_by_state gauge&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_query_users_by_state{state=&amp;#34;disabled&amp;#34;} 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_query_users_by_state{state=&amp;#34;enabled&amp;#34;} 2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The quick-start has three demo accounts and one of them is disabled, so the values are 1 and 2.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Every node runs the query on its own and reports on its own, and each result comes from the local copy of the database. When Prometheus scrapes every node, use &lt;code&gt;max&lt;/code&gt; or take only one node; do not add them up.&lt;/li&gt;&#xA;&lt;li&gt;It runs once right after startup, and then once every &lt;code&gt;interval_ms&lt;/code&gt;. If a run takes longer than the interval, the next one starts after it ends, so runs never overlap.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;/metrics&lt;/code&gt; gives the result of the last run, not the current value.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Another example: how many sessions each NAS has now. The number of result rows follows the number of NASes, so set &lt;code&gt;max_rows&lt;/code&gt; higher than the number of NASes:&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:#75715e&#34;&gt;# rradius.toml (add at the end)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;queries&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;sessions_by_nas&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;sql&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT nas, count(*) AS value FROM accounting WHERE stopped IS NULL GROUP BY nas&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;help&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Open sessions by NAS&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;labels&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;nas&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_rows&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;500&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Tested: send one accounting Start with &lt;code&gt;rradius-bench&lt;/code&gt; (the &lt;code&gt;NAS-IP-Address&lt;/code&gt; it carries is &lt;code&gt;192.0.2.1&lt;/code&gt;), and after the next run:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_query_sessions_by_nas{nas=&amp;#34;192.0.2.1&amp;#34;} 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Use a label only when its values are a limited set, for example the NAS, the address pool or the account state. Do not use an account name or a session ID as a label: every different value becomes a time series in Prometheus, and a large number of them will overwhelm Prometheus.&lt;/p&gt;&#xA;&lt;h3 id=&#34;query-with-the-command&#34;&gt;Query with the command&#xA;&lt;/h3&gt;&lt;p&gt;The &lt;code&gt;query&lt;/code&gt; command runs through the API port of the cluster, so the server must be running.&lt;/p&gt;&#xA;&lt;p&gt;List all named queries:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd query list&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;name=open_sessions&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;help=Sessions without a Stop&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;interval_ms=30000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sql=SELECT count(*) AS value FROM accounting WHERE stopped IS NULL&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;name=users_by_state&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;help=Accounts in the users table, by state&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;interval_ms=10000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sql=SELECT CASE enabled WHEN 1 THEN &amp;#39;enabled&amp;#39; ELSE &amp;#39;disabled&amp;#39; END AS state, count(*) AS n FROM users GROUP BY state&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Run one:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd query users_by_state&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;state     n&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;disabled  1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;enabled   2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The command runs the SQL again right now. It does not read the result in &lt;code&gt;/metrics&lt;/code&gt;, and &lt;code&gt;max_rows&lt;/code&gt; does not limit it. Tested: querying right after sending an accounting Start, &lt;code&gt;query open_sessions&lt;/code&gt; was already &lt;code&gt;1&lt;/code&gt;, while &lt;code&gt;rradius_query_open_sessions&lt;/code&gt; in &lt;code&gt;/metrics&lt;/code&gt; was still the &lt;code&gt;0&lt;/code&gt; of the previous run, and it only updates at the next run (30 seconds by default).&lt;/p&gt;&#xA;&lt;p&gt;Add &lt;code&gt;--json&lt;/code&gt; for programs to read:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd query open_sessions --json&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[{&amp;#34;value&amp;#34;:1}]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A name that is not in the configuration gives exit code 2:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd query nosuch&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;queries.nosuch is not set in rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;failed-queries-and-dropped-rows&#34;&gt;Failed queries and dropped rows&#xA;&lt;/h3&gt;&lt;p&gt;Every named query also has three shared metrics:&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;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;&lt;code&gt;rradius_query_failures_total{query,reason}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The number of failures. &lt;code&gt;timeout&lt;/code&gt; exceeded &lt;code&gt;timeout_ms&lt;/code&gt;; &lt;code&gt;error&lt;/code&gt; the database rejected the SQL; &lt;code&gt;shape&lt;/code&gt; the columns of the result are 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;rradius_query_dropped_rows_total{query,reason}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rows of a successful run that did not become samples. &lt;code&gt;null_value&lt;/code&gt; the value is NULL; &lt;code&gt;over_limit&lt;/code&gt; more than &lt;code&gt;max_rows&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_query_last_success_timestamp_seconds{query}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The Unix time of the last success; 0 if it has never succeeded&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;On failure, the gauge keeps the result of the last success and is not cleared. So to know whether the numbers are fresh, look at whether &lt;code&gt;last_success_timestamp_seconds&lt;/code&gt; is moving forward.&lt;/li&gt;&#xA;&lt;li&gt;A failure logs one WARN line, at most one line a minute for the same reason, for example &lt;code&gt;query broken: the run failed (shape): the result has no column &amp;quot;n&amp;quot;&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The causes of &lt;code&gt;shape&lt;/code&gt; include: there is no column named in &lt;code&gt;value&lt;/code&gt; or &lt;code&gt;labels&lt;/code&gt;, the value is not a number, a label is NULL, or two rows have exactly the same labels.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Example: forgetting &lt;code&gt;value&lt;/code&gt;. The value column of the query below is called &lt;code&gt;n&lt;/code&gt;, but &lt;code&gt;value = &amp;quot;n&amp;quot;&lt;/code&gt; is not set:&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:#75715e&#34;&gt;# rradius.toml (add at the end; written wrongly on purpose)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;queries&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;users_count&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;sql&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT count(*) AS n FROM users&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;help&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Accounts in the users table&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;check&lt;/code&gt; cannot see this, because the columns of the result are only known when the query runs. Right after startup the log has:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::named_queries: query users_count: the run failed (shape): the result has no column &amp;#34;value&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;/metrics&lt;/code&gt; has only &lt;code&gt;# HELP&lt;/code&gt; and &lt;code&gt;# TYPE&lt;/code&gt; and no samples; the shared metrics show the failure:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_query_failures_total{query=&amp;#34;users_count&amp;#34;,reason=&amp;#34;shape&amp;#34;} 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_query_last_success_timestamp_seconds{query=&amp;#34;users_count&amp;#34;} 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;status&lt;/code&gt; says &lt;code&gt;users_count last success (seconds ago)     never&lt;/code&gt;. But &lt;code&gt;rradiusd query users_count&lt;/code&gt; still prints &lt;code&gt;n&lt;/code&gt; and &lt;code&gt;3&lt;/code&gt;, because the command only runs the SQL and does not check the columns. So when the command finds data but the metric does not, look at the log for &lt;code&gt;shape&lt;/code&gt; first. To fix it, add &lt;code&gt;value = &amp;quot;n&amp;quot;&lt;/code&gt;, or change the SQL to &lt;code&gt;count(*) AS value&lt;/code&gt;, and then restart.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;Queries&lt;/code&gt; section of &lt;code&gt;rradiusd status&lt;/code&gt; (tested):&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd status&#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;Queries&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  open_sessions last success (seconds ago)   1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  open_sessions rows                         1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  open_sessions failed runs                  0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  users_by_state last success (seconds ago)  1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  users_by_state rows                        2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  users_by_state failed runs                 0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can set an alert like this: &lt;code&gt;time() - rradius_query_last_success_timestamp_seconds &amp;gt; 3 * &amp;lt;interval in seconds&amp;gt;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;after-changing-the-configuration&#34;&gt;After changing the configuration&#xA;&lt;/h2&gt;&lt;p&gt;Any change to &lt;code&gt;[databases]&lt;/code&gt; and &lt;code&gt;[queries]&lt;/code&gt; needs a restart. When you send &lt;code&gt;SIGHUP&lt;/code&gt; to reload, the other settings take effect as usual, and the log lists the parts that were not applied:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::reload: configuration reloaded from rradius.toml; these need a restart to apply: [databases]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A change to &lt;code&gt;[queries]&lt;/code&gt; gives &lt;code&gt;these need a restart to apply: [queries]&lt;/code&gt;. Check with &lt;code&gt;rradiusd check&lt;/code&gt; first; most errors in &lt;code&gt;[databases]&lt;/code&gt; and &lt;code&gt;[queries]&lt;/code&gt; show up there.&lt;/p&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; says &lt;code&gt;databases.billing.kind must be &amp;quot;mysql&amp;quot; or &amp;quot;postgresql&amp;quot;, not &amp;quot;oracle&amp;quot;&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; Only PostgreSQL and MySQL are supported.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change it to &lt;code&gt;postgresql&lt;/code&gt; or &lt;code&gt;mysql&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; says &lt;code&gt;`url`: unknown field `url`&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; An external database does not accept a connection string.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Split it into &lt;code&gt;host&lt;/code&gt;, &lt;code&gt;port&lt;/code&gt;, &lt;code&gt;database&lt;/code&gt;, &lt;code&gt;user&lt;/code&gt; and &lt;code&gt;password_file&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; says &lt;code&gt;databases.bill-ing: a database name may only have ASCII letters, digits and _&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The name has a &lt;code&gt;-&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change it to &lt;code&gt;bill_ing&lt;/code&gt;, and change the name in the sql handler and in scripts too.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; says &lt;code&gt;databases.billing.password: at most one of password and password_file may be set&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; Both are set.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Keep &lt;code&gt;password_file&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; says &lt;code&gt;databases.billing.tls must be &amp;quot;verify&amp;quot; or &amp;quot;off&amp;quot;, not &amp;quot;require&amp;quot;&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;tls&lt;/code&gt; has only two values.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; To encrypt, use &lt;code&gt;verify&lt;/code&gt; (the default), and point &lt;code&gt;ca_file&lt;/code&gt; to the CA of the database.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; says &lt;code&gt;databases.billing.ca_file: cannot read &#39;db-ca.pem&#39;: I/O error: No such file or directory (os error 2)&lt;/code&gt; or &lt;code&gt;databases.billing.ca_file: no certificate in &#39;db-ca.pem&#39;&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The path of &lt;code&gt;ca_file&lt;/code&gt; is wrong, or the file is not a PEM certificate. A relative path is relative to the directory of the configuration file.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Check the path; first convert a DER certificate to PEM with &lt;code&gt;openssl x509 -inform der -in ca.der -out db-ca.pem&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; says &lt;code&gt;databases.billing.ca_file is only used with tls = &amp;quot;verify&amp;quot;&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;tls = &amp;quot;off&amp;quot;&lt;/code&gt; does not verify certificates, so &lt;code&gt;ca_file&lt;/code&gt; is of no use.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Choose one: remove &lt;code&gt;ca_file&lt;/code&gt;, or remove &lt;code&gt;tls = &amp;quot;off&amp;quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; Logins get no answer, and the log has &lt;code&gt;pool timed out while waiting for an open connection&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The external database is unreachable, or all the connections of the pool are in use and the wait exceeded the time limit.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Look at &lt;code&gt;rradius_external_db_connections&lt;/code&gt;: if &lt;code&gt;idle&lt;/code&gt; and &lt;code&gt;in_use&lt;/code&gt; are both 0, it cannot connect at all, so check the network, the account and TLS; if &lt;code&gt;in_use&lt;/code&gt; stays equal to &lt;code&gt;max&lt;/code&gt;, there are not enough connections or the queries are too slow.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The log has &lt;code&gt;invalid peer certificate: UnknownIssuer&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The database certificate was not issued by a CA the system trusts, for example a self-made CA.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Use &lt;code&gt;ca_file&lt;/code&gt; to point to the certificate (PEM) of that CA.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The log has &lt;code&gt;invalid peer certificate: certificate not valid for name &amp;quot;127.0.0.1&amp;quot;&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The name written in &lt;code&gt;host&lt;/code&gt; is not on the database certificate, for example the certificate has only &lt;code&gt;localhost&lt;/code&gt; while &lt;code&gt;host&lt;/code&gt; is an address.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change &lt;code&gt;host&lt;/code&gt; to a name on the certificate, or issue a new certificate that includes this name.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; MySQL cannot connect, and the log has &lt;code&gt;RSA auth backend disabled&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;tls = &amp;quot;off&amp;quot;&lt;/code&gt;, and the database account uses the MySQL 8 default &lt;code&gt;caching_sha2_password&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Use &lt;code&gt;tls = &amp;quot;verify&amp;quot;&lt;/code&gt;; when you cannot use TLS, change the account to &lt;code&gt;mysql_native_password&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; A script gives &lt;code&gt;db_query: there is no database &#39;billing&#39; in [databases]&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The name is misspelled, or the section does not exist; this error only appears when the script runs, and &lt;code&gt;check&lt;/code&gt; cannot catch it.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Compare it with the name of &lt;code&gt;[databases.&amp;lt;name&amp;gt;]&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; A script gives &lt;code&gt;column x has a type that cannot be read; CAST it to text in the SQL&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The script has no value for the type of the column; dates and times are the common case.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Convert it to text in the SQL, for example &lt;code&gt;CAST(created AS TEXT) AS created&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; says &lt;code&gt;queries.ok.sql: must begin with SELECT or WITH: it only reads&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; Named queries can only read.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change it to a query that begins with &lt;code&gt;SELECT&lt;/code&gt; or &lt;code&gt;WITH&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; says &lt;code&gt;queries.ok.interval_ms must be at least 5000, not 1000&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The interval is too short.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; At least 5000. &lt;code&gt;timeout_ms&lt;/code&gt; also cannot be larger than &lt;code&gt;interval_ms&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; says &lt;code&gt;queries.ok.labels: &amp;quot;value&amp;quot; is also the value column&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The same column cannot be both the value and a label.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Remove it from &lt;code&gt;labels&lt;/code&gt;, or set &lt;code&gt;value&lt;/code&gt; to another column.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The log has &lt;code&gt;query broken: the run failed (shape): the result has no column &amp;quot;n&amp;quot;&lt;/code&gt;, and the metric never changes.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The column named in &lt;code&gt;value&lt;/code&gt; is not in the query result. When &lt;code&gt;value&lt;/code&gt; is not set, the result must have a column called &lt;code&gt;value&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Give the column the same name with &lt;code&gt;AS&lt;/code&gt; in the SQL, for example &lt;code&gt;count(*) AS n&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;rradius_query_dropped_rows_total{reason=&amp;quot;over_limit&amp;quot;}&lt;/code&gt; keeps increasing.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The result has more rows than &lt;code&gt;max_rows&lt;/code&gt;, and the extra rows are dropped.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Aggregate in the SQL first or add &lt;code&gt;LIMIT&lt;/code&gt;; when you really need it, raise &lt;code&gt;max_rows&lt;/code&gt; (up to 10000).&lt;/p&gt;&#xA;&lt;h2 id=&#34;accounts-in-another-system-http-api&#34;&gt;Accounts in another system: HTTP API&#xA;&lt;/h2&gt;&lt;p&gt;When the accounts are in a membership system (the booking or billing system of a hotel or a coworking space) that you can only ask through an HTTP API, use &lt;code&gt;http_request&lt;/code&gt; in a &lt;code&gt;lua&lt;/code&gt; handler. For the full configuration and script, see &lt;a class=&#34;link&#34; href=&#34;../15-access-recipes/#accounts-in-an-external-system-external-api&#34; &gt;the external-api section of Chapter 15&lt;/a&gt; and &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;Chapter 10&lt;/a&gt;. This section adds the points those two chapters do not cover.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;When the API only speaks JSON.&lt;/strong&gt; Scripts have no function to encode or decode JSON (&lt;code&gt;rradius-core/src/lua_engine.rs&lt;/code&gt; does not provide one), so the example lets the API answer with a status code and response headers, and the request is form-encoded. If your API only speaks JSON:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If you build the request string yourself, you must escape quotes and backslashes in the values yourself, which is easy to get wrong and is not recommended; it is better to ask the API side to add an endpoint that accepts form encoding.&lt;/li&gt;&#xA;&lt;li&gt;To get a value out of a JSON response, you can only use Lua string matching (&lt;code&gt;response.body:match(…)&lt;/code&gt;). That is fine for a fixed, simple format, but unreliable for a complex structure.&lt;/li&gt;&#xA;&lt;li&gt;The most dependable way is to put a very thin adapter service in front of the membership system, or to open a dedicated endpoint for RADIUS that answers with only a status code and headers.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Source address and DNS.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Every node calls the API on its own.&lt;/strong&gt; Every node of the cluster sends requests from its own address, so the firewall and the rate limit on the API side must accept the address of every node.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;allowed_hosts&lt;/code&gt; compares host names; it does not check the resolved address.&lt;/strong&gt; If DNS is tampered with, a request may be sent somewhere else; HTTPS certificate verification is the protection in that case, so do not use &lt;code&gt;http://&lt;/code&gt; (only on the local machine or an isolated network). &lt;code&gt;script_http.rs&lt;/code&gt; does not check the address of the resolved result, and only limits the number of lookups in progress at the same time.&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, and the HTTP client in the code is set not to redirect (&lt;code&gt;redirect::Policy::none()&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Limit the source and the rate on the API side.&lt;/strong&gt; rradius forwards to the API the account name and password that anyone types on a login page, so traffic that guesses passwords reaches it too.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Whether accounting should notify the API.&lt;/strong&gt; The accounting in the example only writes to a local table. To notify the membership system when a user goes online or offline, you can also call &lt;code&gt;http_request&lt;/code&gt; in the accounting script, but:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The accounting script must return &lt;code&gt;accept&lt;/code&gt; before the NAS gets a reply. When the API does not answer or the script fails, the NAS retransmits and the script runs again, so the API must tolerate receiving the same notification twice (be idempotent).&lt;/li&gt;&#xA;&lt;li&gt;Do not let a failure of the API block accounting. A steadier approach is to write accounting to the table as usual and return &lt;code&gt;accept&lt;/code&gt;, and let another program send the data from the table to the membership system.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Cache passes.&lt;/strong&gt; If every login asks the API once, the speed of the API is the speed of logins. To reduce the load, the script can record a &amp;ldquo;pass&amp;rdquo; in an rradius table for a few minutes (&lt;code&gt;sql_execute&lt;/code&gt;) and look in the table first afterwards. This is a design idea; neither the examples nor this book implement or test it; do not record a plaintext password in it.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Common problems.&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;What you see&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause and 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;The log has &lt;code&gt;attempt to call a nil value&lt;/code&gt;, 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 has no &lt;code&gt;[lua.http]&lt;/code&gt;, so there is no &lt;code&gt;http_request&lt;/code&gt; in 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;Every login is rejected, and the log has &lt;code&gt;… is not in lua.http.allowed_hosts&lt;/code&gt;&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; (when only a host name is written, only HTTPS 443 is allowed)&lt;/td&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 in the log is a timeout&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;code&gt;timeout_ms&lt;/code&gt; must be shorter than the NAS retransmit 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;The reason has to do with a certificate&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The API certificate is issued by an internal CA; set &lt;code&gt;lua.http.ca_file&lt;/code&gt;; server certificates are always verified, and there is no option to turn it off&lt;/td&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 to the same host are waiting at the same time: 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;With PEAP or MS-CHAPv2 on Wi-Fi, what arrives is not the plaintext password, so the API has nothing to compare; only EAP-TTLS inner PAP works, and the handler must set &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 is no trusted root certificate&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;At startup it prints &lt;code&gt;lua.http: no trusted certificates; this system has none, so set lua.http.ca_file&lt;/code&gt;: this 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;&lt;p&gt;&lt;strong&gt;Not tested:&lt;/strong&gt; any real membership or billing system, and HTTPS certificate verification (the scenario test uses a local fake API without TLS).&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;10 Writing policies in Lua&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../92-metrics-reference/&#34; &gt;Appendix C: Metrics reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../93-lua-reference/&#34; &gt;Appendix D: Lua API reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>10 Writing policies in Lua</title>
            <link>https://embark.systems/en/rradius/oss/10-lua-policies/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/10-lua-policies/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Tell when a script runs and what its return value means&lt;/li&gt;&#xA;&lt;li&gt;Read the attributes of a request and add attributes to the reply&lt;/li&gt;&#xA;&lt;li&gt;Read and write the cluster database with &lt;code&gt;sql_query&lt;/code&gt; and &lt;code&gt;sql_execute&lt;/code&gt;, with writes that come out the same on every node&lt;/li&gt;&#xA;&lt;li&gt;Write an accounting script that is safe to run again on a retransmission&lt;/li&gt;&#xA;&lt;li&gt;Call an allow-listed HTTP API from a script, and stay within the limits on execution time, memory and database wait&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: you have run the quick-start in &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;chapter 03&lt;/a&gt;, and you have read &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;chapter 07&lt;/a&gt; so you know auth chains and handlers. This chapter covers usage only. The full parameters, return values and error messages of every function are in &lt;a class=&#34;link&#34; href=&#34;../93-lua-reference/&#34; &gt;Appendix D&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#where-scripts-run&#34; &gt;Where scripts run&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#prepare-a-practice-environment&#34; &gt;Prepare a practice environment&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#your-first-script&#34; &gt;Your first script&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#return-values&#34; &gt;Return values&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#read-the-attributes-of-a-request&#34; &gt;Read the attributes of a request&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#add-reply-attributes&#34; &gt;Add reply attributes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#read-and-write-the-cluster-database&#34; &gt;Read and write the cluster database&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#create-tables-with-migrations&#34; &gt;Create tables with migrations&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#use-a-script-as-a-lua-handler-in-the-auth-chain&#34; &gt;Use a script as a lua handler in the auth chain&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#two-step-login-reply-with-access-challenge&#34; &gt;Two-step login: reply with Access-Challenge&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#write-an-accounting-script&#34; &gt;Write an accounting script&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#call-an-http-api&#34; &gt;Call an HTTP API&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#other-helper-functions&#34; &gt;Other helper functions&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#variables-for-eap-and-certificates&#34; &gt;Variables for EAP and certificates&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#limits-on-execution-time-memory-and-database-wait&#34; &gt;Limits on execution time, memory and database wait&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#after-you-change-a-script&#34; &gt;After you change a script&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;where-scripts-run&#34;&gt;Where scripts run&#xA;&lt;/h2&gt;&lt;p&gt;rradius has two kinds of script:&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;Kind&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Setting&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;When it runs&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;Top-level script&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;script&lt;/code&gt; in &lt;code&gt;[lua]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Every accounting request (RADIUS and TACACS+); logins when there is no auth chain; TACACS+ authorization (when the client has no &lt;code&gt;authorize_group&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; handler&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;type = &amp;quot;lua&amp;quot;&lt;/code&gt; in &lt;code&gt;[[auth.handlers]]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;When the auth chain reaches it, for logins only&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;So as soon as the configuration has &lt;code&gt;[auth]&lt;/code&gt;, logins go to the auth chain, and the top-level script only sees accounting and TACACS+ authorization. The quick-start works this way: &lt;code&gt;accounting.lua&lt;/code&gt; starts with &amp;ldquo;reject if this is not accounting&amp;rdquo;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The auth chain is chosen per client. When &lt;code&gt;[auth]&lt;/code&gt; has no default chain (no &lt;code&gt;[[auth.handlers]]&lt;/code&gt;) and the client does not pick a named chain with &lt;code&gt;auth&lt;/code&gt;, logins from that client also go to the top-level script.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Each time a script runs for a request, it sees a global environment created new for that request:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Global variables the script sets are not visible to the next request. To remember something, write it to the database.&lt;/li&gt;&#xA;&lt;li&gt;The built-in Lua libraries such as &lt;code&gt;string&lt;/code&gt;, &lt;code&gt;table&lt;/code&gt; and &lt;code&gt;math&lt;/code&gt; are available, but read-only. Changing them is an error.&lt;/li&gt;&#xA;&lt;li&gt;There is no &lt;code&gt;io&lt;/code&gt;, &lt;code&gt;require&lt;/code&gt; or &lt;code&gt;loadstring&lt;/code&gt;, and &lt;code&gt;os&lt;/code&gt; keeps only the time-related functions. A script cannot read or write files or run programs.&lt;/li&gt;&#xA;&lt;li&gt;The variables and functions rradius adds, such as &lt;code&gt;get_attr&lt;/code&gt;, &lt;code&gt;sql_query&lt;/code&gt; and &lt;code&gt;phase&lt;/code&gt;, are listed in full in Appendix D.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Scripts use Luau (an extension of Lua 5.1). The server compiles them once at startup and runs them directly for each request.&lt;/p&gt;&#xA;&lt;h2 id=&#34;prepare-a-practice-environment&#34;&gt;Prepare a practice environment&#xA;&lt;/h2&gt;&lt;p&gt;This chapter uses a configuration changed from the quick-start so that logins go to the top-level script. That makes it easier to see what the script does.&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cp -R ~/rradius-lab/quick-start ~/rradius-lab/lua&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cd ~/rradius-lab/lua&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rm -rf data&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Open &lt;code&gt;rradius.toml&lt;/code&gt; in an editor and do two things:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Delete the &lt;code&gt;[auth]&lt;/code&gt; section and the &lt;code&gt;[[auth.handlers]]&lt;/code&gt; under it, from the &lt;code&gt;[auth]&lt;/code&gt; line up to the line before &lt;code&gt;[radius]&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Change &lt;code&gt;[lua]&lt;/code&gt; to point to the new script:&lt;/li&gt;&#xA;&lt;/ol&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:#75715e&#34;&gt;# rradius.toml (only the changed part)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;lua&lt;/span&gt;]&#xA;&lt;/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;policy.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:#75715e&#34;&gt;# ... (other settings omitted)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The default value of each &lt;code&gt;[lua]&lt;/code&gt; key and whether it can be reloaded are in &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Reload&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;&lt;code&gt;lua.script&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;required&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;The top-level script, relative to 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;lua.max_execution_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1000&lt;/code&gt;&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;How long a script may run in one request (milliseconds)&lt;/td&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.query_timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;5000&lt;/code&gt;&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;The total time a script may wait for the database in one request (milliseconds)&lt;/td&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.max_memory_mb&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;256&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;needs restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Memory limit of each Lua VM (MiB)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;your-first-script&#34;&gt;Your first script&#xA;&lt;/h2&gt;&lt;p&gt;Goal: do with a script what the sql handler does. Look up the &lt;code&gt;users&lt;/code&gt; table, compare the password, and on accept add two reply attributes.&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;-- policy.lua&lt;/span&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: the practice environment does not record it. Answer at once so the NAS does not keep retransmitting.&lt;/span&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; phase &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;accounting&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;  &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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;-- This script only handles RADIUS logins.&lt;/span&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; protocol &lt;span style=&#34;color:#f92672&#34;&gt;~=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;radius&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;  &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;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;local&lt;/span&gt; user &lt;span style=&#34;color:#f92672&#34;&gt;=&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;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; user &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:#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;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;#39;SELECT password FROM users WHERE username = ? AND enabled = 1&amp;#39;&lt;/span&gt;, {user})&#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; account &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; rows[&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;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;not&lt;/span&gt; account &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;not&lt;/span&gt; password_verify(account.password, get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Password&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;  log(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;refused&amp;#39;&lt;/span&gt;, user)&#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;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;set_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Filter-Id&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;staff&amp;#39;&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;Session-Timeout&amp;#39;&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:#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Save it as &lt;code&gt;policy.lua&lt;/code&gt;, check the configuration, then start the server (same as chapter 03):&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd serve --config 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; compiles the script, so you see syntax errors here. Log in from another terminal:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user bob --password bob-password --load pap,concurrency=1 --requests 1&#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;  pap: 24/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user bob --password wrong --load pap,concurrency=1 --requests 1&#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;  pap: 25/s, sent 1, accept 0, reject 1, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The server log:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;bob&amp;#34; account=&amp;#34;bob&amp;#34; chain=&amp;#34;script&amp;#34; handler=&amp;#34;script&amp;#34; decision=&amp;#34;accept&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::lua_engine: script policy.lua (radius/authentication, client localhost): refused bob&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;bob&amp;#34; account=&amp;#34;bob&amp;#34; chain=&amp;#34;script&amp;#34; handler=&amp;#34;script&amp;#34; decision=&amp;#34;reject&amp;#34;&#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;chain=&amp;quot;script&amp;quot; handler=&amp;quot;script&amp;quot;&lt;/code&gt;: the top-level script made this decision, not an auth chain.&lt;/li&gt;&#xA;&lt;li&gt;A line written by &lt;code&gt;log()&lt;/code&gt; starts with the script, the protocol and phase, and the client, so you can tell which request wrote it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;bob&lt;/code&gt;&amp;rsquo;s password is stored as bcrypt. &lt;code&gt;password_verify&lt;/code&gt; compares the same way the sql handler does, so both storage formats are recognized.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;What this walk-through used:&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;Name&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Kind&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Use here&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;phase&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;variable&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;quot;authentication&amp;quot;&lt;/code&gt;, &lt;code&gt;&amp;quot;authorization&amp;quot;&lt;/code&gt; or &lt;code&gt;&amp;quot;accounting&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;protocol&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;variable&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;quot;radius&amp;quot;&lt;/code&gt; or &lt;code&gt;&amp;quot;tacacs&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;client&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;variable&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The name of the matched client; its &lt;code&gt;address&lt;/code&gt; when it has no &lt;code&gt;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;get_attr(name)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;function&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Read one attribute of the request&lt;/td&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(sql, params)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;function&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Query the cluster 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;password_verify(stored, given)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;function&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Compare a stored password&lt;/td&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;set_attr(name, value)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;function&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Add one attribute to the 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;&lt;code&gt;log(...)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;function&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Write one log line&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;return-values&#34;&gt;Return values&#xA;&lt;/h2&gt;&lt;p&gt;The string the script finally returns decides the result:&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;Return&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Top-level script&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;code&gt;lua&lt;/code&gt; handler&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;&#39;accept&#39;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accept: Access-Accept, TACACS+ PASS, Accounting-Response&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accept (with &lt;code&gt;first_match&lt;/code&gt; this ends the 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;&lt;code&gt;&#39;reject&#39;&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;Reject, and the whole chain ends here&lt;/td&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;&#39;ignore&#39;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Treated as reject&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No opinion, pass to the next 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;&#39;challenge&#39;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Valid only for RADIUS logins: Access-Challenge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;Any other value, nothing returned, an error&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;Reject&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;Only the exact lower-case string counts. In a test, returning &lt;code&gt;&#39;ACCEPT&#39;&lt;/code&gt; was a reject.&lt;/li&gt;&#xA;&lt;li&gt;For an accounting request, &amp;ldquo;reject&amp;rdquo; means no reply: the NAS gets no Accounting-Response and retransmits. The log says &lt;code&gt;Lua script did not accept accounting (radius, client localhost)&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;When a script fails, the log gets one ERROR line, for example &lt;code&gt;Lua script error (radius/authentication): runtime error: policy.lua:12: …&lt;/code&gt;. After the colon come the script file name and line number.&lt;/li&gt;&#xA;&lt;li&gt;There is one exception: when a failure comes from a database that cannot be reached or that times out, a login does not get a reject. It gets no reply. See &lt;a class=&#34;link&#34; href=&#34;#when-the-database-is-unreachable&#34; &gt;When the database is unreachable&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;read-the-attributes-of-a-request&#34;&gt;Read the attributes of a request&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;get_attr(name)&lt;/code&gt; returns the first attribute of the request with that name, or &lt;code&gt;nil&lt;/code&gt; if there is none. The name is the name in the dictionary (chapter 06), and the case must match.&lt;/p&gt;&#xA;&lt;p&gt;The type of the value depends on the type in the dictionary:&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;Dictionary type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What Lua gets&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Example&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;string&lt;/code&gt;, &lt;code&gt;octets&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A string (raw bytes)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;get_attr(&#39;User-Name&#39;)&lt;/code&gt; → &lt;code&gt;&amp;quot;alice&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;integer&lt;/code&gt;, &lt;code&gt;date&lt;/code&gt;, &lt;code&gt;byte&lt;/code&gt;, &lt;code&gt;short&lt;/code&gt;, &lt;code&gt;signed&lt;/code&gt;, &lt;code&gt;integer64&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A number&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;get_attr(&#39;NAS-Port&#39;)&lt;/code&gt; → &lt;code&gt;7&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;Addresses such as &lt;code&gt;ipaddr&lt;/code&gt;, &lt;code&gt;ipv6addr&lt;/code&gt;, &lt;code&gt;ipv6prefix&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A string in text form&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;get_attr(&#39;NAS-IP-Address&#39;)&lt;/code&gt; → &lt;code&gt;&amp;quot;192.0.2.1&amp;quot;&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;For an enumerated value you get the number, not the name in the dictionary. For example Start of &lt;code&gt;Acct-Status-Type&lt;/code&gt; is &lt;code&gt;1&lt;/code&gt;, so write &lt;code&gt;get_attr(&#39;Acct-Status-Type&#39;) == 1&lt;/code&gt;, not &lt;code&gt;== &#39;Start&#39;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;User-Password&lt;/code&gt; is the decrypted plain text, and exists only for PAP. A CHAP or MS-CHAP request has no plain-text password, so a script cannot compare it. Leave those to the sql or ldap handler of an auth chain.&lt;/p&gt;&#xA;&lt;p&gt;An attribute can appear several times, for example &lt;code&gt;Class&lt;/code&gt;. &lt;code&gt;get_attrs(name)&lt;/code&gt; returns all the values, in packet 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-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;-- policy.lua (excerpt)&lt;/span&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; classes &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; get_attrs(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Class&amp;#39;&lt;/span&gt;)   &lt;span style=&#34;color:#75715e&#34;&gt;-- an empty table {} when there are none&lt;/span&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; i, value &lt;span style=&#34;color:#66d9ef&#34;&gt;in&lt;/span&gt; ipairs(classes) &lt;span style=&#34;color:#66d9ef&#34;&gt;do&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;Class&amp;#39;&lt;/span&gt;, i, value)&#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;p&gt;Tested: when the request carries two &lt;code&gt;Class&lt;/code&gt; attributes (&lt;code&gt;a&lt;/code&gt;, &lt;code&gt;b&lt;/code&gt;), &lt;code&gt;get_attrs(&#39;Class&#39;)&lt;/code&gt; is &lt;code&gt;{&amp;quot;a&amp;quot;, &amp;quot;b&amp;quot;}&lt;/code&gt; and &lt;code&gt;get_attr(&#39;Class&#39;)&lt;/code&gt; is &lt;code&gt;&amp;quot;a&amp;quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A TACACS+ request has no dictionary. Attribute names are the packet field names and AV pair names, for example &lt;code&gt;user&lt;/code&gt;, &lt;code&gt;rem_addr&lt;/code&gt;, &lt;code&gt;service&lt;/code&gt;, &lt;code&gt;cmd&lt;/code&gt;. The list is in Appendix D, and the usage is in &lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;chapter 12&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; Attribute values come from the NAS or the user. Do not put them straight into SQL or a URL. Always use parameters in SQL (next section), and &lt;code&gt;url_encode&lt;/code&gt; in URLs.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;add-reply-attributes&#34;&gt;Add reply attributes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;set_attr(name, value)&lt;/code&gt; adds one attribute to the reply, in the order of the calls. Calling it twice with the same name gives two attributes. The value can be a string or a number:&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;-- policy.lua (excerpt)&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;Filter-Id&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;staff&amp;#39;&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;Service-Type&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Framed-User&amp;#39;&lt;/span&gt;)   &lt;span style=&#34;color:#75715e&#34;&gt;-- an enumeration can be written with its dictionary name&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;Session-Timeout&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;3600&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The reply from a test (recorded with &lt;code&gt;[log.trace]&lt;/code&gt;, chapter 17): &lt;code&gt;Filter-Id = staff, Service-Type = 2, Session-Timeout = 3600&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The name and value are checked at the moment of the call. A name that is not in the dictionary, a value that is not in the enumeration, or a value of the wrong type makes &lt;code&gt;set_attr&lt;/code&gt; fail, and the request is rejected. For example &lt;code&gt;set_attr(&#39;Service-Type&#39;, &#39;Nonsense&#39;)&lt;/code&gt; gives &lt;code&gt;&#39;Nonsense&#39; is not a value of &#39;Service-Type&#39;&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Write a tagged attribute as &lt;code&gt;name:tag&lt;/code&gt;, for example &lt;code&gt;Tunnel-Type:1&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Only &amp;ldquo;accept&amp;rdquo; and &amp;ldquo;challenge&amp;rdquo; send these attributes. A reject does not.&lt;/li&gt;&#xA;&lt;li&gt;The Accounting-Response of an accounting request never carries attributes. Anything the script sets is not sent.&lt;/li&gt;&#xA;&lt;li&gt;In TACACS+ authorization, &lt;code&gt;set_attr&lt;/code&gt; adds AV pairs to the reply, for example &lt;code&gt;set_attr(&#39;priv-lvl&#39;, 15)&lt;/code&gt;. The name &lt;code&gt;server_msg&lt;/code&gt; is a special case: it becomes the message shown to the user, not an AV pair.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;read-and-write-the-cluster-database&#34;&gt;Read and write the cluster database&#xA;&lt;/h2&gt;&lt;p&gt;Scripts use the cluster database (the built-in hiqlite: one copy of SQLite on each node, replicated with Raft) through two functions:&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;Function&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What it does&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Returns&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_query(sql, params)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reads the local copy of the database&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An array with one table per row, with column names as 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;sql_execute(sql, params)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Writes: sent to the cluster leader, and returns after it is replicated to every node&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The number of rows affected&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;use-parameters-do-not-build-strings&#34;&gt;Use parameters, do not build strings&#xA;&lt;/h3&gt;&lt;p&gt;Write &lt;code&gt;?&lt;/code&gt; for every value in the SQL, and put the values in an array as the second argument, matched in 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-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;-- policy.lua (excerpt)&lt;/span&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; rows &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; sql_query(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;SELECT password FROM users WHERE username = ? AND enabled = 1&amp;#39;&lt;/span&gt;, {user})&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;A parameter is never treated as SQL. In a test, querying &lt;code&gt;x&#39; OR &#39;1&#39;=&#39;1&lt;/code&gt; returned an empty array.&lt;/li&gt;&#xA;&lt;li&gt;The number of &lt;code&gt;?&lt;/code&gt; must equal the number of values. When it does not, the call fails before it is sent: &lt;code&gt;sql_query: 1 placeholder, 0 values&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Only &lt;code&gt;?&lt;/code&gt; is allowed. Forms such as &lt;code&gt;?1&lt;/code&gt; and &lt;code&gt;:name&lt;/code&gt; fail: &lt;code&gt;only plain ? placeholders are supported, found ?1&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;A value can be a string, a number or a boolean (&lt;code&gt;true&lt;/code&gt; is stored as 1). &lt;code&gt;nil&lt;/code&gt; is not allowed: a &lt;code&gt;nil&lt;/code&gt; in the middle of the array gives &lt;code&gt;parameters must be an array without holes&lt;/code&gt;. To store NULL, write &lt;code&gt;NULL&lt;/code&gt; in the SQL itself.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The query result:&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;#39;SELECT username, enabled FROM users WHERE username = ?&amp;#39;&lt;/span&gt;, {&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;alice&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;-- #rows is 1; rows[1].username is &amp;#34;alice&amp;#34;; rows[1].enabled is 1&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;When nothing is found you get an empty array, and &lt;code&gt;rows[1]&lt;/code&gt; is &lt;code&gt;nil&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;INTEGER and REAL become numbers, TEXT becomes a string, and NULL becomes &lt;code&gt;nil&lt;/code&gt; (so that key does not exist).&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;sql_query&lt;/code&gt; is read-only. Writing with it fails: &lt;code&gt;attempt to write a readonly database&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;writes-every-node-must-compute-the-same-result&#34;&gt;Writes: every node must compute the same result&#xA;&lt;/h3&gt;&lt;p&gt;The SQL of &lt;code&gt;sql_execute&lt;/code&gt; runs unchanged once on every node. So a write must not contain anything that each node would compute differently, such as the current time or a random number. rradius stops these before sending:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Functions: &lt;code&gt;date&lt;/code&gt;, &lt;code&gt;datetime&lt;/code&gt;, &lt;code&gt;julianday&lt;/code&gt;, &lt;code&gt;now&lt;/code&gt;, &lt;code&gt;random&lt;/code&gt;, &lt;code&gt;randomblob&lt;/code&gt;, &lt;code&gt;strftime&lt;/code&gt;, &lt;code&gt;time&lt;/code&gt;, &lt;code&gt;timediff&lt;/code&gt;, &lt;code&gt;unixepoch&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Keywords: &lt;code&gt;CURRENT_TIMESTAMP&lt;/code&gt;, &lt;code&gt;CURRENT_DATE&lt;/code&gt;, &lt;code&gt;CURRENT_TIME&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Compute the time in Lua and pass it in as a parameter:&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;-- policy.lua (excerpt)&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;&amp;#39;INSERT INTO last_login (username, at, client) VALUES (?, ?, ?) &amp;#39;&lt;/span&gt; &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;  &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;ON CONFLICT (username) DO UPDATE SET at = excluded.at, client = excluded.client&amp;#39;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  {user, math.floor(now_unix()), client})&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When written as &lt;code&gt;strftime(&#39;%s&#39;, &#39;now&#39;)&lt;/code&gt;, a test gave &lt;code&gt;sql_execute: non-deterministic `strftime` is not allowed in writes; pass time values from now_unix() instead&lt;/code&gt;. It does not matter if these words appear in a string value, in a comment, or as part of a column name (for example &lt;code&gt;update_date&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;sql_query&lt;/code&gt; reads only locally, so this limit does not apply. This is why the queries of &lt;code&gt;[sessions]&lt;/code&gt; can use &lt;code&gt;strftime&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;code&gt;sql_query&lt;/code&gt; reads the local copy. With several nodes in the cluster, data just written on another node may be readable here only a moment later. When you need to &amp;ldquo;read your own write&amp;rdquo;, decide from the return value of &lt;code&gt;sql_execute&lt;/code&gt; in the same request, for example &lt;code&gt;DELETE … WHERE …&lt;/code&gt; returning 1 means you got it.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;when-the-database-is-unreachable&#34;&gt;When the database is unreachable&#xA;&lt;/h3&gt;&lt;p&gt;A write waits for the leader to confirm. When the cluster has had no leader for more than 5 seconds, a new write fails at once. The first write after the majority is lost has already been handed to the cluster, and waits 30 seconds before it fails (see &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;chapter 16&lt;/a&gt;). When the total time one request spends waiting for the database goes past &lt;code&gt;lua.query_timeout_ms&lt;/code&gt;, the call fails too, for example &lt;code&gt;sql_query timed out: the database calls of one request have 5000 ms together&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This kind of failure means &amp;ldquo;cannot be asked right now&amp;rdquo;. It does not mean this person may not log in, so the server handles it differently from an ordinary error:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Login: no reply, so the NAS retransmits or asks another server. The log says &lt;code&gt;RADIUS Access-Request from client localhost not answered: the authentication backend could not be used&lt;/code&gt;, and &lt;code&gt;Discarded: database&lt;/code&gt; in &lt;code&gt;status&lt;/code&gt; goes up by one. The result is the same even if the script catches the error with &lt;code&gt;pcall&lt;/code&gt; and then returns &lt;code&gt;&#39;reject&#39;&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Accounting: with an accounting spool the request is first written to the spool and replayed later (chapter 13); without one there is no reply.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Tested: with &lt;code&gt;query_timeout_ms = 200&lt;/code&gt;, a query that ran for a long time made &lt;code&gt;rradius-bench&lt;/code&gt; show &lt;code&gt;timeouts 1&lt;/code&gt;, and &lt;code&gt;Discarded: database&lt;/code&gt; went from 0 to 1.&lt;/p&gt;&#xA;&lt;p&gt;All database calls in one request (including &lt;code&gt;db_query&lt;/code&gt; and &lt;code&gt;db_execute&lt;/code&gt; from chapter 09) share the same &lt;code&gt;query_timeout_ms&lt;/code&gt;: the second call can only use the time the first left over. The use of external databases is in chapter 09, and the parameters and errors of each function are in Appendix D.&lt;/p&gt;&#xA;&lt;h2 id=&#34;create-tables-with-migrations&#34;&gt;Create tables with migrations&#xA;&lt;/h2&gt;&lt;p&gt;Create the tables a script uses with &lt;code&gt;migrations_dir&lt;/code&gt; of &lt;code&gt;[cluster]&lt;/code&gt;. When the server starts, before it begins to serve, it applies the SQL files in that directory in numeric order, each file only once.&lt;/p&gt;&#xA;&lt;p&gt;Rules:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A file name is &lt;code&gt;&amp;lt;number&amp;gt;_&amp;lt;name&amp;gt;.sql&lt;/code&gt;, numbered from &lt;code&gt;1&lt;/code&gt; with no gaps, for example &lt;code&gt;1_schema.sql&lt;/code&gt;, &lt;code&gt;2_demo_users.sql&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Each file is one transaction, written through the cluster, so the tables are the same on every node.&lt;/li&gt;&#xA;&lt;li&gt;For each file applied, the name and the SHA-256 of the content are recorded. If you later change a file that was already applied, or a number is missing, the server fails to start with exit code 2.&lt;/li&gt;&#xA;&lt;li&gt;To change a table, add a new file, for example &lt;code&gt;3_last_login.sql&lt;/code&gt;. Do not change old files.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Add a table to the practice environment for the example in the previous section:&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;-- migrations/3_last_login.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; last_login (&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  username 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;,&#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;at&lt;/span&gt; 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;  client TEXT&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Migrations are applied only at startup, so restart the server after you add a new file. How this behaves with several nodes in the cluster (waiting for the leader, catching up) is in &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;chapter 16&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;use-a-script-as-a-lua-handler-in-the-auth-chain&#34;&gt;Use a script as a lua handler in the auth chain&#xA;&lt;/h2&gt;&lt;p&gt;A &lt;code&gt;lua&lt;/code&gt; handler in an auth chain is good for rules other than the password: leave the password to the sql or ldap handler, and let the script decide only whether this account may go online right now.&lt;/p&gt;&#xA;&lt;p&gt;Go back to the quick-start configuration (the one with &lt;code&gt;[auth]&lt;/code&gt;) and add a &lt;code&gt;lua&lt;/code&gt; handler in front of the sql handler:&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:#75715e&#34;&gt;# rradius.toml (replaces the original [auth] part)&lt;/span&gt;&#xA;&lt;/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;]&#xA;&lt;/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;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;&#xA;&lt;/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;policy.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;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;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;-- policy.lua (lua handler)&lt;/span&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;-- auth_user is the account name after the auth chain has cleaned it up; User-Name is what the request carried.&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;policy&amp;#39;&lt;/span&gt;, get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Name&amp;#39;&lt;/span&gt;), auth_user)&#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; auth_user &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; &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:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;reject&amp;#39;&lt;/span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;-- stop here: the whole chain ends&lt;/span&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;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;ignore&amp;#39;&lt;/span&gt;        &lt;span style=&#34;color:#75715e&#34;&gt;-- no opinion: pass to the next handler (sql) to compare the password&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Tested results:&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&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;code&gt;User-Name&lt;/code&gt; and &lt;code&gt;auth_user&lt;/code&gt; the script saw&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;&lt;code&gt;handler&lt;/code&gt; in the authentication record&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;Alice&lt;/code&gt; with the right password&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Alice&lt;/code&gt;, &lt;code&gt;alice&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;&lt;code&gt;sql&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;CAROL&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;CAROL&lt;/code&gt;, &lt;code&gt;carol&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;&lt;code&gt;lua&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;nobody&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;nobody&lt;/code&gt;, &lt;code&gt;nobody&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;&lt;code&gt;none&lt;/code&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;code&gt;auth_user&lt;/code&gt; has a value only inside an auth chain. It is the name after &lt;code&gt;[auth.username]&lt;/code&gt; has cleaned it up. Use it when you query tables.&lt;/li&gt;&#xA;&lt;li&gt;A &lt;code&gt;lua&lt;/code&gt; handler runs only for logins. Accounting always goes to the top-level script.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; In a &lt;code&gt;first_match&lt;/code&gt; chain, when a &lt;code&gt;lua&lt;/code&gt; handler returns &lt;code&gt;&#39;accept&#39;&lt;/code&gt; the login is accepted at once, and the handlers after it do not compare the password. Tested: with a script that returned &lt;code&gt;&#39;accept&#39;&lt;/code&gt; for &lt;code&gt;guest&lt;/code&gt;, any password logged in. A script that only applies rules should return &lt;code&gt;&#39;ignore&#39;&lt;/code&gt; when it lets the login pass. To require both checks, use &lt;code&gt;policy = &amp;quot;all_accept&amp;quot;&lt;/code&gt; (chapter 07).&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;When the script really compares the password itself (for example with &lt;code&gt;password_verify&lt;/code&gt; or by calling an API), add &lt;code&gt;verifies_password = true&lt;/code&gt; to the handler, so the auth chain treats its accept as &amp;ldquo;password checked&amp;rdquo;. The inner login of PEAP and TTLS needs this. The details are in chapter 07 and &lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;chapter 11&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;two-step-login-reply-with-access-challenge&#34;&gt;Two-step login: reply with Access-Challenge&#xA;&lt;/h2&gt;&lt;p&gt;When a script returns &lt;code&gt;&#39;challenge&#39;&lt;/code&gt;, the server sends an Access-Challenge, and the NAS asks the user once more (for example for a one-time password). The second Access-Request brings back the same &lt;code&gt;State&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-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;-- policy.lua (excerpt)&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;State&amp;#39;&lt;/span&gt;, random_token())          &lt;span style=&#34;color:#75715e&#34;&gt;-- 32 hexadecimal characters&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;Reply-Message&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Enter your code&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;return&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;challenge&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;Only a RADIUS login can return a challenge. For TACACS+, accounting and authorization, returning &lt;code&gt;&#39;challenge&#39;&lt;/code&gt; is treated as a reject.&lt;/li&gt;&#xA;&lt;li&gt;An Access-Challenge can carry only &lt;code&gt;Reply-Message&lt;/code&gt;, &lt;code&gt;State&lt;/code&gt;, &lt;code&gt;Idle-Timeout&lt;/code&gt;, &lt;code&gt;Session-Timeout&lt;/code&gt; and vendor attributes, and at most one &lt;code&gt;State&lt;/code&gt;. If it carries any other attribute, the server sends a reject instead, and the log says &lt;code&gt;RADIUS Access-Challenge for client localhost not sent: &#39;Filter-Id&#39; is not allowed in an Access-Challenge&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The script must remember whom it gave a challenge to: write the &lt;code&gt;State&lt;/code&gt; to a table, and look it up in the second request.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The full approach (password, TOTP, a limit on the number of failures, a code usable only once) is in the example &lt;code&gt;rradius-server/examples/two-step-totp.lua&lt;/code&gt;, explained step by step in &lt;a class=&#34;link&#34; href=&#34;../15-access-recipes/&#34; &gt;chapter 15&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;write-an-accounting-script&#34;&gt;Write an accounting script&#xA;&lt;/h2&gt;&lt;p&gt;Accounting requests always go to the top-level script. &lt;code&gt;accounting.lua&lt;/code&gt; of the quick-start is a complete example. It shows the main points of writing an accounting script:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Reply only by returning &lt;code&gt;&#39;accept&#39;&lt;/code&gt;.&lt;/strong&gt; Without a reply, the NAS retransmits the same packet.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Make every write safe to repeat.&lt;/strong&gt; When the NAS retransmits, the script runs again, so use &lt;code&gt;INSERT … ON CONFLICT … DO UPDATE&lt;/code&gt;: writing the same packet twice gives the same result as writing it once.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When the request cannot be recorded and a retransmission would not help, still return &lt;code&gt;&#39;accept&#39;&lt;/code&gt;&lt;/strong&gt;, for example for a packet without &lt;code&gt;Acct-Session-Id&lt;/code&gt;. Leave one line with &lt;code&gt;log()&lt;/code&gt; first.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Use &lt;code&gt;now_unix()&lt;/code&gt; minus &lt;code&gt;Acct-Delay-Time&lt;/code&gt; for the time&lt;/strong&gt;: that is when the event happened. For a request replayed from the accounting spool, the server adds the time it waited in the spool to &lt;code&gt;Acct-Delay-Time&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When &lt;code&gt;replayed&lt;/code&gt; is &lt;code&gt;true&lt;/code&gt;, the request was replayed from the accounting spool&lt;/strong&gt; and may be about something long ago. Do not use it for real-time actions.&lt;/li&gt;&#xA;&lt;/ol&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;-- accounting.lua (excerpt from the quick-start)&lt;/span&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; status &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Acct-Status-Type&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;if&lt;/span&gt; status &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;7&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; status &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;8&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;then&lt;/span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;-- Accounting-On/Off: this NAS restarted&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;&amp;#34;UPDATE accounting SET stopped = updated, terminate_cause = 11 WHERE client = ? AND nas = ? AND stopped IS NULL&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {client, nas})&#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;p&gt;The number of accounting scripts that run at the same time is limited: the number of Lua VMs minus 2, at least 1 (the number of VMs equals the number of CPUs the program can use). Requests over the limit wait in a queue and are not rejected. A script gives up its place while it waits for the database or an HTTP reply. This keeps CPU available for logins when a lot of accounting arrives. Login and authorization scripts have no such limit.&lt;/p&gt;&#xA;&lt;p&gt;How to design accounting tables, the spool, and the &lt;code&gt;session&lt;/code&gt; command are all in &lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;chapter 13&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;call-an-http-api&#34;&gt;Call an HTTP API&#xA;&lt;/h2&gt;&lt;p&gt;When accounts live in another system (a membership system, a billing system), a script can call its HTTP API. You first list the allowed hosts in the configuration:&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:#75715e&#34;&gt;# rradius.toml (add after [lua])&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&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;]   &lt;span style=&#34;color:#75715e&#34;&gt;# host only: HTTPS only, port 443&lt;/span&gt;&#xA;&lt;/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;p&gt;Without &lt;code&gt;[lua.http]&lt;/code&gt;, &lt;code&gt;http_request&lt;/code&gt; and &lt;code&gt;url_encode&lt;/code&gt; do not exist in the script: they are &lt;code&gt;nil&lt;/code&gt;. The default of each key is in &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&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;&lt;code&gt;lua.http.allowed_hosts&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;required&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;host&lt;/code&gt;, &lt;code&gt;host:port&lt;/code&gt;, or &lt;code&gt;http://host:port&lt;/code&gt; (plain HTTP for this host)&lt;/td&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.timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;2000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Time limit of one call, from connecting to reading the whole response&lt;/td&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.max_response_bytes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1048576&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Upper limit of the response body&lt;/td&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.max_concurrent&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;64&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Calls in progress at the same time for each host; logins and accounting are counted 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;&lt;code&gt;lua.http.ca_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;none&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A CA to trust in addition to the system root certificates&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;All these keys can be reloaded. &lt;code&gt;allowed_hosts&lt;/code&gt; cannot be written as &lt;code&gt;https://…&lt;/code&gt; or with a path, and &lt;code&gt;check&lt;/code&gt; points it out: &lt;code&gt;lua.http.allowed_hosts: &#39;https://api.example.com&#39; is not host, host:port or http://host:port&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;member-api.lua&lt;/code&gt; of the example scenario &lt;code&gt;external-api&lt;/code&gt; is a complete example. Its core is:&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;-- member-api.lua (excerpt from the external-api scenario)&lt;/span&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; 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;  &lt;span style=&#34;color:#75715e&#34;&gt;-- The name and password come from the user, so always encode them first.&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;&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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; response.status &lt;span style=&#34;color:#f92672&#34;&gt;~=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;200&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:#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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;local&lt;/span&gt; plan &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; response.headers[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;x-plan&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;if&lt;/span&gt; plan &lt;span style=&#34;color:#f92672&#34;&gt;and&lt;/span&gt; plan:match(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;^[%w_-]+$&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;Filter-Id&amp;#39;&lt;/span&gt;, plan)&#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;p&gt;The result of &lt;code&gt;http_request&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;When an HTTP response was received, whatever the status code, it returns a table: &lt;code&gt;status&lt;/code&gt; (a number), &lt;code&gt;body&lt;/code&gt; (a string) and &lt;code&gt;headers&lt;/code&gt; (header names always in lower case). 500 and 302 are also responses, and redirects are not followed automatically.&lt;/li&gt;&#xA;&lt;li&gt;When there was no response, it returns &lt;code&gt;nil&lt;/code&gt; and a reason. For example a timeout &lt;code&gt;timed out after 1500ms&lt;/code&gt;, a response that is too large &lt;code&gt;the response is over 1048576 octets&lt;/code&gt;, too many at once &lt;code&gt;too many requests at once&lt;/code&gt;, or not in the allow list &lt;code&gt;https://evil.example is not in lua.http.allowed_hosts&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;In these cases the script keeps running, and the script decides what to do. Misuse of the parameters (not a table, no &lt;code&gt;url&lt;/code&gt;, a method other than GET, POST, PUT, DELETE or PATCH, setting a header such as &lt;code&gt;Host&lt;/code&gt;) is a Lua error.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This example calls the API from a &lt;code&gt;lua&lt;/code&gt; handler with &lt;code&gt;verifies_password = true&lt;/code&gt;, because the API really compares the password.&lt;/p&gt;&#xA;&lt;p&gt;Tested (with a test HTTP server on the local machine, &lt;code&gt;allowed_hosts = [&amp;quot;http://127.0.0.1:&amp;lt;port&amp;gt;&amp;quot;]&lt;/code&gt;): with the right password the API answered 200 and &lt;code&gt;X-Plan: gold&lt;/code&gt;, the login was accepted, and the reply carried &lt;code&gt;Filter-Id = gold&lt;/code&gt;. With a wrong password the API answered 401 and the login was rejected.&lt;/p&gt;&#xA;&lt;p&gt;Every call is recorded in the &lt;code&gt;result&lt;/code&gt; label of the metric &lt;code&gt;rradius_script_http_requests_total&lt;/code&gt;: &lt;code&gt;ok&lt;/code&gt;, &lt;code&gt;timeout&lt;/code&gt;, &lt;code&gt;error&lt;/code&gt;, &lt;code&gt;denied&lt;/code&gt; (not in the allow list, or the URL was refused), &lt;code&gt;too_large&lt;/code&gt;, &lt;code&gt;busy&lt;/code&gt; (too many at once). On a failure the log also gets one WARN line, for example &lt;code&gt;script http_request to members.example.com: timed out after 1500ms&lt;/code&gt;. It writes only the host, not the rest of the URL.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;code&gt;timeout_ms&lt;/code&gt; should be shorter than the NAS retransmit interval. When the API does not answer, the script should reject quickly, instead of making the NAS wait until it gives up.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; Do not put the API key in a script that other people can read. Set the permissions of the script file so that only the account that runs rradius can read it.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;other-helper-functions&#34;&gt;Other helper functions&#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;Function&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Use&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;now_unix()&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The current Unix time (seconds, an integer value). Always use it for times written to 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;random_token()&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;32 hexadecimal random characters, for example as a &lt;code&gt;State&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;totp_verify(secret, code)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Check a TOTP code (Base32 key, 6 digits, 30-second steps, one step before and after allowed). Returns the step number when correct, &lt;code&gt;nil&lt;/code&gt; when 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;password_verify(stored, given)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Compare a stored password with the same rules as the auth chain, returns &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;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;wpa_pmk(passphrase, ssid)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Compute the WPA2 PMK (64 hexadecimal characters)&lt;/td&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;url_encode(text)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Encode a piece of text as one part of a URL (exists only with &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;&lt;code&gt;log(...)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Write one INFO log line; the arguments are joined with spaces, newlines become spaces, at most 4096 bytes&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;totp_verify&lt;/code&gt; returns the step number so that a script can record the step it used, and the same code cannot be used a second time (the way &lt;code&gt;two-step-totp.lua&lt;/code&gt; does it).&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;password_verify&lt;/code&gt; does not count failures and is not protected by &lt;code&gt;[auth.lockout]&lt;/code&gt;. When a script compares passwords itself, you must limit the number of guesses yourself. Or leave the password to a handler of the auth chain and let &lt;code&gt;[auth.lockout]&lt;/code&gt; count.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;code&gt;print()&lt;/code&gt; exists, but it writes to the standard output of the program, not to the log. When you run under systemd or in a container you usually cannot see it. Always use &lt;code&gt;log()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Enterprise edition:&lt;/strong&gt; &lt;code&gt;send_disconnect&lt;/code&gt; and &lt;code&gt;send_coa&lt;/code&gt; can send Disconnect and CoA from a script. The core has these two names too, but calling them always fails: &lt;code&gt;send_coa: not supported by this program (CoA needs rradius-enterprise)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;variables-for-eap-and-certificates&#34;&gt;Variables for EAP and certificates&#xA;&lt;/h2&gt;&lt;p&gt;For an EAP login, the auth chain or the top-level script sees a few more variables:&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;Variable&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;When it has a value&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Example&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_method&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After an EAP-TLS certificate is accepted, and for the inner login of PEAP and TTLS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;quot;tls&amp;quot;&lt;/code&gt;, &lt;code&gt;&amp;quot;peap&amp;quot;&lt;/code&gt;, &lt;code&gt;&amp;quot;ttls&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;tls_subject&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After an EAP-TLS certificate is accepted&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;quot;CN=laptop-001&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;tls_subject_attrs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;{ CN = { &amp;quot;laptop-001&amp;quot; } }&lt;/code&gt;, one array for each name&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Tested (wifi-certs scenario, with a &lt;code&gt;lua&lt;/code&gt; handler in front of the sql handler that logs these variables): when logging in with the certificate of &lt;code&gt;laptop-001&lt;/code&gt;, the script saw &lt;code&gt;eap_method = &amp;quot;tls&amp;quot;&lt;/code&gt;, &lt;code&gt;tls_subject = &amp;quot;CN=laptop-001&amp;quot;&lt;/code&gt; and &lt;code&gt;tls_subject_attrs.CN[1] = &amp;quot;laptop-001&amp;quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For a request that is not EAP, these variables are all &lt;code&gt;nil&lt;/code&gt;. The usage (for example giving a different VLAN by the OU of the certificate) is in &lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;chapter 11&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;limits-on-execution-time-memory-and-database-wait&#34;&gt;Limits on execution time, memory and database wait&#xA;&lt;/h2&gt;&lt;p&gt;Scripts run inside the server, and a badly written script must not bring the server down. There are three limits:&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;Limit&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Setting&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;When exceeded&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;Execution time&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;lua.max_execution_ms&lt;/code&gt; (default 1000)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;script exceeded the execution limit of 1000 ms&lt;/code&gt;, the request 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;Memory&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;lua.max_memory_mb&lt;/code&gt; (default 256, per VM)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;memory error: not enough memory&lt;/code&gt;, the request 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;Database wait&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;lua.query_timeout_ms&lt;/code&gt; (default 5000, the sum of all calls in one request)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The call fails; a login gets no reply&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Execution time counts only the time the script itself is running. Time spent waiting for the database, waiting for an HTTP reply, or waiting in the queue for an accounting place does not count. Each request is timed separately.&lt;/p&gt;&#xA;&lt;p&gt;Tested (&lt;code&gt;max_execution_ms = 100&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-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;-- policy.lua&lt;/span&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;while&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&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;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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::lua_engine: Lua script error (radius/authentication): runtime error: script exceeded the execution limit of 100 ms&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;After the time limit is passed, catching the error with &lt;code&gt;pcall&lt;/code&gt; does not help: every following step raises the same error, and in the end even returning &lt;code&gt;&#39;accept&#39;&lt;/code&gt; counts as a failure. In a test, &lt;code&gt;pcall(function() while true do end end) return &#39;accept&#39;&lt;/code&gt; was rejected.&lt;/li&gt;&#xA;&lt;li&gt;A long-running loop does not block other requests: about every 10 milliseconds of running, the script lets other requests go first.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The memory limit applies to each Lua VM. The number of VMs equals the number of CPUs the program can use, and all scripts share them. When one script needs too much memory, the error is its own. Other scripts that happen to be on the same VM at the same time may get the same error. In a test with &lt;code&gt;max_memory_mb = 16&lt;/code&gt;, &lt;code&gt;string.rep(&#39;x&#39;, 64 * 1024 * 1024)&lt;/code&gt; made that request fail, and the next request was accepted as usual.&lt;/p&gt;&#xA;&lt;h2 id=&#34;after-you-change-a-script&#34;&gt;After you change a script&#xA;&lt;/h2&gt;&lt;p&gt;Script files, like the configuration file, are replaced by new ones when you send &lt;code&gt;SIGHUP&lt;/code&gt; to reload. You do not need to 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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kill -HUP &amp;lt;server PID&amp;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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::reload: configuration reloaded from rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;When the new script has a syntax error, the reload fails and the server keeps using the old one: &lt;code&gt;reload failed, keeping the running configuration: cannot compile script &#39;policy.lua&#39;: syntax error: 1: Malformed string; did you forget to finish it?&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Changing &lt;code&gt;lua.max_memory_mb&lt;/code&gt; needs a restart. On reload the log says &lt;code&gt;these need a restart to apply: lua.max_memory_mb&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Run &lt;code&gt;rradiusd check&lt;/code&gt; first. It compiles all scripts (the top-level one and every &lt;code&gt;lua&lt;/code&gt; handler), so you see syntax errors there.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; You changed &lt;code&gt;accounting.lua&lt;/code&gt; to handle logins, but the script is never called for logins.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The configuration has &lt;code&gt;[auth]&lt;/code&gt;, so logins go to the auth chain, and the top-level script gets only accounting.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Write the rule as a &lt;code&gt;lua&lt;/code&gt; handler in the auth chain, or remove &lt;code&gt;[auth]&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; A script test &lt;code&gt;get_attr(&#39;Acct-Status-Type&#39;) == &#39;Start&#39;&lt;/code&gt; is never true.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; For an enumerated value you get the number.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Write &lt;code&gt;== 1&lt;/code&gt; (Start), &lt;code&gt;== 2&lt;/code&gt; (Stop), &lt;code&gt;== 3&lt;/code&gt; (Interim-Update).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The log has &lt;code&gt;sql_execute: non-deterministic `strftime` is not allowed in writes; pass time values from now_unix() instead&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The SQL of a write uses a time or random function.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Compute the value in Lua with &lt;code&gt;now_unix()&lt;/code&gt; and pass it in as a parameter.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The log has &lt;code&gt;sql_query: 1 placeholder, 0 values&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The SQL has &lt;code&gt;?&lt;/code&gt;, but no parameter array was passed, or the array has the wrong length.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add the second argument, for example &lt;code&gt;sql_query(sql, {user})&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The log has &lt;code&gt;attribute value must be a string or number, got boolean&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The value given to &lt;code&gt;set_attr&lt;/code&gt; is a boolean, a table or &lt;code&gt;nil&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Pass a string or a number.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The script returns &lt;code&gt;&#39;challenge&#39;&lt;/code&gt;, but the NAS receives an Access-Reject, and the log has &lt;code&gt;Access-Challenge for client … not sent: &#39;…&#39; is not allowed in an Access-Challenge&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The challenge set a standard attribute other than &lt;code&gt;Reply-Message&lt;/code&gt;, &lt;code&gt;State&lt;/code&gt;, &lt;code&gt;Idle-Timeout&lt;/code&gt; and &lt;code&gt;Session-Timeout&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Set only these in a challenge. Set the other attributes when you accept.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; A login gets no reply, &lt;code&gt;rradius-bench&lt;/code&gt; shows &lt;code&gt;timeouts 1&lt;/code&gt;, and the log has &lt;code&gt;not answered: the authentication backend could not be used&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; A database call of the script failed or timed out (the cluster has no leader, the query is too slow, an external database is unreachable).&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Look at the ERROR line just before it to find which call it was. If the query is too slow, add an index, or raise &lt;code&gt;lua.query_timeout_ms&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The log has &lt;code&gt;script exceeded the execution limit of 1000 ms&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The script&amp;rsquo;s own computation takes too long. Common causes are a loop with no end condition, or processing a lot of data in Lua.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Leave the data processing to SQL. Raise &lt;code&gt;lua.max_execution_ms&lt;/code&gt; only when you really need to.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; A script calling &lt;code&gt;http_request&lt;/code&gt; gets &lt;code&gt;attempt to call a nil value&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The configuration has no &lt;code&gt;[lua.http]&lt;/code&gt;, so the function does not exist in scripts.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add &lt;code&gt;[lua.http]&lt;/code&gt; with &lt;code&gt;allowed_hosts&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;http_request&lt;/code&gt; returns &lt;code&gt;nil&lt;/code&gt; and &lt;code&gt;http://… is not in lua.http.allowed_hosts&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The host, port or http/https of the URL is not exactly the same as the allow list. A host written alone allows only HTTPS on the default port.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Write the allow list the same as the URL, for example &lt;code&gt;api.example.com:8443&lt;/code&gt; or &lt;code&gt;http://10.0.0.5:8080&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; A script written like &lt;code&gt;disconnect-disabled.lua&lt;/code&gt; makes the log say &lt;code&gt;send_disconnect: not supported by this program (CoA needs rradius-enterprise)&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The core does not send CoA or Disconnect.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Remove that part. An accounting request still returns &lt;code&gt;&#39;accept&#39;&lt;/code&gt; as usual.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09 External databases and named queries&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;11 802.1X and EAP&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;12 TACACS+ device administration&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13 Accounting and sessions&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../15-access-recipes/&#34; &gt;15 Scenarios: network access for organizations&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16 Clusters and high availability&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../93-lua-reference/&#34; &gt;Appendix D: Lua API reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>11 802.1X and EAP</title>
            <link>https://embark.systems/en/rradius/oss/11-eap/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/11-eap/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Prepare the server certificate and CA for EAP and configure &lt;code&gt;[radius.eap]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Let company-issued device certificates log in with EAP-TLS, and use a table or a script to decide who gets in&lt;/li&gt;&#xA;&lt;li&gt;Block lost or revoked certificates with a CRL&lt;/li&gt;&#xA;&lt;li&gt;Let employees log in with an account and password using PEAP or TTLS, and pick the right password storage format&lt;/li&gt;&#xA;&lt;li&gt;Read the EAP metrics and logs to find out why a login failed&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You have read &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;Chapter 03&lt;/a&gt; and know how to start the server and test logins with &lt;code&gt;rradius-bench&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;You know what an auth chain and the sql handler are (&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;Chapter 07&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;openssl&lt;/code&gt; is installed on the machine, to generate the demo certificates.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#concepts&#34; &gt;Concepts&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#the-three-methods-the-core-provides&#34; &gt;The three methods the core provides&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#how-one-eap-login-proceeds&#34; &gt;How one EAP login proceeds&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#prepare-the-certificates&#34; &gt;Prepare the certificates&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#configure-radiuseap&#34; &gt;Configure radius.eap&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#which-methods-each-client-can-use&#34; &gt;Which methods each client can use&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#eap-tls-log-in-with-a-certificate&#34; &gt;EAP-TLS: log in with a certificate&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#authorization-after-the-certificate-passes&#34; &gt;Authorization after the certificate passes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#block-revoked-certificates-with-a-crl&#34; &gt;Block revoked certificates with a CRL&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#replace-the-server-certificate&#34; &gt;Replace the server certificate&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#peap-and-ttls-log-in-with-an-account-and-password&#34; &gt;PEAP and TTLS: log in with an account and password&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#how-to-store-passwords&#34; &gt;How to store passwords&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#seeing-eap-in-lua-scripts&#34; &gt;Seeing EAP in Lua scripts&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#conversation-limits-and-timeouts&#34; &gt;Conversation limits and timeouts&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#when-the-database-is-unavailable&#34; &gt;When the database is unavailable&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#eap-metrics-and-logs&#34; &gt;EAP metrics and logs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#connect-real-nases-and-clients&#34; &gt;Connect real NASes and clients&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;concepts&#34;&gt;Concepts&#xA;&lt;/h2&gt;&lt;p&gt;802.1X is the login method for wired networks and Wi-Fi (WPA2/WPA3-Enterprise). A login has three parties:&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;Role&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Who&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What it does&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;Client (supplicant)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The 802.1X software on a laptop or phone&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Presents a certificate or an account and password&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;NAS (network access server, for example an AP controller or a switch)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A client in the rradius configuration&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wraps the EAP packets from the supplicant in RADIUS and passes them to 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;rradius&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The authentication server&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Runs the EAP exchange with the supplicant, decides accept or reject, and hands the encryption keys to the NAS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The NAS does not understand the content of EAP. It only relays. The conversation between the supplicant and rradius travels in the &lt;code&gt;EAP-Message&lt;/code&gt; attribute and takes several round trips: in each round rradius answers with an Access-Challenge that carries a &lt;code&gt;State&lt;/code&gt;, and the NAS sends the same &lt;code&gt;State&lt;/code&gt; back in the next round, so rradius knows which conversation it belongs to. The last round is an Access-Accept or an Access-Reject.&lt;/p&gt;&#xA;&lt;p&gt;Besides your reply attributes (for example a VLAN), the Access-Accept carries &lt;code&gt;MS-MPPE-Recv-Key&lt;/code&gt; and &lt;code&gt;MS-MPPE-Send-Key&lt;/code&gt;. These keys are derived from the TLS handshake, and the NAS uses them to set up wireless encryption with the supplicant. rradius adds both attributes itself; you do not configure them.&lt;/p&gt;&#xA;&lt;p&gt;A few things differ from a normal PAP login:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;rradius handles the whole conversation itself.&lt;/strong&gt; Once &lt;code&gt;[radius.eap]&lt;/code&gt; is configured, requests that carry &lt;code&gt;EAP-Message&lt;/code&gt; do not run the auth chain or a script in every round. The auth chain is asked only once, at the end: for EAP-TLS after the handshake is complete, for PEAP and TTLS when the password inside the tunnel has arrived.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Message-Authenticator is required.&lt;/strong&gt; If a request with &lt;code&gt;EAP-Message&lt;/code&gt; has no &lt;code&gt;Message-Authenticator&lt;/code&gt;, rradius drops it without a reply, whatever the client&amp;rsquo;s &lt;code&gt;require_message_authenticator&lt;/code&gt; says (RFC 3579). A NAS includes it whenever it sends EAP, so you normally never see this.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The conversation lives in the memory of the node that received it.&lt;/strong&gt; When the cluster has several nodes, every round of one conversation must go to the same node. A different node has no such &lt;code&gt;State&lt;/code&gt; and answers EAP-Failure. If there is a load balancer between the NAS and rradius, make it send the requests of one NAS to the same node.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Without &lt;code&gt;[radius.eap]&lt;/code&gt;&lt;/strong&gt;, &lt;code&gt;EAP-Message&lt;/code&gt; is just an ordinary attribute, and the request goes to the auth chain or the script as usual.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;the-three-methods-the-core-provides&#34;&gt;The three methods the core provides&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;rradiusd&lt;/code&gt; provides three EAP methods. You write the method names in the configuration:&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;Name in the configuration&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Method&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;The supplicant presents&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;TLS version&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Client certificate needed&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What the auth chain receives&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;tls&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP-TLS (RFC 5216, RFC 9190)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A certificate&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TLS 1.2, 1.3&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Yes, and it must be issued by a CA in &lt;code&gt;client_ca_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The name on the certificate; the certificate itself is the proof&lt;/td&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;peap&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PEAP version 0, inner EAP-MSCHAPv2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Account and password&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TLS 1.2 only&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 inner account and the MS-CHAPv2 response&lt;/td&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;ttls&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP-TTLS version 0 (RFC 5281), inner PAP or MS-CHAPv2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Account and password&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TLS 1.2 only&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 inner account and password (PAP) or MS-CHAPv2 response&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Methods that are not provided:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;EAP-MD5 is not provided. When a supplicant asks only for EAP-MD5, the conversation ends with EAP-Failure.&lt;/li&gt;&#xA;&lt;li&gt;When &lt;code&gt;methods&lt;/code&gt; has any other name, &lt;code&gt;check&lt;/code&gt; rejects it, for example &lt;code&gt;md5&lt;/code&gt; gives &lt;code&gt;&#39;md5&#39; is not a method this server offers; it has tls, peap and ttls&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;TLS session resumption is not provided either: every login is a full handshake.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Enterprise edition:&lt;/strong&gt; EAP-SIM, EAP-AKA&amp;rsquo;, TLS session resumption and OCSP certificate checking are in the enterprise edition. &lt;code&gt;check&lt;/code&gt; in the core rejects configuration that uses them; see &lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt; in this chapter.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;How to choose:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Company-issued devices that can hold a certificate&lt;/strong&gt; (laptops, managed phones): use EAP-TLS. There is no password to guess, and you revoke a lost device with a CRL.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Employees&amp;rsquo; own devices&lt;/strong&gt;: use PEAP. Almost every operating system has PEAP-MSCHAPv2 built in.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TTLS with inner PAP&lt;/strong&gt; suits account sources whose passwords can only be compared in clear text, for example a directory that checks the password with an LDAP bind (&lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;Chapter 08&lt;/a&gt;). The inner password is inside the TLS tunnel, so it does not cross the air in clear text.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;how-one-eap-login-proceeds&#34;&gt;How one EAP login proceeds&#xA;&lt;/h2&gt;&lt;p&gt;Take EAP-TLS as the example. The &lt;code&gt;rounds per finished conversation: 6.0&lt;/code&gt; that &lt;code&gt;rradius-bench&lt;/code&gt; reports is these six rounds:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The NAS sends the supplicant&amp;rsquo;s EAP-Response/Identity (for example &lt;code&gt;laptop-001.corp.example.com&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;rradius picks the first method this client may use and answers with EAP-TLS Start.&lt;/li&gt;&#xA;&lt;li&gt;The next rounds are the TLS handshake. When a TLS message is too long, rradius cuts it into several fragments according to &lt;code&gt;fragment_size&lt;/code&gt; and waits for the supplicant to acknowledge each one before sending the next.&lt;/li&gt;&#xA;&lt;li&gt;After a successful handshake, rradius takes the name from the certificate and hands it to the auth chain (or to the Lua script when there is no auth chain) to decide.&lt;/li&gt;&#xA;&lt;li&gt;On accept it answers Access-Accept with EAP-Success, the MPPE keys and the reply attributes; on reject it answers Access-Reject with EAP-Failure.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;When the supplicant does not want the method rradius proposed first, it answers with a Legacy Nak that lists the methods it wants. rradius restarts with one of the methods this client allows; if none is allowed, it ends the conversation. This can only happen before the supplicant has sent any TLS data. Once the handshake has started, the method cannot change.&lt;/p&gt;&#xA;&lt;p&gt;When a conversation ends, the server log has one authentication record with &lt;code&gt;chain=&amp;quot;eap&amp;quot;&lt;/code&gt; and a &lt;code&gt;handler&lt;/code&gt; of &lt;code&gt;eap-tls&lt;/code&gt;, &lt;code&gt;eap-peap&lt;/code&gt; or &lt;code&gt;eap-ttls&lt;/code&gt;. The Access-Challenge rounds in between are not logged.&lt;/p&gt;&#xA;&lt;h2 id=&#34;prepare-the-certificates&#34;&gt;Prepare the certificates&#xA;&lt;/h2&gt;&lt;p&gt;EAP needs at least a server certificate and its private key. For EAP-TLS you also need the CA that issues the client certificates.&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;Setting&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Purpose&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 certificate chain (PEM)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;cert_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The supplicant uses it to confirm it is talking to the real RADIUS server&lt;/td&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 private key (PEM)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;key_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Kept only on the server, mode 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;CA of the client certificates (PEM)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;client_ca_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP-TLS accepts only client certificates issued by these CAs&lt;/td&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 (PEM)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;crl_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Optional; EAP-TLS uses it to block revoked certificates&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Some points:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Client certificates are trusted only through &lt;code&gt;client_ca_file&lt;/code&gt;.&lt;/strong&gt; The system root certificates are not trusted; otherwise a certificate issued by any public CA could log in.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;The server certificate must verify on the supplicant.&lt;/strong&gt; The supplicant must trust the CA that issued the server certificate and check the server name (for example &lt;code&gt;domain_match&lt;/code&gt; in a wpa_supplicant configuration). The example server certificate is &lt;code&gt;DNS:radius.corp.example.com&lt;/code&gt; with the usage &lt;code&gt;serverAuth&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Private key permissions.&lt;/strong&gt; If others can read &lt;code&gt;key_file&lt;/code&gt;, every configuration load logs a warning:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::common::seal: radius.eap.key_file: &amp;#39;certs/server.key&amp;#39; has mode 644, which others can reach or its group can write; make it 0600 or 0640&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Whoever gets this private key can impersonate your RADIUS server and collect PEAP password hashes.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Both scenarios ship a script that generates demo certificates:&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;Scenario&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Script&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Files produced (in &lt;code&gt;certs/&lt;/code&gt;)&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;enterprise-wifi&lt;/code&gt;&lt;/td&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;ca.pem&lt;/code&gt;, &lt;code&gt;ca.key&lt;/code&gt;, &lt;code&gt;server.pem&lt;/code&gt;/&lt;code&gt;.key&lt;/code&gt;, one device certificate &lt;code&gt;device.pem&lt;/code&gt;/&lt;code&gt;.key&lt;/code&gt; (&lt;code&gt;DNS:laptop-001.corp.example.com&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;wifi-certs&lt;/code&gt;&lt;/td&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;ca.pem&lt;/code&gt;, &lt;code&gt;ca.key&lt;/code&gt;, &lt;code&gt;server.pem&lt;/code&gt;/&lt;code&gt;.key&lt;/code&gt;, the two laptop certificates &lt;code&gt;laptop-001&lt;/code&gt; and &lt;code&gt;laptop-002&lt;/code&gt;, &lt;code&gt;ca.crl&lt;/code&gt; (which lists &lt;code&gt;laptop-002&lt;/code&gt;), and &lt;code&gt;crl-db/&lt;/code&gt; for &lt;code&gt;openssl ca&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;Both scripts generate keys and CSRs with &lt;code&gt;openssl req&lt;/code&gt; and sign with &lt;code&gt;openssl x509&lt;/code&gt;; both OpenSSL and LibreSSL work. &lt;code&gt;setup.sh&lt;/code&gt; does not overwrite an existing &lt;code&gt;certs/ca.pem&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; The CA these scripts generate is for testing only. In production, use your company CA to issue the server certificate and the device certificates, and do not keep the CA&amp;rsquo;s private key on the RADIUS server.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;configure-radiuseap&#34;&gt;Configure radius.eap&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;[radius.eap]&lt;/code&gt; sits under &lt;code&gt;[radius]&lt;/code&gt;. The smallest EAP-TLS configuration needs only four file paths:&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:#75715e&#34;&gt;# conf.d/eap.toml&lt;/span&gt;&#xA;&lt;/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;]&#xA;&lt;/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;]&#xA;&lt;/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;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;p&gt;This fragment goes in the &lt;code&gt;conf.d/&lt;/code&gt; of the &lt;code&gt;config init&lt;/code&gt; starter and has been verified with &lt;code&gt;check&lt;/code&gt; (&lt;code&gt;configuration ok&lt;/code&gt;). Paths are relative to the directory of the main configuration file &lt;code&gt;rradius.toml&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;All keys (defaults are taken from &lt;code&gt;config show&lt;/code&gt;; the full description is in &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&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;&lt;code&gt;methods&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[&amp;quot;tls&amp;quot;]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The methods offered, in order; the first one is proposed at the start. At least one, no duplicates&lt;/td&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;cert_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;none&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Server certificate chain, PEM. Required whenever any method is 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;code&gt;key_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;none&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Server private key, PEM. Required&lt;/td&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;client_ca_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;none&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;CA that issues the client certificates. Required when &lt;code&gt;methods&lt;/code&gt; has &lt;code&gt;tls&lt;/code&gt;; not allowed when it does not&lt;/td&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;crl_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;none&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Revocation list for the client certificates. Used only for &lt;code&gt;tls&lt;/code&gt;; not allowed when &lt;code&gt;methods&lt;/code&gt; has no &lt;code&gt;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;match_identity&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP-TLS: the name on the certificate must match the EAP Identity the supplicant reports&lt;/td&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;fragment_size&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Upper limit of each TLS data fragment, 256 to 1400 bytes&lt;/td&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_timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;30000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How long an unfinished conversation may go without a next round before it is dropped (milliseconds); must be greater than 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;max_sessions&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;4096&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Total number of unfinished conversations kept&lt;/td&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;max_sessions_per_client&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1024&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Number of unfinished conversations kept per client (NAS)&lt;/td&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;max_sessions_per_device&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;4&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Number of unfinished conversations kept per device (same client, same &lt;code&gt;Calling-Station-Id&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;All of &lt;code&gt;[radius.eap]&lt;/code&gt; can be reloaded: after SIGHUP, new conversations use the new settings and the reloaded certificates and CRL, while conversations already running finish with the settings they started with. When the new settings have an error (for example a certificate file is missing), the reload fails, the server keeps running with the old settings, and logins are not affected. Log from a real 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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::reload: reload failed, keeping the running configuration: rradius.toml: radius.eap.cert_file &amp;#39;certs/gone.pem&amp;#39;: I/O error: No such file or directory (os error 2)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;At that point &lt;code&gt;rradius_reload_total{result=&amp;quot;error&amp;quot;}&lt;/code&gt; goes up by 1. When you replace certificates, first confirm the new files with &lt;code&gt;check&lt;/code&gt;, then send SIGHUP.&lt;/p&gt;&#xA;&lt;p&gt;When &lt;code&gt;methods&lt;/code&gt; has &lt;code&gt;peap&lt;/code&gt; or &lt;code&gt;ttls&lt;/code&gt;, the configuration must have &lt;code&gt;[auth]&lt;/code&gt;: only the auth chain can check the password inside the tunnel. Without it, &lt;code&gt;check&lt;/code&gt; answers &lt;code&gt;radius.eap.methods has a method whose password only a chain can check, and there is no [auth] section&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;which-methods-each-client-can-use&#34;&gt;Which methods each client can use&#xA;&lt;/h2&gt;&lt;p&gt;A client&amp;rsquo;s &lt;code&gt;eap_methods&lt;/code&gt; decides which methods the devices behind that NAS may use, proposed in 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-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# rradius.toml (excerpt)&lt;/span&gt;&#xA;&lt;/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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# … (other settings omitted)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Rules:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;When &lt;code&gt;radius.eap.methods&lt;/code&gt; has only one method, a client can leave out &lt;code&gt;eap_methods&lt;/code&gt; and gets that one method.&lt;/li&gt;&#xA;&lt;li&gt;When &lt;code&gt;radius.eap.methods&lt;/code&gt; has two or more methods, &lt;strong&gt;every client must write&lt;/strong&gt; &lt;code&gt;eap_methods&lt;/code&gt;. A client that does not use EAP writes &lt;code&gt;eap_methods = []&lt;/code&gt;. If you leave it out, &lt;code&gt;check&lt;/code&gt; answers &lt;code&gt;radius client &#39;example&#39;: eap_methods is required when radius.eap.methods has more than one method; [] for a client without EAP&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;eap_methods&lt;/code&gt; can list only methods that are in &lt;code&gt;radius.eap.methods&lt;/code&gt;; the order may differ. For example, with &lt;code&gt;methods = [&amp;quot;tls&amp;quot;, &amp;quot;peap&amp;quot;]&lt;/code&gt;, a NAS with &lt;code&gt;eap_methods = [&amp;quot;peap&amp;quot;]&lt;/code&gt; proposes PEAP first to its devices.&lt;/li&gt;&#xA;&lt;li&gt;When a client with &lt;code&gt;eap_methods = []&lt;/code&gt; sends EAP, rradius answers EAP-Failure at once and opens no conversation.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Why write it for every client? A supplicant can ask to change the method with a Legacy Nak. If adding PEAP automatically turned it on for every NAS, a network that was meant for certificate login only could start accepting password logins. Writing it per client means adding a method does not open another network by accident.&lt;/p&gt;&#xA;&lt;h2 id=&#34;eap-tls-log-in-with-a-certificate&#34;&gt;EAP-TLS: log in with a certificate&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; Let &lt;code&gt;laptop-001&lt;/code&gt; log in with its certificate in the &lt;code&gt;wifi-certs&lt;/code&gt; scenario, and see the revoked &lt;code&gt;laptop-002&lt;/code&gt; get blocked.&lt;/p&gt;&#xA;&lt;p&gt;The key parts of this scenario&amp;rsquo;s configuration:&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:#75715e&#34;&gt;# rradius.toml (excerpt)&lt;/span&gt;&#xA;&lt;/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;]&#xA;&lt;/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 NULL FROM devices WHERE name = ?&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 devices WHERE name = ? 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 d AS (SELECT vlan FROM devices WHERE name = ?)&#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 d&#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 d&#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 d&amp;#34;&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;&#xA;&lt;/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;]&#xA;&lt;/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;]&#xA;&lt;/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;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;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;enable&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;UPDATE devices SET enabled = 1 WHERE name = ?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 devices SET enabled = 0 WHERE name = ?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 name, vlan, enabled FROM devices WHERE name = ?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:#75715e&#34;&gt;# … (other settings omitted)&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;Devices are listed in the &lt;code&gt;devices&lt;/code&gt; table (&lt;code&gt;migrations/1_schema.sql&lt;/code&gt;). The name is the DNS name on the certificate, and &lt;code&gt;vlan&lt;/code&gt; decides which VLAN the device goes into.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;certificate_query&lt;/code&gt; is the query used after the certificate has passed: one row found means accept. &lt;code&gt;user_query&lt;/code&gt; returns a &lt;code&gt;NULL&lt;/code&gt; password, so this table cannot be used for password logins.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;reply_query&lt;/code&gt; returns three VLAN attributes; &lt;code&gt;:1&lt;/code&gt; is the tag.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;[accounts]&lt;/code&gt; has only &lt;code&gt;enable&lt;/code&gt;, &lt;code&gt;disable&lt;/code&gt; and &lt;code&gt;show&lt;/code&gt;, so you can disable or enable a device with the &lt;code&gt;user&lt;/code&gt; command.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Set up:&lt;/strong&gt; Prepare the working directory as in &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;Chapter 03&lt;/a&gt;, then generate the certificates and replace the example secrets. The scenario&amp;rsquo;s client address is &lt;code&gt;10.30.0.10&lt;/code&gt;; change it to &lt;code&gt;127.0.0.1&lt;/code&gt; for a local 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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cp -R rradius-server/examples/scenarios/wifi-certs ~/rradius-lab/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ sed -i.bak &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;s#^dictionary = .*#dictionary = \&amp;#34;&lt;/span&gt;$PWD&lt;span style=&#34;color:#e6db74&#34;&gt;/share/dictionary\&amp;#34;#&amp;#34;&lt;/span&gt; ~/rradius-lab/wifi-certs/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cd ~/rradius-lab/wifi-certs&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ sh setup.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;wrote certs in …/rradius-lab/wifi-certs/certs: ca.pem, ca.crl, server, laptop-001, laptop-002 (revoked)&#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; f in raft api wlc; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; openssl rand -hex &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt; &amp;gt; $f.secret; &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;$ chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;600&lt;/span&gt; *.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ sed -i.bak2 &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;s/^address = &amp;#34;10.30.0.10&amp;#34;/address = &amp;#34;127.0.0.1&amp;#34;/&amp;#39;&lt;/span&gt; rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you have not run &lt;code&gt;setup.sh&lt;/code&gt; first, &lt;code&gt;check&lt;/code&gt; fails: &lt;code&gt;rradius.toml: radius.eap.cert_file &#39;certs/server.pem&#39;: I/O error: No such file or directory (os error 2)&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Start the server (&lt;code&gt;rradiusd serve --config rradius.toml&lt;/code&gt;), then open another terminal.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Verify:&lt;/strong&gt; Use &lt;code&gt;rradius-bench&lt;/code&gt; to play the supplicant and the NAS:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 wlc.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user laptop-001.corp.example.com --load eap-tls,concurrency=1 --requests 1 \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --ca-file certs/ca.pem --tls-name radius.corp.example.com \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --cert-file certs/laptop-001.pem --key-file certs/laptop-001.key&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;measured 0.004 s after 0.000 s of warmup&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;eap-tls (fixed-concurrency): concurrency 1, 1 threads, 1 sockets, busiest worker 29%&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  eap-tls: 224/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    rounds per finished conversation: 6.0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    latency us: p50 4415.5, p90 4415.5, p99 4415.5, p99.9 4415.5, max 4415.5&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Parameters of the EAP load:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;--user&lt;/code&gt;: the EAP Identity. For EAP-TLS it must equal the name on the certificate (see &lt;code&gt;match_identity&lt;/code&gt; in the next section).&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;--cert-file&lt;/code&gt;, &lt;code&gt;--key-file&lt;/code&gt;: the client certificate and private key. &lt;code&gt;eap-tls&lt;/code&gt; requires them; without them you get &lt;code&gt;rradius-bench: eap-tls needs --cert-file&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;--ca-file&lt;/code&gt;: the CA used to check the server certificate. If you leave it out, any server certificate is accepted; give it in tests too, so you can confirm the server sends the right certificate.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;--tls-name&lt;/code&gt;: the name the server certificate must match. It defaults to the value of &lt;code&gt;--server&lt;/code&gt;; when you connect with &lt;code&gt;127.0.0.1&lt;/code&gt;, write the name on the certificate, &lt;code&gt;radius.corp.example.com&lt;/code&gt;, explicitly.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;--tls-version 1.3&lt;/code&gt;: use TLS 1.3 instead (&lt;code&gt;eap-tls&lt;/code&gt; only). Tested: same &lt;code&gt;accept 1&lt;/code&gt;, 6 rounds.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Server log:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: 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;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now try the revoked &lt;code&gt;laptop-002&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 wlc.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user laptop-002.corp.example.com --load eap-tls,concurrency=1 --requests 1 \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --ca-file certs/ca.pem --tls-name radius.corp.example.com \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --cert-file certs/laptop-002.pem --key-file certs/laptop-002.key&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-bench: eap-tls: TLS: received fatal alert: CertificateRevoked&#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;  eap-tls: 0/s, sent 1, accept 0, reject 0, challenge 0, accounting 0, timeouts 0, invalid 1, late 0, socket errors 0, retransmits 0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;laptop-002&lt;/code&gt; is still enabled in the table. What blocks it is the CRL: during the handshake rradius sends the TLS alert &lt;code&gt;CertificateRevoked&lt;/code&gt;, and the auth chain is never asked.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;code&gt;rradius-bench&lt;/code&gt; stops when it receives a TLS alert and counts it as &lt;code&gt;invalid 1&lt;/code&gt;; it does not send the last acknowledgement round. A real supplicant acknowledges the alert and then receives an Access-Reject with EAP-Failure. So when you test this case with &lt;code&gt;rradius-bench&lt;/code&gt;, the conversation on the server is cleared only after &lt;code&gt;session_timeout_ms&lt;/code&gt; (30 seconds) and counted as &lt;code&gt;result=&amp;quot;timeout&amp;quot;&lt;/code&gt;, not &lt;code&gt;reject&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Finally, disable &lt;code&gt;laptop-001&lt;/code&gt; with the &lt;code&gt;user&lt;/code&gt; command:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd user disable --config rradius.toml laptop-001.corp.example.com&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;disabled laptop-001.corp.example.com&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 wlc.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user laptop-001.corp.example.com --load eap-tls,concurrency=1 --requests 1 \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --ca-file certs/ca.pem --tls-name radius.corp.example.com \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --cert-file certs/laptop-001.pem --key-file certs/laptop-001.key&#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;  eap-tls: 520/s, sent 1, accept 0, reject 1, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;$ rradiusd user enable --config rradius.toml laptop-001.corp.example.com&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;enabled laptop-001.corp.example.com&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This time the handshake succeeds, and &lt;code&gt;certificate_query&lt;/code&gt; finds no enabled device, so the login is rejected. Log:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::lua_engine: EAP conversation with client wlc refused: not authorized&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: 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;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;What the result looks like:&lt;/strong&gt; A certificate must pass two gates to log in: the TLS handshake (CA, validity period, CRL), and then authorization (table, directory or script). When the first fails, the supplicant receives a TLS alert; when the second fails, the log says &lt;code&gt;refused: not authorized&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;authorization-after-the-certificate-passes&#34;&gt;Authorization after the certificate passes&#xA;&lt;/h2&gt;&lt;h3 id=&#34;which-name-on-the-certificate&#34;&gt;Which name on the certificate&#xA;&lt;/h3&gt;&lt;p&gt;After a successful handshake, rradius takes the login name from the client certificate:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It first looks at the DNS names and email names in the subject alternative name.&lt;/li&gt;&#xA;&lt;li&gt;Only when there are neither does it use the common name (CN). When DNS or email names exist, the CN does not count, because a CA that checks only the alternative names may let the applicant fill in the CN freely.&lt;/li&gt;&#xA;&lt;li&gt;If the alternative names cannot be read (for example a DNS name that is not text), the whole certificate is rejected; rradius does not fall back to the CN.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;With &lt;code&gt;match_identity = true&lt;/code&gt; (the default), the EAP Identity the supplicant reports must be one of these names, ignoring case. When it does not match, the login is rejected and the auth chain does not run:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::lua_engine: EAP conversation with client wlc refused: the EAP Identity does not fit the certificate&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;wlc&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; account=&amp;#34;&amp;#34; chain=&amp;#34;eap&amp;#34; handler=&amp;#34;eap-tls&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;(This is the result of a real test with the &lt;code&gt;laptop-001&lt;/code&gt; certificate and &lt;code&gt;--user alice&lt;/code&gt;. The &lt;code&gt;user&lt;/code&gt; in the record is the RADIUS &lt;code&gt;User-Name&lt;/code&gt; the NAS sent; the line that gives the reason does not print the EAP Identity, because it comes from outside and may contain control characters.)&lt;/p&gt;&#xA;&lt;p&gt;Some supplicants always report an EAP Identity such as &lt;code&gt;anonymous&lt;/code&gt;. In that case set &lt;code&gt;match_identity = false&lt;/code&gt;, and the name becomes the first name on the certificate. Tested: with the same &lt;code&gt;laptop-001&lt;/code&gt; certificate and &lt;code&gt;--user anonymous&lt;/code&gt;, &lt;code&gt;match_identity = true&lt;/code&gt; rejects; after changing it to &lt;code&gt;false&lt;/code&gt; and sending SIGHUP, the login is accepted, and the record is &lt;code&gt;user=&amp;quot;anonymous&amp;quot; account=&amp;quot;laptop-001.corp.example.com&amp;quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The name goes to the auth chain as written on the certificate. The &lt;code&gt;User-Name&lt;/code&gt; that the auth chain and scripts see is this name, not the Identity the supplicant reported.&lt;/p&gt;&#xA;&lt;h3 id=&#34;decide-with-the-sql-handler&#34;&gt;Decide with the sql handler&#xA;&lt;/h3&gt;&lt;p&gt;For a certificate login, the sql handler works like this:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If there is a &lt;code&gt;certificate_query&lt;/code&gt;, it uses that and accepts when one row is found; if not, it uses &lt;code&gt;user_query&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;When only &lt;code&gt;user_query&lt;/code&gt; is used, the row found must have a password value to be accepted: an empty password is often used to mean a disabled account, and a certificate login is treated the same way. If you do not want to store passwords for devices, write a &lt;code&gt;certificate_query&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;default_user&lt;/code&gt; does not apply: a certificate cannot log in under a name that does not exist.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;reply_query&lt;/code&gt; runs as usual, and the result goes into the Access-Accept.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The &lt;code&gt;enterprise-wifi&lt;/code&gt; scenario keeps employee accounts and devices in the same &lt;code&gt;accounts&lt;/code&gt; table, told apart by &lt;code&gt;kind&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:#75715e&#34;&gt;# rradius.toml (excerpt)&lt;/span&gt;&#xA;&lt;/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 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;p&gt;This way a device certificate cannot pose as an employee account, and an employee password cannot log in as a device.&lt;/p&gt;&#xA;&lt;h3 id=&#34;decide-with-the-ldap-handler&#34;&gt;Decide with the ldap handler&#xA;&lt;/h3&gt;&lt;p&gt;The ldap handler processes certificate logins only when you write a &lt;code&gt;certificate_filter&lt;/code&gt;, for example &lt;code&gt;certificate_filter = &amp;quot;(uid={user})&amp;quot;&lt;/code&gt;. It accepts when an entry is found and &lt;code&gt;required_groups&lt;/code&gt; is satisfied, without a bind. An ldap handler without &lt;code&gt;certificate_filter&lt;/code&gt; skips a certificate login and logs the line &lt;code&gt;ignoring a certificate login: this handler has no certificate_filter&lt;/code&gt;. The other settings of the ldap handler are in &lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;Chapter 08&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;decide-with-a-lua-script-when-there-is-no-auth-chain&#34;&gt;Decide with a Lua script when there is no auth chain&#xA;&lt;/h3&gt;&lt;p&gt;When the configuration has no &lt;code&gt;[auth]&lt;/code&gt;, the top-level Lua script decides after the certificate passes, and it can see &lt;code&gt;eap_method&lt;/code&gt; and &lt;code&gt;tls_subject&lt;/code&gt;. For an example, see &lt;a class=&#34;link&#34; href=&#34;#seeing-eap-in-lua-scripts&#34; &gt;Seeing EAP in Lua scripts&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;name-normalization-and-certificates&#34;&gt;Name normalization and certificates&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;strip_realm&lt;/code&gt; and &lt;code&gt;lowercase&lt;/code&gt; in &lt;code&gt;[auth.username]&lt;/code&gt; are also applied to the name from the certificate, but only changes of letter case are allowed. When normalization would remove a realm, the certificate login is rejected:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::lua_engine: auth chain: rejecting a request from client wlc: normalization changes a certificate&amp;#39;s name in more than case&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is the result of a real test in &lt;code&gt;enterprise-wifi&lt;/code&gt; (&lt;code&gt;strip_realm = &amp;quot;suffix&amp;quot;&lt;/code&gt;) with a certificate whose email name is &lt;code&gt;alice@corp.example.com&lt;/code&gt;. A certificate proves the whole name, and stripping the realm turns it into a different account. So store the device&amp;rsquo;s full name from the certificate in the table; DNS names have no &lt;code&gt;@&lt;/code&gt; and are not affected.&lt;/p&gt;&#xA;&lt;h3 id=&#34;what-the-access-accept-carries&#34;&gt;What the Access-Accept carries&#xA;&lt;/h3&gt;&lt;p&gt;On accept, the Access-Accept carries:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;EAP-Success and &lt;code&gt;MS-MPPE-Recv-Key&lt;/code&gt;, &lt;code&gt;MS-MPPE-Send-Key&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The attributes the auth chain or script returned, for example a VLAN.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;User-Name&lt;/code&gt;: when the auth chain or script does not return &lt;code&gt;User-Name&lt;/code&gt;, rradius puts in the name from the certificate, so the NAS uses the same name in its logs and accounting.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Reply attributes are put only in the Access-Accept, never in the Access-Challenge rounds in between.&lt;/p&gt;&#xA;&lt;p&gt;A certificate login does not count toward &lt;code&gt;auth.lockout&lt;/code&gt;: there is nothing to guess, and a rejection does not count as a failure.&lt;/p&gt;&#xA;&lt;h2 id=&#34;block-revoked-certificates-with-a-crl&#34;&gt;Block revoked certificates with a CRL&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;crl_file&lt;/code&gt; is a PEM revocation list, and it can hold several. Once it is set, every certificate in the client certificate chain is checked during the handshake.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Three things you must know:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Every CA level in the chain needs a CRL.&lt;/strong&gt; If you give only the root CA&amp;rsquo;s CRL and the client certificate was issued by an intermediate CA, the handshake fails. Tested: with a certificate issued by an intermediate CA and a &lt;code&gt;crl_file&lt;/code&gt; that held only the root CA&amp;rsquo;s CRL, the supplicant received an &lt;code&gt;UnknownCA&lt;/code&gt; alert; after the root CA&amp;rsquo;s and the intermediate CA&amp;rsquo;s CRLs were concatenated into one file, the handshake passed.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Send SIGHUP after you update the CRL file.&lt;/strong&gt; rradius reads the CRL only when it loads the configuration.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;An expired CRL is still used.&lt;/strong&gt; A CRL past its Next Update does not make every login fail, but a newly revoked certificate is not blocked until you put in a new list. Regenerate the CRL regularly and reload.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The procedure to revoke a certificate, using &lt;code&gt;crl-db/&lt;/code&gt; of &lt;code&gt;wifi-certs&lt;/code&gt; as the example (run in the &lt;code&gt;certs/&lt;/code&gt; directory):&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ openssl ca -config crl-db/ca.cnf -revoke laptop-001.pem&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Using configuration from crl-db/ca.cnf&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Adding Entry with serial number 72F38A3DEE757B6E6A37D73476289C204A1B85A5 to DB for /CN=laptop-001&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Revoking Certificate 72F38A3DEE757B6E6A37D73476289C204A1B85A5.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Database updated&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ openssl ca -config crl-db/ca.cnf -gencrl -out ca.crl&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Using configuration from crl-db/ca.cnf&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kill -HUP &amp;lt;PID of the server&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The order and results of the real test:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;After the new &lt;code&gt;ca.crl&lt;/code&gt; is generated and before SIGHUP is sent, &lt;code&gt;laptop-001&lt;/code&gt; still gets &lt;code&gt;accept 1&lt;/code&gt;: the new list has not been read yet.&lt;/li&gt;&#xA;&lt;li&gt;After SIGHUP, the log shows &lt;code&gt;configuration reloaded from rradius.toml&lt;/code&gt;, and &lt;code&gt;rradius_reload_total{result=&amp;quot;ok&amp;quot;}&lt;/code&gt; goes up by 1.&lt;/li&gt;&#xA;&lt;li&gt;Log in again, and &lt;code&gt;rradius-bench&lt;/code&gt; prints &lt;code&gt;TLS: received fatal alert: CertificateRevoked&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;In a cluster, every node needs the same new CRL and its own SIGHUP.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; A conversation finishes with the settings it started with. A conversation can last at most four times &lt;code&gt;session_timeout_ms&lt;/code&gt;, so an old CRL cannot stay in force just because a supplicant keeps talking.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;how-many-gates-a-certificate-login-passes&#34;&gt;How many gates a certificate login passes&#xA;&lt;/h3&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Handshake: issued by client_ca_file? expired? in crl_file?&#xA;  ▼&#xA;Name: does the EAP Identity match a name on the certificate? (match_identity)&#xA;  ▼&#xA;Authorization: does certificate_query (or the script) find this device?&#xA;  ▼&#xA;Access-Accept&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Each gate can stop a device, and they take effect 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;Method&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;How fast 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;Disable in the table (for example &lt;code&gt;enabled = 0&lt;/code&gt;, judged by &lt;code&gt;certificate_query&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;At the next login, across the whole cluster&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Everyday disabling; blocks 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 (&lt;code&gt;crl_file&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After the new list is on every node and SIGHUP is sent&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;When the CA issues CRLs, or the same certificate is used in other systems&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;(This comparison table comes from the old manual and has not been measured again.) When the CA offers only online lookup (OCSP), you need the enterprise edition (see the enterprise note at the start of this chapter).&lt;/p&gt;&#xA;&lt;h3 id=&#34;update-the-crl-on-a-schedule&#34;&gt;Update the CRL on a schedule&#xA;&lt;/h3&gt;&lt;p&gt;A CRL has a Next Update, and rradius keeps using it after it expires (see above), so you have to refresh it regularly yourself:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use cron or a systemd timer to download the CRL from the CA regularly and convert it to PEM (see the format notes under &lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;Download to a temporary file first, confirm that it starts with &lt;code&gt;-----BEGIN X509 CRL-----&lt;/code&gt; and is not empty, and then swap it into the place of &lt;code&gt;crl_file&lt;/code&gt; with &lt;code&gt;mv&lt;/code&gt;. When the download fails, keep the old file; do not put an empty file there. An empty file, or a file without a CRL, is rejected by &lt;code&gt;check&lt;/code&gt; and by reload (&lt;code&gt;crl_file &#39;…&#39; holds no certificate revocation list&lt;/code&gt;), and when a reload fails the server keeps running with the old settings.&lt;/li&gt;&#xA;&lt;li&gt;Send SIGHUP. Every node must do this.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;This schedule itself (the download source, the CA&amp;rsquo;s CRL distribution point) has not been verified on real equipment.&lt;/p&gt;&#xA;&lt;h3 id=&#34;ecdsa-or-rsa-for-the-server-certificate&#34;&gt;ECDSA or RSA for the server certificate&#xA;&lt;/h3&gt;&lt;p&gt;When login volume is high, switch the server certificate to &lt;strong&gt;ECDSA P-256&lt;/strong&gt;: the CPU cost of each full handshake is about one third of RSA 2048 (source: a measurement in the old &lt;code&gt;docs/usage.md&lt;/code&gt;, not measured again in this chapter; for the baseline rows see &lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;Chapter 19&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Use the P-256 curve, not P-384.&lt;/strong&gt; Community reports say old Android (7.0) supports only P-256, and a P-384 certificate chain fails there (not official documentation, not verified on a real device). The same goes for the CA and intermediate certificates.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The server uses only one certificate at a time.&lt;/strong&gt; Before you switch to ECDSA, connect once with each kind of device.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Generate the EC private key with OpenSSL 3.&lt;/strong&gt; The old documentation records that rradius cannot read EC private keys generated with the LibreSSL that ships with macOS (&lt;code&gt;failed to parse private key&lt;/code&gt;); this was not verified again. To generate ECDSA, replace &lt;code&gt;-newkey rsa:2048&lt;/code&gt; with &lt;code&gt;-newkey ec -pkeyopt ec_paramgen_curve:prime256v1&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;monitoring&#34;&gt;Monitoring&#xA;&lt;/h3&gt;&lt;p&gt;A sudden rise of &lt;code&gt;rradius_eap_sessions_total{method=&amp;quot;tls&amp;quot;,result=&amp;quot;reject&amp;quot;}&lt;/code&gt; is often a CA level missing from the CRL (see &lt;code&gt;UnknownRevocationStatus&lt;/code&gt; under &lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;), but it can also be a batch of devices whose certificates have expired or been revoked.&lt;/p&gt;&#xA;&lt;h2 id=&#34;replace-the-server-certificate&#34;&gt;Replace the server certificate&#xA;&lt;/h2&gt;&lt;p&gt;After the server certificate expires, supplicants that check it refuse this server (supplicant behavior, not verified on real equipment in this chapter), so replace it before it expires. &lt;code&gt;openssl x509 -in certs/server.pem -noout -enddate&lt;/code&gt; shows the expiry date.&lt;/p&gt;&#xA;&lt;p&gt;The steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Issue a new server certificate with the same CA, with the same name (for example &lt;code&gt;DNS:radius.corp.example.com&lt;/code&gt;) and usage (&lt;code&gt;serverAuth&lt;/code&gt;) as the old one. Supplicants trust the CA and the name, not that particular certificate, so you do not need to change the supplicant settings.&lt;/li&gt;&#xA;&lt;li&gt;Put the new certificate and private key where &lt;code&gt;cert_file&lt;/code&gt; and &lt;code&gt;key_file&lt;/code&gt; point, and set the private key mode to 0600.&lt;/li&gt;&#xA;&lt;li&gt;Run &lt;code&gt;rradiusd check --config rradius.toml&lt;/code&gt; and confirm &lt;code&gt;configuration ok&lt;/code&gt;. When the private key and the certificate are not a pair, you see &lt;code&gt;does not fit cert_file&lt;/code&gt; here.&lt;/li&gt;&#xA;&lt;li&gt;Send SIGHUP. Conversations that start afterwards use the new certificate; conversations in progress finish with the old one.&lt;/li&gt;&#xA;&lt;li&gt;Every node in the cluster must be changed and given its own SIGHUP.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Tested: with the server running, a new certificate and private key issued by the same CA were put in place, &lt;code&gt;check&lt;/code&gt; passed, and after SIGHUP an EAP-TLS login still gave &lt;code&gt;accept 1&lt;/code&gt;. To confirm that the new certificate is really what is sent, a server certificate issued by another CA was put in and SIGHUP sent: after that &lt;code&gt;rradius-bench --ca-file certs/ca.pem&lt;/code&gt; got &lt;code&gt;TLS: invalid peer certificate: BadSignature&lt;/code&gt;, and only with the new CA&amp;rsquo;s &lt;code&gt;--ca-file&lt;/code&gt; did it get &lt;code&gt;accept 1&lt;/code&gt;. So new conversations after SIGHUP do use the new certificate.&lt;/p&gt;&#xA;&lt;p&gt;Changing the CA is different: every supplicant must trust the new CA first. In the transition period, let supplicants trust both the old and the new CA, and change the server certificate after all of them are updated.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;client_ca_file&lt;/code&gt; can hold several CA certificates. To let device certificates issued by two CAs log in (for example while changing the CA), concatenate them in one file. When a client certificate has expired, the handshake fails, and just like with revocation it never reaches authorization.&lt;/p&gt;&#xA;&lt;h2 id=&#34;peap-and-ttls-log-in-with-an-account-and-password&#34;&gt;PEAP and TTLS: log in with an account and password&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; Use the &lt;code&gt;enterprise-wifi&lt;/code&gt; scenario to let employees log in with PEAP and devices log in with EAP-TLS, and then add TTLS.&lt;/p&gt;&#xA;&lt;p&gt;The EAP and client settings of this scenario:&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:#75715e&#34;&gt;# rradius.toml (excerpt)&lt;/span&gt;&#xA;&lt;/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;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;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;]&#xA;&lt;/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;EAP-TLS is proposed first; a device without a certificate uses a Legacy Nak to ask for PEAP.&lt;/li&gt;&#xA;&lt;li&gt;An employee may type &lt;code&gt;Staff1@corp.example.com&lt;/code&gt;, and &lt;code&gt;[auth.username]&lt;/code&gt; turns it into &lt;code&gt;staff1&lt;/code&gt; in the table.&lt;/li&gt;&#xA;&lt;li&gt;The demo accounts are in &lt;code&gt;migrations/2_demo_data.sql&lt;/code&gt;: &lt;code&gt;staff1&lt;/code&gt; (password &lt;code&gt;staff1-password&lt;/code&gt;, stored as &lt;code&gt;{nthash}&lt;/code&gt;, enabled), &lt;code&gt;staff2&lt;/code&gt; (disabled), and the device &lt;code&gt;laptop-001.corp.example.com&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Set up:&lt;/strong&gt; Prepare the working directory as in the previous section, run &lt;code&gt;sh make-certs.sh&lt;/code&gt;, replace the three &lt;code&gt;.secret&lt;/code&gt; files, change the client address to &lt;code&gt;127.0.0.1&lt;/code&gt;, run &lt;code&gt;check&lt;/code&gt;, and start.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Verify:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 wlc.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user Staff1@corp.example.com --password staff1-password --load peap,concurrency=1 --requests 1 \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --ca-file certs/ca.pem --tls-name radius.corp.example.com&#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;  peap: 398/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    rounds per finished conversation: 10.0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;PEAP takes 10 rounds: rradius proposes EAP-TLS first, the supplicant answers with a Nak to ask for PEAP, and then come the handshake, the MS-CHAPv2 inside the tunnel and the result acknowledgement.&lt;/p&gt;&#xA;&lt;p&gt;The same command in a few other situations, with the real results:&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;Test&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;Reason in the log&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;staff1&lt;/code&gt;, wrong password&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;reject 1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;failed: the chain did not accept the inner 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;staff2&lt;/code&gt; (disabled), correct password&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;reject 1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;Device certificate &lt;code&gt;--load eap-tls&lt;/code&gt;, &lt;code&gt;--cert-file certs/device.pem&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accept 1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;staff1&lt;/code&gt;, &lt;code&gt;--load ttls&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;reject 1&lt;/code&gt;, only 2 rounds&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;failed: the peer asked only for methods this server does not offer&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 last row: this client does not have &lt;code&gt;ttls&lt;/code&gt;, so the supplicant&amp;rsquo;s Nak request is refused.&lt;/p&gt;&#xA;&lt;p&gt;The authentication record in the log:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;wlc&amp;#34; source=127.0.0.1 user=&amp;#34;Staff1@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;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;user&lt;/code&gt; is the outer name the NAS sent, and &lt;code&gt;account&lt;/code&gt; is the inner name the auth chain used after normalization. For PEAP and TTLS the inner name decides everything; the outer name can be an anonymous value such as &lt;code&gt;anonymous@corp.example.com&lt;/code&gt; without affecting the result.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Add TTLS:&lt;/strong&gt; Change two lines, then reload:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd config diff rradius.toml.before rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radius.clients[wlc].eap_methods: [&amp;#34;tls&amp;#34;, &amp;#34;peap&amp;#34;] | [&amp;#34;tls&amp;#34;, &amp;#34;peap&amp;#34;, &amp;#34;ttls&amp;#34;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radius.eap.methods: [&amp;#34;tls&amp;#34;, &amp;#34;peap&amp;#34;] | [&amp;#34;tls&amp;#34;, &amp;#34;peap&amp;#34;, &amp;#34;ttls&amp;#34;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kill -HUP &amp;lt;PID of the server&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 wlc.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user staff1@corp.example.com --password staff1-password --load ttls,concurrency=1 --requests 1 \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --ca-file certs/ca.pem --tls-name radius.corp.example.com&#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;  ttls: 687/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    rounds per finished conversation: 6.0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;(&lt;code&gt;rradius.toml.before&lt;/code&gt; is a copy saved before the change.) The &lt;code&gt;ttls&lt;/code&gt; load of &lt;code&gt;rradius-bench&lt;/code&gt; uses inner PAP.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What the result looks like:&lt;/strong&gt; On the same NAS, devices use certificates and employees use passwords, and both go through the same auth chain; &lt;code&gt;handler&lt;/code&gt; is &lt;code&gt;eap-tls&lt;/code&gt;, &lt;code&gt;eap-peap&lt;/code&gt; or &lt;code&gt;eap-ttls&lt;/code&gt;, and &lt;code&gt;account&lt;/code&gt; is the normalized account. When the password is wrong or the account is disabled, the log says &lt;code&gt;failed: the chain did not accept the inner name&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;what-happens-inside-the-tunnel&#34;&gt;What happens inside the tunnel&#xA;&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;PEAP:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Only PEAP version 0 is implemented, with only EAP-MSCHAPv2 inside, only TLS 1.2, and no client certificate required. When the supplicant asks for another version or insists on TLS 1.3, the conversation ends with EAP-Failure.&lt;/li&gt;&#xA;&lt;li&gt;The inner MS-CHAPv2 response goes to the client&amp;rsquo;s auth chain. It counts as accepted only when the auth chain really compared the password and returned &lt;code&gt;MS-CHAP2-Success&lt;/code&gt;. A script returning &lt;code&gt;accept&lt;/code&gt; does not count, and a Lua handler cannot put &lt;code&gt;MS-CHAP2-Success&lt;/code&gt; in by itself.&lt;/li&gt;&#xA;&lt;li&gt;When the password is wrong, the supplicant receives an MS-CHAPv2 Failure (&lt;code&gt;E=691&lt;/code&gt;) in the tunnel, and then an EAP-Failure.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;TTLS:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Only version 0 is implemented, with only TLS 1.2 and no client certificate required.&lt;/li&gt;&#xA;&lt;li&gt;The inner method can be PAP (&lt;code&gt;User-Name&lt;/code&gt;, &lt;code&gt;User-Password&lt;/code&gt;) or MS-CHAPv2 (&lt;code&gt;MS-CHAP-Challenge&lt;/code&gt;, &lt;code&gt;MS-CHAP2-Response&lt;/code&gt;). The MS-CHAPv2 challenge must be a value exported from the TLS tunnel; the supplicant cannot pick it.&lt;/li&gt;&#xA;&lt;li&gt;Inner PAP counts only when the handler that accepts it is one that compares passwords: the sql handler, the ldap handler, or a lua handler with &lt;code&gt;verifies_password = true&lt;/code&gt;. A script that only checks whether the account is enabled does not count, and the log says &lt;code&gt;the chain accepted the inner name without checking a password&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The inner name is at most 253 bytes and the PAP password at most 128 bytes; anything longer is rejected before the auth chain. An unknown inner AVP that is marked mandatory (M flag) is also rejected.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Common to both:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The client must have an auth chain. Without one, the login is rejected, and the log says &lt;code&gt;this client has no chain to check a password with&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;default_user&lt;/code&gt; does not apply to the password inside the tunnel.&lt;/li&gt;&#xA;&lt;li&gt;The MPPE keys that the auth chain returns are not sent; the keys derived from the TLS tunnel are sent instead. Other reply attributes go into the Access-Accept as usual. When the auth chain does not return &lt;code&gt;User-Name&lt;/code&gt;, rradius puts in the normalized account name.&lt;/li&gt;&#xA;&lt;li&gt;A wrong password is logged, with the authentication record, the moment the auth chain rejects it, without waiting for the supplicant to finish the conversation; the same conversation is not recorded twice.&lt;/li&gt;&#xA;&lt;li&gt;A password login inside the tunnel counts toward &lt;code&gt;auth.lockout&lt;/code&gt; as usual (&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;Chapter 07&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;At most 8 rounds inside the tunnel.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; TTLS inner MS-CHAPv2 was only checked against the code and the tests. The &lt;code&gt;ttls&lt;/code&gt; load of &lt;code&gt;rradius-bench&lt;/code&gt; sends only inner PAP, so this chapter never actually ran inner MS-CHAPv2.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;how-to-store-passwords&#34;&gt;How to store passwords&#xA;&lt;/h2&gt;&lt;p&gt;PEAP uses MS-CHAPv2, and the server must be able to compute the NT hash of the password to compare. So for PEAP accounts, store the password as &lt;code&gt;{nthash}&lt;/code&gt; or in clear text; a one-way hash such as bcrypt cannot be used to compare MS-CHAPv2. The inner PAP of TTLS receives the clear-text password, so any format can be compared.&lt;/p&gt;&#xA;&lt;p&gt;Tested: add &lt;code&gt;[accounts]&lt;/code&gt; to &lt;code&gt;enterprise-wifi&lt;/code&gt; and add one account with each of two &lt;code&gt;scheme&lt;/code&gt; values:&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:#75715e&#34;&gt;# rradius.toml (add at the end of the file)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&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;nthash&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;add&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;INSERT INTO accounts (name, kind, password, grp) VALUES (?1, &amp;#39;user&amp;#39;, ?2, &amp;#39;staff&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;passwd&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;UPDATE accounts SET password = ?2 WHERE name = ?1 AND kind = &amp;#39;user&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;show&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT name, kind, grp, enabled FROM accounts WHERE name = ?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;&lt;code&gt;staff3&lt;/code&gt; was added with &lt;code&gt;scheme = &amp;quot;nthash&amp;quot;&lt;/code&gt;, and &lt;code&gt;staff4&lt;/code&gt; was added after changing &lt;code&gt;scheme&lt;/code&gt; to &lt;code&gt;&amp;quot;bcrypt&amp;quot;&lt;/code&gt; (&lt;code&gt;printf &#39;staff3-password\n&#39; | rradiusd user add --config rradius.toml staff3&lt;/code&gt;). Results:&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;Account&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Storage format&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;PEAP&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;TTLS (inner PAP)&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;staff3&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;nthash&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accept 1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accept 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;staff4&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;bcrypt&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;reject 1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accept 1&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 rules for choosing:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;To use PEAP, store &lt;code&gt;nthash&lt;/code&gt;. An NT hash has no salt, so if the table leaks it is about as dangerous as clear text; protect the cluster data directory well.&lt;/li&gt;&#xA;&lt;li&gt;When you use only TTLS inner PAP, you can store a safer hash such as bcrypt.&lt;/li&gt;&#xA;&lt;li&gt;When the account is in LDAP and the password can only be checked with a bind, the bind accepts only a clear-text password, so it suits TTLS inner PAP only, not PEAP.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;code&gt;rradius_password_checks_total&lt;/code&gt; is counted per storage format; for example, the tests above raised &lt;code&gt;ok&lt;/code&gt; for &lt;code&gt;scheme=&amp;quot;nthash&amp;quot;&lt;/code&gt;. The formats are described in &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;Chapter 07&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;seeing-eap-in-lua-scripts&#34;&gt;Seeing EAP in Lua scripts&#xA;&lt;/h2&gt;&lt;p&gt;When an EAP login reaches the auth chain or a script, the script has three more global variables:&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;Variable&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;When it has a value&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Content&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_method&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP login&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;quot;tls&amp;quot;&lt;/code&gt;, &lt;code&gt;&amp;quot;peap&amp;quot;&lt;/code&gt; or &lt;code&gt;&amp;quot;ttls&amp;quot;&lt;/code&gt;; nil when it is not 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;tls_subject&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;When &lt;code&gt;eap_method&lt;/code&gt; is &lt;code&gt;&amp;quot;tls&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The subject of the client certificate, as text, in the order on the certificate, with values escaped per RFC 4514, for example &lt;code&gt;CN=laptop-002&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;tls_subject_attrs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A table: attribute name to an array of its values (not escaped), for example &lt;code&gt;tls_subject_attrs.CN[1]&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;get_attr(&#39;User-Name&#39;)&lt;/code&gt; gives the name on the certificate (EAP-TLS) or the name inside the tunnel (PEAP, TTLS).&lt;/p&gt;&#xA;&lt;p&gt;In a configuration without &lt;code&gt;[auth]&lt;/code&gt;, the script below lets certificates whose CN starts with &lt;code&gt;laptop-&lt;/code&gt; log in, and puts in a &lt;code&gt;Filter-Id&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-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;-- auth.lua: with no [auth], this script decides after an EAP-TLS certificate passes&lt;/span&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;-- This demo records no accounting: an accounting script that returns &amp;#39;accept&amp;#39; means it has been recorded, see Chapter 13.&lt;/span&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; phase &lt;span style=&#34;color:#f92672&#34;&gt;~=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;authentication&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;  &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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; eap_method &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;tls&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;  log(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;certificate&amp;#39;&lt;/span&gt;, get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Name&amp;#39;&lt;/span&gt;), tls_subject)&#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; cn &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; tls_subject_attrs &lt;span style=&#34;color:#f92672&#34;&gt;and&lt;/span&gt; tls_subject_attrs.CN &lt;span style=&#34;color:#f92672&#34;&gt;and&lt;/span&gt; tls_subject_attrs.CN[&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;if&lt;/span&gt; cn &lt;span style=&#34;color:#f92672&#34;&gt;and&lt;/span&gt; cn:match(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;^laptop%-&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;Filter-Id&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;corp-devices&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;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;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;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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Tested (the &lt;code&gt;config init&lt;/code&gt; starter plus the &lt;code&gt;conf.d/eap.toml&lt;/code&gt; above, without &lt;code&gt;crl_file&lt;/code&gt;): a login with the &lt;code&gt;laptop-002&lt;/code&gt; certificate gives &lt;code&gt;accept 1&lt;/code&gt;, and the log:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::lua_engine: script auth.lua (radius/authentication, client example): certificate laptop-002.corp.example.com CN=laptop-002&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;example&amp;#34; source=127.0.0.1 user=&amp;#34;laptop-002.corp.example.com&amp;#34; account=&amp;#34;laptop-002.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;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note that &lt;code&gt;crl_file&lt;/code&gt; is not set here, so the revoked &lt;code&gt;laptop-002&lt;/code&gt; got in too. A script can only decide what happens after the handshake passes; revocation depends on the CRL.&lt;/p&gt;&#xA;&lt;p&gt;A few limits:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This script is no use for PEAP and TTLS: their passwords must be checked by the auth chain, so the configuration must have &lt;code&gt;[auth]&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;When a lua handler in the auth chain is to compare the password for TTLS inner PAP, set &lt;code&gt;verifies_password = true&lt;/code&gt; and compare &lt;code&gt;User-Password&lt;/code&gt; yourself.&lt;/li&gt;&#xA;&lt;li&gt;Other ways of writing scripts are in &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;Chapter 10&lt;/a&gt;, and the full API is in &lt;a class=&#34;link&#34; href=&#34;../93-lua-reference/&#34; &gt;Appendix D&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;conversation-limits-and-timeouts&#34;&gt;Conversation limits and timeouts&#xA;&lt;/h2&gt;&lt;p&gt;Every unfinished conversation takes memory. Anyone who can send an EAP Identity through a NAS can open a conversation, so rradius puts limits on them:&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 rradius does&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Count (&lt;code&gt;result&lt;/code&gt; of &lt;code&gt;rradius_eap_sessions_total&lt;/code&gt;)&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 next round within &lt;code&gt;session_timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Drops the conversation, cleared within about a second&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;timeout&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;Rounds keep coming, but more than four times &lt;code&gt;session_timeout_ms&lt;/code&gt; has passed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Drops it&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;timeout&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 conversation receives its 257th request&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Answers EAP-Failure and drops it&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;reject&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 total number of conversations reaches &lt;code&gt;max_sessions&lt;/code&gt;, or this client&amp;rsquo;s reaches &lt;code&gt;max_sessions_per_client&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Opens the new conversation and drops an old one: first those that went silent after the Identity, then the one idle for the longest time&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;evicted&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 unfinished conversations of one device reach &lt;code&gt;max_sessions_per_device&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Does not answer the new request; the NAS retransmits&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;overload&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 same device goes silent after the Identity and then starts again&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The old one is replaced by the new one&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;replaced&lt;/code&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;&amp;ldquo;The same device&amp;rdquo; is the same client with the same &lt;code&gt;Calling-Station-Id&lt;/code&gt;. When a request has no &lt;code&gt;Calling-Station-Id&lt;/code&gt;, devices cannot be told apart, and only &lt;code&gt;max_sessions&lt;/code&gt; and &lt;code&gt;max_sessions_per_client&lt;/code&gt; take effect.&lt;/li&gt;&#xA;&lt;li&gt;A conversation in progress is heard in every round and ranks last for dropping, so a flood of fake Identities cannot push out real logins.&lt;/li&gt;&#xA;&lt;li&gt;Once a conversation has been recorded as a rejection, a later timeout or eviction is not counted again.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;You normally do not need to tune these values. For when you do:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;When one controller has many devices and many people log in at the same time (for example at the start of the working day) and the &lt;code&gt;1024&lt;/code&gt; of &lt;code&gt;max_sessions_per_client&lt;/code&gt; is not enough, raise it.&lt;/li&gt;&#xA;&lt;li&gt;When &lt;code&gt;session_timeout_ms&lt;/code&gt; is too short, slow supplicants, or phones that wait for the user to tap &amp;ldquo;trust certificate&amp;rdquo;, get dropped midway.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;fragment_size&lt;/code&gt; is &lt;code&gt;1000&lt;/code&gt; by default. Lower it when the NAS or the network in between has trouble with large RADIUS packets; the minimum is 256.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;code&gt;rradius_eap_sessions_open&lt;/code&gt; is the number of unfinished conversations right now.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;rradius-bench&lt;/code&gt; can also measure throughput with an EAP load (for example &lt;code&gt;--load eap-tls,concurrency=16&lt;/code&gt;); that is covered in &lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;Chapter 19&lt;/a&gt;. When measuring, remember to set &lt;code&gt;max_sessions&lt;/code&gt; and &lt;code&gt;max_sessions_per_client&lt;/code&gt; higher than the number of simultaneous conversations; &lt;code&gt;rradius-server/benchmarks/eap.toml&lt;/code&gt; in the source does exactly that.&lt;/p&gt;&#xA;&lt;h2 id=&#34;when-the-database-is-unavailable&#34;&gt;When the database is unavailable&#xA;&lt;/h2&gt;&lt;p&gt;The EAP conversation itself is in memory, but the last step (the auth chain querying the table) needs the cluster database. When the database is temporarily unavailable (for example a call times out; read-only queries are still answered from the local replica when there is no leader, see Chapter 16):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The request is not answered, &lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;database&amp;quot;}&lt;/code&gt; goes up by 1, and the log says &lt;code&gt;EAP request from client &amp;lt;name&amp;gt; not answered: …&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The conversation is kept. When the NAS retransmits the same EAP-Response, rradius redoes that step and does not read the TLS data again.&lt;/li&gt;&#xA;&lt;li&gt;Each retransmission counts as a round and is still subject to &lt;code&gt;session_timeout_ms&lt;/code&gt; and the limit of 256 rounds.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;So when the database is down briefly, supplicants only log in more slowly and are not rejected; when the outage is too long, the conversation times out and the supplicant must start over.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; This part was only checked against the code and the spec, and was never run under a real database failure. For the overall behavior when the cluster has no leader, see &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 16&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;eap-metrics-and-logs&#34;&gt;EAP metrics and logs&#xA;&lt;/h2&gt;&lt;p&gt;The EAP metrics on &lt;code&gt;/metrics&lt;/code&gt; (from a real test; names and labels copied as they are):&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_eap_sessions_open 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_eap_sessions_total{method=&amp;#34;tls&amp;#34;,result=&amp;#34;accept&amp;#34;} 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_eap_sessions_total{method=&amp;#34;tls&amp;#34;,result=&amp;#34;reject&amp;#34;} 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_eap_sessions_total{method=&amp;#34;peap&amp;#34;,result=&amp;#34;accept&amp;#34;} 2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_eap_sessions_total{method=&amp;#34;peap&amp;#34;,result=&amp;#34;reject&amp;#34;} 3&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_eap_sessions_total{method=&amp;#34;ttls&amp;#34;,result=&amp;#34;accept&amp;#34;} 3&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_eap_sessions_total{method=&amp;#34;ttls&amp;#34;,result=&amp;#34;reject&amp;#34;} 1&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;method&lt;/code&gt; is &lt;code&gt;tls&lt;/code&gt;, &lt;code&gt;peap&lt;/code&gt; or &lt;code&gt;ttls&lt;/code&gt;, and &lt;code&gt;result&lt;/code&gt; is one of six values: &lt;code&gt;accept&lt;/code&gt;, &lt;code&gt;reject&lt;/code&gt;, &lt;code&gt;timeout&lt;/code&gt;, &lt;code&gt;overload&lt;/code&gt;, &lt;code&gt;replaced&lt;/code&gt;, &lt;code&gt;evicted&lt;/code&gt; (their meaning is in the previous section). Every combination appears, including those with the value 0. A conversation is counted only once.&lt;/p&gt;&#xA;&lt;p&gt;How to read them when troubleshooting:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;reject&lt;/code&gt; keeps rising: usually wrong passwords, disabled accounts or authorization that does not pass. Look at the reason in the log.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;timeout&lt;/code&gt; keeps rising: supplicants open conversations but do not finish them. The usual causes are that the supplicant does not trust the server certificate (it just gives up), or that packets are lost between the NAS and rradius.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;overload&lt;/code&gt; and &lt;code&gt;evicted&lt;/code&gt; rise: the number of conversations has hit a limit; see the previous section.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;code&gt;status&lt;/code&gt; has an EAP section that shows the number of unfinished conversations:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd status --config rradius.toml&#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;EAP&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Sessions under way  1&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;(This is what you see in &lt;code&gt;wifi-certs&lt;/code&gt; after testing a revoked certificate with &lt;code&gt;rradius-bench&lt;/code&gt;: that conversation is waiting for the 30-second timeout.)&lt;/p&gt;&#xA;&lt;p&gt;The log lines related to EAP are all WARN:&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;Start of the line&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;&lt;code&gt;EAP conversation with client &amp;lt;name&amp;gt; refused: &amp;lt;reason&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The handshake succeeded but authorization did not pass, for example &lt;code&gt;not authorized&lt;/code&gt;, &lt;code&gt;the EAP Identity does not fit the certificate&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 conversation with client &amp;lt;name&amp;gt; failed: &amp;lt;reason&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The conversation failed midway, for example wrong password, method not allowed, TLS handshake failure&lt;/td&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 request from client &amp;lt;name&amp;gt; not answered: &amp;lt;reason&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The database is unavailable and the request got no answer; the conversation waits for the NAS to retransmit&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Each conversation that ends also has an &lt;code&gt;rradius_auth&lt;/code&gt; authentication record. The log never prints the MSK or TLS content, and never prints the password inside the tunnel. The full description of metrics and logs is in &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;Chapter 17&lt;/a&gt; and &lt;a class=&#34;link&#34; href=&#34;../92-metrics-reference/&#34; &gt;Appendix C&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;connect-real-nases-and-clients&#34;&gt;Connect real NASes and clients&#xA;&lt;/h2&gt;&lt;p&gt;The tests in this chapter use &lt;code&gt;rradius-bench&lt;/code&gt; to play both the NAS and the supplicant. When you connect real equipment:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;NAS:&lt;/strong&gt; On the AP controller or switch, point the RADIUS server at the rradius authentication port (default 1812), with the shared secret equal to &lt;code&gt;secret_file&lt;/code&gt;; change the client&amp;rsquo;s &lt;code&gt;address&lt;/code&gt; back to the NAS&amp;rsquo;s real address. Configure accounting as in &lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;Chapter 13&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Supplicant:&lt;/strong&gt; Set it to trust the CA that issued the server certificate and give the server name (the example is &lt;code&gt;radius.corp.example.com&lt;/code&gt;). For EAP-TLS, also install the device certificate and private key. When there are many devices, use MDM or group policy (GPO) to push the CA certificate, the server name and the Wi-Fi settings to the devices together, instead of relying on users to tap &amp;ldquo;trust&amp;rdquo; by hand; without preconfiguration, users are asked again and again whether to trust the certificate, or they simply choose not to verify. This step is an operation of each operating system and management system, and this manual has not tested it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;VLAN:&lt;/strong&gt; The NAS must support assigning a VLAN by &lt;code&gt;Tunnel-Private-Group-Id&lt;/code&gt;, so that the reply attributes in the examples have an effect.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The &lt;code&gt;eapol/&lt;/code&gt; directory of the &lt;code&gt;enterprise-wifi&lt;/code&gt; scenario has two &lt;code&gt;eapol_test&lt;/code&gt; configurations (&lt;code&gt;tls.conf&lt;/code&gt;, &lt;code&gt;peap.conf&lt;/code&gt;), which let a Linux machine simulate a supplicant. &lt;code&gt;eapol_test&lt;/code&gt; is a test tool that ships with wpa_supplicant and is not in the repo.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; Supplicants must verify the server certificate. If they do not, a fake access point can impersonate your network, collect the PEAP MS-CHAPv2 responses, and guess passwords offline.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; This chapter has not been tested with a real AP, a switch, &lt;code&gt;eapol_test&lt;/code&gt; or the 802.1X supplicant built into any operating system. The steps above and the settings in &lt;code&gt;eapol/&lt;/code&gt; were only checked against the scenario files and the code.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;rradius.toml: radius.eap.cert_file &#39;certs/server.pem&#39;: I/O error: No such file or directory (os error 2)&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The certificates have not been generated yet, or the path is wrong. Paths are relative to the directory of the main configuration file.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Run the scenario&amp;rsquo;s &lt;code&gt;make-certs.sh&lt;/code&gt; or &lt;code&gt;setup.sh&lt;/code&gt; first, or change to the correct path.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;radius.eap.client_ca_file is required&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;methods&lt;/code&gt; has &lt;code&gt;tls&lt;/code&gt; (the default is &lt;code&gt;[&amp;quot;tls&amp;quot;]&lt;/code&gt;), but there is no &lt;code&gt;client_ca_file&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add the CA that issues the client certificates; when you use only PEAP or TTLS, write &lt;code&gt;methods&lt;/code&gt; explicitly and do not rely on the default.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;radius.eap.crl_file only applies to tls, which methods does not have&lt;/code&gt; (&lt;code&gt;client_ca_file&lt;/code&gt; gets the same message).&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The methods have no &lt;code&gt;tls&lt;/code&gt;, so these settings have no effect.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Delete them, or add &lt;code&gt;tls&lt;/code&gt; to &lt;code&gt;methods&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;radius.eap.key_file &#39;certs/other.key&#39; does not fit cert_file &#39;certs/server.pem&#39;: keys may not be consistent: KeyMismatch&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The private key and the certificate are not a pair.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Use the private key that was used to issue this certificate.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;radius.eap.client_ca_file &#39;…&#39; holds no certificate&lt;/code&gt; or &lt;code&gt;radius.eap.crl_file &#39;…&#39; holds no certificate revocation list&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The wrong file was given, or it is not in PEM format.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Confirm that the file content is &lt;code&gt;-----BEGIN CERTIFICATE-----&lt;/code&gt; or &lt;code&gt;-----BEGIN X509 CRL-----&lt;/code&gt;. Convert DER to PEM first with &lt;code&gt;openssl x509&lt;/code&gt; or &lt;code&gt;openssl crl&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;radius.eap.methods has a method whose password only a chain can check, and there is no [auth] section&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;peap&lt;/code&gt; or &lt;code&gt;ttls&lt;/code&gt; is used, but there is no auth chain.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add &lt;code&gt;[auth]&lt;/code&gt; and a handler that compares passwords (&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;Chapter 07&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;radius client &#39;example&#39;: eap_methods is required when radius.eap.methods has more than one method; [] for a client without EAP&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; When two or more methods are offered, every client must write &lt;code&gt;eap_methods&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Write its methods for each client; write &lt;code&gt;[]&lt;/code&gt; for those that do not use EAP.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;radius client &#39;example&#39;: eap_methods has a method that radius.eap.methods does not&lt;/code&gt;, or &lt;code&gt;eap_methods needs [radius.eap]&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The client lists a method the server does not offer, or there is no &lt;code&gt;[radius.eap]&lt;/code&gt; at all.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Make &lt;code&gt;eap_methods&lt;/code&gt; a subset of &lt;code&gt;radius.eap.methods&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;radius.eap.fragment_size must be from 256 to 1400, not 1500&lt;/code&gt;, &lt;code&gt;radius.eap.session_timeout_ms must be greater than 0&lt;/code&gt;, or &lt;code&gt;radius.eap.max_sessions must be greater than 0&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; A value is out of range.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change it as the message says.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;radius.eap.&amp;lt;key&amp;gt;: not supported by this program (… needs rradius-enterprise)&lt;/code&gt;, or &lt;code&gt;radius.eap.methods: &amp;lt;method&amp;gt; is not supported by this program (… needs rradius-enterprise)&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The configuration has a key or method that exists only in the enterprise edition. The keys that are rejected this way are listed under &amp;ldquo;Settings the core does not support or that have no effect&amp;rdquo; in &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Delete them from the &lt;code&gt;rradiusd&lt;/code&gt; configuration; use only &lt;code&gt;tls&lt;/code&gt;, &lt;code&gt;peap&lt;/code&gt; and &lt;code&gt;ttls&lt;/code&gt; as methods.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;radius.eap.methods: &#39;md5&#39; is not a method this server offers; it has tls, peap and ttls&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The core has only the three methods &lt;code&gt;tls&lt;/code&gt;, &lt;code&gt;peap&lt;/code&gt; and &lt;code&gt;ttls&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Use one of these three.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;rradius-bench&lt;/code&gt; prints &lt;code&gt;TLS: received fatal alert: CertificateRevoked&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The client certificate is in &lt;code&gt;crl_file&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; This is the expected result. If the certificate should not be revoked, check whether the CRL is the latest one.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; Certificates issued by an intermediate CA always fail the handshake and the supplicant receives &lt;code&gt;UnknownCA&lt;/code&gt;, but without &lt;code&gt;crl_file&lt;/code&gt; they can log in.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;crl_file&lt;/code&gt; has only the root CA&amp;rsquo;s CRL. Every CA level in the chain needs a CRL.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Concatenate the CRL of every CA level into the same &lt;code&gt;crl_file&lt;/code&gt;, then send SIGHUP.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; After &lt;code&gt;crl_file&lt;/code&gt; is set, all devices are rejected, and the reason in the log is &lt;code&gt;invalid peer certificate: UnknownRevocationStatus&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; One CA level in the chain has no matching CRL (it was not put in &lt;code&gt;crl_file&lt;/code&gt;, or another CA&amp;rsquo;s was put in). The program does not turn on &amp;ldquo;let it through when the revocation status cannot be found&amp;rdquo;, so a missing status means rejection (&lt;code&gt;rradius-core/src/common/tls.rs&lt;/code&gt; only calls &lt;code&gt;with_crls&lt;/code&gt;, not &lt;code&gt;allow_unknown_revocation_status&lt;/code&gt;). The alert the supplicant receives varies with the chain; in the intermediate CA example in the previous test it was &lt;code&gt;UnknownCA&lt;/code&gt;. The phrase &lt;code&gt;UnknownRevocationStatus&lt;/code&gt; itself comes from the library&amp;rsquo;s error type and was not reproduced on real equipment separately.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Concatenate the CRLs of the root CA and of every intermediate CA into the same &lt;code&gt;crl_file&lt;/code&gt;, run &lt;code&gt;check&lt;/code&gt;, then send SIGHUP.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; A new CRL was put in, but revoked certificates can still log in.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; It has not been reloaded.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Send SIGHUP and confirm that the log has &lt;code&gt;configuration reloaded&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The log says &lt;code&gt;refused: the EAP Identity does not fit the certificate&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The EAP Identity the supplicant reports is not a DNS or email name on the certificate (when these names exist, the CN does not count).&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Make the supplicant&amp;rsquo;s Identity use a name on the certificate; when the supplicant can only report an anonymous name, set &lt;code&gt;match_identity = false&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The log says &lt;code&gt;refused: not authorized&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The handshake succeeded, but the auth chain or script did not accept the name. A common cause with the sql handler is that &lt;code&gt;certificate_query&lt;/code&gt; finds nothing, the device is disabled, or there is no &lt;code&gt;certificate_query&lt;/code&gt; and the password that &lt;code&gt;user_query&lt;/code&gt; finds is empty.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Look up the table with the &lt;code&gt;account&lt;/code&gt; name from the log.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The log says &lt;code&gt;auth chain: rejecting a request from client wlc: normalization changes a certificate&#39;s name in more than case&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;strip_realm&lt;/code&gt; in &lt;code&gt;[auth.username]&lt;/code&gt; would remove the realm of the certificate name.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Store the full name from the certificate in the table and let certificate logins use another auth chain without &lt;code&gt;strip_realm&lt;/code&gt;, or use certificates with DNS names.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; PEAP is always &lt;code&gt;reject&lt;/code&gt;, while the same account can log in with TTLS inner PAP.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The password is stored as a one-way hash such as bcrypt, which cannot be used to compare MS-CHAPv2.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Store &lt;code&gt;{nthash}&lt;/code&gt; for PEAP accounts (&lt;code&gt;accounts.scheme = &amp;quot;nthash&amp;quot;&lt;/code&gt;), or use TTLS.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The log says &lt;code&gt;failed: the peer asked only for methods this server does not offer&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The method the supplicant wants is not in this client&amp;rsquo;s &lt;code&gt;eap_methods&lt;/code&gt; (or the supplicant wants only EAP-MD5).&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add that method to &lt;code&gt;radius.eap.methods&lt;/code&gt; and to the client&amp;rsquo;s &lt;code&gt;eap_methods&lt;/code&gt;, or change the supplicant&amp;rsquo;s settings.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The log says &lt;code&gt;failed: the chain accepted the inner name without checking a password&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; TTLS inner PAP was accepted only by a lua handler that does not compare the password.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add a sql or ldap handler, or let the lua handler compare the password itself and set &lt;code&gt;verifies_password = true&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;rradius-bench&lt;/code&gt; prints &lt;code&gt;rradius-bench: --no-message-authenticator: EAP loads always carry Message-Authenticator (RFC 3579)&lt;/code&gt; and exits with code 3.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; EAP loads always carry &lt;code&gt;Message-Authenticator&lt;/code&gt;; the server also drops EAP requests that do not have it.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Do not add &lt;code&gt;--no-message-authenticator&lt;/code&gt; to an EAP load.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The supplicant keeps retrying, &lt;code&gt;rradius_eap_sessions_total{result=&amp;quot;timeout&amp;quot;}&lt;/code&gt; keeps rising, and the log has no &lt;code&gt;refused&lt;/code&gt; or &lt;code&gt;failed&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The supplicant gives up during the TLS handshake, most often because it does not trust the server certificate or the server name does not match.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Check the supplicant&amp;rsquo;s CA setting and server name; use &lt;code&gt;rradius-bench --ca-file … --tls-name …&lt;/code&gt; to confirm that the certificate the server sends verifies.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05 RADIUS service and NAS clients&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;08 LDAP and Active Directory&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;10 Writing policies in Lua&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13 Accounting and sessions&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../15-access-recipes/&#34; &gt;15 Scenarios: network access for organizations&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16 Clusters and high availability&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;19 Performance tuning and load testing&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../92-metrics-reference/&#34; &gt;Appendix C: Metrics reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../93-lua-reference/&#34; &gt;Appendix D: Lua API reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>12 TACACS&#43; device administration</title>
            <link>https://embark.systems/en/rradius/oss/12-tacacs/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/12-tacacs/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Let router and switch administrators log in with TACACS+&lt;/li&gt;&#xA;&lt;li&gt;Give privilege levels by role and limit the commands each person can run&lt;/li&gt;&#xA;&lt;li&gt;Authorize commands without writing a script, using authorize groups (&lt;code&gt;authorize_groups&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Record every login, logout and command in a table&lt;/li&gt;&#xA;&lt;li&gt;Read TACACS+ reply statuses and logs, and fix common problems&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: you have read &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;chapter 03&lt;/a&gt;, can start the server and test with &lt;code&gt;rradius-bench&lt;/code&gt;, and know what an auth chain is (&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;chapter 07&lt;/a&gt;). Authorization and accounting need a Lua script; see &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;chapter 10&lt;/a&gt; for the syntax. Everything in this chapter runs on one machine, with &lt;code&gt;rradius-bench&lt;/code&gt; acting as the device, so you do not need a real router.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#how-tacacs-differs-from-radius&#34; &gt;How TACACS+ differs from RADIUS&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#who-decides-a-request&#34; &gt;Who decides a request&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#reply-statuses&#34; &gt;Reply statuses&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#prepare-the-lab-environment&#34; &gt;Prepare the lab environment&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#reading-the-device-admin-configuration&#34; &gt;Reading the device-admin configuration&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#add-devices&#34; &gt;Add devices&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#start-and-log-in&#34; &gt;Start and log in&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#authentication-types-ascii-pap-chap-ms-chap&#34; &gt;Authentication types: ASCII, PAP, CHAP, MS-CHAP&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#enable-moving-to-a-higher-privilege-level&#34; &gt;enable: moving to a higher privilege level&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#without-an-auth-chain-authenticate-in-the-script&#34; &gt;Without an auth chain: authenticate in the script&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#authorize-with-a-script&#34; &gt;Authorize with a script&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#authorize-with-authorize-groups&#34; &gt;Authorize with authorize groups&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#record-every-command&#34; &gt;Record every command&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#messages-for-the-user-server_msg&#34; &gt;Messages for the user: server_msg&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#connection-management-and-limits&#34; &gt;Connection management and limits&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#when-the-database-is-unavailable&#34; &gt;When the database is unavailable&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#the-device-side&#34; &gt;The device side&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#watching-tacacs&#34; &gt;Watching TACACS+&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;how-tacacs-differs-from-radius&#34;&gt;How TACACS+ differs from RADIUS&#xA;&lt;/h2&gt;&lt;p&gt;RADIUS is mostly used to give users network access: Wi-Fi, VPN, broadband. TACACS+ (RFC 8907) is used to let administrators manage devices: log in to a switch CLI, decide whether they may run &lt;code&gt;configure&lt;/code&gt;, and record the commands they ran. rradius provides both in one program. &lt;code&gt;[radius]&lt;/code&gt; and &lt;code&gt;[tacacs]&lt;/code&gt; need at least one of them, and you can enable both.&lt;/p&gt;&#xA;&lt;p&gt;How they differ in use:&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;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;RADIUS&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;TACACS+&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;Transport&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;UDP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TCP; one connection can carry several sessions&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Encryption&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Only the password field&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The whole packet body is encrypted with the shared secret (the MD5 pad of RFC 8907)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;AAA&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Authentication and authorization in one reply&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Authentication, authorization and accounting are three separate requests&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Unit of authorization&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;All reply attributes are given at login&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The device can ask again for every 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;Settings in this chapter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius]&lt;/code&gt; (chapter 05)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[tacacs]&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 authorization and accounting requests that a device sends carry a list of AV pairs, for example &lt;code&gt;service=shell&lt;/code&gt;, &lt;code&gt;cmd=show&lt;/code&gt;, &lt;code&gt;cmd-arg=version&lt;/code&gt;. Authorization replies are AV pairs too, for example &lt;code&gt;priv-lvl=15&lt;/code&gt;. The device decides which AV pairs are meaningful; rradius only receives them, hands them to a script or to rules, and sends the result back.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; TACACS+ encryption relies only on the shared secret, so its strength is limited. Protect any path outside the management network with a VPN or another method.&lt;/p&gt;&#xA;&lt;p&gt;The obfuscation in RFC 8907 uses only MD5 and the shared secret. It is not a replacement for real encryption. Keep the devices and rradius on a management network, use long shared secrets (a warning is logged at startup for fewer than 16 bytes; chapter 20), and give each device its own (use several &lt;code&gt;[[tacacs.clients]]&lt;/code&gt; entries, each with its own &lt;code&gt;secret_file&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Enterprise edition:&lt;/strong&gt; The enterprise edition also provides TACACS+ over TLS (RFC 9887).&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;who-decides-a-request&#34;&gt;Who decides a request&#xA;&lt;/h2&gt;&lt;p&gt;When a device connects to the TACACS+ port, rradius first matches the source IP against &lt;code&gt;[[tacacs.clients]]&lt;/code&gt;. If nothing matches, it closes the connection at once without reading a single byte. After that, &lt;strong&gt;every packet&lt;/strong&gt; on the same connection is matched again, so if a reload changes the client list, connections that are already open follow the new list too.&lt;/p&gt;&#xA;&lt;p&gt;Once a client matches, each of the three request types is decided by a different component:&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;With &lt;code&gt;[auth]&lt;/code&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Without &lt;code&gt;[auth]&lt;/code&gt;&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&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The client&amp;rsquo;s auth chain: the &lt;code&gt;[auth.chains.&amp;lt;name&amp;gt;]&lt;/code&gt; named by its &lt;code&gt;auth&lt;/code&gt;, or the default chain if it names none&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The top-level script, with &lt;code&gt;phase&lt;/code&gt; set to &lt;code&gt;authentication&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;Authorization&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;If the client has &lt;code&gt;authorize_group&lt;/code&gt;: the rules of that authorize group. If not: the top-level script, with &lt;code&gt;phase&lt;/code&gt; set to &lt;code&gt;authorization&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same as the left column&lt;/td&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&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The top-level script, with &lt;code&gt;phase&lt;/code&gt; set to &lt;code&gt;accounting&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same as the left column&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;The &amp;ldquo;top-level script&amp;rdquo; is the one named by &lt;code&gt;[lua] script&lt;/code&gt;. In the script, the global variable &lt;code&gt;protocol&lt;/code&gt; is &lt;code&gt;&amp;quot;tacacs&amp;quot;&lt;/code&gt; and &lt;code&gt;client&lt;/code&gt; is the client&amp;rsquo;s name.&lt;/li&gt;&#xA;&lt;li&gt;The auth chain handles authentication only. Authorization and accounting always go through the script, unless authorization is handed to an authorize group.&lt;/li&gt;&#xA;&lt;li&gt;The same script also receives RADIUS requests (if you enabled &lt;code&gt;[radius]&lt;/code&gt;), so check &lt;code&gt;protocol&lt;/code&gt; at the top of the script.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;reply-statuses&#34;&gt;Reply statuses&#xA;&lt;/h2&gt;&lt;p&gt;A TACACS+ reply carries a status. These are the values you see in logs, in test tools and on devices:&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;Status&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;When rradius answers with 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;Authentication&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;PASS&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The auth chain or the script accepts&lt;/td&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&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;FAIL&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rejected: wrong password, unknown account, enable refused, password too long, and so 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;Authentication&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;GETUSER&lt;/code&gt;, &lt;code&gt;GETPASS&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;During an ASCII login: asks for the user name, asks for the password&lt;/td&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&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RESTART&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;This authentication type cannot be checked here; asks the device to try another 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;Authentication&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;ERROR&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Cannot decide: database unavailable, packet body not valid&lt;/td&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&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;PASS_ADD&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Allowed, with the reply AV pairs attached&lt;/td&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&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;FAIL&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Denied&lt;/td&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&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;ERROR&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Cannot decide: database unavailable, packet not valid, reply has more than 255 AV pairs&lt;/td&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&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;SUCCESS&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The script returned &lt;code&gt;accept&lt;/code&gt; and the record was written&lt;/td&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&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;ERROR&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The script did not 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 difference between &lt;code&gt;FAIL&lt;/code&gt; and &lt;code&gt;ERROR&lt;/code&gt; matters. &lt;code&gt;FAIL&lt;/code&gt; means &amp;ldquo;the answer is no&amp;rdquo;, and the device tells the administrator the login failed. &lt;code&gt;ERROR&lt;/code&gt; means &amp;ldquo;this server cannot answer right now&amp;rdquo;, and the device asks the next TACACS+ server in its configuration.&lt;/p&gt;&#xA;&lt;h2 id=&#34;prepare-the-lab-environment&#34;&gt;Prepare the lab environment&#xA;&lt;/h2&gt;&lt;p&gt;This chapter uses the device-admin scenario. It enables TACACS+ only: administrator accounts live in the &lt;code&gt;admins&lt;/code&gt; table of the cluster database, authentication goes to the sql handler, and authorization and accounting go to &lt;code&gt;tacacs.lua&lt;/code&gt;. In the source tree it is at &lt;code&gt;rradius-server/examples/scenarios/device-admin/&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;As in chapter 03, copy it to a working directory first. Run these commands from the root of the source 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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ export PATH&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$PWD&lt;span style=&#34;color:#e6db74&#34;&gt;/target/release:&lt;/span&gt;$PATH&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ mkdir -p ~/rradius-lab&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cp -R rradius-server/examples/scenarios/device-admin ~/rradius-lab/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ sed -i.bak &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;s#^dictionary = .*#dictionary = \&amp;#34;&lt;/span&gt;$PWD&lt;span style=&#34;color:#e6db74&#34;&gt;/share/dictionary\&amp;#34;#&amp;#34;&lt;/span&gt; ~/rradius-lab/device-admin/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cd ~/rradius-lab/device-admin&#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; f in raft api tacacs; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; openssl rand -hex &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt; &amp;gt; $f.secret; &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;$ chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;600&lt;/span&gt; *.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;The third &lt;code&gt;.secret&lt;/code&gt; is the shared secret of the TACACS+ client. The value that ships with the scenario is a public demo value, and &lt;code&gt;check&lt;/code&gt; warns &lt;code&gt;TACACS+ client &#39;core-routers&#39; has the public shared secret shipped with the examples&lt;/code&gt;, so replace it right away.&lt;/li&gt;&#xA;&lt;li&gt;If the quick-start from chapter 03 is still running, stop it first: the two scenarios use the same cluster ports and metrics port.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Then change three places in &lt;code&gt;rradius.toml&lt;/code&gt; so you can test locally:&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:#75715e&#34;&gt;# rradius.toml (only the parts to change)&lt;/span&gt;&#xA;&lt;/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;]&#xA;&lt;/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;127.0.0.1&amp;#34;&lt;/span&gt;        &lt;span style=&#34;color:#75715e&#34;&gt;# was &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;4949&lt;/span&gt;               &lt;span style=&#34;color:#75715e&#34;&gt;# was 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;idle_timeout_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;&#xA;&lt;/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;127.0.0.1&amp;#34;&lt;/span&gt;     &lt;span style=&#34;color:#75715e&#34;&gt;# was &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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;49 is the standard TACACS+ port. It is below 1024, so an ordinary account cannot listen on it, and the lab uses 4949 instead. When you need 49 in production, give the program the privilege it needs; see &lt;a class=&#34;link&#34; href=&#34;../02-install/&#34; &gt;chapter 02&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;rradius-bench&lt;/code&gt; connects from &lt;code&gt;127.0.0.1&lt;/code&gt;, so the client address is changed to that.&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;reading-the-device-admin-configuration&#34;&gt;Reading the device-admin configuration&#xA;&lt;/h2&gt;&lt;p&gt;Without the comments, the configuration file looks like this (the dictionary path on the first line has already been replaced by &lt;code&gt;sed&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:#75715e&#34;&gt;# rradius.toml&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;dictionary&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;…/share/dictionary&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;lua&lt;/span&gt;]&#xA;&lt;/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;tacacs.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;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;data_dir&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;data&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_raft_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;raft.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;secret_api_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;api.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;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;&#xA;&lt;/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;]&#xA;&lt;/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 admins 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;&#xA;&lt;/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;]&#xA;&lt;/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;127.0.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;port&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;4949&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;idle_timeout_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;&#xA;&lt;/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;127.0.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;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;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;metrics&lt;/span&gt;]&#xA;&lt;/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;127.0.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;port&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;9812&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Every key of &lt;code&gt;[tacacs]&lt;/code&gt; (see &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt; for the full types and descriptions):&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;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Reload&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;&lt;code&gt;tacacs.bind&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;0.0.0.0&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Address to listen 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;&lt;code&gt;tacacs.port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;49&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TCP port to listen 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;&lt;code&gt;tacacs.max_connections&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1024&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Limit on connections open at the same time; must be greater than 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;tacacs.max_connections_per_source&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;64&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Limit on connections open at the same time from one source address&lt;/td&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.idle_timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;300000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Close the connection if no complete packet arrives for this long, in milliseconds; must be greater than 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;tacacs.max_body_len&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;65536&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Limit on the packet body, in bytes; a larger body closes the connection; must be greater than 0 (0 fails at load time: &lt;code&gt;tacacs.max_body_len must be greater than 0&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.enable&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;deny&lt;/code&gt;&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;How to handle enable requests: &lt;code&gt;deny&lt;/code&gt; or &lt;code&gt;login&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.authorize_groups&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;empty&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;Authorize groups: a name mapped to a list of rules&lt;/td&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.clients&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;none, at least one&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;The devices allowed to connect&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Adding or removing the whole &lt;code&gt;[tacacs]&lt;/code&gt; section needs a restart.&lt;/p&gt;&#xA;&lt;p&gt;The demo accounts are in &lt;code&gt;migrations/2_demo_data.sql&lt;/code&gt;. Passwords are stored as bcrypt hashes:&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;Account&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Password&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Role&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Authorization result (decided by &lt;code&gt;tacacs.lua&lt;/code&gt;)&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;netadmin1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;netadmin1-password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;netadmin&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Privilege level 15, all 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;noc1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;noc1-password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;noc&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Privilege level 1, only the listed read-only commands&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;admins&lt;/code&gt; table also has the columns &lt;code&gt;role&lt;/code&gt; and &lt;code&gt;enabled&lt;/code&gt;. &lt;code&gt;user_query&lt;/code&gt; has &lt;code&gt;AND enabled = 1&lt;/code&gt;, so a disabled account is the same as one that does not exist.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; The accounts and passwords in &lt;code&gt;2_demo_data.sql&lt;/code&gt; are public demo values. When you turn this scenario into a production setup, delete this file and replace it with your own data.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;add-devices&#34;&gt;Add devices&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;[[tacacs.clients]]&lt;/code&gt; uses the same field definitions as &lt;code&gt;[[radius.clients]]&lt;/code&gt;, but a TACACS+ client uses only these:&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&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;&lt;code&gt;address&lt;/code&gt;&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;The device&amp;rsquo;s IP address, or a whole CIDR 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;name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Name used in logs and metrics; defaults to the value of &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;&lt;code&gt;secret&lt;/code&gt;, &lt;code&gt;secret_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;exactly one of the two&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The shared secret. The examples always use &lt;code&gt;secret_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;auth&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Which &lt;code&gt;[auth.chains.&amp;lt;name&amp;gt;]&lt;/code&gt; to use for this device&amp;rsquo;s authentication; the default chain if 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;&lt;code&gt;authorize_group&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Which authorize group&amp;rsquo;s rules to authorize with (see &lt;a class=&#34;link&#34; href=&#34;#authorize-with-authorize-groups&#34; &gt;Authorize with authorize groups&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;Any other field on a TACACS+ client makes &lt;code&gt;check&lt;/code&gt; fail, for example &lt;code&gt;tacacs client &#39;lab&#39;: eap_methods applies only to RADIUS clients&lt;/code&gt;. How addresses and networks are matched, and the warning for a short shared secret, are the same as for RADIUS clients; see &lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;chapter 05&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;All the devices in one network share one client entry, and so share one shared secret. If devices with different purposes (for example core routers and access switches in a machine room) need different secrets, different auth chains or different authorization rules, split them into separate entries:&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:#75715e&#34;&gt;# conf.d/tacacs-clients.toml&lt;/span&gt;&#xA;&lt;/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;core.secret&amp;#34;&lt;/span&gt;        &lt;span style=&#34;color:#75715e&#34;&gt;# openssl rand -hex 32 &amp;gt; core.secret&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/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;secret_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;access.secret&amp;#34;&lt;/span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;# openssl rand -hex 32 &amp;gt; access.secret&lt;/span&gt;&#xA;&lt;/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;staff&amp;#34;&lt;/span&gt;                     &lt;span style=&#34;color:#75715e&#34;&gt;# [auth.chains.staff] must exist first&lt;/span&gt;&#xA;&lt;/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;noc&amp;#34;&lt;/span&gt;            &lt;span style=&#34;color:#75715e&#34;&gt;# tacacs.authorize_groups.noc must exist first&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The client list can be reloaded: after you send &lt;code&gt;SIGHUP&lt;/code&gt;, both new connections and connections that are already open are matched against the new list. When a source address no longer matches the new list, its connection is closed when the next packet arrives.&lt;/p&gt;&#xA;&lt;h2 id=&#34;start-and-log-in&#34;&gt;Start and log in&#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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd serve --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::cli: cluster node 1 started&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::cli: cluster node 1 has caught up with the cluster&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::cli: Servers started. Press Ctrl+C to stop.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::tacacs: TACACS+ Server listening on 127.0.0.1:4949&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::metrics: Metrics listening on 127.0.0.1:9812&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The first start also logs two hiqlite lines, &lt;code&gt;No metadata exists inside the DB yet&lt;/code&gt;. This is normal (chapter 03).&lt;/p&gt;&#xA;&lt;p&gt;In another terminal, use &lt;code&gt;rradius-bench&lt;/code&gt; as the device and send one PAP login:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --tacacs-port &lt;span style=&#34;color:#ae81ff&#34;&gt;4949&lt;/span&gt; --secret &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 tacacs.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user netadmin1 --password netadmin1-password --load tacacs-pap,concurrency=1 --requests 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;measured 0.049 s after 0.000 s of warmup&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;tacacs-pap (fixed-concurrency): concurrency 1, 1 threads, 1 sockets over tcp, busiest worker 0%&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  tacacs-pap: 20/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    latency us: p50 48922.6, p90 48922.6, p99 48922.6, p99.9 48922.6, max 48922.6&#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;--tacacs-port&lt;/code&gt; is the TACACS+ port; the default is 49.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;accept 1&lt;/code&gt; means a &lt;code&gt;PASS&lt;/code&gt; was received; &lt;code&gt;reject 1&lt;/code&gt; is a &lt;code&gt;FAIL&lt;/code&gt;. The exit codes are the same as in chapter 03: 0 all accepted, 1 some rejected, 2 timeouts or invalid replies, 3 bad arguments and nothing sent.&lt;/li&gt;&#xA;&lt;li&gt;Passwords are stored as bcrypt, and checking one takes time, so the rate is only a few dozen per second. This is normal.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;code&gt;rradius-bench&lt;/code&gt; has five TACACS+ loads:&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;--load&lt;/code&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Request sent&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;tacacs-pap&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PAP authentication, with the user name and password in the first 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;&lt;code&gt;tacacs-chap&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;CHAP authentication; the first packet carries the PPP id, a 16-byte challenge and the response. The server&amp;rsquo;s auth chain must be able to check the password; otherwise the server answers &lt;code&gt;RESTART&lt;/code&gt; (see &amp;ldquo;When &lt;code&gt;RESTART&lt;/code&gt; is returned&amp;rdquo; above) and the bench counts it as &lt;code&gt;invalid&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-ascii&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;ASCII authentication: waits for &lt;code&gt;GETUSER&lt;/code&gt;, then for &lt;code&gt;GETPASS&lt;/code&gt;; three packets in all&lt;/td&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-author&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Authorization request, with the AV pairs &lt;code&gt;service=shell&lt;/code&gt;, &lt;code&gt;cmd=show&lt;/code&gt;, &lt;code&gt;cmd-arg=version&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-acct&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting START, with the AV pairs &lt;code&gt;task_id&lt;/code&gt;, &lt;code&gt;start_time&lt;/code&gt;, &lt;code&gt;service=shell&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;Try a few more:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --tacacs-port &lt;span style=&#34;color:#ae81ff&#34;&gt;4949&lt;/span&gt; --secret &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 tacacs.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user noc1 --password wrong --load tacacs-pap,concurrency=1 --requests 1&#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;  tacacs-pap: 25/s, sent 1, accept 0, reject 1, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;$ rradius-bench run --server 127.0.0.1 --tacacs-port &lt;span style=&#34;color:#ae81ff&#34;&gt;4949&lt;/span&gt; --secret &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 tacacs.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user noc1 --password noc1-password --load tacacs-ascii,concurrency=1 --requests 1&#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;  tacacs-ascii: 26/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    rounds per finished conversation: 3.0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The server log has one line per 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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;tacacs&amp;#34; client=&amp;#34;core-routers&amp;#34; source=127.0.0.1 user=&amp;#34;netadmin1&amp;#34; account=&amp;#34;netadmin1&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;sql&amp;#34; decision=&amp;#34;accept&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;tacacs&amp;#34; client=&amp;#34;core-routers&amp;#34; source=127.0.0.1 user=&amp;#34;noc1&amp;#34; account=&amp;#34;noc1&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;sql&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The format is the same as the RADIUS authentication record, except for &lt;code&gt;protocol=&amp;quot;tacacs&amp;quot;&lt;/code&gt;. Authorization and accounting do not write this record.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;rradius-bench&lt;/code&gt; does not print the content of authorization replies. To see the reply AV pairs, or to send requests in ways &lt;code&gt;rradius-bench&lt;/code&gt; cannot, use the &lt;code&gt;tacacs_client&lt;/code&gt; that comes with the Python package &lt;code&gt;tacacs_plus&lt;/code&gt; (&lt;code&gt;pip install tacacs_plus&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-console&#34; data-lang=&#34;console&#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;&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 tacacs.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;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;# enter 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;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; The &lt;code&gt;tacacs_client&lt;/code&gt; commands come from the previous manual and were not re-run for this version; its arguments may differ between versions, so go by &lt;code&gt;tacacs_client --help&lt;/code&gt;. The authorization results in the tables of this chapter were measured with a test client that can decode the reply (see &amp;ldquo;Authorize with a script&amp;rdquo;).&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;authentication-types-ascii-pap-chap-ms-chap&#34;&gt;Authentication types: ASCII, PAP, CHAP, MS-CHAP&#xA;&lt;/h2&gt;&lt;p&gt;When a device sends an authentication request, it says which type (&lt;code&gt;authen_type&lt;/code&gt;) it uses. How rradius handles each:&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;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Handling&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;ASCII&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Interactive login. If no user name came with the request, it answers &lt;code&gt;GETUSER&lt;/code&gt; (prompt &lt;code&gt;Username: &lt;/code&gt;), then &lt;code&gt;GETPASS&lt;/code&gt; (prompt &lt;code&gt;Password: &lt;/code&gt;, and asks the device not to echo the input). Only when it has both does it hand the login to the auth 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;PAP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The user name and password are in the first packet and go straight to the auth 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;CHAP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The auth chain must contain a handler that can check the password, and uses it to check the CHAP response&lt;/td&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-CHAP (v1), MS-CHAPv2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same as CHAP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;ARAP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Always answers &lt;code&gt;RESTART&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;strong&gt;Limits of ASCII login&lt;/strong&gt; (fixed values, not settings):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If the user name is blank, it asks again; three blank answers in a row get &lt;code&gt;FAIL&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;One connection can have at most 8 ASCII logins unfinished at the same time; any more get &lt;code&gt;ERROR&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;An ASCII login must finish within 60 seconds, or it is discarded.&lt;/li&gt;&#xA;&lt;li&gt;When the device sends ABORT, the login ends with no reply, and the connection stays open.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;A measured ASCII login, three questions and three answers:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;GETUSER  server_msg=&amp;#34;Username: &amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;GETPASS  server_msg=&amp;#34;Password: &amp;#34; (NOECHO)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PASS&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Length limits&lt;/strong&gt; (fixed values): a password can be at most 128 bytes, and the user name given as an answer in an ASCII login at most 255 bytes. Longer ones get &lt;code&gt;FAIL&lt;/code&gt; at once, never reach the auth chain, and do not count toward the failure count of &lt;code&gt;[auth.lockout]&lt;/code&gt;. The log records only the length, never the content:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::tacacs: TACACS+ authentication refused: the password is longer than 128 octets client=&amp;#34;core-routers&amp;#34; user=&amp;#34;lab1&amp;#34; authen_type=2 length=129&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::tacacs: TACACS+ authentication refused: the username is too long client=&amp;#34;core-routers&amp;#34; user=&amp;#34;&amp;#34; authen_type=1 length=256&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;CHAP and MS-CHAP need a password the server can compare.&lt;/strong&gt; A CHAP response is computed from the clear-text password, so the server must hold the clear text (or &lt;code&gt;{clear}&lt;/code&gt;) to check it; the MS-CHAP family needs the clear text or an NT hash. An account stored as bcrypt always fails a CHAP login, and the log shows &lt;code&gt;handler=&amp;quot;no_password_check&amp;quot;&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;tacacs&amp;#34; client=&amp;#34;core-routers&amp;#34; source=127.0.0.1 user=&amp;#34;netadmin1&amp;#34; account=&amp;#34;netadmin1&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;no_password_check&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Which password formats work for CHAP and MS-CHAP, and how &lt;code&gt;auth.allow_mschapv1&lt;/code&gt; turns on MS-CHAPv1 (off by default), are covered in &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;chapter 07&lt;/a&gt;. PAP and ASCII work with any format.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;When &lt;code&gt;RESTART&lt;/code&gt; is returned:&lt;/strong&gt; In the cases below, rradius answers &lt;code&gt;RESTART&lt;/code&gt; without running the auth chain or the script, so the device tries another type (usually PAP or ASCII):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The type is ARAP.&lt;/li&gt;&#xA;&lt;li&gt;The type is CHAP or an MS-CHAP type, but this client&amp;rsquo;s auth chain has no handler that can check the password (sql, ldap, or a lua handler with &lt;code&gt;verifies_password&lt;/code&gt; set). The same holds when there is no &lt;code&gt;[auth]&lt;/code&gt; and everything is left to the script: the script has no password to compare.&lt;/li&gt;&#xA;&lt;li&gt;The type is CHAP or an MS-CHAP type, and the request is an enable request.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;A CHAP challenge shorter than 8 bytes, an MS-CHAP challenge that is not 8 bytes, or an MS-CHAPv2 challenge that is not 16 bytes gets &lt;code&gt;FAIL&lt;/code&gt; and one log line.&lt;/p&gt;&#xA;&lt;p&gt;An authentication action that is not LOGIN (change password CHPASS, SENDPASS, SENDAUTH) always gets &lt;code&gt;FAIL&lt;/code&gt;, and the log says &lt;code&gt;TACACS+ authentication refused: only LOGIN is supported&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; MS-CHAP and MS-CHAPv2 were checked only against the code and the tests; nobody has logged in with a real device or client. PAP, CHAP and ASCII were measured locally with &lt;code&gt;rradius-bench&lt;/code&gt; (CHAP with the &lt;code&gt;tacacs-chap&lt;/code&gt; load against a server that has an auth chain: correct password &lt;code&gt;accept&lt;/code&gt;, wrong password &lt;code&gt;reject&lt;/code&gt;), but none of them was verified with a real device.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;enable-moving-to-a-higher-privilege-level&#34;&gt;enable: moving to a higher privilege level&#xA;&lt;/h2&gt;&lt;p&gt;When you type &lt;code&gt;enable&lt;/code&gt; on a device, the device sends an authentication request whose service field is ENABLE. &lt;code&gt;tacacs.enable&lt;/code&gt; decides the answer:&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;Value&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Behavior&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;deny&lt;/code&gt; (default)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Always answers &lt;code&gt;FAIL&lt;/code&gt;; does not ask for a password, run the auth chain or run 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;login&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Treated as an ordinary login; the auth chain or the script decides&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;With the default &lt;code&gt;deny&lt;/code&gt;, the log is:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::tacacs: TACACS+ enable request refused: [tacacs].enable is &amp;#34;deny&amp;#34; client=&amp;#34;core-routers&amp;#34; user=&amp;#34;netadmin1&amp;#34; priv_lvl=15&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Change it to &lt;code&gt;login&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:#75715e&#34;&gt;# rradius.toml (add one line in [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;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;bind&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;127.0.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;port&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;4949&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;idle_timeout_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;enable&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;login&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;enable&lt;/code&gt; can be reloaded. After you send &lt;code&gt;SIGHUP&lt;/code&gt;, &lt;code&gt;netadmin1&lt;/code&gt; gets &lt;code&gt;PASS&lt;/code&gt; when it enables with its own password, and &lt;code&gt;FAIL&lt;/code&gt; when the password is wrong. Any other value makes &lt;code&gt;check&lt;/code&gt; fail: &lt;code&gt;tacacs.enable must be &amp;quot;deny&amp;quot; or &amp;quot;login&amp;quot;, not &amp;quot;ask&amp;quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;login&lt;/code&gt; uses the login password, not a separate enable password. The auth chain and the script can see two numeric attributes, &lt;code&gt;authen_service&lt;/code&gt; (2 for enable) and &lt;code&gt;priv_lvl&lt;/code&gt; (the level to move to). To handle enable separately, look at these two values in a lua handler or in the script. The example in the next section does this.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Choosing on the device side:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Do not hand enable to rradius unless you set &lt;code&gt;enable = &amp;quot;login&amp;quot;&lt;/code&gt;. The default &lt;code&gt;deny&lt;/code&gt; answers &lt;code&gt;FAIL&lt;/code&gt;, and a device that receives &lt;code&gt;FAIL&lt;/code&gt; does not fall back to its local enable password.&lt;/li&gt;&#xA;&lt;li&gt;To keep the local enable password: on the device, use &lt;code&gt;aaa authentication enable default enable&lt;/code&gt;. The privilege level is decided by the &lt;code&gt;priv-lvl&lt;/code&gt; in the authorization reply at login, so administrators usually do not need enable.&lt;/li&gt;&#xA;&lt;li&gt;To use &lt;code&gt;login&lt;/code&gt;: on the device, use &lt;code&gt;aaa authentication enable default group RRADIUS enable&lt;/code&gt; (Cisco IOS syntax, not verified on real hardware). The administrator then enables with their own login password, so restrict it in the script or lua handler, for example by 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;h2 id=&#34;without-an-auth-chain-authenticate-in-the-script&#34;&gt;Without an auth chain: authenticate in the script&#xA;&lt;/h2&gt;&lt;p&gt;device-admin authenticates with the sql handler, which is the simplest way. Sometimes you want to look at more at authentication time, for example &amp;ldquo;only netadmin can enable&amp;rdquo;. In that case you can remove &lt;code&gt;[auth]&lt;/code&gt; and let the top-level script authenticate by itself.&lt;/p&gt;&#xA;&lt;p&gt;Delete the &lt;code&gt;[auth]&lt;/code&gt; and &lt;code&gt;[[auth.handlers]]&lt;/code&gt; sections from &lt;code&gt;rradius.toml&lt;/code&gt;, add &lt;code&gt;enable = &amp;quot;login&amp;quot;&lt;/code&gt; to &lt;code&gt;[tacacs]&lt;/code&gt;, and then add the authentication part to &lt;code&gt;tacacs.lua&lt;/code&gt; after &lt;code&gt;local user = get_attr(&#39;user&#39;)&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-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;-- tacacs.lua (added after local user = get_attr(&amp;#39;user&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;if&lt;/span&gt; phase &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;authentication&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;  &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 password, role FROM admins WHERE username = ? AND enabled = 1&amp;#34;&lt;/span&gt;, {user})&#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; account &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; rows[&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;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;not&lt;/span&gt; account &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;not&lt;/span&gt; password_verify(account.password, get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;data&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;    &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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#75715e&#34;&gt;-- enable (authen_service 2) only for netadmin&lt;/span&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; get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;authen_service&amp;#39;&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;and&lt;/span&gt; account.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:#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;server_msg&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;enable is for netadmin only&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;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;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;During authentication, &lt;code&gt;user&lt;/code&gt; in the script is the account and &lt;code&gt;data&lt;/code&gt; is the password (for PAP, the password in the first packet; for ASCII, the answer to &lt;code&gt;GETPASS&lt;/code&gt;). &lt;code&gt;authen_type&lt;/code&gt; is the number of the authentication type (1 for ASCII, 2 for PAP).&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;password_verify&lt;/code&gt; checks the stored password the same way the auth chain does, and works with bcrypt and the other formats (chapter 10).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Measured after sending &lt;code&gt;SIGHUP&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;Request&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Reply&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;noc1&lt;/code&gt; logs in with PAP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;PASS&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;noc1&lt;/code&gt; with a wrong password&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;FAIL&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;netadmin1&lt;/code&gt; logs in with ASCII&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;GETUSER&lt;/code&gt;, &lt;code&gt;GETPASS&lt;/code&gt;, &lt;code&gt;PASS&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;noc1&lt;/code&gt; enable&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;FAIL&lt;/code&gt;, with &lt;code&gt;server_msg&lt;/code&gt; set to &lt;code&gt;enable is for netadmin only&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;netadmin1&lt;/code&gt; enable&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;PASS&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;Anyone with CHAP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RESTART&lt;/code&gt; (the script has no password to compare CHAP against)&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 record in the log becomes &lt;code&gt;chain=&amp;quot;script&amp;quot; handler=&amp;quot;script&amp;quot;&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;tacacs&amp;#34; client=&amp;#34;core-routers&amp;#34; source=127.0.0.1 user=&amp;#34;noc1&amp;#34; account=&amp;#34;noc1&amp;#34; chain=&amp;#34;script&amp;#34; handler=&amp;#34;script&amp;#34; decision=&amp;#34;accept&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; When you authenticate in the script, the login failure lockout of &lt;code&gt;[auth.lockout]&lt;/code&gt; does not apply: &lt;code&gt;password_verify&lt;/code&gt; does not count failures. When you need lockout, use an auth chain (chapter 07).&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;When only some devices need special authentication rules, you do not have to remove &lt;code&gt;[auth]&lt;/code&gt; altogether. Define a chain with a lua handler in &lt;code&gt;[auth.chains.&amp;lt;name&amp;gt;]&lt;/code&gt; and let the clients of those devices pick it with &lt;code&gt;auth&lt;/code&gt; (chapter 07).&lt;/p&gt;&#xA;&lt;h2 id=&#34;authorize-with-a-script&#34;&gt;Authorize with a script&#xA;&lt;/h2&gt;&lt;p&gt;When an administrator has logged in and the device wants to open a shell, it sends an authorization request; after that it sends one more for every command (if the device is set up for command authorization). When the client has no &lt;code&gt;authorize_group&lt;/code&gt;, these requests go to the top-level script, with &lt;code&gt;phase&lt;/code&gt; set to &lt;code&gt;authorization&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The attributes the script can see:&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;Attribute&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Content&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;user&lt;/code&gt;, &lt;code&gt;port&lt;/code&gt;, &lt;code&gt;rem_addr&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The account, the terminal name on the device, and the address the administrator connected from&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Each AV pair&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Read by name, for example &lt;code&gt;get_attr(&#39;service&#39;)&lt;/code&gt; is &lt;code&gt;shell&lt;/code&gt;. &lt;code&gt;name=value&lt;/code&gt; and &lt;code&gt;name*value&lt;/code&gt; are read the same way&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Repeated AV pairs&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Use &lt;code&gt;get_attrs&lt;/code&gt;, for example &lt;code&gt;get_attrs(&#39;cmd-arg&#39;)&lt;/code&gt; returns all the arguments&lt;/td&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;priv_lvl&lt;/code&gt;, &lt;code&gt;authen_method&lt;/code&gt;, &lt;code&gt;authen_type&lt;/code&gt;, &lt;code&gt;authen_service&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Numbers from the request header&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;What the script returns:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;accept&lt;/code&gt;: answers &lt;code&gt;PASS_ADD&lt;/code&gt;. Each attribute the script set with &lt;code&gt;set_attr&lt;/code&gt; becomes one &lt;code&gt;name=value&lt;/code&gt; AV pair in the reply.&lt;/li&gt;&#xA;&lt;li&gt;Anything else: answers &lt;code&gt;FAIL&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This is how device-admin&amp;rsquo;s &lt;code&gt;tacacs.lua&lt;/code&gt; decides (the key parts):&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;-- tacacs.lua (excerpt)&lt;/span&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; protocol &lt;span style=&#34;color:#f92672&#34;&gt;~=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;tacacs&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;  &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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;local&lt;/span&gt; user &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;user&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;-- … (accounting part omitted)&lt;/span&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; 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 role FROM admins WHERE username = ? AND enabled = 1&amp;#34;&lt;/span&gt;, {user})&#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; role &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; rows[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;and&lt;/span&gt; rows[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;].role&#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; role &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;service&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;shell&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;  &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;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:#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;)   &lt;span style=&#34;color:#75715e&#34;&gt;-- opening a shell: return 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;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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&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:#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:#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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;-- noc: allow only the commands listed in READ_ONLY; show may be followed only by items listed in SHOW&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;No &lt;code&gt;cmd&lt;/code&gt; (or an empty &lt;code&gt;cmd&lt;/code&gt;) means the device wants to open a shell, and the script returns the privilege level.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;noc&lt;/code&gt; uses an allow list, not a deny list: commands can be written in too many ways to list them all.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Measured results (sent with a test client that can decode the reply AV pairs; &lt;code&gt;rradius-bench&lt;/code&gt; does not print the reply content):&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;Account&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;AV pairs sent&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Reply&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;netadmin1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;service=shell cmd=&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;PASS_ADD&lt;/code&gt;, &lt;code&gt;priv-lvl=15&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;noc1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;service=shell cmd=&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;PASS_ADD&lt;/code&gt;, &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;noc1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;service=shell cmd=show cmd-arg=version&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;PASS_ADD&lt;/code&gt;, no AV pairs&lt;/td&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;noc1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;service=shell cmd=show cmd-arg=running-config&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;FAIL&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;noc1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;service=shell cmd=configure&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;FAIL&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;You can also test with &lt;code&gt;rradius-bench&lt;/code&gt;, which sends &lt;code&gt;show version&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --tacacs-port &lt;span style=&#34;color:#ae81ff&#34;&gt;4949&lt;/span&gt; --secret &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 tacacs.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user noc1 --load tacacs-author,concurrency=1 --requests 1&#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;  tacacs-author: 2006/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;$ rradius-bench run --server 127.0.0.1 --tacacs-port &lt;span style=&#34;color:#ae81ff&#34;&gt;4949&lt;/span&gt; --secret &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 tacacs.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user nobody --load tacacs-author,concurrency=1 --requests 1&#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;  tacacs-author: 5916/s, sent 1, accept 0, reject 1, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;tacacs-author&lt;/code&gt; does not need &lt;code&gt;--password&lt;/code&gt;: an authorization request carries no password, and the device sends it only after a successful login.&lt;/p&gt;&#xA;&lt;p&gt;Limits on the reply (fixed values): one AV pair, name included, is at most 255 bytes, and a &lt;code&gt;set_attr&lt;/code&gt; with a value that is too long makes the script fail. One reply holds at most 255 AV pairs; more than that answers &lt;code&gt;ERROR&lt;/code&gt; and logs &lt;code&gt;has … AV pairs, more than the 255 a reply holds&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;authorize-with-authorize-groups&#34;&gt;Authorize with authorize groups&#xA;&lt;/h2&gt;&lt;p&gt;Many devices need only simple rules: &amp;ldquo;on this group of switches, only these commands are allowed&amp;rdquo;. For this you can skip the script and use an authorize group.&lt;/p&gt;&#xA;&lt;p&gt;Authorize groups are written in &lt;code&gt;[tacacs.authorize_groups]&lt;/code&gt;: each key is a group name, and its value is an array of rule strings. A client picks a group with &lt;code&gt;authorize_group&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:#75715e&#34;&gt;# rradius.toml (add after [tacacs], before [[tacacs.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;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;noc&lt;/span&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;#34;permit service=shell cmd= {priv-lvl=1 autocmd=\&amp;#34;show users\&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:#e6db74&#34;&gt;&amp;#34;deny service=shell cmd=configure&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:#e6db74&#34;&gt;&amp;#34;permit service=shell cmd=show cmd-arg=(version|interfaces|clock)&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:#e6db74&#34;&gt;&amp;#34;permit service=shell cmd=(ping|traceroute|exit)&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;&#xA;&lt;/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;127.0.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;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;noc&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;How each rule is written:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;permit|deny  pattern pattern …  {reply AV pairs …}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;The first word is &lt;code&gt;permit&lt;/code&gt; or &lt;code&gt;deny&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Then come zero or more patterns, separated by spaces. Each pattern is a regular expression that must match &lt;strong&gt;the whole&lt;/strong&gt; of one AV pair in the request (&lt;code&gt;name=value&lt;/code&gt; or &lt;code&gt;name*value&lt;/code&gt;, as the device sent it). &lt;code&gt;cmd=&lt;/code&gt; matches only an empty &lt;code&gt;cmd=&lt;/code&gt;, never &lt;code&gt;cmd=show&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;A rule applies only if each of its patterns matches some AV pair.&lt;/li&gt;&#xA;&lt;li&gt;At the end you can add a &lt;code&gt;{…}&lt;/code&gt; block with the AV pairs to send back for &lt;code&gt;permit&lt;/code&gt;, separated by spaces and sent in the order written. &lt;code&gt;deny&lt;/code&gt; cannot have a reply.&lt;/li&gt;&#xA;&lt;li&gt;Put a value that contains a space or &lt;code&gt;}&lt;/code&gt; in double quotes, for example &lt;code&gt;autocmd=&amp;quot;show users&amp;quot;&lt;/code&gt;. The double quotes are sent to the device as they are.&lt;/li&gt;&#xA;&lt;li&gt;Patterns do not understand double quotes, and they do not match the three fields &lt;code&gt;user&lt;/code&gt;, &lt;code&gt;port&lt;/code&gt; and &lt;code&gt;rem_addr&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;How it decides: it looks, in the order written, for &lt;strong&gt;the first rule that applies&lt;/strong&gt;. If it is &lt;code&gt;permit&lt;/code&gt;, the answer is &lt;code&gt;PASS_ADD&lt;/code&gt; with its reply; if it is &lt;code&gt;deny&lt;/code&gt;, the answer is &lt;code&gt;FAIL&lt;/code&gt;; if no rule applies, the answer is also &lt;code&gt;FAIL&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Measured results for the group above:&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;AV pairs sent&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;First rule that applies&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Reply&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;service=shell cmd=&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rule 1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;PASS_ADD&lt;/code&gt;, &lt;code&gt;priv-lvl=1&lt;/code&gt;, &lt;code&gt;autocmd=&amp;quot;show users&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;service=shell cmd=configure&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rule 2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;FAIL&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;service=shell cmd=show cmd-arg=version&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rule 3&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;PASS_ADD&lt;/code&gt;, no AV pairs&lt;/td&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;service=shell cmd=show cmd-arg=running-config&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;None&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;FAIL&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;service=shell cmd=ping cmd-arg=192.0.2.1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rule 4&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;PASS_ADD&lt;/code&gt;, no AV pairs&lt;/td&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;service=ppp protocol=ip&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;None&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;FAIL&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;Things to know:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For a client with &lt;code&gt;authorize_group&lt;/code&gt;, authorization is decided &lt;strong&gt;entirely&lt;/strong&gt; by the rules. The top-level script does not run, so there is no &lt;code&gt;server_msg&lt;/code&gt; either. Authentication and accounting work as before.&lt;/li&gt;&#xA;&lt;li&gt;An authorize group is a group of devices, not a user group in LDAP or a database. The rules cannot see who is running the command: on the same device, &lt;code&gt;netadmin1&lt;/code&gt; and &lt;code&gt;noc1&lt;/code&gt; get the same answer. To authorize by the user&amp;rsquo;s role, use the script from the previous section.&lt;/li&gt;&#xA;&lt;li&gt;Groups can be reloaded, and are replaced together with the client list. After you change the rules and send &lt;code&gt;SIGHUP&lt;/code&gt;, the next authorization request follows the new rules (measured).&lt;/li&gt;&#xA;&lt;li&gt;A group can have no rules, which means everything is denied.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Points to watch when writing rules:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Use an allow list, not a deny list.&lt;/strong&gt; Rules match only the AV pairs the device sends. A subcommand that is not listed (for example &lt;code&gt;show tech-support&lt;/code&gt;) and an abbreviation typed on the device (for example &lt;code&gt;show run&lt;/code&gt; instead of &lt;code&gt;show running-config&lt;/code&gt;) are not caught by &lt;code&gt;deny cmd=show cmd-arg=running-config&lt;/code&gt;, but they match &lt;code&gt;permit cmd=show&lt;/code&gt;. The &lt;code&gt;noc&lt;/code&gt; group above permits only the listed commands, and everything else falls into &amp;ldquo;no rule applies&amp;rdquo; and is denied, which is safer. What a device actually sends for an abbreviation depends on the device (not verified on real hardware).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Arguments are not matched one by one.&lt;/strong&gt; Each pattern of a rule applies as soon as it matches &lt;strong&gt;any&lt;/strong&gt; AV pair in the request, so &lt;code&gt;cmd-arg=interfaces&lt;/code&gt; also lets through &lt;code&gt;show interfaces&lt;/code&gt; followed by other arguments. For a device to be really read-only, rely on what the privilege level on the device itself can do; the authorization rules are a second line of defense.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;A device may send &lt;code&gt;cmd*&lt;/code&gt; when it opens a shell.&lt;/strong&gt; The separator in an AV pair is &lt;code&gt;=&lt;/code&gt; (mandatory) or &lt;code&gt;*&lt;/code&gt; (optional), and the match follows what the device sent. When the device sends &lt;code&gt;cmd*&lt;/code&gt; (with an empty value), write the pattern as &lt;code&gt;cmd\*&lt;/code&gt;; writing &lt;code&gt;cmd=&lt;/code&gt; does not apply:&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Always write rules in single quotes.&lt;/strong&gt; &lt;code&gt;\*&lt;/code&gt; is an invalid escape in a TOML double-quoted string, so the configuration file cannot be read. A single-quoted string does no escape processing and hands the backslash to the pattern unchanged. If you write the rules above in double quotes, &lt;code&gt;check&lt;/code&gt; fails with &lt;code&gt;rradius.toml: line 39: missing escaped value, expected …&lt;/code&gt; (followed by the list of valid escape characters; the line number is the line in your file). The rules earlier in this section use double quotes because they contain only &lt;code&gt;\&amp;quot;&lt;/code&gt;, an escape TOML already understands; to let the pattern see a backslash, use single quotes.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;When a rule is wrong, startup, reload and &lt;code&gt;check&lt;/code&gt; all fail and name the group and the rule number (counted from 1). When a reload fails, the server keeps running with its previous configuration:&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 you wrote&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Error message&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;allow service=shell&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;tacacs.authorize_groups.ops: rule 1: starts with &#39;allow&#39;; it has to start with permit or deny&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;permit service=shell cmd=(show&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;tacacs.authorize_groups.ops: rule 1: pattern &#39;cmd=(show&#39; is not a valid regular expression: …&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;permit service=shell {priv-lvl=15&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;tacacs.authorize_groups.ops: rule 1: the reply has no closing }&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;permit service=shell {priv-lvl=15} x&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;tacacs.authorize_groups.ops: rule 1: text after the reply&#39;s closing }: &#39; x&#39;&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;deny service=shell {priv-lvl=15}&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;tacacs.authorize_groups.ops: rule 1: deny cannot have a reply: FAIL carries no AV pairs&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;permit service=shell {priv-lvl}&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;tacacs.authorize_groups.ops: rule 1: reply AV pair &#39;priv-lvl&#39; has no = or *&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;Unpaired double quotes in the reply&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;tacacs.authorize_groups.ops: rule 1: the reply&#39;s double quotes are not paired&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;authorize_group = &amp;quot;nosuch&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;tacacs client &#39;lab&#39;: unknown authorize_group &#39;nosuch&#39; (no tacacs.authorize_groups.nosuch)&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;authorize_group&lt;/code&gt; in &lt;code&gt;[[radius.clients]]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius client &#39;&amp;lt;name&amp;gt;&#39;: authorize_group applies only to TACACS+ clients&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;Each message is also prefixed with the configuration file name, for example &lt;code&gt;rradius.toml: &lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;record-every-command&#34;&gt;Record every command&#xA;&lt;/h2&gt;&lt;p&gt;When a device is set up for command accounting, it sends an accounting request for every login, every logout and every command. rradius hands it to the top-level script, with &lt;code&gt;phase&lt;/code&gt; set to &lt;code&gt;accounting&lt;/code&gt;. Only when the script returns &lt;code&gt;accept&lt;/code&gt; does it answer &lt;code&gt;SUCCESS&lt;/code&gt;; any other result answers &lt;code&gt;ERROR&lt;/code&gt;, so the device knows the record was not saved.&lt;/p&gt;&#xA;&lt;p&gt;The AV pairs in an accounting request are decided by the device. Common ones are:&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;AV pair&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;&lt;code&gt;task_id&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The number of this task; the start and the stop use the same 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;code&gt;start_time&lt;/code&gt;, &lt;code&gt;stop_time&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The start or stop time; a request with neither is an intermediate update (watchdog)&lt;/td&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;cmd&lt;/code&gt;, &lt;code&gt;cmd-arg&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The command and its arguments; there can be several arguments&lt;/td&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;service&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;For example &lt;code&gt;shell&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;elapsed_time&lt;/code&gt; and others&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Depends on the device&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;device-admin writes them into the &lt;code&gt;tacacs_log&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-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;-- tacacs.lua (excerpt)&lt;/span&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; phase &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;accounting&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;  &lt;span style=&#34;color:#66d9ef&#34;&gt;local&lt;/span&gt; event &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; (get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;stop_time&amp;#39;&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;and&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;stop&amp;#39;&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; (get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;start_time&amp;#39;&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;and&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;start&amp;#39;&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;update&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;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;) &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&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;for&lt;/span&gt; _, arg &lt;span style=&#34;color:#66d9ef&#34;&gt;in&lt;/span&gt; ipairs(get_attrs(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;cmd-arg&amp;#39;&lt;/span&gt;)) &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&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; arg &lt;span style=&#34;color:#f92672&#34;&gt;~=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;lt;cr&amp;gt;&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;      cmd &lt;span style=&#34;color:#f92672&#34;&gt;=&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:#f92672&#34;&gt;..&lt;/span&gt; arg&#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;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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  sql_execute(&lt;span style=&#34;color:#e6db74&#34;&gt;[[INSERT OR IGNORE INTO tacacs_log (device, task_id, event, username, rem_addr, cmd, logged)&#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;                VALUES (?, ?, ?, ?, ?, ?, ?)]]&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {client, get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;task_id&amp;#39;&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;#39;&lt;/span&gt;, event, user &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;#39;&lt;/span&gt;, get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;rem_addr&amp;#39;&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;#39;&lt;/span&gt;, cmd, 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;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;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;-- migrations/1_schema.sql (excerpt)&#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; tacacs_log (&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  device TEXT &lt;span style=&#34;color:#66d9ef&#34;&gt;NOT&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;NULL&lt;/span&gt;,          &lt;span style=&#34;color:#75715e&#34;&gt;-- name of the [[tacacs.clients]] entry&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  task_id TEXT &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;  event TEXT &lt;span style=&#34;color:#66d9ef&#34;&gt;NOT&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;NULL&lt;/span&gt;,           &lt;span style=&#34;color:#75715e&#34;&gt;-- &amp;#39;start&amp;#39;, &amp;#39;stop&amp;#39; or &amp;#39;update&amp;#39;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  username TEXT &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;  rem_addr TEXT &lt;span style=&#34;color:#66d9ef&#34;&gt;NOT&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;NULL&lt;/span&gt;,        &lt;span style=&#34;color:#75715e&#34;&gt;-- where the administrator connected to the device from&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  cmd TEXT &lt;span style=&#34;color:#66d9ef&#34;&gt;NOT&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;NULL&lt;/span&gt;,             &lt;span style=&#34;color:#75715e&#34;&gt;-- the full command; an empty string for login and logout&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  logged 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;PRIMARY&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;KEY&lt;/span&gt; (device, task_id, event)&#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;CREATE&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;INDEX&lt;/span&gt; tacacs_log_user &lt;span style=&#34;color:#66d9ef&#34;&gt;ON&lt;/span&gt; tacacs_log (username, logged);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;The command and its arguments are sent separately; the script puts them back into one line and drops the &lt;code&gt;&amp;lt;cr&amp;gt;&lt;/code&gt; the device adds.&lt;/li&gt;&#xA;&lt;li&gt;The primary key is &lt;code&gt;(device, task_id, event)&lt;/code&gt;, together with &lt;code&gt;INSERT OR IGNORE&lt;/code&gt;: when a device resends the same record, only one row stays in the table. An accounting script must be safe to run more than once; the reason is in &lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;chapter 13&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;tacacs_log&lt;/code&gt; grows without limit, and rradius never cleans it up.&lt;/strong&gt; Every command is one row. Delete old rows regularly, the same way as for accounting tables; see &lt;a class=&#34;link&#34; href=&#34;../18-operations/&#34; &gt;chapter 18&lt;/a&gt;. How long to keep them depends on your company&amp;rsquo;s audit requirements; check before you delete.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;A measured accounting request for &lt;code&gt;show version&lt;/code&gt; (AV pairs: &lt;code&gt;task_id=42 start_time=1795000000 service=shell cmd=show cmd-arg=version cmd-arg=&amp;lt;cr&amp;gt;&lt;/code&gt;) got the reply &lt;code&gt;SUCCESS&lt;/code&gt;, and this row appeared in the 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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;device=core-routers&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;task_id=42&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;event=start&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;username=noc1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rem_addr=192.0.2.10&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cmd=show version&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;logged=1795384714&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Send it with &lt;code&gt;rradius-bench&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --tacacs-port &lt;span style=&#34;color:#ae81ff&#34;&gt;4949&lt;/span&gt; --secret &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 tacacs.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user noc1 --load tacacs-acct,concurrency=1 --requests 1&#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;  tacacs-acct: 3185/s, sent 1, accept 0, reject 0, challenge 0, accounting 1, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;accounting 1&lt;/code&gt; means a &lt;code&gt;SUCCESS&lt;/code&gt; was received.&lt;/p&gt;&#xA;&lt;p&gt;To turn these records into metrics such as &amp;ldquo;how many commands each person ran per day&amp;rdquo;, use named queries (&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;chapter 09&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; TACACS+ accounting has no accounting spool, and is not written to &lt;code&gt;[radius.accounting_log]&lt;/code&gt;: both of those handle RADIUS accounting only. When the database cannot be written, the script fails and the device receives &lt;code&gt;ERROR&lt;/code&gt;; it is up to the device to resend or to try the next server.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;messages-for-the-user-server_msg&#34;&gt;Messages for the user: server_msg&#xA;&lt;/h2&gt;&lt;p&gt;A value set by the script with &lt;code&gt;set_attr(&#39;server_msg&#39;, &#39;…&#39;)&lt;/code&gt; is put into the &lt;code&gt;server_msg&lt;/code&gt; field of the reply, and most devices show it to the administrator. It applies to:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The &lt;code&gt;PASS&lt;/code&gt; and &lt;code&gt;FAIL&lt;/code&gt; of an authentication reply. When authentication is accepted, a &lt;code&gt;server_msg&lt;/code&gt; set by a handler of the auth chain counts too.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;PASS_ADD&lt;/code&gt; and &lt;code&gt;FAIL&lt;/code&gt; of an authorization reply. It does not become an AV pair and does not count toward the 255-byte limit on AV pairs.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;SUCCESS&lt;/code&gt; and &lt;code&gt;ERROR&lt;/code&gt; of an accounting reply.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If it is set several times, the last value is used. A value longer than 1024 bytes is not sent; the log gets one ERROR line, but the decision stays as it was. An authorization decided by an authorize group has no &lt;code&gt;server_msg&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For example, add one line in &lt;code&gt;tacacs.lua&lt;/code&gt; before it rejects a &lt;code&gt;noc&lt;/code&gt; command:&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;-- tacacs.lua (excerpt)&lt;/span&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; READ_ONLY[cmd] &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;server_msg&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;noc accounts may only look&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;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;p&gt;In the measured run, &lt;code&gt;configure&lt;/code&gt; from a &lt;code&gt;noc&lt;/code&gt; account got &lt;code&gt;FAIL&lt;/code&gt;, with &lt;code&gt;server_msg&lt;/code&gt; set to &lt;code&gt;noc accounts may only look&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;connection-management-and-limits&#34;&gt;Connection management and limits&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Single-connection mode.&lt;/strong&gt; When a device sets the single-connection flag in the first packet of a connection, rradius sets the same flag in its first reply, which means it agrees to run several sessions on that connection. Later replies do not carry the flag. With or without the flag, rradius accepts several sessions on the same connection. Measured: the flag in the first reply is &lt;code&gt;0x4&lt;/code&gt;, in the second &lt;code&gt;0x0&lt;/code&gt;, and both logins are &lt;code&gt;PASS&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Connection limits.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;max_connections&lt;/code&gt;: the limit on all connections. At the limit, a new connection is closed at once.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;max_connections_per_source&lt;/code&gt;: the limit for one source address. An IPv4 address and its IPv4-mapped IPv6 address count as one source.&lt;/li&gt;&#xA;&lt;li&gt;Connections that are not from a client in the configuration do not count toward either limit.&lt;/li&gt;&#xA;&lt;li&gt;A closed connection writes at most one log line per second and is counted in &lt;code&gt;rradius_tacacs_connections_total{result=&amp;quot;refused&amp;quot;}&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Measured with &lt;code&gt;max_connections_per_source = 1&lt;/code&gt; and two connections at the same time, the second one is closed:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::tacacs: TACACS+ connection from 127.0.0.1 closed: it already holds max_connections_per_source = 1 connections&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; When many devices connect from the same address through NAT, the default of 64 may not be enough; raise &lt;code&gt;max_connections_per_source&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Idle and write timeouts.&lt;/strong&gt; A connection that receives no complete packet for &lt;code&gt;idle_timeout_ms&lt;/code&gt; (default 300000 ms, which is 5 minutes) is closed; the time a script spends running is not counted as idle. A connection is also closed when a reply cannot be written within 10 seconds (fixed value). A closed connection gives up its place in &lt;code&gt;max_connections&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Packet checks.&lt;/strong&gt; In these cases the connection is closed without a reply:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The packet body is longer than &lt;code&gt;max_body_len&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The version is not the TACACS+ major version.&lt;/li&gt;&#xA;&lt;li&gt;The sequence number is even or 255 (RFC 8907 says the device sends only odd numbers).&lt;/li&gt;&#xA;&lt;li&gt;The &amp;ldquo;unencrypted&amp;rdquo; flag is set: rradius always needs a shared secret.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;When a packet can be decoded but a field is not valid (privilege level above 15, authentication type above 6, service above 9, an accounting request with none of the START, STOP or WATCHDOG flags, and so on), rradius answers &lt;code&gt;ERROR&lt;/code&gt; for that type of request without running the auth chain or the script, and counts it in &lt;code&gt;rradius_tacacs_malformed_total&lt;/code&gt;. When the body cannot be decoded at all (most often because the shared secrets differ), it answers &lt;code&gt;ERROR&lt;/code&gt; and then closes the connection; see &lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;when-the-database-is-unavailable&#34;&gt;When the database is unavailable&#xA;&lt;/h2&gt;&lt;p&gt;When the cluster database is unavailable (for example a call times out, or the script has to write and the cluster has no leader) and a decision cannot be made, authentication and authorization answer &lt;code&gt;ERROR&lt;/code&gt;, not &lt;code&gt;FAIL&lt;/code&gt;, so the device asks the next TACACS+ server. When the data itself says &amp;ldquo;no&amp;rdquo; (unknown account, wrong password), the answer is still &lt;code&gt;FAIL&lt;/code&gt;. The log:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;TACACS+ authentication for client &amp;lt;name&amp;gt; answered ERROR: the authentication backend could not be used&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;TACACS+ authorization for client &amp;lt;name&amp;gt; answered ERROR: the cluster database could not be used&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When the cluster has &lt;code&gt;[cluster] stop_without_leader_ms&lt;/code&gt; set and this node has had no leader for longer than that, authentication and authorization always answer &lt;code&gt;ERROR&lt;/code&gt;, and the script does not even run. Accounting is still handed to the script; when the script cannot write to the database it answers &lt;code&gt;ERROR&lt;/code&gt;. For this setting and the behavior of the cluster, see &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;chapter 16&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So set at least two TACACS+ servers on the device, ideally pointing to different nodes of the cluster.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; Authentication answering &lt;code&gt;ERROR&lt;/code&gt; with &lt;code&gt;stop_without_leader_ms&lt;/code&gt; set was measured in &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;chapter 16&lt;/a&gt;, which simulates three nodes on one machine. Authorization, accounting, and the replies when a database call times out were checked only against the code and the specification, not on a real multi-machine cluster.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;the-device-side&#34;&gt;The device side&#xA;&lt;/h2&gt;&lt;p&gt;Every vendor&amp;rsquo;s commands are different. This section lists only what must be configured on the device; for the actual commands, see the device&amp;rsquo;s documentation:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Server address, port and key.&lt;/strong&gt; The address is that of an rradius node, the port is &lt;code&gt;tacacs.port&lt;/code&gt; (usually 49 in production), and the key is the content of the client&amp;rsquo;s &lt;code&gt;secret_file&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;At least two servers.&lt;/strong&gt; When the cluster has several nodes, point them to different nodes. The device asks the next server only when rradius answers &lt;code&gt;ERROR&lt;/code&gt; or does not answer.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Use TACACS+ for authentication (login), and keep a local account as the last fallback.&lt;/strong&gt; When none of the TACACS+ servers can be reached, administrators can still log in with a local account on the device.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Authorization:&lt;/strong&gt; authorize when opening a shell (exec) to get &lt;code&gt;priv-lvl&lt;/code&gt;; to check each command, also turn on command authorization.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Accounting:&lt;/strong&gt; turn on accounting for exec and for commands, so you get records of logins, logouts and every command.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Source address.&lt;/strong&gt; The source interface the device uses to send TACACS+ must match the &lt;code&gt;address&lt;/code&gt; of the &lt;code&gt;[[tacacs.clients]]&lt;/code&gt; entry.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;As an example with Cisco IOS, here is a set of commands that ties these items together; replace the address and the key with your own:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;aaa new-model&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;tacacs server rradius-1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; address ipv4 10.50.0.100&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; key &amp;lt;content of tacacs.secret&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;aaa group server tacacs+ RRADIUS&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; server name rradius-1&#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;aaa authentication login default group RRADIUS local&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;aaa authorization exec default group RRADIUS local&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;aaa authorization commands 1 default group RRADIUS local&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;aaa authorization commands 15 default group RRADIUS local&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;aaa accounting exec default start-stop group RRADIUS&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;aaa accounting commands 1 default stop-only group RRADIUS&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;aaa accounting commands 15 default stop-only group RRADIUS&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; Always keep &lt;code&gt;local&lt;/code&gt; as the fallback, and make sure the local emergency account can log in before you change the configuration. When rradius is down or the network is cut, the device falls back to the local account; without a fallback you lock yourself out of the device. Turn on authentication only (&lt;code&gt;aaa authentication login&lt;/code&gt;) first and confirm you can log in, then turn on exec authorization, and turn on command authorization (&lt;code&gt;aaa authorization commands&lt;/code&gt;) last: with a wrong authorization rule, even &lt;code&gt;exit&lt;/code&gt; may be denied. With several rradius servers, list several &lt;code&gt;server name&lt;/code&gt; lines in &lt;code&gt;aaa group server&lt;/code&gt;; the device tries them in order.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; This chapter was not tested with a real router or switch. The above lists the settings TACACS+ devices usually need; the IOS commands come from the previous manual and may differ between versions, so confirm them on a lab device before going live.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;watching-tacacs&#34;&gt;Watching TACACS+&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;status&lt;/code&gt; has a TACACS+ section:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd status --config rradius.toml&#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;TACACS+&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Open connections  0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Authentication    0.0/s (11)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Authorization     0.0/s (19)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Accounting        0.0/s (2)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Malformed         0.0/s (0)&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The matching metrics are &lt;code&gt;rradius_tacacs_connections_open&lt;/code&gt;, &lt;code&gt;rradius_tacacs_connections_total{result}&lt;/code&gt;, &lt;code&gt;rradius_tacacs_requests_total{type}&lt;/code&gt;, &lt;code&gt;rradius_tacacs_malformed_total&lt;/code&gt; and &lt;code&gt;rradius_tacacs_response_seconds&lt;/code&gt;. An ASCII login counts only once in &lt;code&gt;requests_total{type=&amp;quot;authen&amp;quot;}&lt;/code&gt;, however many packets go back and forth. For the meaning of each metric, see &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;chapter 17&lt;/a&gt; and &lt;a class=&#34;link&#34; href=&#34;../92-metrics-reference/&#34; &gt;Appendix C&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;When &lt;code&gt;Malformed&lt;/code&gt; goes up, the most common cause is a wrong shared secret on one device.&lt;/p&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;rradius-bench&lt;/code&gt; prints &lt;code&gt;lengths: the fields of the reply do not add up to its length, so the shared secret may be wrong&lt;/code&gt;, the result is &lt;code&gt;invalid 1&lt;/code&gt;, and the exit code is 2. Server log: &lt;code&gt;TACACS+ connection from 127.0.0.1 closed: a body did not decode, so the shared secret may be wrong&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The shared secret on the device and the one on the client differ. &lt;code&gt;rradius_tacacs_malformed_total&lt;/code&gt; goes up.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Make sure the key on the device is the same as the content of &lt;code&gt;secret_file&lt;/code&gt;. The newline at the end of the file does not count as part of the secret.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; A device cannot connect, and the server log says &lt;code&gt;TACACS+ connection from unknown client 127.0.0.1 closed&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The source address is not in the &lt;code&gt;address&lt;/code&gt; of any &lt;code&gt;[[tacacs.clients]]&lt;/code&gt;. Behind NAT, the address seen is the one after NAT.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add that address or network to a client and send &lt;code&gt;SIGHUP&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; Sometimes the connection works and sometimes it is dropped, with the log &lt;code&gt;TACACS+ connection from 127.0.0.1 closed: it already holds max_connections_per_source = 1 connections&lt;/code&gt; (the address and number are the values from the measured run; you see your own source and setting).&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; One source opened too many connections, commonly several devices behind NAT, or a monitoring script that does not close its connections.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Raise &lt;code&gt;max_connections_per_source&lt;/code&gt;; this takes a restart to apply.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; A CHAP login fails with the log &lt;code&gt;handler=&amp;quot;no_password_check&amp;quot; decision=&amp;quot;reject&amp;quot;&lt;/code&gt;, while the same account can log in with PAP.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The account&amp;rsquo;s password is stored as a hash (for example bcrypt), which CHAP cannot check.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Make the device use PAP or ASCII; or store those accounts in a format that can be compared (chapter 07; consider the risk of the database leaking).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; When a device logs in with CHAP, the log says &lt;code&gt;TACACS+ authentication type not supported here: asking the client to restart with another&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; This client&amp;rsquo;s auth chain has no handler that can check the password (for example there is no &lt;code&gt;[auth]&lt;/code&gt; and everything goes to the script), or the request is an enable request.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add a sql or ldap handler, or make the device use PAP or ASCII.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;enable&lt;/code&gt; always fails, with the log &lt;code&gt;TACACS+ enable request refused: [tacacs].enable is &amp;quot;deny&amp;quot;&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;tacacs.enable&lt;/code&gt; has the default &lt;code&gt;deny&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; On the device, use privilege-level authorization (give &lt;code&gt;priv-lvl&lt;/code&gt; at login), or set &lt;code&gt;tacacs.enable&lt;/code&gt; to &lt;code&gt;login&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; You changed the port, a limit or &lt;code&gt;idle_timeout_ms&lt;/code&gt; in &lt;code&gt;[tacacs]&lt;/code&gt; and sent &lt;code&gt;SIGHUP&lt;/code&gt;, but nothing changed, and the log says &lt;code&gt;configuration reloaded from rradius.toml; these need a restart to apply: tacacs.max_connections_per_source, tacacs.idle_timeout_ms&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; These keys need a restart to take effect.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Schedule a server restart. Only &lt;code&gt;enable&lt;/code&gt;, &lt;code&gt;authorize_groups&lt;/code&gt; and the client list can be reloaded.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;[tacacs] is enabled but has no [[tacacs.clients]] entries&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; There is a &lt;code&gt;[tacacs]&lt;/code&gt; section but no client.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add at least one &lt;code&gt;[[tacacs.clients]]&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;tacacs client &#39;lab&#39;: unknown auth chain &#39;nosuch&#39; (no [auth.chains.nosuch])&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The client&amp;rsquo;s &lt;code&gt;auth&lt;/code&gt; points to an auth chain that does not exist.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Define that chain in &lt;code&gt;[auth.chains.nosuch]&lt;/code&gt; first (chapter 07), or change it to an existing name.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;tacacs.idle_timeout_ms must be greater than 0&lt;/code&gt; or &lt;code&gt;tacacs.max_connections must be greater than 0&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; These two values cannot be 0.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change them to a positive number, or delete the line to use the default.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;rradius.toml: line N: missing escaped value, expected …&lt;/code&gt;, pointing at a rule in &lt;code&gt;[tacacs.authorize_groups]&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The rule is written in double quotes and contains a backslash such as &lt;code&gt;cmd\*&lt;/code&gt;, which a TOML double-quoted string does not accept.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Use single quotes (see &amp;ldquo;Authorize with authorize groups&amp;rdquo;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; Authorization is always &lt;code&gt;FAIL&lt;/code&gt;, and none of the &lt;code&gt;log&lt;/code&gt; calls in the script print anything.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; This client has &lt;code&gt;authorize_group&lt;/code&gt;, so authorization is handed to the rules and the script does not run; when no rule applies the answer is &lt;code&gt;FAIL&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Check whether the rule patterns match the whole AV pair the device sent (for example &lt;code&gt;cmd=show&lt;/code&gt; does not match &lt;code&gt;cmd=show interfaces&lt;/code&gt;, because the arguments are in separate &lt;code&gt;cmd-arg&lt;/code&gt; pairs), or remove &lt;code&gt;authorize_group&lt;/code&gt; and use the script.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; Accounting keeps getting &lt;code&gt;ERROR&lt;/code&gt;, and the server log has &lt;code&gt;Lua script did not accept accounting&lt;/code&gt; or a script error.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The script did not return &lt;code&gt;accept&lt;/code&gt;, or it failed while running.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Fix the script according to the log. When the top of the script branches on &lt;code&gt;protocol&lt;/code&gt; and &lt;code&gt;phase&lt;/code&gt;, do not let TACACS+ accounting fall through to &lt;code&gt;return &#39;reject&#39;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05 RADIUS service and NAS clients&lt;/a&gt;: how clients are matched, and the shared secret&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;: auth chains, password formats, &lt;code&gt;auth.chains&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;08 LDAP and Active Directory&lt;/a&gt;: log in to devices with directory accounts&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09 External databases and named queries&lt;/a&gt;: turn accounting records into metrics&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;10 Writing policies in Lua&lt;/a&gt;: &lt;code&gt;get_attr&lt;/code&gt;, &lt;code&gt;get_attrs&lt;/code&gt;, &lt;code&gt;set_attr&lt;/code&gt;, &lt;code&gt;sql_execute&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13 Accounting and sessions&lt;/a&gt;: why an accounting script must be safe to run more than once&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16 Clusters and high availability&lt;/a&gt;: &lt;code&gt;stop_without_leader_ms&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../92-metrics-reference/&#34; &gt;Appendix C: Metrics reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>13 Accounting and sessions</title>
            <link>https://embark.systems/en/rradius/oss/13-accounting/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/13-accounting/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Receive accounting requests from a NAS and reply only after the data is in the table&lt;/li&gt;&#xA;&lt;li&gt;Design the accounting table and the accounting script so they survive retransmitted and late packets&lt;/li&gt;&#xA;&lt;li&gt;Turn on the accounting spool so no accounting is lost while the cluster database cannot take writes&lt;/li&gt;&#xA;&lt;li&gt;Write every accounting request to a local JSON log file&lt;/li&gt;&#xA;&lt;li&gt;Query online sessions with the &lt;code&gt;session&lt;/code&gt; command&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: you have done &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;chapter 03&lt;/a&gt; and have &lt;code&gt;~/rradius-lab/quick-start&lt;/code&gt;; you can write a simple Lua script (&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;chapter 10&lt;/a&gt;). Run the commands in this chapter in &lt;code&gt;~/rradius-lab/quick-start&lt;/code&gt;, with the server running.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#how-accounting-requests-are-handled&#34; &gt;How accounting requests are handled&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#when-the-server-does-not-reply&#34; &gt;When the server does not reply&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#reading-the-accounting-script&#34; &gt;Reading the accounting script&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#designing-the-accounting-table&#34; &gt;Designing the accounting table&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#sending-accounting-to-test&#34; &gt;Sending accounting to test&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#what-happens-when-the-script-fails&#34; &gt;What happens when the script fails&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#querying-online-sessions&#34; &gt;Querying online sessions&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#the-accounting-log&#34; &gt;The accounting log&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#the-accounting-spool&#34; &gt;The accounting spool&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#how-a-script-knows-it-is-a-replay-replayed&#34; &gt;How a script knows it is a replay: replayed&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#tacacs-accounting&#34; &gt;TACACS+ accounting&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;how-accounting-requests-are-handled&#34;&gt;How accounting requests are handled&#xA;&lt;/h2&gt;&lt;p&gt;A NAS sends an Accounting-Request (RFC 2866) when a session starts, during the session and when it ends. It says who is online, for how long and how much data they moved. When rradius receives one:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It matches the source IP against &lt;code&gt;[[radius.clients]]&lt;/code&gt;, then checks the request&amp;rsquo;s Authenticator with that client&amp;rsquo;s shared secret. If there is no match or the check fails, it drops the request without a reply (chapter 05).&lt;/li&gt;&#xA;&lt;li&gt;Retransmit detection: if the same request arrives while it is still being handled, it is dropped. If it was already answered, a copy arriving within 10 seconds gets the original reply again and the script does not run again (chapter 05).&lt;/li&gt;&#xA;&lt;li&gt;It hands the request to the top-level script (&lt;code&gt;[lua] script&lt;/code&gt;) with &lt;code&gt;phase&lt;/code&gt; set to &lt;code&gt;accounting&lt;/code&gt;. The auth chain (&lt;code&gt;[auth]&lt;/code&gt;) does not handle accounting.&lt;/li&gt;&#xA;&lt;li&gt;Only when the script returns &lt;code&gt;accept&lt;/code&gt; does it send an Accounting-Response.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The last point is the core of the whole accounting design: &lt;strong&gt;a reply means &amp;ldquo;I have recorded it&amp;rdquo;&lt;/strong&gt;. If the NAS gets no reply, it retransmits; the NAS decides how many times and how far apart. So rradius replies only once the data is safely written, and stays silent when it cannot write, so the NAS sends it again.&lt;/p&gt;&#xA;&lt;p&gt;The accounting script can see every attribute in the request, named as in the dictionary (chapter 06). Compare enumerated attributes by number, for example &lt;code&gt;Acct-Status-Type&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;Value&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;&lt;code&gt;1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;2&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Stop&lt;/td&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;3&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Interim-Update&lt;/td&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;7&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting-On (the NAS boots)&lt;/td&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;8&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting-Off (the NAS shuts down)&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 can also see &lt;code&gt;client&lt;/code&gt; (the client&amp;rsquo;s name), &lt;code&gt;protocol&lt;/code&gt; (&lt;code&gt;&amp;quot;radius&amp;quot;&lt;/code&gt;), &lt;code&gt;phase&lt;/code&gt;, and &lt;code&gt;replayed&lt;/code&gt;, which is true only when the request is replayed from the accounting spool.&lt;/p&gt;&#xA;&lt;h2 id=&#34;when-the-server-does-not-reply&#34;&gt;When the server does not reply&#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;Situation&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Reply&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Log&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 script returns &lt;code&gt;accept&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting-Response&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;The script returns &lt;code&gt;reject&lt;/code&gt; or returns nothing&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No reply&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Lua script did not accept accounting (radius, client &amp;lt;name&amp;gt;)&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 script fails or exceeds &lt;code&gt;max_execution_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No reply&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Lua script error (radius/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;A database call fails (timeout, no leader) and the accounting spool is on&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reply after writing to the spool&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The script&amp;rsquo;s 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;A database call fails and there is no accounting spool&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No reply (unless the script catches the error and still returns &lt;code&gt;accept&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The script&amp;rsquo;s 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;The accounting spool is full or cannot be written to disk&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No reply&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accounting spool: request from client &amp;lt;name&amp;gt; not written: …&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;A request that gets no reply is not counted in any &lt;code&gt;rradius_radius_discarded_total&lt;/code&gt;. To see how many accounting requests went unanswered, compare &lt;code&gt;rradius_radius_packets_total{kind=&amp;quot;acct&amp;quot;}&lt;/code&gt; with &lt;code&gt;rradius_radius_responses_total{code=&amp;quot;accounting_response&amp;quot;}&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;reading-the-accounting-script&#34;&gt;Reading the accounting script&#xA;&lt;/h2&gt;&lt;p&gt;The quick-start &lt;code&gt;accounting.lua&lt;/code&gt; is an accounting script you can use as it is. It inserts or updates a row in the &lt;code&gt;accounting&lt;/code&gt; table, one row per session. Here it is piece by piece:&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;-- accounting.lua (excerpt)&lt;/span&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; phase &lt;span style=&#34;color:#f92672&#34;&gt;~=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;accounting&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;  &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;p&gt;quick-start has &lt;code&gt;[auth]&lt;/code&gt;, so authentication never reaches this script. If the configuration changes later, this script still does not let anyone through.&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; nas &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;NAS-IP-Address&amp;#39;&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;NAS-IPv6-Address&amp;#39;&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;NAS-Identifier&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;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;not&lt;/span&gt; nas &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; nas &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;  nas &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; client&#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;p&gt;A client can be a whole network, so the script tells NASes apart by the address or name the NAS reports itself. The NAS says these values about itself, but they are only compared within one client. NASes in the same client share one secret, so they are equally trusted anyway.&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; status &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Acct-Status-Type&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;if&lt;/span&gt; status &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;7&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; status &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;8&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;  sql_execute(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;UPDATE accounting SET stopped = updated, terminate_cause = 11 WHERE client = ? AND nas = ? AND stopped IS NULL&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {client, nas})&#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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; status &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:#f92672&#34;&gt;and&lt;/span&gt; status &lt;span style=&#34;color:#f92672&#34;&gt;~=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;and&lt;/span&gt; status &lt;span style=&#34;color:#f92672&#34;&gt;~=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;3&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:#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;p&gt;A NAS that reboots sends Accounting-On or Off, which means all of its earlier sessions are over. Here the script marks them all as ended. Any other type it does not recognize gets &lt;code&gt;accept&lt;/code&gt; anyway: staying silent would only make the NAS retransmit forever.&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; session &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Acct-Session-Id&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;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;not&lt;/span&gt; session &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; session &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;  log(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;accounting without Acct-Session-Id from&amp;#39;&lt;/span&gt;, client)&#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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;local&lt;/span&gt; seen &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; math.floor(now_unix()) &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; math.floor(get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Acct-Delay-Time&amp;#39;&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&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; seconds &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; math.floor(get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Acct-Session-Time&amp;#39;&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&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; &lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;octets&lt;/span&gt;(name)&#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; math.floor(get_attr(name &lt;span style=&#34;color:#f92672&#34;&gt;..&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;-Octets&amp;#39;&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; math.floor(get_attr(name &lt;span style=&#34;color:#f92672&#34;&gt;..&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;-Gigawords&amp;#39;&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;4294967296&lt;/span&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;A request without Acct-Session-Id cannot be recorded, and a retransmit will not help, so the script writes one log line and returns &lt;code&gt;accept&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Acct-Delay-Time&lt;/code&gt; is the NAS saying &amp;ldquo;this happened that many seconds ago&amp;rdquo;. Subtracting it from the current time gives the time the event really happened. When a request is replayed from the accounting spool, rradius adds the time it waited in the spool to this value (see &lt;a class=&#34;link&#34; href=&#34;#the-accounting-spool&#34; &gt;The accounting spool&lt;/a&gt;), so the same line of code handles replays too.&lt;/li&gt;&#xA;&lt;li&gt;For more than 4 GiB of traffic, the NAS puts the carry in &lt;code&gt;Acct-Input-Gigawords&lt;/code&gt; and &lt;code&gt;Acct-Output-Gigawords&lt;/code&gt;.&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-lua&#34; data-lang=&#34;lua&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sql_execute(&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;  INSERT INTO accounting (client, nas, session_id, username, started, updated, session_time, input_octets, output_octets)&#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;  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)&#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;  ON CONFLICT (client, nas, session_id) DO UPDATE SET&#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;    updated = CASE WHEN stopped IS NULL THEN max(updated, excluded.updated) ELSE updated END,&#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;    session_time = max(session_time, excluded.session_time),&#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;    input_octets = max(input_octets, excluded.input_octets),&#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;    output_octets = max(output_octets, excluded.output_octets)&#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;]]&lt;/span&gt;, {client, nas, session, get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Name&amp;#39;&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;#39;&lt;/span&gt;, seen &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; seconds, seen, seconds, octets(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Acct-Input&amp;#39;&lt;/span&gt;), octets(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Acct-Output&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:#66d9ef&#34;&gt;if&lt;/span&gt; status &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&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;  sql_execute(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;UPDATE accounting SET stopped = ?, terminate_cause = ? WHERE client = ? AND nas = ? AND session_id = ? AND stopped IS NULL&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {seen, math.floor(get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Acct-Terminate-Cause&amp;#39;&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;), client, nas, session})&#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;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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This part is the most important design in the script: &lt;strong&gt;writing the same packet twice gives the same result as writing it once&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It uses &lt;code&gt;INSERT … ON CONFLICT … DO UPDATE&lt;/code&gt;: whichever of Start, Interim-Update and Stop arrives first, it inserts or updates the same row.&lt;/li&gt;&#xA;&lt;li&gt;Counters use &lt;code&gt;max()&lt;/code&gt;: an old Interim-Update that arrives late does not make the traffic smaller.&lt;/li&gt;&#xA;&lt;li&gt;Packets that arrive after the session ended (a late Interim-Update, a retransmitted Stop) no longer change &lt;code&gt;updated&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The Stop &lt;code&gt;UPDATE&lt;/code&gt; has &lt;code&gt;AND stopped IS NULL&lt;/code&gt;: a retransmitted Stop does not overwrite the end time recorded the first time.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Why it has to be written this way: a NAS that gets no reply retransmits; a script that fails halfway runs again on the next retransmit; and replay from the accounting spool is &amp;ldquo;at least once&amp;rdquo;, so a power cut can run the same request again. In all three cases the same packet reaches the script more than once.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; When a script has several &lt;code&gt;sql_execute&lt;/code&gt; calls and an earlier one succeeds but a later one fails, the NAS retransmits the whole packet and the earlier statement runs again. Every statement must be safe to run again.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;designing-the-accounting-table&#34;&gt;Designing the accounting table&#xA;&lt;/h2&gt;&lt;p&gt;The quick-start accounting table (&lt;code&gt;migrations/1_schema.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:#75715e&#34;&gt;-- migrations/1_schema.sql (excerpt)&#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; accounting (&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  client TEXT &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;  nas TEXT &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;  session_id TEXT &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;  username TEXT,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  started 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;  updated 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;  stopped INTEGER,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  session_time 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; &lt;span style=&#34;color:#66d9ef&#34;&gt;DEFAULT&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  input_octets 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; &lt;span style=&#34;color:#66d9ef&#34;&gt;DEFAULT&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  output_octets 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; &lt;span style=&#34;color:#66d9ef&#34;&gt;DEFAULT&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  terminate_cause INTEGER,&#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;PRIMARY&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;KEY&lt;/span&gt; (client, nas, session_id)&#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;CREATE&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;INDEX&lt;/span&gt; accounting_user &lt;span style=&#34;color:#66d9ef&#34;&gt;ON&lt;/span&gt; accounting (username);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Key points of the design:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The primary key is &lt;code&gt;(client, nas, session_id)&lt;/code&gt;.&lt;/strong&gt; Acct-Session-Id is unique only within one NAS, and two NASes can produce the same ID, so the key has to include which NAS it is.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Times are stored as Unix seconds.&lt;/strong&gt; &lt;code&gt;started&lt;/code&gt;, &lt;code&gt;updated&lt;/code&gt; and &lt;code&gt;stopped&lt;/code&gt; are integers, which makes comparing and calculating easy.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;stopped IS NULL&lt;/code&gt; means still online.&lt;/strong&gt; But a NAS can drop off without sending Stop, so &amp;ldquo;online&amp;rdquo; also needs a &amp;ldquo;recently updated&amp;rdquo; condition; see &lt;code&gt;[sessions]&lt;/code&gt; in the next section.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Add indexes for the queries you run.&lt;/strong&gt; quick-start looks rows up by &lt;code&gt;username&lt;/code&gt;; the usage-control scenario sums one person&amp;rsquo;s traffic over a period, so its index is &lt;code&gt;(username, started)&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Once a migration has been applied it cannot change. To change the table, add a file with the next number (chapter 10).&lt;/p&gt;&#xA;&lt;p&gt;Not every scenario needs an accounting table. In the ip-pool and usage-control scenarios, &amp;ldquo;who is online&amp;rdquo; is recorded in the address pool table or the connection-slot table. The accounting script updates that table, and &lt;code&gt;[sessions]&lt;/code&gt; queries it directly (chapter 14).&lt;/p&gt;&#xA;&lt;h2 id=&#34;sending-accounting-to-test&#34;&gt;Sending accounting to test&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;rradius-bench&lt;/code&gt; has these accounting loads:&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;--load&lt;/code&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Request sent&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;acct-start&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;acct-alive&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Interim-Update, with &lt;code&gt;Acct-Session-Time&lt;/code&gt; and traffic&lt;/td&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;acct-stop&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Stop, with &lt;code&gt;Acct-Session-Time&lt;/code&gt; and traffic&lt;/td&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;acct-on&lt;/code&gt;, &lt;code&gt;acct-off&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting-On, Accounting-Off&lt;/td&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&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PAP login, Start, Stop, all with the same session ID&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Each &lt;code&gt;rradius-bench run&lt;/code&gt; generates new session IDs, so an &lt;code&gt;acct-start&lt;/code&gt; and an &lt;code&gt;acct-stop&lt;/code&gt; sent separately are two different sessions. To test a complete session, use &lt;code&gt;session&lt;/code&gt; (chapter 03).&lt;/p&gt;&#xA;&lt;p&gt;Send two Starts, then an Accounting-On:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --load acct-start,concurrency=1 --requests 1&#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;  acct-start: 1997/s, sent 1, accept 0, reject 0, challenge 0, accounting 1, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user bob --load acct-start,concurrency=1 --requests 1&#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;$ rradiusd session list --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;username=bob&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nas=192.0.2.1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;session_id=1138000000000000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;started=1795384997&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;updated=1795384997&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;username=alice&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nas=192.0.2.1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;session_id=dc80000000000000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;started=1795384997&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;updated=1795384997&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --load acct-on,concurrency=1 --requests 1&#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;  acct-on: 2954/s, sent 1, accept 0, reject 0, challenge 0, accounting 1, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;$ rradiusd session list --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;no sessions&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The NAS address of &lt;code&gt;rradius-bench&lt;/code&gt; is always &lt;code&gt;192.0.2.1&lt;/code&gt;, so the Accounting-On ended every session of that &amp;ldquo;NAS&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;To test &lt;code&gt;Acct-Delay-Time&lt;/code&gt;, add the attribute with &lt;code&gt;--attr&lt;/code&gt; (41 is the number of &lt;code&gt;Acct-Delay-Time&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ date +%s&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1795385623&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user grace --attr 41=int:600 --load acct-start,concurrency=1 --requests 1&#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;$ rradiusd session show --config rradius.toml grace&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;username=grace&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nas=192.0.2.1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;session_id=2868000000000000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;started=1795385023&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;updated=1795385023&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;started&lt;/code&gt; is 600 seconds earlier than now, which is exactly the delay the NAS reported.&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-happens-when-the-script-fails&#34;&gt;What happens when the script fails&#xA;&lt;/h2&gt;&lt;p&gt;Replace the script with one that fails, to see what the NAS sees. Back it up first, then write a script that always fails on accounting:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cp accounting.lua accounting.lua.keep&#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;#34;if phase == &amp;#39;accounting&amp;#39; then error(&amp;#39;no table today&amp;#39;) end\nreturn &amp;#39;reject&amp;#39;\n&amp;#34;&lt;/span&gt; &amp;gt; accounting.lua&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kill -HUP &amp;lt;server PID&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --load acct-start,concurrency=1 --requests 1 --timeout 2&#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;  acct-start: 0/s, sent 1, accept 0, reject 0, challenge 0, accounting 0, timeouts 1, invalid 0, late 0, socket errors 0, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;timeouts 1&lt;/code&gt;: there was no reply. The server log:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::lua_engine: Lua script error (radius/accounting): runtime error: accounting.lua:1: no table today\nstack traceback:…&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When the script returns &lt;code&gt;reject&lt;/code&gt; instead, there is also no reply, and the log says:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::lua_engine: Lua script did not accept accounting (radius, client localhost)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When you are done, restore the script with &lt;code&gt;mv accounting.lua.keep accounting.lua&lt;/code&gt; and send &lt;code&gt;SIGHUP&lt;/code&gt; again. Scripts can be reloaded; if a broken script does not compile, the reload fails and the server keeps using the previous script.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; When accounting gets no reply, the NAS keeps retransmitting until it gives up, and some NASes then discard the record. Fix script errors quickly. For short periods when the database cannot take writes, use the accounting spool below.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;querying-online-sessions&#34;&gt;Querying online sessions&#xA;&lt;/h2&gt;&lt;p&gt;rradius does not keep &amp;ldquo;who is online&amp;rdquo; itself. The &lt;code&gt;session&lt;/code&gt; command runs the SQL you wrote in &lt;code&gt;[sessions]&lt;/code&gt; and prints the result as it is, so what &amp;ldquo;online&amp;rdquo; means is decided by your table and your SQL.&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:#75715e&#34;&gt;# rradius.toml (the quick-start [sessions])&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;sessions&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;list&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT username, nas, session_id, started, updated FROM accounting WHERE stopped IS NULL AND updated &amp;gt; strftime(&amp;#39;%s&amp;#39;, &amp;#39;now&amp;#39;) - 900 ORDER BY started, session_id&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, nas, session_id, started, updated FROM accounting WHERE username = ?1 AND stopped IS NULL AND updated &amp;gt; strftime(&amp;#39;%s&amp;#39;, &amp;#39;now&amp;#39;) - 900 ORDER BY started, session_id&amp;#34;&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&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;&lt;code&gt;sessions.list&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;none&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;read by the command only&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The SQL that &lt;code&gt;session list&lt;/code&gt; runs, with no parameters&lt;/td&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;sessions.show&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;none&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;read by the command only&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The SQL that &lt;code&gt;session show &amp;lt;name&amp;gt;&lt;/code&gt; runs; &lt;code&gt;?1&lt;/code&gt; is the user name&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;(See &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt; for the full description.)&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Both statements may only read: after any whitespace they must start with &lt;code&gt;SELECT&lt;/code&gt; or &lt;code&gt;WITH&lt;/code&gt;, in any letter case.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;show&lt;/code&gt; must use &lt;code&gt;?1&lt;/code&gt;, and only &lt;code&gt;?1&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Only the command reads this section; the running server does not look at it, so a change needs no reload and no restart. Startup, reload and &lt;code&gt;check&lt;/code&gt; do validate it, though, so a mistake still fails there.&lt;/li&gt;&#xA;&lt;li&gt;quick-start counts a session as online when it has no Stop and was updated in the last 15 minutes. If your NAS sends Interim-Updates less often than every 15 minutes, widen this condition.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;How to use the command:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd session show --config rradius.toml --json bob&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[{&amp;#34;username&amp;#34;:&amp;#34;bob&amp;#34;,&amp;#34;nas&amp;#34;:&amp;#34;192.0.2.1&amp;#34;,&amp;#34;session_id&amp;#34;:&amp;#34;1138000000000000&amp;#34;,&amp;#34;started&amp;#34;:1795384997,&amp;#34;updated&amp;#34;:1795384997}]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd session show --config rradius.toml nobody&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;no sessions for nobody&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd session show --config rradius.toml --json nobody&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;Without &lt;code&gt;--json&lt;/code&gt;, each row is a block of &lt;code&gt;field=value&lt;/code&gt; lines in SELECT column order. NULL is an empty value, and rows are separated by a blank line.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;--json&lt;/code&gt; prints a JSON array: NULL is &lt;code&gt;null&lt;/code&gt;, integers and reals are numbers, text is a string, and a BLOB is a lower-case hexadecimal string.&lt;/li&gt;&#xA;&lt;li&gt;The name given to &lt;code&gt;show&lt;/code&gt; is normalized by &lt;code&gt;[auth.username]&lt;/code&gt; of the default chain, the same as the &lt;code&gt;user&lt;/code&gt; command (chapter 07).&lt;/li&gt;&#xA;&lt;li&gt;The command reads through the cluster&amp;rsquo;s API port. It does not start a node and does not create a data directory, but the server must be running. The read is a consistent read: it returns data the cluster has already confirmed.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Exit codes:&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;Exit code&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;0&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;At least one row was printed&lt;/td&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;No matching row: &lt;code&gt;list&lt;/code&gt; prints &lt;code&gt;no sessions&lt;/code&gt;, &lt;code&gt;show&lt;/code&gt; prints &lt;code&gt;no sessions for &amp;lt;name&amp;gt;&lt;/code&gt;; with &lt;code&gt;--json&lt;/code&gt; it prints &lt;code&gt;[]&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;2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The command or configuration is wrong and nothing ran; or the SQL failed (&lt;code&gt;the statement failed: …&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;3&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Cannot reach the cluster, or no answer within 30 seconds: &lt;code&gt;the cluster did not answer within 30 s&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;Messages for a wrong &lt;code&gt;[sessions]&lt;/code&gt; (exit code 2):&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 you wrote&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Message&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;list = &amp;quot;DELETE FROM accounting&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius.toml: sessions.list: must begin with SELECT or WITH: it only reads&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 = &amp;quot;… WHERE username = ?&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius.toml: sessions.show: use ?1 for the user name, not ?&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 = &amp;quot;… WHERE username = ?2&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius.toml: sessions.show: only ?1 (the user name) can be used&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;No &lt;code&gt;[sessions]&lt;/code&gt;, or no such key&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;sessions.show is not set in rradius.toml&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 &lt;code&gt;session&lt;/code&gt; command only queries. To turn the number of people online into a Prometheus metric, use a named query (&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;chapter 09&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-accounting-log&#34;&gt;The accounting log&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;[radius.accounting_log]&lt;/code&gt; makes rradius append one JSON line to a local file for every accounting request it answers. This is separate from the accounting table: the table is data your script writes for you to query, while the log is the raw record the server writes, kept as it was received. It suits collection by a log system or keeping for later checks.&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:#75715e&#34;&gt;# rradius.toml (added at the end of the file)&lt;/span&gt;&#xA;&lt;/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;accounting_log&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;log/accounting.log&amp;#34;&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&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;&lt;code&gt;radius.accounting_log.file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;none, required&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;The file to append to, relative to the configuration file&amp;rsquo;s 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;radius.accounting_log.queue&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;65536&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;needs restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The most records that can wait to be written, 1 to 16777216&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Adding or removing the whole &lt;code&gt;[radius.accounting_log]&lt;/code&gt; table needs a restart. (See &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt; for the full description.)&lt;/p&gt;&#xA;&lt;p&gt;The directory of the file must exist first, or &lt;code&gt;check&lt;/code&gt; fails:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: radius.accounting_log.file: directory log does not exist&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ mkdir log&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;After you restart the server and send one &lt;code&gt;session&lt;/code&gt;, the log has two more lines (each line is wrapped into two here to make it readable):&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&amp;#34;time&amp;#34;:&amp;#34;2026-11-22T22:03:10.581Z&amp;#34;,&amp;#34;client&amp;#34;:&amp;#34;localhost&amp;#34;,&amp;#34;source&amp;#34;:&amp;#34;127.0.0.1&amp;#34;,&amp;#34;transport&amp;#34;:&amp;#34;udp&amp;#34;,&amp;#34;handling&amp;#34;:&amp;#34;script&amp;#34;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &amp;#34;attributes&amp;#34;:{&amp;#34;User-Name&amp;#34;:&amp;#34;alice&amp;#34;,&amp;#34;NAS-IP-Address&amp;#34;:&amp;#34;192.0.2.1&amp;#34;,&amp;#34;NAS-Identifier&amp;#34;:&amp;#34;rradius-bench&amp;#34;,&amp;#34;Acct-Status-Type&amp;#34;:&amp;#34;Start&amp;#34;,&amp;#34;Acct-Session-Id&amp;#34;:&amp;#34;98a0000000000000&amp;#34;}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&amp;#34;time&amp;#34;:&amp;#34;2026-11-22T22:03:10.582Z&amp;#34;,&amp;#34;client&amp;#34;:&amp;#34;localhost&amp;#34;,&amp;#34;source&amp;#34;:&amp;#34;127.0.0.1&amp;#34;,&amp;#34;transport&amp;#34;:&amp;#34;udp&amp;#34;,&amp;#34;handling&amp;#34;:&amp;#34;script&amp;#34;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &amp;#34;attributes&amp;#34;:{&amp;#34;User-Name&amp;#34;:&amp;#34;alice&amp;#34;,&amp;#34;NAS-IP-Address&amp;#34;:&amp;#34;192.0.2.1&amp;#34;,&amp;#34;NAS-Identifier&amp;#34;:&amp;#34;rradius-bench&amp;#34;,&amp;#34;Acct-Status-Type&amp;#34;:&amp;#34;Stop&amp;#34;,&amp;#34;Acct-Session-Id&amp;#34;:&amp;#34;98a0000000000000&amp;#34;,&amp;#34;Acct-Session-Time&amp;#34;:&amp;#34;60&amp;#34;,&amp;#34;Acct-Input-Octets&amp;#34;:&amp;#34;20000&amp;#34;,&amp;#34;Acct-Output-Octets&amp;#34;:&amp;#34;30000&amp;#34;}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The fields of each line, in a fixed order:&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;Field&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Content&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;time&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The time of the reply, RFC 3339, UTC, to the millisecond&lt;/td&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;client&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The client&amp;rsquo;s 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;&lt;code&gt;source&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The source address&lt;/td&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;transport&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Always &lt;code&gt;udp&lt;/code&gt; in the core&lt;/td&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;handling&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;script&lt;/code&gt;: the script accepted it; &lt;code&gt;spool&lt;/code&gt;: it was written to the 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;attributes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The request&amp;rsquo;s attributes, keyed by dictionary name. Enumerated values are written as names (&lt;code&gt;Start&lt;/code&gt;), not numbers. An attribute that appears several times is an array&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;When a request carries the RFC 8045 &lt;code&gt;IP-Port-Range&lt;/code&gt; (an operator&amp;rsquo;s NAS or CGN uses it to report the public address and ports allocated to or released from a subscriber), &lt;code&gt;attributes&lt;/code&gt; gets one more key at the end, &lt;code&gt;IP-Port-Range&lt;/code&gt;. It is an array with one object per &lt;code&gt;IP-Port-Range&lt;/code&gt;, whose keys are the dictionary names of the sub-attributes, in packet order; a single one is still an array. The original flat keys stay as before, and repeated names are still arrays, so existing readers are not affected. The key exists because with several ranges in one packet, flat arrays can only be matched up by position, and a range that lacks one sub-attribute shifts everything after it; the grouping keeps the fields of each range together.&lt;/p&gt;&#xA;&lt;p&gt;What is written and what is not:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Only requests that &lt;strong&gt;got a reply&lt;/strong&gt; are written. A request the script did not accept, and so did not reply to, is not written.&lt;/li&gt;&#xA;&lt;li&gt;A retransmit answered directly by retransmit detection is not written again.&lt;/li&gt;&#xA;&lt;li&gt;Only RADIUS accounting. TACACS+ accounting is not written here.&lt;/li&gt;&#xA;&lt;li&gt;The server creates the file with mode 0640. Measured: &lt;code&gt;-rw-r-----&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Writing does not slow down replies.&lt;/strong&gt; After the reply, the record goes into a queue, and another thread writes it in batches. If &lt;code&gt;queue&lt;/code&gt; records are already waiting, the new one is dropped and counted. When a write fails, the failure is counted, and the same error is warned about at most once a minute; the server keeps running.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Log rotation.&lt;/strong&gt; On &lt;code&gt;SIGHUP&lt;/code&gt;, the server finishes writing what is in the queue, closes the file, and opens &lt;code&gt;file&lt;/code&gt; again (creating it if it does not exist). So to rotate, rename first, then send &lt;code&gt;SIGHUP&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ mv log/accounting.log log/accounting.log.1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kill -HUP &amp;lt;server PID&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ ls -l log&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-rw-r-----  1 …   368 … accounting.log&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-rw-r-----  1 …  1187 … accounting.log.1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Records after the &lt;code&gt;SIGHUP&lt;/code&gt; go to the newly created &lt;code&gt;accounting.log&lt;/code&gt;. Records between the rename and the &lt;code&gt;SIGHUP&lt;/code&gt; still go to the old file (the one that was renamed) and are not lost. If reopening the file fails during a reload, one failure with &lt;code&gt;stage=&amp;quot;open&amp;quot;&lt;/code&gt; is counted and warned about, and the server keeps writing to the original file. If the directory of a new &lt;code&gt;file&lt;/code&gt; does not exist, the reload fails and the configuration does not change.&lt;/p&gt;&#xA;&lt;p&gt;With logrotate, send &lt;code&gt;SIGHUP&lt;/code&gt; in &lt;code&gt;postrotate&lt;/code&gt; and do not use &lt;code&gt;copytruncate&lt;/code&gt; (it loses lines). The &lt;code&gt;/etc/logrotate.d/rradius&lt;/code&gt; shipped in the deb and rpm packages is written this way. It rotates &lt;code&gt;/var/log/rradius/*.jsonl&lt;/code&gt;, so if you put &lt;code&gt;file&lt;/code&gt; in that directory with the extension &lt;code&gt;.jsonl&lt;/code&gt; when you install the package, it is rotated with the rest (chapter 02).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;On shutdown.&lt;/strong&gt; On SIGTERM or SIGINT, the server first stops accepting requests and waits for requests in progress to finish, then writes what is left in the queue, waiting at most 5 seconds.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Metrics and status.&lt;/strong&gt; These metrics exist only when &lt;code&gt;[radius.accounting_log]&lt;/code&gt; is set, and all start at 0:&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;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;&lt;code&gt;rradius_accounting_log_written_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Records written to the log 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_accounting_log_dropped_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Records dropped because the queue was full&lt;/td&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_accounting_log_failures_total{stage=&amp;quot;open&amp;quot;}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Failures to open 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;rradius_accounting_log_failures_total{stage=&amp;quot;write&amp;quot;}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Failures to write&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;status&lt;/code&gt; adds a section after the accounting spool section:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd status --config rradius.toml&#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;Accounting log&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Written        0.0/s (5)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Dropped        0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Failed opens   0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Failed writes  0.0/s (0)&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;With &lt;code&gt;--json&lt;/code&gt;, the key for this section is &lt;code&gt;acct_log&lt;/code&gt;. If &lt;code&gt;Dropped&lt;/code&gt; or &lt;code&gt;Failed&lt;/code&gt; keeps growing, the log is missing records: check disk space and file permissions.&lt;/p&gt;&#xA;&lt;h3 id=&#34;reverse-lookup-of-public-addresses-and-ports&#34;&gt;Reverse lookup of public addresses and ports&#xA;&lt;/h3&gt;&lt;p&gt;When an operator uses CGNAT (many subscribers sharing one public address), the question &amp;ldquo;who had this public address and port at that moment?&amp;rdquo; is answered from the log file. &lt;code&gt;rradiusd accounting find&lt;/code&gt; only reads log files. It does not contact the cluster and needs no configuration file, so you can run it on backed-up files:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd accounting find --ip 198.51.100.7 --port &lt;span style=&#34;color:#ae81ff&#34;&gt;1500&lt;/span&gt; --at 2026-11-25T10:30:00Z --file accounting.jsonl&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;198.51.100.7:1024-2047 allocated 2026-11-25T10:00:00.120Z ended 2026-11-25T11:00:00Z ended_by release time_source received identity &amp;#34;Acct-Session-Id=s-1 client=bng1&amp;#34; client=bng1 User-Name=alice Acct-Session-Id=s-1 Framed-IP-Address=100.64.0.5&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd accounting find --ip 198.51.100.7 --port &lt;span style=&#34;color:#ae81ff&#34;&gt;4096&lt;/span&gt; --at 2026-11-25T10:30:00Z --file accounting.jsonl --json&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[{&amp;#34;allocated&amp;#34;:&amp;#34;2026-11-25T10:00:00.120Z&amp;#34;,&amp;#34;attributes&amp;#34;:{&amp;#34;Acct-Session-Id&amp;#34;:&amp;#34;s-1&amp;#34;,&amp;#34;Framed-IP-Address&amp;#34;:&amp;#34;100.64.0.5&amp;#34;,&amp;#34;User-Name&amp;#34;:&amp;#34;alice&amp;#34;,&amp;#34;client&amp;#34;:&amp;#34;bng1&amp;#34;},&amp;#34;ended_by&amp;#34;:&amp;#34;release&amp;#34;,&amp;#34;ext_ip&amp;#34;:&amp;#34;198.51.100.7&amp;#34;,&amp;#34;identity&amp;#34;:&amp;#34;Acct-Session-Id=s-1 client=bng1&amp;#34;,&amp;#34;port_end&amp;#34;:4096,&amp;#34;port_start&amp;#34;:4096,&amp;#34;released&amp;#34;:&amp;#34;2026-11-25T11:00:00Z&amp;#34;,&amp;#34;time_source&amp;#34;:&amp;#34;received&amp;#34;}]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd accounting find --ip 198.51.100.7 --port &lt;span style=&#34;color:#ae81ff&#34;&gt;1500&lt;/span&gt; --at 2026-11-25T11:30:00Z --file accounting.jsonl&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1&#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;Times need a time zone&lt;/strong&gt;, for example &lt;code&gt;2026-11-25T10:00:00Z&lt;/code&gt; or &lt;code&gt;2026-11-25T18:00:00+08:00&lt;/code&gt;. You can give &lt;code&gt;--file&lt;/code&gt; more than once; if you give none, or give &lt;code&gt;-&lt;/code&gt;, it reads standard input. A &lt;code&gt;--file&lt;/code&gt; whose name ends in &lt;code&gt;.gz&lt;/code&gt; is decompressed automatically (give an &lt;code&gt;accounting.jsonl.2.gz&lt;/code&gt; rotated by logrotate straight to &lt;code&gt;--file&lt;/code&gt;; several gzip files joined together also work). Standard input is not decompressed, so use &lt;code&gt;zcat accounting.jsonl.2.gz | rradiusd accounting find --ip … --at …&lt;/code&gt;. If a compressed file is damaged or truncated, the command exits with code 2 and names the file.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Who holds it:&lt;/strong&gt; a range whose &lt;code&gt;IP-Port-Range-Alloc&lt;/code&gt; is &lt;code&gt;Allocation&lt;/code&gt; starts the hold, and &lt;code&gt;Deallocation&lt;/code&gt; ends it. A release without start and end ports ends all the earlier allocations of the same holder. A &lt;code&gt;Stop&lt;/code&gt; with the same client and &lt;code&gt;Acct-Session-Id&lt;/code&gt; also ends its hold. The RFC does not say this; it is the command&amp;rsquo;s decision, and the output marks it &lt;code&gt;ended_by&lt;/code&gt; &lt;code&gt;stop&lt;/code&gt; so you can tell. If there is neither a release nor a Stop, the output says &lt;code&gt;ended ... still held&lt;/code&gt; (&lt;code&gt;released&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt; in JSON).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Time basis:&lt;/strong&gt; the event time is &lt;code&gt;Event-Timestamp&lt;/code&gt; first; if there is none, the received time minus &lt;code&gt;Acct-Delay-Time&lt;/code&gt;; if there is none of that, the received time. &lt;code&gt;time_source&lt;/code&gt; in the output says which one was used. A NAS retransmit or queueing can make the received time later than the event, so near a boundary, judge by &lt;code&gt;time_source&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;No assumption that there is a user name:&lt;/strong&gt; the output lists only the identifying attributes that line has (&lt;code&gt;User-Name&lt;/code&gt;, &lt;code&gt;Acct-Session-Id&lt;/code&gt;, &lt;code&gt;Framed-IP-Address&lt;/code&gt;, &lt;code&gt;NAS-Identifier&lt;/code&gt;, &lt;code&gt;NAS-IP-Address&lt;/code&gt;, &lt;code&gt;client&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Exit codes:&lt;/strong&gt; 0 found, 1 not found, 2 a bad argument or file (the message names the file and line number).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Retention.&lt;/strong&gt; The command stores no data. How long log files are kept is decided by the rotation tool (logrotate, newsyslog) and by the enterprise export&amp;rsquo;s &lt;code&gt;keep_days&lt;/code&gt;. Legal retention periods for operator logs differ from place to place; you decide, and rradius sets no default and deletes no files for you.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; This feature has not been tried with a real CGN or BNG. The test packets were built by hand from the RFC 8045 attribute definitions, so you need to confirm on your own equipment what it really sends (for example whether it has &lt;code&gt;Ext-IPv4-Addr&lt;/code&gt;, whether a release covers only some of the ports, and whether a &lt;code&gt;Stop&lt;/code&gt; comes with a separate release).&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Known limits:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A release ends the whole entry if it overlaps the held ports at all; it does not split. If a device releases only some of the ports, the remaining ports are treated as released at query time, so the lookup under-reports.&lt;/li&gt;&#xA;&lt;li&gt;A range with no &lt;code&gt;Ext-IPv4-Addr&lt;/code&gt;, no start and end ports, or no identity cannot be matched. The command prints the number of such ranges on standard error.&lt;/li&gt;&#xA;&lt;li&gt;A standalone CGN that sends only the inside address, which then has to be matched to the BNG&amp;rsquo;s session, is not supported in this version; IPv6 public addresses are not supported.&lt;/li&gt;&#xA;&lt;li&gt;Events are sorted by time and loaded into memory as a whole: memory grows with the number of relevant lines (including &lt;code&gt;IP-Port-Range&lt;/code&gt; and &lt;code&gt;Stop&lt;/code&gt;), so pick the files by date before you query.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The log contains personal data such as &lt;code&gt;User-Name&lt;/code&gt;. Handle the retention period and access rights according to your own rules.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;the-accounting-spool&#34;&gt;The accounting spool&#xA;&lt;/h2&gt;&lt;p&gt;A write to the cluster database has to be confirmed by a majority of nodes (chapter 16). While the cluster has lost its majority, or the database is too busy and times out, the accounting script cannot write, so the NAS gets no reply. After a few retransmits the NAS gives up, and those records are lost.&lt;/p&gt;&#xA;&lt;p&gt;The accounting spool is a local on-disk store of requests waiting to be replayed. With &lt;code&gt;[radius.accounting_spool]&lt;/code&gt; set, when a database call fails while the script runs because it &lt;strong&gt;cannot connect or times out&lt;/strong&gt; (whether or not the script catches the error, and whatever it finally returns), rradius first writes the whole request to disk and sends the Accounting-Response only once it is safely written. Later, in the background, it replays requests in order: it hands each request to the script again, until the script accepts it.&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:#75715e&#34;&gt;# rradius.toml (added at the end of the file)&lt;/span&gt;&#xA;&lt;/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;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;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&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;&lt;code&gt;radius.accounting_spool.dir&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;none, required&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;needs restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The spool directory, relative to the configuration file&amp;rsquo;s 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;radius.accounting_spool.max_bytes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1073741824&lt;/code&gt; (1 GiB)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;needs restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The size limit of the spool, in bytes, must be greater than 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;radius.accounting_spool.replay_interval_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;5000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;needs restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How long to wait before trying again after a replay fails, in milliseconds, must be greater than 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;radius.accounting_spool.replay_window&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;needs restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How many requests to replay at the same time, 1 to 1024&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;A change anywhere in the table needs a restart; on reload, the log says &lt;code&gt;these need a restart to apply: [radius.accounting_spool]&lt;/code&gt;. (See &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt; for the full description.)&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What goes into the spool and what does not:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Goes in: failures that mean &amp;ldquo;the database cannot be used right now&amp;rdquo;, such as a database call timeout, no leader, or the write queue refusing the request.&lt;/li&gt;&#xA;&lt;li&gt;Does not go in: wrong SQL (a syntax error, a missing table, a wrong number of parameters), a Lua error in the script itself, and a script that returns &lt;code&gt;reject&lt;/code&gt; without calling the database. Writing these down would not fix them, so they still get no reply.&lt;/li&gt;&#xA;&lt;li&gt;When the spool is full (writing more would exceed &lt;code&gt;max_bytes&lt;/code&gt;) or a disk write fails, there is no reply, &lt;code&gt;rradius_acct_spool_full_total&lt;/code&gt; is incremented once, and a log line is written. Later requests are still tried as usual.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Replay rules:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It starts from the oldest, takes at most &lt;code&gt;replay_window&lt;/code&gt; requests at a time, and hands them to the &lt;strong&gt;current&lt;/strong&gt; script with &lt;code&gt;phase&lt;/code&gt; set to &lt;code&gt;accounting&lt;/code&gt; and &lt;code&gt;replayed&lt;/code&gt; set to true.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Acct-Delay-Time&lt;/code&gt; gets the number of seconds the request waited in the spool added to it; if the request did not have this attribute, one is added.&lt;/li&gt;&#xA;&lt;li&gt;If the script accepts and there was no database failure along the way, the replay succeeded and is counted in &lt;code&gt;rradius_acct_spool_replayed_total&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;If the database is still unusable, there is a Lua error, the execution time limit is exceeded, or the script caught a database error but still returned &lt;code&gt;accept&lt;/code&gt;: it waits &lt;code&gt;replay_interval_ms&lt;/code&gt; and tries the same request again, and everything behind it waits.&lt;/li&gt;&#xA;&lt;li&gt;These cases, where trying again will not succeed, are moved to &lt;code&gt;rejected.log&lt;/code&gt; and counted in &lt;code&gt;rradius_acct_spool_rejected_total&lt;/code&gt;, and the replay goes on to the next request: the client is no longer in the configuration, what was stored is not a RADIUS packet, the script did not accept without a database failure, or the script ended because of a SQL or parameter error (including a violated unique or foreign key constraint).&lt;/li&gt;&#xA;&lt;li&gt;Within a batch, results are settled in write order and stop at the first request that must be retried. The requests after it stay in the spool and run again later, even if the script accepted them.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The default &lt;code&gt;replay_window = 1&lt;/code&gt; replays strictly one by one in the order received, because a script may expect the Start of a session to come before its Stop. A larger value catches up faster, but the order may interleave, and when a batch stops partway, the requests after the stop run one extra time. If you write the script to be safe to run again, as in &lt;a class=&#34;link&#34; href=&#34;#reading-the-accounting-script&#34; &gt;Reading the accounting script&lt;/a&gt;, neither order nor repeats cause problems.&lt;/p&gt;&#xA;&lt;p&gt;Replay is &amp;ldquo;at least once&amp;rdquo;: if the server is stopped between a replay and recording its progress, after the restart those few requests run again. Progress is written to disk at least every 64 requests and whenever the replay moves to a new file. After a restart, replay continues from the recorded progress.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Files in the directory:&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;File&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Content&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;segment-&amp;lt;20 digits&amp;gt;.log&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Requests waiting to be replayed, stored in order; a file holds up to 16 MiB before the next one starts&lt;/td&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;position&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How far the replay has got&lt;/td&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;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Requests that were moved out and will not be replayed 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;&lt;code&gt;truncated.log&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;If the last record was found unfinished at startup, it is saved here before it is cut off&lt;/td&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;*.corrupt&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A file with damage in the middle, renamed and left untouched; the replay skips to the next file&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The server creates the directory with mode 0700 and the files with 0600. The files are in a binary format and contain personal data such as &lt;code&gt;User-Name&lt;/code&gt;; if the disk is lost, the data is lost with it. &lt;code&gt;check&lt;/code&gt; verifies that &lt;code&gt;dir&lt;/code&gt; is usable, but it does not create it and does not change any file in it.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Measured: when the cluster loses its majority.&lt;/strong&gt; On one machine, start three nodes (the three configurations of the ha-cluster scenario, each with its own ports, &lt;code&gt;data_dir&lt;/code&gt; and &lt;code&gt;dir&lt;/code&gt;; for the setup see chapter 16). Send one accounting request to node 1 to confirm it works, then stop the other two nodes. The commands below leave out node 1&amp;rsquo;s port:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For the first request after the stop, the script&amp;rsquo;s write waited about 30 seconds before it failed, and then the request was written to the spool and answered. The NAS&amp;rsquo;s timeout is shorter than that, so the NAS retransmits first; the retransmit in progress is dropped, and a retransmit that arrives after the request was written to the spool is answered by retransmit detection.&lt;/li&gt;&#xA;&lt;li&gt;Once this node has had no leader for more than 5 seconds, writes fail immediately, and new accounting is written to the spool and answered within a few milliseconds:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user dave --load acct-start,concurrency=1 --requests 1 --timeout 10&#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;  acct-start: 166/s, sent 1, accept 0, reject 0, challenge 0, accounting 1, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;$ rradiusd status --config node1.toml&#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;Accounting spool&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Bytes waiting  223&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Replayed       0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Rejected       0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Not spooled    0.0/s (0)&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The log also has the script&amp;rsquo;s error &lt;code&gt;Lua script error (radius/accounting): runtime error: no leader for 48 s&lt;/code&gt;. That is expected: the script really could not write, but the request is safely on disk.&lt;/p&gt;&#xA;&lt;p&gt;After you start the other two nodes, the replay finishes within a dozen or so seconds: &lt;code&gt;Bytes waiting&lt;/code&gt; goes back to 0, &lt;code&gt;rradius_acct_spool_replayed_total&lt;/code&gt; is 2, the accounting table has both records, and &lt;code&gt;Acct-Delay-Time&lt;/code&gt; is larger than before by the seconds they waited in the spool.&lt;/p&gt;&#xA;&lt;p&gt;If you change the script to always &lt;code&gt;reject&lt;/code&gt; on replay and try again, that request is moved to &lt;code&gt;rejected.log&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::lua_engine: Lua script did not accept accounting (radius, client nas-network)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::lua_engine: accounting spool: request from client nas-network moved to rejected.log: the script did not accept it&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The seconds added to &lt;code&gt;Acct-Delay-Time&lt;/code&gt; are counted from the moment the request was &lt;strong&gt;written to the spool&lt;/strong&gt;, not from when it was received. For the first request after stopping the nodes above, the script waited about 30 seconds before failing. Those 30 seconds are not counted, so that request&amp;rsquo;s time is about 30 seconds late.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; A full spool, a failed disk write, and the handling of damaged files (&lt;code&gt;truncated.log&lt;/code&gt;, &lt;code&gt;*.corrupt&lt;/code&gt;) were checked only against the code and the tests, not measured.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Metrics and status.&lt;/strong&gt; The accounting spool metrics appear whether or not &lt;code&gt;[radius.accounting_spool]&lt;/code&gt; is 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;Metric&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;&lt;code&gt;rradius_acct_spool_written_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Requests written 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;&lt;code&gt;rradius_acct_spool_replayed_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Requests replayed successfully (the script accepted)&lt;/td&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;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Requests moved to &lt;code&gt;rejected.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;rradius_acct_spool_full_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Requests not written because the spool was full or the disk failed&lt;/td&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_corrupt_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Damaged files that were renamed and kept&lt;/td&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;Bytes waiting to be replayed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;In the Accounting spool section of &lt;code&gt;status&lt;/code&gt;, &lt;code&gt;Bytes waiting&lt;/code&gt; is &lt;code&gt;rradius_acct_spool_bytes&lt;/code&gt; and &lt;code&gt;Not spooled&lt;/code&gt; is &lt;code&gt;rradius_acct_spool_full_total&lt;/code&gt;. Worth alerting on: &lt;code&gt;rradius_acct_spool_bytes&lt;/code&gt; that stays above 0 for a long time (it is not catching up), and &lt;code&gt;full_total&lt;/code&gt; or &lt;code&gt;rejected_total&lt;/code&gt; going up. For example alert rules, see &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;chapter 17&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; The spool lives on each node&amp;rsquo;s own disk and is not replicated to other nodes. While a node&amp;rsquo;s spool still has data, do not delete that node&amp;rsquo;s &lt;code&gt;dir&lt;/code&gt;, and do not throw away its disk after removing the node from the cluster: wait until &lt;code&gt;Bytes waiting&lt;/code&gt; is back to 0 first.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;how-a-script-knows-it-is-a-replay-replayed&#34;&gt;How a script knows it is a replay: replayed&#xA;&lt;/h2&gt;&lt;p&gt;When a request is replayed from the spool, the global variable &lt;code&gt;replayed&lt;/code&gt; is true; otherwise it is false. Most scripts do not need to tell the difference; just write them to be safe to run again. You need it for things that &amp;ldquo;have side effects and should happen only once, at the time&amp;rdquo;, for example:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Calling an external HTTP API to notify some system.&lt;/li&gt;&#xA;&lt;li&gt;Deciding from an Interim-Update whether to disconnect a user. A replayed Interim-Update is old news from several minutes ago.&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-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;-- accounting.lua (excerpt)&lt;/span&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; replayed &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;replayed&amp;#39;&lt;/span&gt;, get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Acct-Session-Id&amp;#39;&lt;/span&gt;), &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;delay&amp;#39;&lt;/span&gt;, get_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Acct-Delay-Time&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;p&gt;During a measured replay, this line printed:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::lua_engine: script accounting.lua (radius/accounting, client nas-network): replayed 57b0000000000000 delay 14&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;tacacs-accounting&#34;&gt;TACACS+ accounting&#xA;&lt;/h2&gt;&lt;p&gt;A TACACS+ accounting request also goes to the top-level script, with &lt;code&gt;phase&lt;/code&gt; set to &lt;code&gt;accounting&lt;/code&gt; and &lt;code&gt;protocol&lt;/code&gt; set to &lt;code&gt;&amp;quot;tacacs&amp;quot;&lt;/code&gt;, but it differs from RADIUS in three ways:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;When the script does not accept, the reply is &lt;code&gt;ERROR&lt;/code&gt;, not silence.&lt;/li&gt;&#xA;&lt;li&gt;There is no accounting spool.&lt;/li&gt;&#xA;&lt;li&gt;It is not written to &lt;code&gt;[radius.accounting_log]&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For attributes, table design and examples, see &lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;chapter 12&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The NAS keeps retransmitting accounting requests, &lt;code&gt;rradius-bench&lt;/code&gt; shows &lt;code&gt;timeouts 1&lt;/code&gt;, and the server log has &lt;code&gt;Lua script did not accept accounting&lt;/code&gt; or &lt;code&gt;Lua script error (radius/accounting)&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The accounting script did not return &lt;code&gt;accept&lt;/code&gt;. Common causes are an &lt;code&gt;if phase ~= &#39;accounting&#39;&lt;/code&gt; or &lt;code&gt;protocol&lt;/code&gt; test at the top of the script written the wrong way round, or wrong SQL.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Correct the script as the log says, then send &lt;code&gt;SIGHUP&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;rradius-bench&lt;/code&gt; shows &lt;code&gt;timeouts 1&lt;/code&gt; and the server log has nothing.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The request was dropped before the script. The most common reasons are a shared secret that does not match (&lt;code&gt;Discarded: invalid&lt;/code&gt; in &lt;code&gt;status&lt;/code&gt; goes up) or a source that is not a client in the configuration (&lt;code&gt;Discarded: unknown client&lt;/code&gt;).&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; See &lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;chapter 05&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The same session has two rows in the accounting table, or its traffic is counted twice.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The script is not safe to run again: it uses a plain &lt;code&gt;INSERT&lt;/code&gt;, or it adds the traffic up.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change it to &lt;code&gt;INSERT … ON CONFLICT … DO UPDATE&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; as in &lt;a class=&#34;link&#34; href=&#34;#reading-the-accounting-script&#34; &gt;Reading the accounting script&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;session list&lt;/code&gt; keeps listing people who went offline long ago.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The NAS did not send Stop (power loss, link loss), and the &lt;code&gt;[sessions]&lt;/code&gt; SQL looks only at &lt;code&gt;stopped IS NULL&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add a &amp;ldquo;recently updated&amp;rdquo; condition, such as the quick-start &lt;code&gt;updated &amp;gt; strftime(&#39;%s&#39;, &#39;now&#39;) - 900&lt;/code&gt;, and make the NAS send Interim-Updates.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;session list&lt;/code&gt; prints &lt;code&gt;sessions.list is not set in rradius.toml&lt;/code&gt;, exit code 2.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The configuration file has no &lt;code&gt;[sessions]&lt;/code&gt;, or no &lt;code&gt;list&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add &lt;code&gt;[sessions]&lt;/code&gt;. No reload is needed after the change.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;session list&lt;/code&gt; waits 30 seconds, prints &lt;code&gt;the cluster did not answer within 30 s&lt;/code&gt;, exit code 3.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The server is not running, or the cluster&amp;rsquo;s API port cannot be reached.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Start the server first.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;radius.accounting_log.file: directory log does not exist&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The directory of the log file does not exist.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Create the directory first, and make sure the account that runs the server can write to it.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;radius.accounting_log.queue must be from 1 to 16777216&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;queue&lt;/code&gt; is out of range, for example 0.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change it to a value in range, or delete it to use the default.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;radius.accounting_spool.dir: cannot use &#39;afile&#39;: Not a directory (os error 20)&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;dir&lt;/code&gt; points to a file, or to a directory that cannot be written to or listed.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change it to a directory you can write to. If the directory does not exist but its parent can be written to, &lt;code&gt;check&lt;/code&gt; passes and the server creates it at startup.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;radius.accounting_spool.replay_window must be from 1 to 1024&lt;/code&gt;, &lt;code&gt;radius.accounting_spool.max_bytes must be greater than 0&lt;/code&gt; or &lt;code&gt;radius.accounting_spool.replay_interval_ms must be greater than 0&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; A value is out of range.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change it to a value in range.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;conf.d/snippet.toml: line 1: missing field `dir` &lt;/code&gt;, starting with the file and line where &lt;code&gt;[radius.accounting_spool]&lt;/code&gt; is.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;[radius.accounting_spool]&lt;/code&gt; has no &lt;code&gt;dir&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add &lt;code&gt;dir&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The cluster has recovered, but &lt;code&gt;rradius_acct_spool_bytes&lt;/code&gt; never goes back to 0, and the same script error appears in the log every 5 seconds.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The request being replayed fails every time for a reason that &amp;ldquo;may go away next time&amp;rdquo;, such as a Lua error in the script or an execution timeout. Everything behind it is waiting.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Correct the script as the log says and reload; the replay continues from that request.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;rradius_acct_spool_rejected_total&lt;/code&gt; goes up, and the log has &lt;code&gt;moved to rejected.log&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; On replay the script rejected the request, or there was a SQL error, or the client has been removed from the configuration.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Fix the cause given in the log. Requests in &lt;code&gt;rejected.log&lt;/code&gt; are not replayed automatically again.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05 RADIUS service and NAS clients&lt;/a&gt;: clients, retransmit detection, overload protection&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;06 Dictionary and attributes&lt;/a&gt;: attribute names and enumerated values&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09 External databases and named queries&lt;/a&gt;: turning accounting data into metrics&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;10 Writing policies in Lua&lt;/a&gt;: &lt;code&gt;sql_execute&lt;/code&gt;, &lt;code&gt;log&lt;/code&gt;, migrations&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;12 TACACS+ device administration&lt;/a&gt;: TACACS+ accounting&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../14-isp-recipes/&#34; &gt;14 Scenarios: broadband and ISP&lt;/a&gt;: accounting for address pools and traffic control&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16 Clusters and high availability&lt;/a&gt;: why a write waits for the leader to confirm&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../92-metrics-reference/&#34; &gt;Appendix C: Metrics reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>14 Scenarios: broadband and ISP</title>
            <link>https://embark.systems/en/rradius/oss/14-isp-recipes/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/14-isp-recipes/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Allocate IPv4 addresses and delegated IPv6 prefixes from address pools in database tables, and confirm and release them with accounting&lt;/li&gt;&#xA;&lt;li&gt;Authenticate IPoE subscribers that have no password, using the DHCP Option 82 line identity&lt;/li&gt;&#xA;&lt;li&gt;Return fixed addresses, routed subnets and fixed prefixes, and reject the login instead of silently falling back to a dynamic address when the data is wrong&lt;/li&gt;&#xA;&lt;li&gt;Limit concurrent connections and traffic over a period, per plan&lt;/li&gt;&#xA;&lt;li&gt;Return different rate attributes for the same plan depending on the BNG vendor&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: you have read &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;chapter 03&lt;/a&gt;, and you can copy a scenario, start the server and log in with &lt;code&gt;rradius-bench&lt;/code&gt;. You know what the auth chain in &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;chapter 07&lt;/a&gt; and the Lua scripts in &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;chapter 10&lt;/a&gt; do. Everything in this chapter runs on one machine. You do not need a real BNG.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#what-these-scenarios-have-in-common&#34; &gt;What these scenarios have in common&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#prepare-a-lab-directory&#34; &gt;Prepare a lab directory&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#ipv4-address-pool-ip-pool&#34; &gt;IPv4 address pool: ip-pool&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#ipv6-prefix-pool-prefix-pool&#34; &gt;IPv6 prefix pool: prefix-pool&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#authenticate-by-line-identity-line-identity&#34; &gt;Authenticate by line identity: line-identity&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#dual-stack-lines-dual-stack-lines&#34; &gt;Dual-stack lines: dual-stack-lines&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#fixed-addresses-and-prefixes-static-ip&#34; &gt;Fixed addresses and prefixes: static-ip&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#plans-and-usage-control-usage-control&#34; &gt;Plans and usage control: usage-control&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#return-rates-by-bng-rate-limit&#34; &gt;Return rates by BNG: rate-limit&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#single-file-examples&#34; &gt;Single-file examples&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;what-these-scenarios-have-in-common&#34;&gt;What these scenarios have in common&#xA;&lt;/h2&gt;&lt;p&gt;The seven scenarios in this chapter are all under &lt;code&gt;rradius-server/examples/scenarios/&lt;/code&gt; in the source tree. They are all single-node, and their data lives in the cluster database. They use the same set of techniques. Read these points first, and each section below only covers what is different.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The auth chain checks the password first, then runs the policy.&lt;/strong&gt; Scenarios with a password use &lt;code&gt;policy = &amp;quot;all_accept&amp;quot;&lt;/code&gt; in &lt;code&gt;[auth]&lt;/code&gt;. The first handler is an sql handler that checks the password, and the second is a lua handler that allocates or checks something. &lt;code&gt;all_accept&lt;/code&gt; runs the handlers in order and stops at the first reject, so a user with a wrong password never reaches the lua handler and never takes an address or a connection slot. The reply attributes that the lua handler sets go into the Access-Accept.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The accounting script confirms and releases.&lt;/strong&gt; When &lt;code&gt;[auth]&lt;/code&gt; is present, the auth chain handles authentication, and the &lt;code&gt;script&lt;/code&gt; in &lt;code&gt;[lua]&lt;/code&gt; handles only accounting. The server sends an Accounting-Response only when the accounting script returns &lt;code&gt;accept&lt;/code&gt;. For any other result it does not answer, and the NAS retransmits. So every write in the accounting script is written so that processing the same packet twice gives the same result as processing it once.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Three states: reserved, in use, released.&lt;/strong&gt; Addresses, prefixes and connection slots all have a state column:&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;State&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;When it is entered&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;When it is left&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;reserved&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;When authentication succeeds&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An Accounting-Start turns it into &lt;code&gt;active&lt;/code&gt;; if none arrives within 120 seconds, it is released&lt;/td&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;active&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting-Start or Interim-Update&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting-Stop, an Accounting-On or Accounting-Off from the NAS, or no message for 3 Interim intervals&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Released&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Any of the endings above&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The next user takes it&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 returns &lt;code&gt;Acct-Interim-Interval = 300&lt;/code&gt; in the Access-Accept, which asks the NAS to send an Interim-Update every 300 seconds. When a NAS crashes without sending a Stop, its session expires after 3 Interim intervals (900 seconds) with no message, and the next reclaim releases it.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Claim resources with compare-and-update.&lt;/strong&gt; The script first reads a few candidates from its local copy of the database. Then it tries to claim one with a conditional &lt;code&gt;UPDATE&lt;/code&gt; (for example &lt;code&gt;WHERE state = &#39;free&#39;&lt;/code&gt;). &lt;code&gt;sql_execute&lt;/code&gt; returns the number of rows affected, and the claim succeeded only if it is 1. All writes go through the cluster leader one at a time, so two simultaneous requests cannot claim the same row. The local copy may be slightly stale, and the worst case is one extra attempt. This works the same way on several nodes (see &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;chapter 16&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Reclaim triggered by requests.&lt;/strong&gt; Expired reservations and sessions that stopped sending Interim updates do not disappear by themselves. Someone has to release them. These scenarios have no scheduler, so requests do it on the side. The &lt;code&gt;housekeeping&lt;/code&gt; table has one row per job, with the time of the last run. When the script sees that more than 60 seconds have passed, it tries to claim the job with &lt;code&gt;UPDATE housekeeping … WHERE last_run &amp;lt; ?&lt;/code&gt;. Only the request that wins the claim does the reclaim, at most 1000 rows at a time. So even with several nodes, the job runs once per period.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Write the reason for a reject to the log.&lt;/strong&gt; An Access-Reject does not carry the reply attributes that handlers set, so the NAS only knows it was rejected. The script writes the reason into the server log with &lt;code&gt;log()&lt;/code&gt;, in this form:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::lua_engine: script allocate.lua (radius/authentication, client localhost): ip pool business is exhausted: no address for hank&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Monitor with named queries.&lt;/strong&gt; Each scenario with a pool has &lt;code&gt;[queries.&amp;lt;name&amp;gt;]&lt;/code&gt;. Every node queries its own copy every 30 seconds (&lt;code&gt;interval_ms&lt;/code&gt; defaults to &lt;code&gt;30000&lt;/code&gt;), and the result becomes the metric &lt;code&gt;rradius_query_&amp;lt;name&amp;gt;&lt;/code&gt;. &lt;code&gt;rradiusd query &amp;lt;name&amp;gt;&lt;/code&gt; runs the query once, right now, and prints a table. A named query takes effect only after a restart. See &lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;chapter 09&lt;/a&gt; for details.&lt;/p&gt;&#xA;&lt;p&gt;The configuration keys used by the scenarios in this chapter (see &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt; for the full description):&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;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Use 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;code&gt;auth.policy&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;first_match&lt;/code&gt;&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;code&gt;all_accept&lt;/code&gt; in every scenario with a password&lt;/td&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.handlers&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;none&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;An sql handler plus a lua handler, or a lua handler 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;&lt;code&gt;lua.script&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;required&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;With &lt;code&gt;[auth]&lt;/code&gt;, handles accounting 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;&lt;code&gt;sessions.list&lt;/code&gt;, &lt;code&gt;show&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;none&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Query the pool or slot table directly&lt;/td&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;queries.&amp;lt;name&amp;gt;.sql&lt;/code&gt;, &lt;code&gt;labels&lt;/code&gt;, &lt;code&gt;value&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;none, &lt;code&gt;[]&lt;/code&gt;, &lt;code&gt;value&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Pool usage as metrics&lt;/td&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;queries.&amp;lt;name&amp;gt;.interval_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;30000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The scenarios use the 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;code&gt;log.trace.clients&lt;/code&gt;, &lt;code&gt;users&lt;/code&gt;, &lt;code&gt;minutes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[]&lt;/code&gt;, &lt;code&gt;[]&lt;/code&gt;, required&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;See the reply attributes during experiments&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The demo data is in &lt;code&gt;migrations/2_demo_*.sql&lt;/code&gt;. The accounts, passwords and pools are public demo values. When you turn a scenario into a production setup, delete this file and use your own data. A migration file that has been applied cannot be edited. To change the structure, add a file with the next number.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Run the examples from a release archive, and run one at a time.&lt;/strong&gt; After you unpack a release archive &lt;code&gt;rradius-&amp;lt;version&amp;gt;-&amp;lt;platform&amp;gt;.tar.gz&lt;/code&gt;, the directory layout is the same as the source repository (executables in &lt;code&gt;bin/&lt;/code&gt;, examples in &lt;code&gt;rradius-server/examples/&lt;/code&gt;). In chapter 03, &lt;code&gt;export PATH=&amp;quot;$PWD/target/release:$PATH&amp;quot;&lt;/code&gt; becomes &lt;code&gt;export PATH=&amp;quot;$PWD/bin:$PATH&amp;quot;&lt;/code&gt; in the unpacked root directory. All other commands and paths stay the same. The scenarios all use the standard ports (1812, 1813, and 49 for TACACS+), so two of them started on the same machine conflict. Run one at a time, or change the ports. Every example has an automatic test (&lt;code&gt;rradius-server/tests/scenarios_test.rs&lt;/code&gt; starts each scenario the way these chapters do, sends requests and compares the results), so a configuration file copied as shown starts correctly. The &lt;code&gt;.secret&lt;/code&gt; files hold demo values such as &lt;code&gt;change-me&lt;/code&gt;. Replace them in production (see &amp;ldquo;Replace the example secrets&amp;rdquo; in chapter 03 and &amp;ldquo;Changing secrets&amp;rdquo; in chapter 18).&lt;/p&gt;&#xA;&lt;h2 id=&#34;prepare-a-lab-directory&#34;&gt;Prepare a lab directory&#xA;&lt;/h2&gt;&lt;p&gt;Copy each scenario out the way chapter 03 shows, and run it from the copy. Do not start it in the source directory. Taking ip-pool as the example, run this in the root of the source 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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ export PATH&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$PWD&lt;span style=&#34;color:#e6db74&#34;&gt;/target/release:&lt;/span&gt;$PATH&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ mkdir -p ~/rradius-lab&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cp -R rradius-server/examples/scenarios/ip-pool ~/rradius-lab/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ sed -i.bak &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;s#^dictionary = .*#dictionary = \&amp;#34;&lt;/span&gt;$PWD&lt;span style=&#34;color:#e6db74&#34;&gt;/share/dictionary\&amp;#34;#&amp;#34;&lt;/span&gt; ~/rradius-lab/ip-pool/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cd ~/rradius-lab/ip-pool&#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; f in *.secret; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; openssl rand -hex &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt; &amp;gt; $f; &lt;span style=&#34;color:#66d9ef&#34;&gt;done&lt;/span&gt;; chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;600&lt;/span&gt; *.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;for&lt;/code&gt; loop before the last line replaces the public secrets that come with the scenario with random values. If you skip it, &lt;code&gt;check&lt;/code&gt; prints a warning about permissions and public values for every &lt;code&gt;.secret&lt;/code&gt; file, but the configuration itself is still fine.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;rradius-bench&lt;/code&gt; does not print reply attributes. To see what the server replied, add tracing at the end of &lt;code&gt;rradius.toml&lt;/code&gt;, using the client name of this scenario:&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:#75715e&#34;&gt;# rradius.toml (add at the end of the file)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&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;clients&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;localhost&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;60&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;[log.trace]&lt;/code&gt; can be reloaded and stops by itself after 60 minutes. Once it is on, every request and response adds one &lt;code&gt;rradius_trace&lt;/code&gt; line to the log, with passwords shown as &lt;code&gt;&amp;lt;hidden&amp;gt;&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_trace: response client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; code=2 attributes=&amp;#34;Message-Authenticator = &amp;lt;hidden&amp;gt;, Framed-IP-Address = 10.77.0.4, Acct-Interim-Interval = 300&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;code=2&lt;/code&gt; is an Access-Accept, &lt;code&gt;3&lt;/code&gt; is an Access-Reject, and &lt;code&gt;5&lt;/code&gt; is an Accounting-Response. For the full description of tracing, see &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;chapter 17&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Then start the server in one terminal (&lt;code&gt;rradiusd serve --config rradius.toml&lt;/code&gt;) and run the tests of each section in another terminal. This chapter uses three loads of &lt;code&gt;rradius-bench&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;pap&lt;/code&gt;: sends one login.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;acct-start&lt;/code&gt;: sends one Accounting-Start, with a different session ID on every run.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;session&lt;/code&gt;: sends a login, a Start and a Stop in order, all with the same session ID. It also copies the &lt;code&gt;Class&lt;/code&gt; and &lt;code&gt;Framed-IP-Address&lt;/code&gt; from the Access-Accept into the two accounting requests, as a real NAS does.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;To add attributes, use &lt;code&gt;--attr type-number=type:value&lt;/code&gt;, for example &lt;code&gt;--attr 8=ip:10.77.0.4&lt;/code&gt;, &lt;code&gt;--attr 31=text:00-11-22-33-44-55&lt;/code&gt; or &lt;code&gt;--attr 52=int:2&lt;/code&gt;. &lt;code&gt;--attr&lt;/code&gt; is added to every request that is sent, authentication and accounting alike.&lt;/p&gt;&#xA;&lt;h2 id=&#34;ipv4-address-pool-ip-pool&#34;&gt;IPv4 address pool: ip-pool&#xA;&lt;/h2&gt;&lt;h3 id=&#34;goal&#34;&gt;Goal&#xA;&lt;/h3&gt;&lt;p&gt;After a user passes password authentication, the user gets an IPv4 address from the pool they belong to, in &lt;code&gt;Framed-IP-Address&lt;/code&gt; of the Access-Accept. The same person logging in again gets the same address back. After logging out, the same user gets their last address back first for a day (stickiness). When the pool is used up, the login is rejected and the log says why.&lt;/p&gt;&#xA;&lt;h3 id=&#34;should-the-authentication-server-allocate-addresses&#34;&gt;Should the authentication server allocate addresses&#xA;&lt;/h3&gt;&lt;p&gt;Many BNGs and NASes have address pools of their own. In that case the authentication server only returns a pool name in &lt;code&gt;Framed-Pool&lt;/code&gt; and the NAS issues addresses from its own pool. You do not need this scenario then. Return &lt;code&gt;Framed-Pool&lt;/code&gt; from the &lt;code&gt;reply_query&lt;/code&gt; of the sql handler (see &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;chapter 03&lt;/a&gt; and &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;chapter 07&lt;/a&gt;). The authentication server should allocate in these cases:&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;Case&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;The NAS has no address pool, or the pool is too small or lacks features&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Only the authentication server can provide the 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;One set of addresses is shared by several NASes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A central pool prevents each NAS from issuing its own addresses and causing conflicts&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;You need to ask &amp;ldquo;who is using this address now&amp;rdquo;, or audit or limit usage&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The ownership of every address is in a table&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;tables&#34;&gt;Tables&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;migrations/1_schema.sql&lt;/code&gt; creates three tables:&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;Table&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;subscribers&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Account, password, &lt;code&gt;pool&lt;/code&gt; (which pool the address comes from), &lt;code&gt;enabled&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;ip_pool&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One row per address. The primary key is &lt;code&gt;(pool, ip)&lt;/code&gt;, so different pools can have overlapping addresses (for example in different VRFs)&lt;/td&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;housekeeping&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The time of the last run of each reclaim job&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The columns of &lt;code&gt;ip_pool&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;state&lt;/code&gt;: &lt;code&gt;free&lt;/code&gt;, &lt;code&gt;reserved&lt;/code&gt; or &lt;code&gt;active&lt;/code&gt;, enforced by a &lt;code&gt;CHECK&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;username&lt;/code&gt;, &lt;code&gt;session_id&lt;/code&gt;, &lt;code&gt;nas&lt;/code&gt;: the user now holding the address, the session confirmed by accounting, and which NAS.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;expires&lt;/code&gt;: the expiry time. 120 seconds for a reservation, and 3 Interim intervals for an address in use.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;last_user&lt;/code&gt;, &lt;code&gt;released&lt;/code&gt;: when an address is released, the previous user and the time are recorded, for stickiness.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;n&lt;/code&gt;: the sequence number of the address in the pool. Numbers in one pool run consecutively from 1, and new addresses continue the numbering.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;When &lt;code&gt;n&lt;/code&gt; has gaps, the random starting points for choosing an address concentrate on some addresses. Four indexes (&lt;code&gt;ip_pool_user&lt;/code&gt;, &lt;code&gt;ip_pool_state&lt;/code&gt;, &lt;code&gt;ip_pool_last_user&lt;/code&gt;, &lt;code&gt;ip_pool_expiry&lt;/code&gt;) cover the condition of every query. When SQLite has no statistics and a condition uses only the first few columns of an index, it may choose to scan the whole pool by primary key instead. So when you add columns or change queries, change the indexes with them.&lt;/p&gt;&#xA;&lt;p&gt;Demo data: the &lt;code&gt;residential&lt;/code&gt; pool is &lt;code&gt;10.77.0.2&lt;/code&gt; to &lt;code&gt;10.77.0.9&lt;/code&gt;, 8 addresses. The &lt;code&gt;business&lt;/code&gt; pool has only 3 addresses (&lt;code&gt;10.88.0.2&lt;/code&gt; to &lt;code&gt;10.88.0.4&lt;/code&gt;) but four users, &lt;code&gt;dave&lt;/code&gt;, &lt;code&gt;frank&lt;/code&gt;, &lt;code&gt;gina&lt;/code&gt; and &lt;code&gt;hank&lt;/code&gt;, so you can see the pool run out. &lt;code&gt;erin&lt;/code&gt; is disabled.&lt;/p&gt;&#xA;&lt;h3 id=&#34;configuration-highlights&#34;&gt;Configuration highlights&#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:#75715e&#34;&gt;# rradius.toml (excerpt, other settings omitted)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;lua&lt;/span&gt;]&#xA;&lt;/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;accounting.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;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 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;&#xA;&lt;/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;allocate.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;sessions&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;list&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT username, nas, session_id, ip, updated FROM ip_pool WHERE state = &amp;#39;active&amp;#39; AND expires &amp;gt; strftime(&amp;#39;%s&amp;#39;, &amp;#39;now&amp;#39;) ORDER BY ip&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, nas, session_id, ip, updated FROM ip_pool WHERE username = ?1 AND state = &amp;#39;active&amp;#39; AND expires &amp;gt; strftime(&amp;#39;%s&amp;#39;, &amp;#39;now&amp;#39;) ORDER BY ip&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;queries&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;pool_usage&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;sql&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT pool, state, count(*) AS addresses FROM ip_pool GROUP BY pool, state&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;help&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Addresses of each pool by state: free, reserved or active.&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;labels&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;pool&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;state&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;value&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;addresses&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;code&gt;[sessions]&lt;/code&gt; queries the pool directly. The address pool itself records who is using which address, so no separate accounting table is needed. Only the &lt;code&gt;session&lt;/code&gt; command reads &lt;code&gt;[sessions]&lt;/code&gt;, so changing it needs no reload.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;pool_usage&lt;/code&gt; becomes the metric &lt;code&gt;rradius_query_pool_usage{pool,state}&lt;/code&gt;. The query uses the &lt;code&gt;ip_pool_state&lt;/code&gt; index, so it does not scan the whole table however large the pool is.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;script-highlights&#34;&gt;Script highlights&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;allocate.lua&lt;/code&gt; (the lua handler) does four things in order:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If the user already has a &lt;code&gt;reserved&lt;/code&gt; or &lt;code&gt;active&lt;/code&gt; address, it reuses it and does not take another.&lt;/li&gt;&#xA;&lt;li&gt;Otherwise, it first takes the address this user used last, if it is free now and was released less than &lt;code&gt;HOLD_SECONDS&lt;/code&gt; (86400 seconds) ago.&lt;/li&gt;&#xA;&lt;li&gt;Then it picks &lt;code&gt;CANDIDATES&lt;/code&gt; (8) free addresses and tries to claim them one by one. The starting point is random within the range of &lt;code&gt;n&lt;/code&gt; among free addresses, so that simultaneous requests do not all go for the same candidates. It reads at most &lt;code&gt;ATTEMPTS&lt;/code&gt; (4) rounds of candidates.&lt;/li&gt;&#xA;&lt;li&gt;If it cannot claim any, it writes a line &lt;code&gt;ip pool … is exhausted&lt;/code&gt; and rejects.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;code&gt;accounting.lua&lt;/code&gt; handles accounting:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Start and Interim-Update confirm this user&amp;rsquo;s address as &lt;code&gt;active&lt;/code&gt;, with the expiry set to 3 Interim intervals from now. If the reservation has already expired and been released while the address is still free, it takes the address back.&lt;/li&gt;&#xA;&lt;li&gt;Stop releases only the address of this session, or a reservation that was never confirmed. So a Stop from an old session that arrives late cannot touch a new binding.&lt;/li&gt;&#xA;&lt;li&gt;Accounting-On and Accounting-Off mean the NAS rebooted, and release all &lt;code&gt;active&lt;/code&gt; addresses of this NAS. Which NAS it is comes from &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;, in that order. When none is present, the client name is used, because one client can be a whole network range.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;code&gt;RESERVE_SECONDS&lt;/code&gt;, &lt;code&gt;HOLD_SECONDS&lt;/code&gt; and &lt;code&gt;INTERIM_SECONDS&lt;/code&gt; exist once in each of the two scripts. When you change them, change both.&lt;/p&gt;&#xA;&lt;h3 id=&#34;testing-and-notes&#34;&gt;Testing and notes&#xA;&lt;/h3&gt;&lt;p&gt;Verified. &lt;code&gt;alice&lt;/code&gt; logs in twice and &lt;code&gt;bob&lt;/code&gt; once:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --password alice-password --load pap,concurrency=1 --requests 1&#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;  pap: 639/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;$ rradiusd query pool_usage --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pool         state     addresses&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;business     free      3&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;residential  free      6&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;residential  reserved  2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Both trace lines of &lt;code&gt;alice&lt;/code&gt; show &lt;code&gt;Framed-IP-Address = 10.77.0.4, Acct-Interim-Interval = 300&lt;/code&gt;, so she took only one address. The other &lt;code&gt;reserved&lt;/code&gt; address is &lt;code&gt;bob&lt;/code&gt;&amp;rsquo;s. Addresses are picked at random, so your result may differ.&lt;/p&gt;&#xA;&lt;p&gt;Log in &lt;code&gt;dave&lt;/code&gt;, &lt;code&gt;frank&lt;/code&gt;, &lt;code&gt;gina&lt;/code&gt; and &lt;code&gt;hank&lt;/code&gt; in turn. The first three succeed. &lt;code&gt;hank&lt;/code&gt; gets &lt;code&gt;reject 1&lt;/code&gt;, and the log says:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… script allocate.lua (radius/authentication, client localhost): ip pool business is exhausted: no address for hank&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Send a Start, and the address changes from &lt;code&gt;reserved&lt;/code&gt; to &lt;code&gt;active&lt;/code&gt; and shows up in &lt;code&gt;session list&lt;/code&gt;. &lt;code&gt;acct-start&lt;/code&gt; does not carry an address by itself, so add the one you just got with &lt;code&gt;--attr&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --load acct-start,concurrency=1 --requests 1 --attr 8=ip:10.77.0.4&#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;$ rradiusd session list --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;username=alice&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nas=192.0.2.1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;session_id=e370000000000000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ip=10.77.0.4&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;updated=1795384802&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;session&lt;/code&gt; load runs a whole session, and the address is released after the Stop:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user carol --password carol-password --load session,concurrency=1 --requests 1&#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;  acct-stop: 776/s, sent 1, accept 0, reject 0, challenge 0, accounting 1, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When &lt;code&gt;carol&lt;/code&gt; logs in again, she gets the same address back (stickiness).&lt;/p&gt;&#xA;&lt;p&gt;Notes:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A reservation takes 120 seconds to expire. To repeat the pool-exhaustion test, wait two minutes, or stop the server and delete &lt;code&gt;data/&lt;/code&gt; to start over.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;rradius_query_pool_usage&lt;/code&gt; is updated only every 30 seconds, so a change you just made shows up in the next round. To see it right away, use &lt;code&gt;rradiusd query pool_usage&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;A wrong password, a disabled account and an account that does not exist are all &lt;code&gt;reject&lt;/code&gt;, and none of them takes an address.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;operations-look-up-addresses-add-and-remove-addresses&#34;&gt;Operations: look up addresses, add and remove addresses&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;ip_pool&lt;/code&gt; is an ordinary table, and there is no dedicated management command. The columns in the SQL below are the columns of &lt;code&gt;migrations/1_schema.sql&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Check the usage of each pool, and &amp;ldquo;who is using this address now&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-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;SELECT&lt;/span&gt; pool, &lt;span style=&#34;color:#66d9ef&#34;&gt;state&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;count&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;) &lt;span style=&#34;color:#66d9ef&#34;&gt;FROM&lt;/span&gt; ip_pool &lt;span style=&#34;color:#66d9ef&#34;&gt;GROUP&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;BY&lt;/span&gt; pool, &lt;span style=&#34;color:#66d9ef&#34;&gt;state&lt;/span&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;SELECT&lt;/span&gt; pool, ip, &lt;span style=&#34;color:#66d9ef&#34;&gt;state&lt;/span&gt;, username, nas, session_id, expires &lt;span style=&#34;color:#66d9ef&#34;&gt;FROM&lt;/span&gt; ip_pool &lt;span style=&#34;color:#66d9ef&#34;&gt;WHERE&lt;/span&gt; ip &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;10.77.0.2&amp;#39;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Check for leaks: rows that have expired but have not been released. These rows are released at the next reclaim. If they stay, no request is arriving to trigger the reclaim:&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;SELECT&lt;/span&gt; ip, username, expires &lt;span style=&#34;color:#66d9ef&#34;&gt;FROM&lt;/span&gt; ip_pool &lt;span style=&#34;color:#66d9ef&#34;&gt;WHERE&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;state&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;!=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;free&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;AND&lt;/span&gt; expires &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; strftime(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;%s&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;now&amp;#39;&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Adding addresses means adding rows. &lt;code&gt;n&lt;/code&gt; continues from the largest value in the pool so that it stays consecutive (the reason is in &amp;ldquo;Tables&amp;rdquo; 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-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; ip_pool (pool, ip, n)&#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;VALUES&lt;/span&gt; (&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;residential&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;10.77.0.10&amp;#39;&lt;/span&gt;, (&lt;span style=&#34;color:#66d9ef&#34;&gt;SELECT&lt;/span&gt; coalesce(&lt;span style=&#34;color:#66d9ef&#34;&gt;max&lt;/span&gt;(n), &lt;span style=&#34;color:#ae81ff&#34;&gt;0&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;FROM&lt;/span&gt; ip_pool &lt;span style=&#34;color:#66d9ef&#34;&gt;WHERE&lt;/span&gt; pool &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;residential&amp;#39;&lt;/span&gt;));&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When there are many addresses, generate these statements with a program, write them as a migration file with a new number, and put it on every node and restart the nodes one by one (see &lt;a class=&#34;link&#34; href=&#34;../18-operations/#adding-a-migration&#34; &gt;chapter 18&lt;/a&gt;). An applied file cannot be edited. To shrink a pool, first check that the addresses you delete are &lt;code&gt;free&lt;/code&gt;, then delete the rows, starting from the largest &lt;code&gt;n&lt;/code&gt; so that &lt;code&gt;n&lt;/code&gt; does not get gaps:&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;DELETE&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;FROM&lt;/span&gt; ip_pool &lt;span style=&#34;color:#66d9ef&#34;&gt;WHERE&lt;/span&gt; pool &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;residential&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;AND&lt;/span&gt; ip &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;10.77.0.10&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;AND&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;state&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;free&amp;#39;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;monitoring-and-alerts&#34;&gt;Monitoring and alerts&#xA;&lt;/h3&gt;&lt;p&gt;The metric of &lt;code&gt;pool_usage&lt;/code&gt; is &lt;code&gt;rradius_query_pool_usage{pool,state}&lt;/code&gt;. Every node outputs the same numbers, so in a cluster use &lt;code&gt;max()&lt;/code&gt;, not &lt;code&gt;sum()&lt;/code&gt;. An alert for a pool that is nearly used up:&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-promql&#34; data-lang=&#34;promql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;max&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;by&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;pool&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;rradius_query_pool_usage{state&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&amp;#34;&lt;span style=&#34;color:#e6db74&#34;&gt;free&lt;/span&gt;&amp;#34;}&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;How much is used:&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-promql&#34; data-lang=&#34;promql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;max&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;by&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;pool&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;rradius_query_pool_usage{state&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&amp;#34;&lt;span style=&#34;color:#e6db74&#34;&gt;free&lt;/span&gt;&amp;#34;}&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;     &lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;sum&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;by&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;pool&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;max&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;by&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;pool, state&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;rradius_query_pool_usage&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;ul&gt;&#xA;&lt;li&gt;A lot of &lt;code&gt;reserved&lt;/code&gt; and few &lt;code&gt;active&lt;/code&gt; means the NAS is not sending Accounting-Start. A reservation takes 120 seconds to be reclaimed.&lt;/li&gt;&#xA;&lt;li&gt;A query with no matching rows produces no sample. When a pool is completely used up (no &lt;code&gt;free&lt;/code&gt; row at all), the sample with &lt;code&gt;state=&amp;quot;free&amp;quot;&lt;/code&gt; disappears, and the first alert expression above does not fire. To catch this case, use &lt;code&gt;max by (pool) (rradius_query_pool_usage{state=&amp;quot;active&amp;quot;}) unless on (pool) max by (pool) (rradius_query_pool_usage{state=&amp;quot;free&amp;quot;})&lt;/code&gt;, or, when you know the pool name, &lt;code&gt;absent(rradius_query_pool_usage{pool=&amp;quot;business&amp;quot;,state=&amp;quot;free&amp;quot;})&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;When a query fails, the metric keeps its last value. Check that &lt;code&gt;rradius_query_last_success_timestamp_seconds{query=&amp;quot;pool_usage&amp;quot;}&lt;/code&gt; is advancing (see &lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;chapter 09&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;Cost: this query uses the covering index &lt;code&gt;ip_pool_state&lt;/code&gt; (&lt;code&gt;SCAN ip_pool USING COVERING INDEX ip_pool_state&lt;/code&gt;). On 2026-11-16, on an in-memory SQLite 3.54.1 database with 110,000 addresses, the median was about 3.7 ms. Rewritten as &lt;code&gt;WHERE state = &#39;free&#39; GROUP BY pool&lt;/code&gt;, it uses &lt;code&gt;ip_pool_expiry&lt;/code&gt;, needs a table lookup for every row, and takes about 9.5 ms. So fetching every state of every pool in one query is better. Not measured again.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;scale&#34;&gt;Scale&#xA;&lt;/h3&gt;&lt;p&gt;Login storm measurement of 2026-11-16 (change ip-pool-scale; one 14-CPU Docker machine, 7 CPUs for the server and 7 CPUs for the measuring program, 64 concurrent PAP logins, every user logging in for the first time; not measured again since):&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;Pool&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Logins&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Per second&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;22,000 addresses, 20,000 users&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;5,000&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;about 7,500&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No duplicates, no rejects&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;110,000 addresses, 100,000 users&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;20,000&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;about 6,600&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No duplicates, no rejects&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;110,000 addresses, 100,000 users, all reconnecting at once&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;100,000&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;about 6,500 (about 15 seconds in all)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;100,000 users each got a different address, no rejects&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;This speed depends on two things: choosing candidates uses the &lt;code&gt;(pool, state, n)&lt;/code&gt; index, and every query at login has a condition covered by the first columns of some index. The &lt;code&gt;WHERE nas = ? AND state = &#39;active&#39;&lt;/code&gt; of the accounting script has no index, but it runs only when a NAS reboots and sends Accounting-On or Accounting-Off, not at every login. When SQLite has no statistics, an index covers only part of a condition, and the query may scan the whole pool by primary key. The &amp;ldquo;reuse the binding&amp;rdquo; query of an earlier version did exactly that (it had &lt;code&gt;ORDER BY ip&lt;/code&gt;, which the primary key already satisfies), and with 110,000 addresses it managed only 64 logins per second. When you change a query, use &lt;code&gt;EXPLAIN QUERY PLAN&lt;/code&gt; to see which index it uses.&lt;/p&gt;&#xA;&lt;p&gt;The measurement covers authentication only. The accounting writes (Start, Interim, Stop) are counted separately, and the limits are in &lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;chapter 19&lt;/a&gt;. If the reconnect takes longer than 120 seconds, reservations that received no Start are released first, and the &amp;ldquo;reserved&amp;rdquo; count is lower than the number of logins.&lt;/p&gt;&#xA;&lt;h3 id=&#34;known-limitations&#34;&gt;Known limitations&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;One address per user.&lt;/strong&gt; Two simultaneous sessions of the same account (for example from two devices) get the same address, because an existing binding is reused. To limit concurrent connections, do it separately; see &amp;ldquo;Plans and usage control&amp;rdquo;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;This scenario does not handle DHCPv6-PD.&lt;/strong&gt; IPv6 prefixes need aligned allocation; see &amp;ldquo;IPv6 prefix pool&amp;rdquo;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;There are no built-in pool functions and no dedicated management command.&lt;/strong&gt; Usage comes from &lt;code&gt;pool_usage&lt;/code&gt; and &lt;code&gt;rradiusd query&lt;/code&gt;. Picking and releasing addresses is done in the script.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;One address at a time.&lt;/strong&gt; There is no &amp;ldquo;allocate a whole range&amp;rdquo;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;After a NAS crash, an address is kept for up to 15 minutes&lt;/strong&gt; (3 Interim intervals, 900 seconds) before it goes to someone else. When the NAS comes back and sends Accounting-On, the addresses are released at once.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When the pool is exhausted, the NAS only sees a Reject.&lt;/strong&gt; The reason is in the log. Monitor the log for &lt;code&gt;is exhausted&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;ipv6-prefix-pool-prefix-pool&#34;&gt;IPv6 prefix pool: prefix-pool&#xA;&lt;/h2&gt;&lt;h3 id=&#34;goal-1&#34;&gt;Goal&#xA;&lt;/h3&gt;&lt;p&gt;Delegate prefixes to subscribers with DHCPv6-PD. After the password check succeeds, the subscriber gets a prefix from the pool, in &lt;code&gt;Delegated-IPv6-Prefix&lt;/code&gt;. The WAN-side /64 is not allocated here. The scenario returns the pool name in &lt;code&gt;Framed-IPv6-Pool&lt;/code&gt;, and the BNG&amp;rsquo;s own pool decides. After the subscriber goes offline, the prefix is kept for them for a day, and when they come back they get the same one.&lt;/p&gt;&#xA;&lt;h3 id=&#34;tables-1&#34;&gt;Tables&#xA;&lt;/h3&gt;&lt;p&gt;An IPv6 pool is too large to store one row per prefix. This scenario stores only three constants per pool, and the table holds only the prefixes that have been allocated:&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;Table&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;prefix_pools&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One row per pool: &lt;code&gt;base&lt;/code&gt; (the high 64 bits of the prefix, as an integer), &lt;code&gt;plen&lt;/code&gt; (the length of the pool), &lt;code&gt;dlen&lt;/code&gt; (the length each user gets, at most 64)&lt;/td&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;prefix_leases&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Only allocated prefixes. A prefix without a row is free. The primary key is &lt;code&gt;(pool, n)&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;subscribers&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Account, password, &lt;code&gt;pool&lt;/code&gt;. The pool name is also the &lt;code&gt;Framed-IPv6-Pool&lt;/code&gt; returned to the BNG&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The high 64 bits of prefix number &lt;code&gt;n&lt;/code&gt; (&lt;code&gt;n&lt;/code&gt; starts at 0) are &lt;code&gt;base | (n &amp;lt;&amp;lt; (64 - dlen))&lt;/code&gt;, so it is always aligned. A pool has 2 to the power &lt;code&gt;dlen - plen&lt;/code&gt; prefixes, and a &lt;code&gt;CHECK&lt;/code&gt; limits this to at most 2 to the power 30. &lt;code&gt;base&lt;/code&gt; must also be aligned to &lt;code&gt;plen&lt;/code&gt;, and a value that is not aligned cannot be written. &lt;code&gt;2001:0db8:0100:0000&lt;/code&gt; is written as &lt;code&gt;0x20010db801000000&lt;/code&gt;. An address whose top bit is 1 (for example &lt;code&gt;fd00::/8&lt;/code&gt;) is a negative number in SQLite, which does not matter.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;prefix_leases.state&lt;/code&gt; has one more value, &lt;code&gt;released&lt;/code&gt;: the subscriber went offline, and the prefix is kept for them for the time being, until &lt;code&gt;expires&lt;/code&gt; (the release time plus &lt;code&gt;HOLD_SECONDS&lt;/code&gt;) passes and the row is deleted. Others take the oldest &lt;code&gt;released&lt;/code&gt; row only when they cannot find a free &lt;code&gt;n&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;prefix&lt;/code&gt; column stores the text of the prefix. It must have exactly the form the server produces when it decodes the &lt;code&gt;Delegated-IPv6-Prefix&lt;/code&gt; reported by the NAS: compressed and lower case, for example &lt;code&gt;2001:db8:100::/56&lt;/code&gt;. Accounting confirmation uses this string to find the row.&lt;/p&gt;&#xA;&lt;p&gt;The demo data has three pools: &lt;code&gt;residential&lt;/code&gt; is &lt;code&gt;2001:db8:100::/48&lt;/code&gt; with one /56 per user, &lt;code&gt;business&lt;/code&gt; is &lt;code&gt;2001:db8:200::/52&lt;/code&gt; with one /60 per user, and &lt;code&gt;ula&lt;/code&gt; is &lt;code&gt;fd12:3456:789a::/48&lt;/code&gt; with one /56 per user, 256 prefixes each.&lt;/p&gt;&#xA;&lt;h3 id=&#34;configuration-highlights-1&#34;&gt;Configuration highlights&#xA;&lt;/h3&gt;&lt;p&gt;The configuration is built like ip-pool: &lt;code&gt;all_accept&lt;/code&gt; with an sql handler first and then the lua handler &lt;code&gt;allocate.lua&lt;/code&gt;, the &lt;code&gt;accounting.lua&lt;/code&gt; of accounting in &lt;code&gt;[lua]&lt;/code&gt;, and &lt;code&gt;[sessions]&lt;/code&gt; querying &lt;code&gt;prefix_leases&lt;/code&gt;. There are three named queries:&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;Query&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Metric&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;prefix_leases&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_query_prefix_leases{pool,state}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Number of prefixes in each state of each pool&lt;/td&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;prefix_capacity&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_query_prefix_capacity{pool}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The capacity of each pool, &lt;code&gt;1 &amp;lt;&amp;lt; (dlen - plen)&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;prefix_hold_age&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_query_prefix_hold_age{pool}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Seconds from the oldest &lt;code&gt;released&lt;/code&gt; row to now, which is the hold time you are actually guaranteed right now&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;When you compute usage, count only &lt;code&gt;reserved&lt;/code&gt; and &lt;code&gt;active&lt;/code&gt;. &lt;code&gt;released&lt;/code&gt; is kept for offline users and can be taken when needed.&lt;/p&gt;&#xA;&lt;h3 id=&#34;script-highlights-1&#34;&gt;Script highlights&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;allocate.lua&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If the user already has a prefix, it reuses it. A &lt;code&gt;released&lt;/code&gt; one goes back to &lt;code&gt;reserved&lt;/code&gt;, waiting for their Accounting-Start.&lt;/li&gt;&#xA;&lt;li&gt;Otherwise, a hash of the account name (FNV-1a) decides the starting &lt;code&gt;n&lt;/code&gt;. In the next &lt;code&gt;WINDOW&lt;/code&gt; (1024) values of &lt;code&gt;n&lt;/code&gt; it looks for a free one and claims it with &lt;code&gt;INSERT OR IGNORE&lt;/code&gt;: 1 affected row means it won, and 0 means someone just took it (the primary key blocked it). The same person always starts from the same point, so they get the same prefix when that position is free, but this is not a guarantee.&lt;/li&gt;&#xA;&lt;li&gt;If the window has no free &lt;code&gt;n&lt;/code&gt;, it picks one at random from the oldest few &lt;code&gt;released&lt;/code&gt; rows and claims it.&lt;/li&gt;&#xA;&lt;li&gt;Only when there is no &lt;code&gt;released&lt;/code&gt; row to take does it look for a free one in the whole pool. Only when the whole pool is full does it reject, and the log says &lt;code&gt;prefix pool … is exhausted&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The text of the prefix is computed in SQL. Luau has no 64-bit integers, so the &lt;code&gt;CLAIM&lt;/code&gt; SQL builds the compressed form with bit operations and &lt;code&gt;printf(&#39;%x:…&#39;)&lt;/code&gt;. When it loses a claim and looks again, the number of candidates doubles with every loss (up to 64), and it tries at most &lt;code&gt;ATTEMPTS&lt;/code&gt; (16) times.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;accounting.lua&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Start and Interim-Update confirm the prefix as &lt;code&gt;active&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Stop changes the prefix of this session to &lt;code&gt;released&lt;/code&gt; and keeps it for &lt;code&gt;HOLD_SECONDS&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Accounting-On and Accounting-Off change all &lt;code&gt;active&lt;/code&gt; prefixes of this NAS to &lt;code&gt;released&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;If the packet carries &lt;code&gt;Delegated-IPv6-Prefix&lt;/code&gt;, it must match. If it does not, only the account is used, because one user has only one prefix in one pool.&lt;/li&gt;&#xA;&lt;li&gt;A Start that arrives after the reservation expired and was deleted is not put back, because &lt;code&gt;n&lt;/code&gt; cannot be derived from the text of a prefix. It only writes a line &lt;code&gt;is not in prefix_leases&lt;/code&gt; to the log.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;testing-and-notes-1&#34;&gt;Testing and notes&#xA;&lt;/h3&gt;&lt;p&gt;Verified. Four users log in, and each gets a prefix from their own pool:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… user=&amp;#34;alice&amp;#34; code=2 attributes=&amp;#34;Message-Authenticator = &amp;lt;hidden&amp;gt;, Delegated-IPv6-Prefix = 2001:db8:100:e700::/56, Framed-IPv6-Pool = residential, Acct-Interim-Interval = 300&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… user=&amp;#34;carol&amp;#34; code=2 attributes=&amp;#34;Message-Authenticator = &amp;lt;hidden&amp;gt;, Delegated-IPv6-Prefix = 2001:db8:200:120::/60, Framed-IPv6-Pool = business, Acct-Interim-Interval = 300&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… user=&amp;#34;dave&amp;#34; code=2 attributes=&amp;#34;Message-Authenticator = &amp;lt;hidden&amp;gt;, Delegated-IPv6-Prefix = fd12:3456:789a:df00::/56, Framed-IPv6-Pool = ula, Acct-Interim-Interval = 300&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The starting point is decided by the account name, so with the same demo data you should get the same prefixes as shown here. After &lt;code&gt;alice&lt;/code&gt; runs through one round with the &lt;code&gt;session&lt;/code&gt; load:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd query prefix_leases --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pool         state     prefixes&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;business     reserved  1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;residential  active    1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;residential  released  1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ula          reserved  1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;released&lt;/code&gt; row of &lt;code&gt;residential&lt;/code&gt; is &lt;code&gt;alice&lt;/code&gt;&amp;rsquo;s prefix (the &lt;code&gt;active&lt;/code&gt; one is &lt;code&gt;bob&lt;/code&gt;, confirmed separately with &lt;code&gt;acct-start&lt;/code&gt;). When she logs in again, she gets &lt;code&gt;2001:db8:100:e700::/56&lt;/code&gt; back, and that row goes back to &lt;code&gt;reserved&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Notes:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The &lt;code&gt;session&lt;/code&gt; load of &lt;code&gt;rradius-bench&lt;/code&gt; copies only &lt;code&gt;Class&lt;/code&gt; and &lt;code&gt;Framed-IP-Address&lt;/code&gt; into accounting, not &lt;code&gt;Delegated-IPv6-Prefix&lt;/code&gt;, so the test takes the &amp;ldquo;account only&amp;rdquo; path. A real BNG sends the prefix.&lt;/li&gt;&#xA;&lt;li&gt;The fuller the pool, the longer the run of consecutive used &lt;code&gt;n&lt;/code&gt; that has to be walked. So the script looks at only one window, and takes a &lt;code&gt;released&lt;/code&gt; row when the window has no free one. When &lt;code&gt;prefix_hold_age&lt;/code&gt; gets smaller, the time that offline users keep their prefix is being squeezed, and it is a signal to expand the pool.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;when-the-pool-is-nearly-full&#34;&gt;When the pool is nearly full&#xA;&lt;/h3&gt;&lt;p&gt;When a pool is nearly full, two things matter: whether logins get slow or rejected, and whether a user who goes offline and comes back still gets the same prefix. The first is measured on a real server. The second is mostly measured by simulation. They are described separately. &lt;strong&gt;All the numbers in this section come from chapter 19 of the old manual and from the change &lt;code&gt;ipv6-prefix-pool&lt;/code&gt; (2026-11-16 to 17, recorded in &lt;code&gt;docs/spectra/changes/archive/2026-11-16-ipv6-prefix-pool/&lt;/code&gt;), and were not measured again. They all measure the current design, which stores only allocated prefixes and has the &lt;code&gt;released&lt;/code&gt; hold&lt;/strong&gt;, not the earlier design with one pre-generated row per prefix.&lt;/p&gt;&#xA;&lt;h4 id=&#34;login-speed-docker-single-node&#34;&gt;Login speed: Docker, single node&#xA;&lt;/h4&gt;&lt;p&gt;Capacity 65,536 (&lt;code&gt;2001:db8::/40&lt;/code&gt; cut into /56), a single node in Docker (7 CPUs for the server and another 7 for &lt;code&gt;rradius-bench&lt;/code&gt;), new users logging in for the first time with 64 concurrent requests. The pool is first filled to the stated usage with &lt;code&gt;allocate.lua&lt;/code&gt;, in two ways: &amp;ldquo;reserved&amp;rdquo; is just filled, with no &lt;code&gt;released&lt;/code&gt; row (the worst case: no free slot in the window and no &lt;code&gt;released&lt;/code&gt; row to take, so the whole pool is searched for a free slot), and &amp;ldquo;&lt;code&gt;released&lt;/code&gt;&amp;rdquo; is the normal state after users go offline.&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;Usage&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Prefixes in the pool&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;New users per second&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;p50&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;p99&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Rejected (pool still has free slots)&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;90%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reserved&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;4,125&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;11 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;71 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;95%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reserved&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1,643&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;24 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;155 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;99%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reserved&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;334&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;161 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;457 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;90%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;released&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;5,114&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;10 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;40 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;99%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;released&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;3,383&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;11 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;67 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;100%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;released&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1,465&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;30 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;34 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;0&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;It is faster when there are &lt;code&gt;released&lt;/code&gt; rows.&lt;/strong&gt; The window covers only the next &lt;code&gt;WINDOW&lt;/code&gt; (1,024) values of &lt;code&gt;n&lt;/code&gt; after the starting point. When the window has no free one, the script takes the oldest &lt;code&gt;released&lt;/code&gt; row directly and does not scan the pool. When the pool is filled with reservations there is no &lt;code&gt;released&lt;/code&gt; row to take, and the higher the usage the slower it gets. This is also why monitoring recommends an alert at more than 85% usage.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;No duplicates.&lt;/strong&gt; After every measurement, the number of rows in the table equals the number of distinct prefixes (the unique index guards this).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Where randomized relaxed retry comes from.&lt;/strong&gt; The first version looked for the &amp;ldquo;next&amp;rdquo; free &lt;code&gt;n&lt;/code&gt; after losing a claim. Measured on a server, at 90% usage about 2.5% of logins were rejected (76 of 3,000 new users), although the pool still had more than six thousand free slots. Users that arrive at the same time and start in the same stretch all find the same free &lt;code&gt;n&lt;/code&gt;. Only one wins each round, and the losers all go for the same one again in the next round. The fuller the pool, the shorter the free stretches. So now (&lt;code&gt;free_near&lt;/code&gt;, &lt;code&gt;steal&lt;/code&gt; and &lt;code&gt;width&lt;/code&gt; in &lt;code&gt;allocate.lua&lt;/code&gt;), after losing a claim, the script picks one at random from the free stretch that follows. The number of candidates doubles with each loss (up to 64), and claiming a &lt;code&gt;released&lt;/code&gt; row works the same way (starting from the oldest 8 rows and doubling with each loss). It tries at most &lt;code&gt;ATTEMPTS&lt;/code&gt; (16) times. A simulation that reads once cannot show this problem, because it has no concurrency.&lt;/p&gt;&#xA;&lt;h4 id=&#34;login-speed-larger-pools-three-node-cluster&#34;&gt;Login speed: larger pools, three-node cluster&#xA;&lt;/h4&gt;&lt;p&gt;Another machine and another measurement (Apple M4 Max, 14 CPUs, macOS, server and &lt;code&gt;rradius-bench&lt;/code&gt; on the same machine, PAP logins, new users logging in for the first time; the old chapter gives the date 2026-11-18). &lt;strong&gt;These numbers can be compared only with each other in this section, not with the Docker table above.&lt;/strong&gt; The pool is first filled to the stated usage with real logins (&lt;code&gt;allocate.lua&lt;/code&gt;). &amp;ldquo;&lt;code&gt;released&lt;/code&gt;&amp;rdquo; means all the filled prefixes were changed to &lt;code&gt;released&lt;/code&gt;. A pool filled by writing directly to the table with prefixes scattered at random is much faster (about 7,000 per second at 65,536 and 99% reserved), because the prefixes and free slots filled by real logins are in runs. So measure with pools filled by real logins.&lt;/p&gt;&#xA;&lt;p&gt;Single node, 64 concurrent:&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;Capacity&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Usage&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Prefixes in the pool&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;New users&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Per second&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;p50&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;p99&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Rejected&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;65,536&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;90%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reserved&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;2,000&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;10,700&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;4.7 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;20 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;65,536&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;95%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reserved&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;2,000&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;3,737&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;7.4 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;108 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;65,536&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;99%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reserved&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;500&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;549&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;93 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;328 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;65,536&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;90%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;released&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;2,000&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;10,751&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;5.0 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;15 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;65,536&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;99%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;released&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;500&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;6,430&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;7.6 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;32 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;65,536&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;100%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;released&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;500&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;6,054&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;8.9 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;262,144&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;90%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reserved&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;2,000&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;10,334&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;4.8 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;22 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;262,144&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;99%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reserved&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;500&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1,879&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;23 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;118 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;262,144&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;99%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;released&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;500&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;6,421&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;8.9 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;25 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;262,144&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;100%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;released&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;500&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;6,062&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;9.4 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;24 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;0&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;With 4 times the capacity, the speed at the same usage is the same or better.&lt;/strong&gt; 99% reserved at 262,144 is more than three times faster than at 65,536, because 1% free slots is four times as many in absolute terms (2,621 against 655).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Still expand before 90%.&lt;/strong&gt; At 99% with the pool full of reservations and no &lt;code&gt;released&lt;/code&gt; row to take, you get only a few hundred to a bit over a thousand per second.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The number of table rows equals the number of distinct prefixes.&lt;/strong&gt; The 100% group at 262,144 had 262,143 rows, one fewer than expected, and the cause was not found.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Three-node cluster (three &lt;code&gt;rradiusd&lt;/code&gt; processes on the same machine, capacity 65,536, three measuring programs each aimed at one node, 63 concurrent in total):&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;Usage&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Prefixes in the pool&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;New users&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Total per second, three nodes&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;p99 per node&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Rejected&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;90%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reserved&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;2,100&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;6,654&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;25–28 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;99%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;released&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;600&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;5,448&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27–34 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;100%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;released&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;600&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;4,696&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;26–32 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;99%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reserved&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;450&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;787&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;250–270 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;0&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;At 90% and in the &lt;code&gt;released&lt;/code&gt; cases it is slower than a single node, at about sixty to eighty percent (6,654 against 10,700, 5,448 against 6,430, 4,696 against 6,054). 99% reserved is faster than a single node (787 against 549), because in that group the bottleneck is finding a free slot, not writing. Writes go through the leader.&lt;/li&gt;&#xA;&lt;li&gt;Three nodes claiming &lt;code&gt;released&lt;/code&gt; rows at the same time produced no rejects and no duplicates: the number of table rows equals the number of distinct prefixes.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;These are three processes on one machine&lt;/strong&gt;, so there is no network latency. Latency between hosts or sites makes each write slower, and this was not measured.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;does-the-user-get-the-same-prefix-when-they-come-back&#34;&gt;Does the user get the same prefix when they come back&#xA;&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;Measured on a server (the old chapter gives the date 2026-11-18):&lt;/strong&gt; capacity 16,384, single node. Users log in in order and send Start, the NAS sends Accounting-On, the users come back in random order, and the test checks whether each gets the original prefix. With the hold (&lt;code&gt;HOLD_SECONDS&lt;/code&gt; 24 hours), at 70%, 90% and 95% usage 100% got the same prefix back, with no rejects. With only the hash starting point (&lt;code&gt;HOLD_SECONDS&lt;/code&gt; set to 0, so all holds expire and are deleted), it was about 55% at 70%, about 41% at 90% and about 37% at 95%. Conclusion: &lt;strong&gt;to be stable across a reboot, rely on the &lt;code&gt;released&lt;/code&gt; hold, not on the hash starting point.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Simulation:&lt;/strong&gt; capacity 65,536, the online time of users follows an exponential distribution (mean one day), and the offline time follows an exponential distribution, or 80% are short disconnects with a mean of 3 minutes and 20% are long absences. After a warm-up, the test measures whether each re-login gets the prefix it had last time. Two independently written simulations were checked against each other. This is not a server measurement, and it does not simulate concurrency or clusters. The main points:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The hash starting point alone (no &lt;code&gt;released&lt;/code&gt;) is not stable.&lt;/strong&gt; With real churn of users going on and offline, at 90% usage about 39–87% get the same one back (depending on the online ratio and the distribution of offline time), at 95% about 62–68%, and at 99% about 39–53%. At 50–70% usage it is still only about 76–93%. Raising the capacity to 1 million gives the same result.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A reboot of the NAS or BNG is the worst case.&lt;/strong&gt; A group of online users disconnect at the same time and come back in random order. With the hash starting point alone: about 51% get the same one back at 70% usage, about 28% at 90%, and about 18% at 95%.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;With the &lt;code&gt;released&lt;/code&gt; hold (24 hours):&lt;/strong&gt; the same reboot case gives 100% back. With normal churn it is about 93–98% at 90% usage (depending on the hold time and the offline distribution), about 89% at 95% and about 82% at 99%. Short disconnects (coming back within the hold period) almost all get the same one back. Users who stay away longer than the hold period, or whose prefix was taken, get a different one.&lt;/li&gt;&#xA;&lt;li&gt;The server measurements at 90% and 95% (about 41% and 37%) are more stable than the simulated 28% and 18%. The cause was not investigated. It may be that the server picks a free slot at random inside the window, which is not exactly the algorithm of the simulation.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h4 id=&#34;capacity-requirement&#34;&gt;Capacity requirement&#xA;&lt;/h4&gt;&lt;p&gt;&lt;strong&gt;The upper limit of stability depends on the ratio of the total number of users to the pool capacity:&lt;/strong&gt; the more users are offline and the fewer free slots there are, the more prefixes get taken. When the total number of users does not exceed the pool capacity, the hold can come close to 100%. When the total number of users far exceeds the capacity, some users must change prefix. For stable prefixes, &lt;strong&gt;the pool capacity must be larger than the total number of users&lt;/strong&gt;, not only the usage low.&lt;/p&gt;&#xA;&lt;h4 id=&#34;alternatives-that-were-rejected&#34;&gt;Alternatives that were rejected&#xA;&lt;/h4&gt;&lt;p&gt;These were all tried in the research phase and are not used (from the simulations in the change record):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Double-hash probing:&lt;/strong&gt; only 1 to 10 percentage points more stability.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Splitting into blocks:&lt;/strong&gt; equal or worse.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Rejecting new users above a usage threshold:&lt;/strong&gt; with demand at 95% and the threshold at 90%, 35% of logins are rejected, which is worse than changing prefixes. So it only alerts and does not reject.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Claiming forward one by one with &lt;code&gt;INSERT OR IGNORE&lt;/code&gt;:&lt;/strong&gt; at 90% usage p99 has to walk 400 to 1,100 values of &lt;code&gt;n&lt;/code&gt;, and each is a write through the leader. Limiting it with &lt;code&gt;ATTEMPTS&lt;/code&gt; would wrongly declare the pool exhausted while free slots remain. So the script now reads once to find free &lt;code&gt;n&lt;/code&gt; and then claims.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;One pre-generated row per prefix (generated by a migration):&lt;/strong&gt; a large pool (for example a /32 cut into /56 has 16 million prefixes) means generating a lot of data, and it was not certain that a migration of 1 million rows could be applied through the cluster. With only allocated prefixes stored, the pool size does not affect the table size. The price is that when the pool is very full, a longer run of consecutive used slots has to be walked (hence the window and taking &lt;code&gt;released&lt;/code&gt; rows).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Looking for a free slot from a random starting point:&lt;/strong&gt; it has no stability (the same user starts from a different point every time), so it is not used.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;monitoring-and-alerts-1&#34;&gt;Monitoring and alerts&#xA;&lt;/h3&gt;&lt;p&gt;The metrics of the named queries are in &amp;ldquo;Configuration highlights&amp;rdquo;. The usage of each pool &lt;strong&gt;counts only &lt;code&gt;reserved&lt;/code&gt; and &lt;code&gt;active&lt;/code&gt;&lt;/strong&gt; (in a cluster use &lt;code&gt;max()&lt;/code&gt;, not &lt;code&gt;sum()&lt;/code&gt;: every node queries the same data). &lt;code&gt;released&lt;/code&gt; is kept for offline users and can be taken when needed. If you counted it, usage would stay close to 100% in steady state.&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-promql&#34; data-lang=&#34;promql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;sum&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;by&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;pool&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;max&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;by&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;pool, state&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;rradius_query_prefix_leases{state&lt;span style=&#34;color:#f92672&#34;&gt;=~&lt;/span&gt;&amp;#34;&lt;span style=&#34;color:#e6db74&#34;&gt;reserved|active&lt;/span&gt;&amp;#34;}&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;  &lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;max&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;by&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;pool&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;rradius_query_prefix_capacity&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;This expression has not been run against a real Prometheus&lt;/strong&gt; (the metric names and labels come from the named queries in the example &lt;code&gt;rradius.toml&lt;/code&gt;). Before going live, run it once in your Prometheus and check that the labels match.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Alert when usage is above 85%&lt;/strong&gt; (&lt;code&gt;&amp;gt; 0.85&lt;/code&gt;). The fuller the pool, the slower the logins and the less it can keep the prefixes of offline users (see the numbers above).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;rradius_query_prefix_hold_age&lt;/code&gt; is the hold time currently guaranteed, in seconds.&lt;/strong&gt; A pool with no &lt;code&gt;released&lt;/code&gt; rows has no sample. If there are some but the oldest is only a few minutes old, the pool is so full that a prefix is taken as soon as it is released, the hold does not reach &lt;code&gt;HOLD_SECONDS&lt;/code&gt;, and stability drops. Expand the pool when it is much smaller than &lt;code&gt;HOLD_SECONDS&lt;/code&gt; (86,400).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A query with no matching rows produces no sample&lt;/strong&gt;, so a completely empty pool has no &lt;code&gt;prefix_leases&lt;/code&gt; sample. Fill the gap in alerts with &lt;code&gt;absent()&lt;/code&gt; (for example, &lt;code&gt;absent(rradius_query_prefix_hold_age{pool=&amp;quot;residential&amp;quot;})&lt;/code&gt; only means there is no &lt;code&gt;released&lt;/code&gt; row now, which is not necessarily a problem), or treat pools with no sample as 0.&lt;/li&gt;&#xA;&lt;li&gt;None of these queries scans the whole pool: the &lt;code&gt;GROUP BY pool, state&lt;/code&gt; of &lt;code&gt;prefix_leases&lt;/code&gt; uses the covering index &lt;code&gt;prefix_leases_pool_state&lt;/code&gt;, taking the oldest &lt;code&gt;released&lt;/code&gt; row uses the partial index &lt;code&gt;prefix_leases_released&lt;/code&gt;, &lt;code&gt;prefix_hold_age&lt;/code&gt; uses &lt;code&gt;prefix_leases_expiry&lt;/code&gt;, and &lt;code&gt;prefix_pools&lt;/code&gt; has only a few rows. The table is only as large as the users that are online or recently offline, so the cost does not depend on the pool capacity.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;use-your-own-pool&#34;&gt;Use your own pool&#xA;&lt;/h3&gt;&lt;p&gt;The pool constant &lt;code&gt;base&lt;/code&gt; is the integer of the high 64 bits of the prefix. Compute it with Python (the result is &lt;code&gt;0x20010db801000000&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;python3 -c &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;print(hex(int.from_bytes(__import__(&amp;#39;ipaddress&amp;#39;).ip_network(&amp;#39;2001:db8:100::/48&amp;#39;).network_address.packed[:8], &amp;#39;big&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;Set &lt;code&gt;plen&lt;/code&gt; and &lt;code&gt;dlen&lt;/code&gt; according to your address plan. &lt;strong&gt;Decide the pool constants before the first start in production.&lt;/strong&gt; An applied migration file cannot be edited, so to add a pool, add a file with the next number. Leave room in the pool size: expand before usage passes 90% (add a pool, or switch to a longer &lt;code&gt;plen&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;h3 id=&#34;combine-with-the-address-pool-for-dual-stack-username-and-password-identity&#34;&gt;Combine with the address pool for dual stack (username and password identity)&#xA;&lt;/h3&gt;&lt;p&gt;When users authenticate with a username and password and need both an IPv4 address and a delegated prefix, the server has only &lt;strong&gt;one top-level script&lt;/strong&gt; for accounting, so the two examples cannot simply run together. The procedure is below. &lt;strong&gt;This combined version has no example and has not been run&lt;/strong&gt; (the combined version with scripts and tests is &amp;ldquo;Dual-stack lines&amp;rdquo;, but that one uses the line identity):&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Authentication:&lt;/strong&gt; list &lt;code&gt;[[auth.handlers]]&lt;/code&gt; in this order: &lt;code&gt;sql&lt;/code&gt; (checks the password), the &lt;code&gt;allocate.lua&lt;/code&gt; of ip-pool, and the &lt;code&gt;allocate.lua&lt;/code&gt; of this scenario. &lt;code&gt;all_accept&lt;/code&gt; runs them one by one and stops at the first reject. Give the two scripts different file names (for example &lt;code&gt;ip-allocate.lua&lt;/code&gt; and &lt;code&gt;prefix-allocate.lua&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Tables:&lt;/strong&gt; the migration file numbers of the two must not collide. Both have &lt;code&gt;subscribers&lt;/code&gt; and &lt;code&gt;housekeeping&lt;/code&gt;, so merge them into one table each. &lt;code&gt;subscribers&lt;/code&gt; needs the IPv4 &lt;code&gt;pool&lt;/code&gt; and the name of the prefix pool (two columns, or two pools with the same name), and &lt;code&gt;housekeeping&lt;/code&gt; needs both rows &lt;code&gt;reap-ip-pool&lt;/code&gt; and &lt;code&gt;reap-prefix-pool&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Accounting:&lt;/strong&gt; merge the two &lt;code&gt;accounting.lua&lt;/code&gt; into one. One packet can carry both &lt;code&gt;Framed-IP-Address&lt;/code&gt; and &lt;code&gt;Delegated-IPv6-Prefix&lt;/code&gt;: handle the address part as ip-pool does and the prefix part as this section does. Accounting-On and Accounting-Off must release on both sides.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When one side is exhausted:&lt;/strong&gt; by default the whole login is rejected (&lt;code&gt;all_accept&lt;/code&gt;). To allow &amp;ldquo;IPv4 without a prefix&amp;rdquo;, change the &lt;code&gt;return &#39;reject&#39;&lt;/code&gt; of the prefix script for exhaustion to &lt;code&gt;return &#39;accept&#39;&lt;/code&gt; without setting attributes. Note that this does not release the IPv4 address that was just reserved. To release it, use a single script like the one in &amp;ldquo;Dual-stack lines&amp;rdquo;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Users with a line identity (Option 82) have no usable account, and handlers do not pass values to each other, so they cannot be chained this way. See &amp;ldquo;Dual-stack lines&amp;rdquo;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;known-limitations-1&#34;&gt;Known limitations&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Prefixes are not guaranteed to be stable.&lt;/strong&gt; When the starting point is taken by someone else, you get a different one. The fuller the pool, the less stable (see above). No history table records &amp;ldquo;which one was used last time&amp;rdquo;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;It is slow when the pool is very full.&lt;/strong&gt; When the pool is full of reservations and has no &lt;code&gt;released&lt;/code&gt; rows, a single Docker node manages about 1,600 new users per second at 95% and about 330 at 99%. With &lt;code&gt;released&lt;/code&gt; rows, 99% still gives more than 3,000 per second (numbers above).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Reclaim handles at most 1,000 rows at a time, once a minute&lt;/strong&gt; (one batch each for turning expired &lt;code&gt;active&lt;/code&gt; rows into &lt;code&gt;released&lt;/code&gt; and for deleting expired reservations and &lt;code&gt;released&lt;/code&gt; rows). When many leases expire together (for example a whole BNG crashes), the rows that have expired but are not yet deleted still hold their prefixes, and clearing them takes several minutes. When the pool is very full, it may wrongly look exhausted during this time.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;An out-of-order Start can keep the prefix of an offline user for a while longer.&lt;/strong&gt; When a Stop arrives first and a Start after it, the Start changes &lt;code&gt;released&lt;/code&gt; back to &lt;code&gt;active&lt;/code&gt;, and only when it expires without an Interim does it turn into &lt;code&gt;released&lt;/code&gt; again (about 900 seconds longer, and the hold is counted again). When a packet carries no prefix and the row is found by user name, a late Start or Interim from an old session can also confirm a new reservation, and the Start of the new session then overwrites it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A reject on exhaustion scans the whole pool.&lt;/strong&gt; When there is no &lt;code&gt;released&lt;/code&gt; row and the window has no free slot, the whole pool is searched to be sure it is exhausted, and the cost is proportional to the number of used rows. When a pool stays exhausted, rejected logins are expensive, so avoid this with the usage alert.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A late Start cannot restore an expired reservation&lt;/strong&gt; (&lt;code&gt;n&lt;/code&gt; cannot be derived from the text of a prefix). It is only logged.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;There is no WAN /64 pool.&lt;/strong&gt; &lt;code&gt;Framed-IPv6-Pool&lt;/code&gt; is only a pool name, and the BNG&amp;rsquo;s pool decides the address of the connection itself.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;It has not been verified against a real BNG.&lt;/strong&gt; The attribute is &lt;code&gt;Delegated-IPv6-Prefix&lt;/code&gt; of RFC 4818, and accounting packets must carry it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Cluster:&lt;/strong&gt; other than the measurement with three processes on one machine, a multi-host cluster has not been measured (see above).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;common-problems&#34;&gt;Common problems&#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;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;Always Reject, and the log has &lt;code&gt;is exhausted&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The pool really has no free slot. Check &lt;code&gt;rradius_query_prefix_leases&lt;/code&gt; and the capacity, and expand the pool&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Always Reject, and the log has &lt;code&gt;is not in prefix_pools&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;subscribers.pool&lt;/code&gt; has no matching pool in &lt;code&gt;prefix_pools&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;Always Reject, and the log has &lt;code&gt;tries: others took the free ones as fast&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Too many users arrive at once and the pool is too full, so all 16 attempts lost. This is usually also a signal to expand the pool&lt;/td&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 succeeds, but the row stays &lt;code&gt;reserved&lt;/code&gt;, is deleted after 120 seconds, and the prefix goes to someone else&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The Start did not arrive, or the &lt;code&gt;Delegated-IPv6-Prefix&lt;/code&gt; of the Start differs from the text in the table (compression, letter case). Look at the prefix in the log line with &lt;code&gt;is not in prefix_leases&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;Cannot write to the pool: &lt;code&gt;CHECK constraint failed&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;base&lt;/code&gt; is not aligned to &lt;code&gt;plen&lt;/code&gt;, or &lt;code&gt;dlen&lt;/code&gt; is smaller than &lt;code&gt;plen&lt;/code&gt; or larger than 64, or the capacity exceeds 2 to the power 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;The user gets a different prefix at every login&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The pool usage is too high and the starting point was taken by someone else; or the user was offline longer than &lt;code&gt;HOLD_SECONDS&lt;/code&gt;; or the position was taken by someone else after the reservation expired (see &amp;ldquo;When the pool is nearly full&amp;rdquo;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;authenticate-by-line-identity-line-identity&#34;&gt;Authenticate by line identity: line-identity&#xA;&lt;/h2&gt;&lt;h3 id=&#34;goal-2&#34;&gt;Goal&#xA;&lt;/h3&gt;&lt;p&gt;IPoE subscribers on fixed broadband have no account and password. &amp;ldquo;Which line&amp;rdquo; is the identity. The BNG puts the circuit-id and remote-id of DHCP Option 82 into the RADIUS request (RFC 4679). For a known line, the scenario returns an address pool name and a profile name. It rejects unknown and disabled lines. If you want, it can also bind a line to the first MAC address it sees.&lt;/p&gt;&#xA;&lt;h3 id=&#34;how-option-82-reaches-radius&#34;&gt;How Option 82 reaches RADIUS&#xA;&lt;/h3&gt;&lt;p&gt;This scenario needs the BNG to put the line identity into the Access-Request. &lt;code&gt;auth.lua&lt;/code&gt; recognizes these attributes:&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;Attribute&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Use&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;ADSL-Agent-Circuit-Id&lt;/code&gt; (RFC 4679, sub-attribute 1 of vendor 3561)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;circuit-id&lt;/td&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;ADSL-Agent-Remote-Id&lt;/code&gt; (RFC 4679, sub-attribute 2 of vendor 3561)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;remote-id; an empty string when absent&lt;/td&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-Port-Id&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Used as the circuit-id when there is no &lt;code&gt;ADSL-Agent-Circuit-Id&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;Calling-Station-Id&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The MAC address of the subscriber&amp;rsquo;s device, needed by &lt;code&gt;lock_mac&lt;/code&gt;; only its 12 hexadecimal characters are used, so colons and hyphens do not matter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;BNGs from different vendors do not agree on which attribute carries Option 82 or what format it has. Some use the set above, some use &lt;code&gt;NAS-Port-Id&lt;/code&gt;, and some join the two values into one string. &lt;strong&gt;First check what your BNG really sends.&lt;/strong&gt; Log in once with an unknown line, and the log shows the values the script saw (&lt;code&gt;line identity: unknown line &amp;lt;remote-id&amp;gt; &amp;lt;circuit-id&amp;gt;&lt;/code&gt;). Fill &lt;code&gt;lines&lt;/code&gt; according to it. You can also turn on &lt;code&gt;[log.trace]&lt;/code&gt; to see the whole request (see &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;chapter 17&lt;/a&gt;). For how to configure the BNG, see its documentation.&lt;/p&gt;&#xA;&lt;p&gt;This scenario does not look at the user name or the password at all. A BNG usually sends the line string or the MAC as the name and a fixed value as the password. The script looks only at the attributes above.&lt;/p&gt;&#xA;&lt;h3 id=&#34;tables-2&#34;&gt;Tables&#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;Table&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;plans&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Each plan: the address pool name &lt;code&gt;pool&lt;/code&gt; returned to the BNG, the profile name &lt;code&gt;profile&lt;/code&gt; (the rate and so on are decided by the profile of the same name on the BNG), and &lt;code&gt;interim&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;lines&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One row per line. The primary key is &lt;code&gt;(remote_id, circuit_id)&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;A circuit-id is usually unique only within one access device, and the remote-id is often the name of that device, so the two together form the primary key. When the BNG sends no remote-id, an empty string is used. Both ids are stored in normalized form:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Leading and trailing whitespace removed and converted to lower case, for example &lt;code&gt;eth 1/1/3:100&lt;/code&gt; and &lt;code&gt;olt-a&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;A value with non-printable characters (binary) is written as &lt;code&gt;0x&lt;/code&gt; plus lower-case hexadecimal, with nothing else done to it, for example &lt;code&gt;0x0004000a0001&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The other columns of &lt;code&gt;lines&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;lock_mac&lt;/code&gt;: &lt;code&gt;0&lt;/code&gt; only records the last MAC seen (&lt;code&gt;last_mac&lt;/code&gt;, &lt;code&gt;last_seen&lt;/code&gt;). &lt;code&gt;1&lt;/code&gt; binds the MAC into &lt;code&gt;bound_mac&lt;/code&gt; at the first login, and rejects any other MAC after that.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;bound_mac&lt;/code&gt;: 12 lower-case hexadecimal characters, with no colons or hyphens. When the subscriber changes device, clear it to &lt;code&gt;NULL&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;configuration-highlights-2&#34;&gt;Configuration highlights&#xA;&lt;/h3&gt;&lt;p&gt;This scenario has no &lt;code&gt;[auth]&lt;/code&gt;. Both authentication and accounting are handled by the top-level script &lt;code&gt;auth.lua&lt;/code&gt;. The clients list only the BNG:&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:#75715e&#34;&gt;# rradius.toml (excerpt, other settings omitted)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;lua&lt;/span&gt;]&#xA;&lt;/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;auth.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;bng&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/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;bng.secret&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; A line identity is not a secret. Anyone who can send requests from a source other than the BNG can impersonate any line by writing any Option 82 into the request. List only the BNG in the client list, not the whole management network. For an extra layer of protection, use &lt;code&gt;lock_mac&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;script-highlights-2&#34;&gt;Script highlights&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;auth.lua&lt;/code&gt; first blocks protocols other than RADIUS, and always returns &lt;code&gt;accept&lt;/code&gt; for accounting. It is the top-level script. If the same server also has &lt;code&gt;[tacacs]&lt;/code&gt; enabled, accepting everything would authorize every command, so it must block first. For authentication:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The line is taken from &lt;code&gt;ADSL-Agent-Circuit-Id&lt;/code&gt;, or from &lt;code&gt;NAS-Port-Id&lt;/code&gt; if that is absent. The remote-id is taken from &lt;code&gt;ADSL-Agent-Remote-Id&lt;/code&gt;, or is an empty string if that is absent. Both are normalized before the lookup in &lt;code&gt;lines&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;If the line is not found, is disabled, or its plan does not exist, it rejects and writes a log line.&lt;/li&gt;&#xA;&lt;li&gt;With &lt;code&gt;lock_mac = 1&lt;/code&gt;, it compares &lt;code&gt;Calling-Station-Id&lt;/code&gt;. The first time, it binds with &lt;code&gt;UPDATE … WHERE bound_mac IS NULL&lt;/code&gt;. When two requests arrive at once, only one wins, and the other rereads and compares.&lt;/li&gt;&#xA;&lt;li&gt;It updates &lt;code&gt;last_mac&lt;/code&gt; and &lt;code&gt;last_seen&lt;/code&gt;, and returns &lt;code&gt;Framed-Pool&lt;/code&gt;, &lt;code&gt;Filter-Id&lt;/code&gt;, &lt;code&gt;Acct-Interim-Interval&lt;/code&gt; and &lt;code&gt;Class&lt;/code&gt; (whose value is the user name). The BNG sends &lt;code&gt;Class&lt;/code&gt; back in accounting packets, so the accounting records know whose line it is.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;testing-and-notes-2&#34;&gt;Testing and notes&#xA;&lt;/h3&gt;&lt;p&gt;Verified. &lt;code&gt;rradius-bench&lt;/code&gt; sends requests from &lt;code&gt;127.0.0.1&lt;/code&gt;, so for the experiment first change the &lt;code&gt;address&lt;/code&gt; of &lt;code&gt;bng&lt;/code&gt; in the lab directory to &lt;code&gt;&amp;quot;127.0.0.1&amp;quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;ADSL-Agent-Circuit-Id&lt;/code&gt; and &lt;code&gt;ADSL-Agent-Remote-Id&lt;/code&gt; are vendor attributes (sub-attributes 1 and 2 of vendor 3561), so &lt;code&gt;--attr&lt;/code&gt; must be written as attribute 26 in hexadecimal: the 4-byte vendor number, a 1-byte sub-attribute number, a 1-byte length (the length of the value plus 2), then the value. You can build it in the shell. The &lt;code&gt;vsa&lt;/code&gt; below is a shell function for demonstration, &lt;strong&gt;not a tool provided by rradius&lt;/strong&gt;, and it works in bash, zsh and sh:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ vsa&lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt; printf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;26=hex:00000de9%02x%02x%s&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$1&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;$((&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;${#&lt;/span&gt;2&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; &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;$(&lt;/span&gt;printf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;%s&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$2&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; | od -An -tx1 | tr -d &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39; \n&amp;#39;&lt;/span&gt;&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:#f92672&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 bng.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user line --password x --load pap,concurrency=1 --requests 1 \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --attr &amp;#34;$(vsa 1 &amp;#39;eth 1/1/3:100&amp;#39;)&amp;#34; --attr &amp;#34;$(vsa 2 &amp;#39;OLT-A&amp;#39;)&amp;#34;&#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;  pap: 1030/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;--user&lt;/code&gt; and &lt;code&gt;--password&lt;/code&gt; can be anything, because the script does not look at them. The remote-id was sent as upper-case &lt;code&gt;OLT-A&lt;/code&gt;, and after normalization it matches &lt;code&gt;olt-a&lt;/code&gt;. The trace lines in the log:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… rradius_trace: request client=&amp;#34;bng&amp;#34; source=127.0.0.1 user=&amp;#34;line&amp;#34; code=1 attributes=&amp;#34;…, ADSL-Agent-Circuit-Id = eth 1/1/3:100, ADSL-Agent-Remote-Id = OLT-A&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… rradius_trace: response client=&amp;#34;bng&amp;#34; source=127.0.0.1 user=&amp;#34;line&amp;#34; code=2 attributes=&amp;#34;Message-Authenticator = &amp;lt;hidden&amp;gt;, Framed-Pool = residential, Filter-Id = fiber-100m, Acct-Interim-Interval = 300, Class = alice&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Results in other cases:&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;&#x9;&#x9;&lt;th&gt;Log&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 line of &lt;code&gt;bob&lt;/code&gt; (&lt;code&gt;eth 1/1/4:100&lt;/code&gt;), with &lt;code&gt;--attr 31=text:00-11-22-33-44-55&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;accept, MAC bound&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;The same line, changed to &lt;code&gt;00-11-22-33-44-66&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;&lt;code&gt;line olt-a eth 1/1/4:100 is locked to 001122334455 and the request has 001122334466&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 line of &lt;code&gt;dave&lt;/code&gt; (&lt;code&gt;olt-b&lt;/code&gt;, &lt;code&gt;eth 2/0/8:200&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;&lt;code&gt;line olt-b eth 2/0/8:200 of dave is disabled&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 line that does not exist&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;&lt;code&gt;unknown line olt-a eth 9/9/9: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;Only &lt;code&gt;--attr 87=hex:0004000a0001&lt;/code&gt; (&lt;code&gt;NAS-Port-Id&lt;/code&gt;, binary)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;accept, &lt;code&gt;Class = erin&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;Notes:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Every login writes &lt;code&gt;last_mac&lt;/code&gt; and &lt;code&gt;last_seen&lt;/code&gt; once. If you do not need this record, remove the final &lt;code&gt;UPDATE&lt;/code&gt; in &lt;code&gt;auth.lua&lt;/code&gt; to save one write per login.&lt;/li&gt;&#xA;&lt;li&gt;&amp;ldquo;Accept&amp;rdquo; returns only a pool name and a profile name, and the BNG&amp;rsquo;s pool decides the address. To have rradius allocate addresses, see the next section.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;maintain-line-data&#34;&gt;Maintain line data&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;lines&lt;/code&gt; and &lt;code&gt;plans&lt;/code&gt; are ordinary tables, and there is no dedicated management command. There are two ways to change the data:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;A migration file.&lt;/strong&gt; Write the SQL below as a migration file with a new number, put it on every node and restart the nodes one by one (see &lt;a class=&#34;link&#34; href=&#34;../18-operations/#adding-a-migration&#34; &gt;chapter 18&lt;/a&gt;). This suits lines that rarely change, when you want a change record. It adds one file for every device change, so it is not practical when devices change often.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Keep the line data elsewhere.&lt;/strong&gt; When there are many lines and they change often (activation, deactivation, device changes), let the script query an external MySQL or PostgreSQL with &lt;code&gt;db_query&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;chapter 09&lt;/a&gt;), or ask the billing system with &lt;code&gt;http_request&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;chapter 10&lt;/a&gt;). &lt;code&gt;lines&lt;/code&gt; then keeps only the columns that rradius writes itself, such as &lt;code&gt;bound_mac&lt;/code&gt; and &lt;code&gt;last_mac&lt;/code&gt;. This scenario does not demonstrate it, and you change &lt;code&gt;auth.lua&lt;/code&gt; yourself.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Whichever way you choose, this is how the contents of the tables are changed:&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;-- Add a plan and a line (both ids in normalized form: lower case, no leading or trailing whitespace)&#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 (plan, pool, profile, interim) &lt;span style=&#34;color:#66d9ef&#34;&gt;VALUES&lt;/span&gt; (&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;fiber-500&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;residential&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;fiber-500m&amp;#39;&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:#66d9ef&#34;&gt;INSERT&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;INTO&lt;/span&gt; lines (remote_id, circuit_id, subscriber, plan, lock_mac) &lt;span style=&#34;color:#66d9ef&#34;&gt;VALUES&lt;/span&gt; (&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;olt-a&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;eth 1/1/9:100&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;frank&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;fiber-500&amp;#39;&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:#75715e&#34;&gt;-- Disable, enable&#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;UPDATE&lt;/span&gt; lines &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; remote_id &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;olt-a&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;AND&lt;/span&gt; circuit_id &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;eth 1/1/9:100&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;UPDATE&lt;/span&gt; lines &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;1&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;WHERE&lt;/span&gt; remote_id &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;olt-a&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;AND&lt;/span&gt; circuit_id &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;eth 1/1/9:100&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:#75715e&#34;&gt;-- The subscriber changed device: clear the binding, and the next device to log in is bound&#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;UPDATE&lt;/span&gt; lines &lt;span style=&#34;color:#66d9ef&#34;&gt;SET&lt;/span&gt; bound_mac &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;NULL&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;WHERE&lt;/span&gt; remote_id &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;olt-a&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;AND&lt;/span&gt; circuit_id &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;eth 1/1/9:100&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:#75715e&#34;&gt;-- The subscriber moves to another line: disable the old line and add a new one, or just change the subscriber of this line&#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;UPDATE&lt;/span&gt; lines &lt;span style=&#34;color:#66d9ef&#34;&gt;SET&lt;/span&gt; subscriber &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;grace&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;WHERE&lt;/span&gt; remote_id &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;olt-a&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;AND&lt;/span&gt; circuit_id &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;eth 1/1/9:100&amp;#39;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Write &lt;code&gt;bound_mac&lt;/code&gt; as 12 lower-case hexadecimal characters (&lt;code&gt;001122aabbcc&lt;/code&gt;) with no colons or hyphens. This is how the script compares it.&lt;/p&gt;&#xA;&lt;h3 id=&#34;known-limitations-2&#34;&gt;Known limitations&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;A line identity is not a secret.&lt;/strong&gt; Anyone who can make the BNG send any Option 82, or who can send requests with a forged BNG address, can impersonate any line. List only the BNG in the client list, and keep the network between the BNG and rradius trusted. For more protection, add &lt;code&gt;lock_mac&lt;/code&gt;, or switch to RADIUS over TLS (RadSec, enterprise edition).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;lock_mac&lt;/code&gt; only stops a change of device and cannot stop forgery.&lt;/strong&gt; A MAC address is in clear text, and anyone on the same layer 2 network can copy it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Every login writes to the database once (&lt;code&gt;last_mac&lt;/code&gt;, &lt;code&gt;last_seen&lt;/code&gt;).&lt;/strong&gt; Writes go through the cluster leader. When the cluster has had no leader for more than 5 seconds, the write fails, and even lines that need no MAC lock cannot log in, and the login gets no response (see &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;chapter 10&lt;/a&gt;). When you do not need the &amp;ldquo;last seen&amp;rdquo; information, remove the final &lt;code&gt;UPDATE&lt;/code&gt; in &lt;code&gt;auth.lua&lt;/code&gt; and the dependency is gone. When a request has no MAC, only &lt;code&gt;last_seen&lt;/code&gt; is updated, and the previous &lt;code&gt;last_mac&lt;/code&gt; is not overwritten.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The first binding can wrongly reject.&lt;/strong&gt; The comparison after binding reads the local copy. When a follower node has not yet applied the binding that was just written, the next login of the same device may be rejected for a moment, and a retry passes.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Text and binary ids can collide.&lt;/strong&gt; A binary value is written as lower-case hexadecimal starting with &lt;code&gt;0x&lt;/code&gt;. So if the BNG forwards a text id that the user controls, the user sending &lt;code&gt;0X0004000A0001&lt;/code&gt; (&lt;code&gt;0x0004000a0001&lt;/code&gt; after lower-casing) is the same as sending that binary value, and text ending with a tab or newline character is also treated as binary. Do not use this scenario if the circuit-id is a string that the user can influence.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Only the RFC 4679 attributes and &lt;code&gt;NAS-Port-Id&lt;/code&gt; are recognized.&lt;/strong&gt; For other formats, change the lines of &lt;code&gt;auth.lua&lt;/code&gt; that read the values.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;It checks only at login.&lt;/strong&gt; Disabling a line does not end a connection that is already online.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;common-problems-1&#34;&gt;Common problems&#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;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;Always Reject, and the log has &lt;code&gt;unknown line&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The values in the table differ from what the BNG sends. Look at the remote-id and circuit-id the script saw in the log (they are the normalized values). When the BNG sends no remote-id, register &lt;code&gt;remote_id&lt;/code&gt; as an empty string&lt;/td&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 has &lt;code&gt;no circuit-id and no NAS-Port-Id in the request&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The BNG did not put Option 82 into the request. Check the BNG configuration, or confirm that it uses another attribute&lt;/td&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 has &lt;code&gt;is locked to&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;lock_mac = 1&lt;/code&gt; and the MAC differs from the bound one. When the device changes, clear &lt;code&gt;bound_mac&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 log has &lt;code&gt;is locked to a MAC and the request has none&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;lock_mac = 1&lt;/code&gt;, but the request has no usable &lt;code&gt;Calling-Station-Id&lt;/code&gt; (not 12 hexadecimal characters)&lt;/td&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 has &lt;code&gt;the plan of line … does not exist&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;lines.plan&lt;/code&gt; has no matching plan in &lt;code&gt;plans&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;Login succeeds but there is no &lt;code&gt;Framed-Pool&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;This script is not the top-level script (&lt;code&gt;script&lt;/code&gt; in &lt;code&gt;[lua]&lt;/code&gt;), or the BNG ignores this attribute&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;dual-stack-lines-dual-stack-lines&#34;&gt;Dual-stack lines: dual-stack-lines&#xA;&lt;/h2&gt;&lt;h3 id=&#34;goal-3&#34;&gt;Goal&#xA;&lt;/h3&gt;&lt;p&gt;This puts the previous scenarios together: authenticate by line identity. If the line has a fixed address, return the fixed one. Otherwise take one from the IPv4 address pool and one from the IPv6 prefix pool. Accounting confirms and releases both. When the prefix pool is exhausted, the IPv4 address just reserved for this request is released, so no unused reservation is left behind.&lt;/p&gt;&#xA;&lt;h3 id=&#34;tables-3&#34;&gt;Tables&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;migrations/1_schema.sql&lt;/code&gt; is a combination of the tables of the three previous scenarios:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;plans&lt;/code&gt; gains &lt;code&gt;pool&lt;/code&gt; (the IPv4 pool) and &lt;code&gt;pool6&lt;/code&gt; (the prefix pool).&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;lines&lt;/code&gt; gains the columns for fixed data, &lt;code&gt;ipv4&lt;/code&gt;, &lt;code&gt;netmask&lt;/code&gt;, &lt;code&gt;routed_v4&lt;/code&gt;, &lt;code&gt;wan_v6&lt;/code&gt; and &lt;code&gt;pd_v6&lt;/code&gt;, which mean the same as in static-ip in the next section.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;ip_pool&lt;/code&gt;, &lt;code&gt;prefix_pools&lt;/code&gt;, &lt;code&gt;prefix_leases&lt;/code&gt; and &lt;code&gt;housekeeping&lt;/code&gt; are the same as in ip-pool and prefix-pool, and use &lt;code&gt;lines.subscriber&lt;/code&gt; as the account name, so &lt;code&gt;subscriber&lt;/code&gt; has a unique index: one subscriber can have only one line.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;IPv4 and IPv6 are decided separately. A line with only a fixed IPv4 still gets its IPv6 prefix from the pool. If either &lt;code&gt;wan_v6&lt;/code&gt; or &lt;code&gt;pd_v6&lt;/code&gt; is set, the IPv6 of that line does not come from the pool, and only the one that is set is returned.&lt;/p&gt;&#xA;&lt;p&gt;Demo data: &lt;code&gt;alice&lt;/code&gt; and &lt;code&gt;bob&lt;/code&gt; are fully dynamic. &lt;code&gt;carol&lt;/code&gt; has a MAC lock. &lt;code&gt;dave&lt;/code&gt; has fixed IPv4 and IPv6. &lt;code&gt;frank&lt;/code&gt; has only a fixed IPv4. The prefix pool &lt;code&gt;tiny6&lt;/code&gt; of the &lt;code&gt;metro&lt;/code&gt; plan has only two /64, so the third user (&lt;code&gt;max&lt;/code&gt;) runs into prefix exhaustion.&lt;/p&gt;&#xA;&lt;p&gt;The three plans and the pools they use (&lt;code&gt;migrations/2_demo_data.sql&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;Plan&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;IPv4 pool&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Prefix pool&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;residential&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;res4&lt;/code&gt; (8 addresses, &lt;code&gt;10.77.0.2&lt;/code&gt; to &lt;code&gt;10.77.0.9&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;res6&lt;/code&gt; (&lt;code&gt;2001:db8:100::/48&lt;/code&gt; cut into /56, 256 prefixes)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Residential&lt;/td&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;business&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;biz4&lt;/code&gt; (3 addresses, &lt;code&gt;10.88.0.2&lt;/code&gt; to &lt;code&gt;10.88.0.4&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;biz6&lt;/code&gt; (&lt;code&gt;2001:db8:200::/52&lt;/code&gt; cut into /60, 256 prefixes)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Business&lt;/td&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;metro&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;res4&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;tiny6&lt;/code&gt; (&lt;code&gt;2001:db8:300::/63&lt;/code&gt; cut into /64, 2 prefixes)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The prefix pool is very small, to see prefix exhaustion&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Thirteen lines (the remote-id is always &lt;code&gt;olt-a&lt;/code&gt;, and the circuit-id is &lt;code&gt;eth 1/1/1:&amp;lt;number&amp;gt;&lt;/code&gt;): &lt;code&gt;:100&lt;/code&gt; alice and &lt;code&gt;:101&lt;/code&gt; bob (residential, fully dynamic); &lt;code&gt;:102&lt;/code&gt; carol (MAC lock); &lt;code&gt;:103&lt;/code&gt; dave (business, fixed IPv4 and IPv6); &lt;code&gt;:104&lt;/code&gt; erin (disabled); &lt;code&gt;:105&lt;/code&gt; frank (fixed IPv4 only); &lt;code&gt;:106&lt;/code&gt; to &lt;code&gt;:109&lt;/code&gt; (business, fully dynamic; &lt;code&gt;biz4&lt;/code&gt; has only 3 addresses, so the fourth runs into IPv4 exhaustion); &lt;code&gt;:110&lt;/code&gt; to &lt;code&gt;:112&lt;/code&gt; (metro, the third runs into prefix exhaustion).&lt;/p&gt;&#xA;&lt;h3 id=&#34;configuration-highlights-3&#34;&gt;Configuration highlights&#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:#75715e&#34;&gt;# rradius.toml (excerpt, other settings omitted)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;lua&lt;/span&gt;]&#xA;&lt;/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;accounting.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;auth&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;line.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;There is no password, so the auth chain has only one lua handler. Why not &amp;ldquo;one handler for IPv4 and one for IPv6&amp;rdquo;: handlers in an auth chain do not pass values to each other, and a reply attribute set by the previous one cannot be read by the next. The two pool scripts would each have to work out again &amp;ldquo;which user is this&amp;rdquo;. Also, only a single script can revoke the IPv4 address just reserved when the prefix runs out.&lt;/p&gt;&#xA;&lt;p&gt;The named queries &lt;code&gt;pool_usage&lt;/code&gt; and &lt;code&gt;prefix_usage&lt;/code&gt; watch the two kinds of pools.&lt;/p&gt;&#xA;&lt;h3 id=&#34;script-highlights-3&#34;&gt;Script highlights&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;line.lua&lt;/code&gt; does these in order:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The line identity, as in line-identity.&lt;/li&gt;&#xA;&lt;li&gt;A check of the fixed data: a value that is not valid is rejected and logged, and is not silently changed to dynamic (the reason is in the next section).&lt;/li&gt;&#xA;&lt;li&gt;IPv4: with a fixed &lt;code&gt;ipv4&lt;/code&gt;, it returns &lt;code&gt;Framed-IP-Address&lt;/code&gt; and &lt;code&gt;Framed-IP-Netmask&lt;/code&gt; (&lt;code&gt;255.255.255.255&lt;/code&gt; when not set), and with &lt;code&gt;routed_v4&lt;/code&gt; it also returns &lt;code&gt;Framed-Route&lt;/code&gt;. Without one, it takes an address from the IPv4 pool of the plan.&lt;/li&gt;&#xA;&lt;li&gt;IPv6: with fixed values, it returns &lt;code&gt;Framed-IPv6-Prefix&lt;/code&gt; and &lt;code&gt;Delegated-IPv6-Prefix&lt;/code&gt;. Without them, it takes a prefix from the prefix pool and returns &lt;code&gt;Framed-IPv6-Pool&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;When the prefix runs out, it releases the IPv4 address just reserved and then rejects. If you change &lt;code&gt;ALLOW_V4_ONLY&lt;/code&gt; at the top of the script to &lt;code&gt;true&lt;/code&gt;, it instead keeps the IPv4 address and returns only the IPv4 attributes: the subscriber has no IPv6 but can reach the network.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Finally it returns &lt;code&gt;Filter-Id&lt;/code&gt; (the profile name of the plan), &lt;code&gt;Acct-Interim-Interval&lt;/code&gt; and &lt;code&gt;Class&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;accounting.lua&lt;/code&gt; is the two accounting scripts of ip-pool and prefix-pool merged. The accounting packets of IPoE have no reliable &lt;code&gt;User-Name&lt;/code&gt;, so it finds the line through &lt;code&gt;Class&lt;/code&gt;. When a packet has no &lt;code&gt;Class&lt;/code&gt;, it still answers the NAS, does not process the packet, and writes one log line. A line with fixed addresses has no row in the pools, so the corresponding &lt;code&gt;UPDATE&lt;/code&gt; changes no row, and that is not an error.&lt;/p&gt;&#xA;&lt;h3 id=&#34;testing-and-notes-3&#34;&gt;Testing and notes&#xA;&lt;/h3&gt;&lt;p&gt;Verified. As in line-identity, first change the &lt;code&gt;address&lt;/code&gt; of &lt;code&gt;bng&lt;/code&gt; to &lt;code&gt;&amp;quot;127.0.0.1&amp;quot;&lt;/code&gt;, and use the &lt;code&gt;vsa&lt;/code&gt; function of the previous section to carry the line identity (the remote-id is always &lt;code&gt;olt-a&lt;/code&gt;). The replies for the lines:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;:100 alice  Framed-IP-Address = 10.77.0.9, Delegated-IPv6-Prefix = 2001:db8:100:e700::/56, Framed-IPv6-Pool = res6, Filter-Id = home-100m, Acct-Interim-Interval = 300, Class = alice&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;:103 dave   Framed-IP-Address = 203.0.113.10, Framed-IP-Netmask = 255.255.255.255, Framed-Route = 203.0.113.8/29 0.0.0.0 1, Framed-IPv6-Prefix = 2001:db8:1:1::/64, Delegated-IPv6-Prefix = 2001:db8:f00::/56, Filter-Id = biz-500m, Acct-Interim-Interval = 300, Class = dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;:105 frank  Framed-IP-Address = 203.0.113.20, Framed-IP-Netmask = 255.255.255.255, Delegated-IPv6-Prefix = 2001:db8:200:c30::/60, Framed-IPv6-Pool = biz6, Filter-Id = biz-500m, Acct-Interim-Interval = 300, Class = frank&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;(Compiled from trace lines; the IPv4 address is picked at random.) &lt;code&gt;:110&lt;/code&gt; and &lt;code&gt;:111&lt;/code&gt; take the two /64 of &lt;code&gt;tiny6&lt;/code&gt;, and &lt;code&gt;:112&lt;/code&gt; is rejected:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… script line.lua (radius/authentication, client bng): prefix pool tiny6 is exhausted: no prefix for max&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;At this point &lt;code&gt;res4 reserved&lt;/code&gt; in &lt;code&gt;rradiusd query pool_usage&lt;/code&gt; is still 3 (&lt;code&gt;alice&lt;/code&gt;, &lt;code&gt;kim&lt;/code&gt;, &lt;code&gt;lee&lt;/code&gt;), and the IPv4 address that &lt;code&gt;max&lt;/code&gt; had just reserved has been released.&lt;/p&gt;&#xA;&lt;p&gt;Test accounting with the &lt;code&gt;session&lt;/code&gt; load: it copies the &lt;code&gt;Class&lt;/code&gt; and &lt;code&gt;Framed-IP-Address&lt;/code&gt; of the Access-Accept into the Start and the Stop, as a BNG does. After the Stop, the IPv4 address of that line goes back to &lt;code&gt;free&lt;/code&gt;, and the prefix becomes &lt;code&gt;released&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Notes:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In the tests &lt;code&gt;User-Name&lt;/code&gt; is &lt;code&gt;line&lt;/code&gt;, and the accounting script does not look at it at all, only at &lt;code&gt;Class&lt;/code&gt;. If a real BNG does not send &lt;code&gt;Class&lt;/code&gt; back, the accounting of that line is not processed. Check the BNG configuration first.&lt;/li&gt;&#xA;&lt;li&gt;The three constants (&lt;code&gt;RESERVE_SECONDS&lt;/code&gt;, &lt;code&gt;HOLD_SECONDS&lt;/code&gt;, &lt;code&gt;REAP_SECONDS&lt;/code&gt;) exist once in &lt;code&gt;line.lua&lt;/code&gt; and once in &lt;code&gt;accounting.lua&lt;/code&gt;, and must be the same.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;maintain-the-data&#34;&gt;Maintain the 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-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;-- Add a dynamic line&#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; lines (remote_id, circuit_id, subscriber, plan) &lt;span style=&#34;color:#66d9ef&#34;&gt;VALUES&lt;/span&gt; (&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;olt-a&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;eth 1/1/2:100&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;zoe&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;residential&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;-- Give a line a fixed IPv4 address and prefix (a NULL column means not fixed)&#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;UPDATE&lt;/span&gt; lines &lt;span style=&#34;color:#66d9ef&#34;&gt;SET&lt;/span&gt; ipv4 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;203.0.113.30&amp;#39;&lt;/span&gt;, pd_v6 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;2001:db8:f10::/56&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;WHERE&lt;/span&gt; subscriber &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;zoe&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;-- Disable&#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;UPDATE&lt;/span&gt; lines &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; subscriber &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;zoe&amp;#39;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Write data changes as a migration file with a new number, put it on every node and restart the nodes one by one (see &lt;a class=&#34;link&#34; href=&#34;../18-operations/#adding-a-migration&#34; &gt;chapter 18&lt;/a&gt;). Write &lt;code&gt;remote_id&lt;/code&gt; and &lt;code&gt;circuit_id&lt;/code&gt; in normalized form (see &amp;ldquo;Authenticate by line identity&amp;rdquo;). Always write IPv6 prefixes in lower case and compressed form. The fixed &lt;code&gt;ipv4&lt;/code&gt;, &lt;code&gt;wan_v6&lt;/code&gt; and &lt;code&gt;pd_v6&lt;/code&gt; each have a unique index (&lt;code&gt;lines_ipv4&lt;/code&gt;, &lt;code&gt;lines_wan_v6&lt;/code&gt;, &lt;code&gt;lines_pd_v6&lt;/code&gt;), so two lines cannot register the same value.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;When a line switches between dynamic and fixed, its existing rows in the pools do not disappear at once.&lt;/strong&gt; The address or prefix is released by the request-triggered reclaim only after accounting stops and the entry expires. Until then it still holds one place in the pool.&lt;/p&gt;&#xA;&lt;h3 id=&#34;cluster&#34;&gt;Cluster&#xA;&lt;/h3&gt;&lt;p&gt;Writes of both authentication and accounting go through the cluster leader. Every login writes &lt;code&gt;last_mac&lt;/code&gt; and &lt;code&gt;last_seen&lt;/code&gt; of &lt;code&gt;lines&lt;/code&gt;, and a dynamic line also reserves an address and a prefix. When the cluster has no leader (see &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;chapter 16&lt;/a&gt;), logins fail, even for lines with fully fixed data. When you do not need the &amp;ldquo;last seen&amp;rdquo; information, remove the last two statements &lt;code&gt;UPDATE lines SET last_mac …&lt;/code&gt; and &lt;code&gt;SET last_seen …&lt;/code&gt; of &lt;code&gt;line.lua&lt;/code&gt;, and fixed lines no longer depend on the leader. A dynamic line must write to reserve its address and prefix, and that cannot be removed.&lt;/p&gt;&#xA;&lt;h3 id=&#34;scale-1&#34;&gt;Scale&#xA;&lt;/h3&gt;&lt;p&gt;Below is the &lt;strong&gt;extra cost per login after the merge&lt;/strong&gt;, taken from chapter 22 of the old manual and &lt;strong&gt;not measured again&lt;/strong&gt; (I did not find the raw files for this group in the change records, only the record in the old chapter). Conditions: Apple M4 Max (14 CPUs, macOS), server and &lt;code&gt;rradius-bench&lt;/code&gt; on the same machine, single node. 64 concurrent PAP logins, with 2,000 different users each logging in for the first time. The IPv4 pool and the prefix pool each have 16,384 entries, with 43% taken beforehand in a scattered way and about 55% at the end of the measurement. Each ran twice.&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;Example&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Logins per second&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;p50&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;p99&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;Address pool (ip-pool)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;about 14,500 (14,473, 14,674)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;about 3.6 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;about 21 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Prefix pool (prefix-pool)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;about 11,200 (11,075, 11,288)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;about 4.8 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;about 22 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Dynamic lines of dual-stack-lines (IPv4 plus prefix)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;about 6,100 (6,102, 6,172)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;about 9.4 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;about 34 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;A dynamic line costs about 163 microseconds per login. This is about the sum of the two separate pools (about 69 plus 90 microseconds), plus the line lookup and the last-seen write. There were no rejects and no duplicate allocations. The throughput is not below half of the slower of the two separate examples (the prefix pool, about 5,600). These are relative numbers on one machine, not the capacity of a BNG site. The measurement used &lt;code&gt;User-Name&lt;/code&gt; as the line name (&lt;code&gt;rradius-bench&lt;/code&gt; rotates it), not the Option 82 attributes, and the only difference is one more attribute to read. Fixed lines do not touch the pools, and a login is one lookup plus one write, which is cheaper than a dynamic line.&lt;/p&gt;&#xA;&lt;h3 id=&#34;known-limitations-3&#34;&gt;Known limitations&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;It has not been verified against a real BNG.&lt;/strong&gt; The attributes are the standard &lt;code&gt;Framed-*&lt;/code&gt; and the &lt;code&gt;Delegated-IPv6-Prefix&lt;/code&gt; of RFC 4818. Whether the BNG accepts them, how &lt;code&gt;Framed-Route&lt;/code&gt; must be written, and whether it sends &lt;code&gt;Class&lt;/code&gt; back in accounting packets are in your BNG documentation.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Fixed values are not checked against the pools.&lt;/strong&gt; If a fixed &lt;code&gt;ipv4&lt;/code&gt; falls inside the range of &lt;code&gt;ip_pool&lt;/code&gt;, or a fixed &lt;code&gt;pd_v6&lt;/code&gt; falls inside a prefix pool, the pool may hand the same value to someone else. Put fixed addresses in a range outside the pools (see &amp;ldquo;Fixed addresses and prefixes&amp;rdquo;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A line is checked only at login.&lt;/strong&gt; Disabling a line does not end a connection that is already online (ending it needs Disconnect, an enterprise feature).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Prefixes are not guaranteed to be stable.&lt;/strong&gt; When the starting point is taken by someone else, you get a different one, and the fuller the pool the less stable (see &amp;ldquo;IPv6 prefix pool&amp;rdquo;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;One line per subscriber.&lt;/strong&gt; The pools and accounting use &lt;code&gt;lines.subscriber&lt;/code&gt; as the key (the unique index &lt;code&gt;lines_subscriber&lt;/code&gt;). For one subscriber with several lines, the pool key must be changed.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Accounting recognizes only &lt;code&gt;Delegated-IPv6-Prefix&lt;/code&gt;.&lt;/strong&gt; A packet with only &lt;code&gt;Framed-IPv6-Prefix&lt;/code&gt; (the WAN prefix) does not confirm the prefix.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;There is no WAN /64 pool.&lt;/strong&gt; &lt;code&gt;Framed-IPv6-Pool&lt;/code&gt; is only a pool name, and the BNG&amp;rsquo;s pool decides the address of the connection itself.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Only the RFC 4679 attributes and &lt;code&gt;NAS-Port-Id&lt;/code&gt; are recognized.&lt;/strong&gt; The security limits of the MAC lock and the line identity are the same as in &amp;ldquo;Authenticate by line identity&amp;rdquo;: a line identity is not a secret, so list only the BNG in the client list.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;common-problems-2&#34;&gt;Common problems&#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;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;Always Reject, and the log has &lt;code&gt;dual stack: unknown line&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The values in the table differ from what the BNG sends. Handle it as in &amp;ldquo;Authenticate by line identity&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;The log has &lt;code&gt;has routed_v4 or netmask but no ipv4&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The line registers &lt;code&gt;routed_v4&lt;/code&gt; or &lt;code&gt;netmask&lt;/code&gt; but has no &lt;code&gt;ipv4&lt;/code&gt;. Add &lt;code&gt;ipv4&lt;/code&gt; or clear them&lt;/td&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 has &lt;code&gt;dual stack: bad … for&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A fixed value is not valid (address, subnet, mask, prefix). The log shows the user, the column and the value, and it does not silently fall back to dynamic&lt;/td&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 has &lt;code&gt;prefix pool … is exhausted&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The prefix pool has no free slot. Expand the pool, or change &lt;code&gt;ALLOW_V4_ONLY&lt;/code&gt; to &lt;code&gt;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;The log has &lt;code&gt;ip pool … is exhausted&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The IPv4 pool has no free slot. It always rejects, whatever &lt;code&gt;ALLOW_V4_ONLY&lt;/code&gt; says&lt;/td&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 packets do not change the pools&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The log has &lt;code&gt;no Class&lt;/code&gt;: the BNG does not send &lt;code&gt;Class&lt;/code&gt; back in accounting packets&lt;/td&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 succeeds but there is no &lt;code&gt;Delegated-IPv6-Prefix&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The &lt;code&gt;pd_v6&lt;/code&gt; of the line is NULL and &lt;code&gt;wan_v6&lt;/code&gt; is set (only the one with a value is returned), or &lt;code&gt;ALLOW_V4_ONLY&lt;/code&gt; is &lt;code&gt;true&lt;/code&gt; and the prefix pool is full&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;fixed-addresses-and-prefixes-static-ip&#34;&gt;Fixed addresses and prefixes: static-ip&#xA;&lt;/h2&gt;&lt;h3 id=&#34;goal-4&#34;&gt;Goal&#xA;&lt;/h3&gt;&lt;p&gt;Business subscribers or certain plans need a fixed IPv4 address, a routed subnet and a fixed IPv6 prefix. A subscriber with no fixed data still gets a pool name as usual, and the BNG allocates.&lt;/p&gt;&#xA;&lt;h3 id=&#34;tables-4&#34;&gt;Tables&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;subscribers&lt;/code&gt; has &lt;code&gt;pool&lt;/code&gt; (the pool name returned when there is no fixed data). &lt;code&gt;static_assignments&lt;/code&gt; has a row only for subscribers with fixed data. Every column can be &lt;code&gt;NULL&lt;/code&gt;, and a &lt;code&gt;NULL&lt;/code&gt; column does not return that attribute:&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;Column&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Returned as&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Example&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;ipv4&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Framed-IP-Address&lt;/code&gt;, plus &lt;code&gt;Framed-IP-Netmask&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;203.0.113.10&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;netmask&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Framed-IP-Netmask&lt;/code&gt;, &lt;code&gt;255.255.255.255&lt;/code&gt; when not set&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;255.255.255.252&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;routed_v4&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Framed-Route&lt;/code&gt;: &lt;code&gt;&amp;lt;subnet&amp;gt; 0.0.0.0 1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;198.51.100.8/29&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;wan_v6&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Framed-IPv6-Prefix&lt;/code&gt;, the prefix of the connection itself, usually a /64&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;2001:db8:1:1::/64&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;pd_v6&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Delegated-IPv6-Prefix&lt;/code&gt;, the prefix delegated to the subscriber&amp;rsquo;s internal network&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;2001:db8:100::/56&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;ipv4&lt;/code&gt;, &lt;code&gt;wan_v6&lt;/code&gt; and &lt;code&gt;pd_v6&lt;/code&gt; each have a unique index, so two subscribers cannot register the same text.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The unique index compares text. Always write IPv6 prefixes in lower case and compressed form (&lt;code&gt;2001:db8:1:1::/64&lt;/code&gt;). &lt;code&gt;2001:0db8:1:1::/64&lt;/code&gt; and &lt;code&gt;2001:DB8:1:1::/64&lt;/code&gt; are different texts, and the index does not catch them. It also cannot catch overlapping subnets (one subscriber&amp;rsquo;s /29 containing another&amp;rsquo;s address). Check this in the process that creates the data.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;what-the-unique-indexes-stop-and-what-they-do-not&#34;&gt;What the unique indexes stop and what they do not&#xA;&lt;/h3&gt;&lt;p&gt;The three unique indexes (&lt;code&gt;static_assignments_ipv4&lt;/code&gt;, &lt;code&gt;static_assignments_wan_v6&lt;/code&gt;, &lt;code&gt;static_assignments_pd_v6&lt;/code&gt;) stop this: when two subscribers register the same text, the &lt;code&gt;INSERT&lt;/code&gt; or &lt;code&gt;UPDATE&lt;/code&gt; written later fails with &lt;code&gt;UNIQUE constraint failed&lt;/code&gt;. &lt;code&gt;NULL&lt;/code&gt; does not count, so many subscribers can all have no &lt;code&gt;wan_v6&lt;/code&gt;. What they cannot stop, besides the prefix notation and the overlapping subnets in the note above:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;A fixed address inside a dynamic pool.&lt;/strong&gt; The pool of the ip-pool scenario does not know which addresses are fixed, and hands the same address to someone else. Always keep fixed addresses outside the range of the pools. When you use both scenarios together, you can check for collisions (this matches only identical addresses):&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;SELECT&lt;/span&gt; s.username, s.ipv4 &lt;span style=&#34;color:#66d9ef&#34;&gt;FROM&lt;/span&gt; static_assignments s &lt;span style=&#34;color:#66d9ef&#34;&gt;JOIN&lt;/span&gt; ip_pool p &lt;span style=&#34;color:#66d9ef&#34;&gt;ON&lt;/span&gt; p.ip &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; s.ipv4;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is a maintenance query to run now and then. &lt;code&gt;ip_pool&lt;/code&gt; has no index that starts with &lt;code&gt;ip&lt;/code&gt;, so with a large pool it scans the whole table. Different pools (for example different VRFs) can have the same address, so look at the result again to see whether it is the same pool.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;configuration-highlights-4&#34;&gt;Configuration highlights&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;all_accept&lt;/code&gt;: the sql handler checks the password, and the lua handler &lt;code&gt;static.lua&lt;/code&gt; returns the address attributes. The &lt;code&gt;accounting.lua&lt;/code&gt; in &lt;code&gt;[lua]&lt;/code&gt; only blocks protocols other than RADIUS, and always answers accounting without recording it.&lt;/p&gt;&#xA;&lt;h3 id=&#34;script-highlights-4&#34;&gt;Script highlights&#xA;&lt;/h3&gt;&lt;p&gt;The rule of &lt;code&gt;static.lua&lt;/code&gt; is &amp;ldquo;reject when the data is wrong&amp;rdquo;. If a subscriber who pays for a fixed address silently gets one that changes because of a typo in the data, nobody notices. So:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It sets attributes with &lt;code&gt;pcall(set_attr, …)&lt;/code&gt;. &lt;code&gt;set_attr&lt;/code&gt; checks the format of the value against the dictionary and raises an error when it is not valid. The script catches it, writes the user, the column and the value to the log, and rejects.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Framed-Route&lt;/code&gt; is a string in the dictionary and &lt;code&gt;Framed-IP-Netmask&lt;/code&gt; is an address, so &lt;code&gt;set_attr&lt;/code&gt; cannot stop values with wrong content (for example &lt;code&gt;garbage&lt;/code&gt; or &lt;code&gt;255.0.255.0&lt;/code&gt;). The script checks them itself: a subnet must have the form &lt;code&gt;a.b.c.d/n&lt;/code&gt; with the host bits at 0, and the 1 bits of a mask must be consecutive at the front.&lt;/li&gt;&#xA;&lt;li&gt;When there is no row, or the row has no address, subnet or prefix (having only &lt;code&gt;netmask&lt;/code&gt; also counts as none), it is the same as having no fixed data, and &lt;code&gt;Framed-Pool&lt;/code&gt; is returned.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;testing-and-notes-4&#34;&gt;Testing and notes&#xA;&lt;/h3&gt;&lt;p&gt;Verified. The replies for the five demo accounts (compiled from trace lines):&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;Account&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Reply&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;alice&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Framed-Pool = residential&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;bob&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Framed-IP-Address = 203.0.113.10, Framed-IP-Netmask = 255.255.255.255, Acct-Interim-Interval = 300&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;carol&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Framed-IP-Address = 203.0.113.20, Framed-IP-Netmask = 255.255.255.252, Framed-Route = 198.51.100.8/29 0.0.0.0 1, Framed-IPv6-Prefix = 2001:db8:1:1::/64, Delegated-IPv6-Prefix = 2001:db8:100::/56, Acct-Interim-Interval = 300&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;dave&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Framed-IPv6-Prefix = 2001:db8:1:2::/64, Delegated-IPv6-Prefix = 2001:db8:200::/56, Acct-Interim-Interval = 300&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;erin&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reject (disabled)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;To see the behavior with wrong data, add one more migration before starting, for example &lt;code&gt;migrations/3_bad.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;UPDATE&lt;/span&gt; static_assignments &lt;span style=&#34;color:#66d9ef&#34;&gt;SET&lt;/span&gt; netmask &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;255.0.255.0&amp;#39;&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;bob&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;UPDATE&lt;/span&gt; static_assignments &lt;span style=&#34;color:#66d9ef&#34;&gt;SET&lt;/span&gt; pd_v6 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;2001:db8:200::/200&amp;#39;&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;dave&amp;#39;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Both &lt;code&gt;bob&lt;/code&gt; and &lt;code&gt;dave&lt;/code&gt; become reject, and the log says:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… script static.lua (radius/authentication, client localhost): static ip: bad netmask for bob : 255.0.255.0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… script static.lua (radius/authentication, client localhost): static ip: bad pd_v6 for dave : 2001:db8:200::/200 - runtime error: &amp;#39;2001:db8:200::/200&amp;#39; is not a valid ipv6prefix for &amp;#39;Delegated-IPv6-Prefix&amp;#39; …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This migration is only for the experiment. After the test, stop the server and delete &lt;code&gt;data/&lt;/code&gt; and this file.&lt;/p&gt;&#xA;&lt;h3 id=&#34;maintain-fixed-data&#34;&gt;Maintain fixed data&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;static_assignments&lt;/code&gt; has no dedicated management command. Write data changes as a migration file with a new number, put it on every node and restart the nodes one by one (see &lt;a class=&#34;link&#34; href=&#34;../18-operations/#adding-a-migration&#34; &gt;chapter 18&lt;/a&gt;). When there are many subscribers and they change often, keep the data in an external database or the billing system, and let the script query it with &lt;code&gt;db_query&lt;/code&gt; or &lt;code&gt;http_request&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;chapter 09&lt;/a&gt;, &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;chapter 10&lt;/a&gt;). The SQL looks like this:&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;-- Add a subscriber and fixed addresses&#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; subscribers (username, password, pool, enabled) &lt;span style=&#34;color:#66d9ef&#34;&gt;VALUES&lt;/span&gt; (&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;gina&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;gina-password&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;business&amp;#39;&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;INSERT&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;INTO&lt;/span&gt; static_assignments (username, ipv4, netmask, routed_v4, wan_v6, pd_v6)&#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;VALUES&lt;/span&gt; (&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;gina&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;203.0.113.30&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;255.255.255.252&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;198.51.100.16/29&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;2001:db8:1:3::/64&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;2001:db8:300::/56&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:#75715e&#34;&gt;-- Change back to dynamic: delete the row&#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;DELETE&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;FROM&lt;/span&gt; static_assignments &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;gina&amp;#39;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The BNG must accept these attributes. Which devices use &lt;code&gt;Framed-Route&lt;/code&gt; and &lt;code&gt;Delegated-IPv6-Prefix&lt;/code&gt; depends on the vendor and the configuration, so see the BNG documentation. When the BNG does not route the &lt;code&gt;/29&lt;/code&gt;, check this first.&lt;/p&gt;&#xA;&lt;h3 id=&#34;known-limitations-4&#34;&gt;Known limitations&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;It does not prevent overlapping subnets, and does not check whether a fixed address is in a dynamic pool&lt;/strong&gt; (see above).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Two simultaneous sessions of the same user get the same fixed address.&lt;/strong&gt; To limit concurrent connections, put the &lt;code&gt;limits.lua&lt;/code&gt; of &amp;ldquo;Plans and usage control&amp;rdquo; in front: the order of &lt;code&gt;[[auth.handlers]]&lt;/code&gt; is the sql handler, &lt;code&gt;limits.lua&lt;/code&gt;, &lt;code&gt;static.lua&lt;/code&gt;. Connection slots must be confirmed and released by the accounting script, so the &lt;code&gt;script&lt;/code&gt; in &lt;code&gt;[lua]&lt;/code&gt; must be replaced with the &lt;code&gt;accounting.lua&lt;/code&gt; of usage-control, and the tables it uses (&lt;code&gt;plans&lt;/code&gt;, &lt;code&gt;session_slots&lt;/code&gt;, &lt;code&gt;accounting&lt;/code&gt;, &lt;code&gt;housekeeping&lt;/code&gt;) must be added to the migrations. The &lt;code&gt;accounting.lua&lt;/code&gt; of static-ip only answers and does not touch connection slots, so a slot is released after its 120-second reservation, and the limit has no effect.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;There are no dynamic IPv6 prefixes.&lt;/strong&gt; This scenario returns only the fixed prefixes written in the table. For aligned DHCPv6-PD allocation, see &amp;ldquo;IPv6 prefix pool&amp;rdquo;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;It does not give fixed addresses by line identity.&lt;/strong&gt; To do so, add columns to &lt;code&gt;lines&lt;/code&gt; (&amp;ldquo;Authenticate by line identity&amp;rdquo;), or change the primary key of &lt;code&gt;static_assignments&lt;/code&gt; to the line.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;It is decided only at login.&lt;/strong&gt; A data change does not affect connections that are already online, and takes effect at their next login.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;There is no built-in check tool and no metric.&lt;/strong&gt; The validity of addresses and prefixes is checked only at login.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;common-problems-3&#34;&gt;Common problems&#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;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 fixed subscriber always gets Reject, and the log has &lt;code&gt;static ip: bad&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The value of that column is not a valid address or prefix. The log shows the user, the column and the 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;Login succeeds but there is no fixed address&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;static_assignments&lt;/code&gt; has no row for this user, or the column is &lt;code&gt;NULL&lt;/code&gt; (having only &lt;code&gt;netmask&lt;/code&gt; also counts as none). The user name must match &lt;code&gt;subscribers&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 BNG does not route the &lt;code&gt;/29&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The BNG does not accept this format of &lt;code&gt;Framed-Route&lt;/code&gt;, or needs extra configuration&lt;/td&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 subscribers get the same address&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A fixed address is inside a dynamic pool, or the subnets overlap. Use the check query 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;&lt;code&gt;INSERT&lt;/code&gt; fails with &lt;code&gt;UNIQUE constraint failed&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;That address or prefix is already registered to someone else&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;plans-and-usage-control-usage-control&#34;&gt;Plans and usage control: usage-control&#xA;&lt;/h2&gt;&lt;h3 id=&#34;goal-5&#34;&gt;Goal&#xA;&lt;/h3&gt;&lt;p&gt;Each subscriber has a plan, and the plan limits two things: how many connections at the same time, and the traffic over the most recent period. After the quota is exceeded, the plan either slows the subscriber down (the login succeeds, but a different &lt;code&gt;Filter-Id&lt;/code&gt; is returned) or rejects.&lt;/p&gt;&#xA;&lt;h3 id=&#34;tables-5&#34;&gt;Tables&#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;Table&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;plans&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;max_sessions&lt;/code&gt;, &lt;code&gt;quota_octets&lt;/code&gt; (bytes in plus out, &lt;code&gt;0&lt;/code&gt; means unlimited), &lt;code&gt;period_days&lt;/code&gt; (the last N days, a rolling window, not a calendar month), &lt;code&gt;over_quota&lt;/code&gt; (&lt;code&gt;throttle&lt;/code&gt; or &lt;code&gt;reject&lt;/code&gt;), &lt;code&gt;normal_filter&lt;/code&gt;, &lt;code&gt;throttle_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;subscribers&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Account, password, &lt;code&gt;plan&lt;/code&gt;, &lt;code&gt;enabled&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;session_slots&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;max_sessions&lt;/code&gt; connection slots per subscriber, primary key &lt;code&gt;(username, slot)&lt;/code&gt;. The number of simultaneous connections is the number of slots that are taken&lt;/td&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&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One row per session, written as in the quick start. The primary key is &lt;code&gt;(client, nas, session_id)&lt;/code&gt;, because a session ID is unique only within one NAS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Demo plans: &lt;code&gt;basic&lt;/code&gt; has 1 simultaneous connection and unlimited traffic. &lt;code&gt;family&lt;/code&gt; has 2 simultaneous connections and 100 GiB per 30 days, and throttles to &lt;code&gt;family-slow&lt;/code&gt; when exceeded. &lt;code&gt;strict&lt;/code&gt; has 1 simultaneous connection and 5 GiB per 30 days, and rejects when exceeded.&lt;/p&gt;&#xA;&lt;p&gt;Connection slots are filled in with &lt;code&gt;INSERT OR IGNORE&lt;/code&gt; at the first login of a subscriber, so you do not need to create them beforehand.&lt;/p&gt;&#xA;&lt;h3 id=&#34;configuration-highlights-5&#34;&gt;Configuration highlights&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;all_accept&lt;/code&gt;: the sql handler checks the password, and the lua handler &lt;code&gt;limits.lua&lt;/code&gt; checks the plan. &lt;code&gt;[sessions]&lt;/code&gt; queries the rows of &lt;code&gt;session_slots&lt;/code&gt; that are &lt;code&gt;active&lt;/code&gt; and not expired. The named query &lt;code&gt;slot_usage&lt;/code&gt; becomes the metric &lt;code&gt;rradius_query_slot_usage{state}&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;script-highlights-5&#34;&gt;Script highlights&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;limits.lua&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It looks up the plan of the subscriber, and rejects a subscriber that is disabled or does not exist.&lt;/li&gt;&#xA;&lt;li&gt;It checks traffic first: it adds up &lt;code&gt;input_octets + output_octets&lt;/code&gt; of this subscriber over the last &lt;code&gt;period_days&lt;/code&gt; days, including the amount accumulated so far by sessions that are still open. If the total is over the quota, it throttles or rejects according to &lt;code&gt;over_quota&lt;/code&gt;. Checking traffic first means a rejected user does not take a connection slot.&lt;/li&gt;&#xA;&lt;li&gt;Then it tries to claim a free connection slot. When it gets one, it reserves it for 120 seconds and returns &lt;code&gt;Filter-Id&lt;/code&gt; and &lt;code&gt;Acct-Interim-Interval&lt;/code&gt;. When it cannot, it rejects. After a plan is made smaller, slots above &lt;code&gt;max_sessions&lt;/code&gt; are no longer allocated.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;code&gt;accounting.lua&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Every accounting packet is written to &lt;code&gt;accounting&lt;/code&gt;. Traffic is taken as &lt;code&gt;max(old value, new value)&lt;/code&gt;, so a retransmitted or late packet does not make the number go backwards.&lt;/li&gt;&#xA;&lt;li&gt;For traffic above 4 GiB, the NAS puts the carry in &lt;code&gt;Acct-Input-Gigawords&lt;/code&gt; and &lt;code&gt;Acct-Output-Gigawords&lt;/code&gt;. The script multiplies them by 4294967296 and adds them back.&lt;/li&gt;&#xA;&lt;li&gt;It restores the time of the event with &lt;code&gt;Acct-Delay-Time&lt;/code&gt;, so a packet replayed from the accounting spool or sent late by the NAS still has the right time.&lt;/li&gt;&#xA;&lt;li&gt;Start confirms the reserved connection slot as &lt;code&gt;active&lt;/code&gt;. Interim-Update extends it. When no slot is found, it takes a reserved or free one (the case where the reservation has expired and the packet arrives late). Stop releases it. Accounting-On and Accounting-Off release all slots of this NAS.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;why-connection-slots-and-not-counting-open-sessions-in-the-accounting-table-at-login&#34;&gt;Why connection slots, and not counting open sessions in the accounting table at login&#xA;&lt;/h3&gt;&lt;p&gt;Counting &amp;ldquo;how many sessions this user still has open&amp;rdquo; at login is simpler, but it has two holes: logins that arrive at the same time cannot see each other, and a reservation cannot be counted before its Accounting-Start arrives. The limit can be exceeded. A connection slot turns &amp;ldquo;take a place&amp;rdquo; into one conditional write (&lt;code&gt;UPDATE … WHERE state = &#39;free&#39;&lt;/code&gt;, and 1 affected row means it won). All writes go through the cluster leader, so two simultaneous logins cannot take the same slot.&lt;/p&gt;&#xA;&lt;h3 id=&#34;numbers-to-tune&#34;&gt;Numbers to tune&#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;Number&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Where&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;RESERVE_SECONDS&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;limits.lua&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;120&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How long to reserve. A NAS usually sends the Start within a few seconds after 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;code&gt;INTERIM_SECONDS&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;limits.lua&lt;/code&gt;, &lt;code&gt;accounting.lua&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;300&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How often the NAS is asked to send an Interim-Update. A slot expires after three times this 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;REAP_SECONDS&lt;/code&gt;&lt;/td&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;60&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The most often the reclaim runs (&lt;code&gt;limits.lua&lt;/code&gt; has 60 written in)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The two scripts are separate files and cannot share constants, so &lt;code&gt;INTERIM_SECONDS&lt;/code&gt; must be the same in both.&lt;/p&gt;&#xA;&lt;h3 id=&#34;testing-and-notes-5&#34;&gt;Testing and notes&#xA;&lt;/h3&gt;&lt;p&gt;Verified. Simultaneous connections:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --password alice-password --load pap,concurrency=1 --requests 1&#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;  pap: 819/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --password alice-password --load pap,concurrency=1 --requests 1&#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;  pap: 3516/s, sent 1, accept 0, reject 1, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The second one is rejected, and the log says &lt;code&gt;usage control: session limit of plan basic ( 1 ) reached by alice - rejected&lt;/code&gt;. &lt;code&gt;bob&lt;/code&gt; on the &lt;code&gt;family&lt;/code&gt; plan can log in twice, and the third is rejected.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Although there is no Accounting-Start after the first login yet, the connection slot is already reserved for 120 seconds. When you log in twice in a row in a test, the second is always rejected. This is not an error. The reservation is blocking it. To free the slot, send a Stop, or wait for the reservation to expire.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Traffic: use the &lt;code&gt;session&lt;/code&gt; load with &lt;code&gt;--attr 52=int:N&lt;/code&gt; (&lt;code&gt;Acct-Input-Gigawords&lt;/code&gt;), which sends N × 4 GiB of usage at once:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user carol --password carol-password --load session,concurrency=1 --requests 1 --attr 52=int:2&#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;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user carol --password carol-password --load pap,concurrency=1 --requests 1&#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;  pap: 3180/s, sent 1, accept 0, reject 1, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;carol&lt;/code&gt; used 8 GiB, more than the 5 GiB of &lt;code&gt;strict&lt;/code&gt;, and the log says &lt;code&gt;quota of plan strict is used up by carol - rejected&lt;/code&gt;. After &lt;code&gt;dave&lt;/code&gt; (&lt;code&gt;family&lt;/code&gt;) sends &lt;code&gt;--attr 52=int:25&lt;/code&gt; (100 GiB), his next login still succeeds, but &lt;code&gt;Filter-Id&lt;/code&gt; changes from &lt;code&gt;family&lt;/code&gt; to &lt;code&gt;family-slow&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Notes:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Traffic is checked at login. When a subscriber goes over the quota while online, this scenario does not disconnect them. The throttle or reject comes at their next login.&lt;/li&gt;&#xA;&lt;li&gt;The period is a rolling window of the last &lt;code&gt;period_days&lt;/code&gt; days, counted from the start time of the session. To reset every month instead, change that &lt;code&gt;SELECT&lt;/code&gt; in &lt;code&gt;limits.lua&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Enterprise edition:&lt;/strong&gt; The enterprise edition can send a CoA or Disconnect-Request to a subscriber who is over the quota at accounting time, so it does not have to wait for the next login.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;operations-look-up-slots-and-traffic-change-plans&#34;&gt;Operations: look up slots and traffic, change plans&#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;-- The connection slots of a subscriber&#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;SELECT&lt;/span&gt; slot, &lt;span style=&#34;color:#66d9ef&#34;&gt;state&lt;/span&gt;, session_id, nas, expires &lt;span style=&#34;color:#66d9ef&#34;&gt;FROM&lt;/span&gt; session_slots &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;bob&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;ORDER&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;BY&lt;/span&gt; slot;&#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;-- His traffic over the last 30 days (bytes)&#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;SELECT&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;sum&lt;/span&gt;(input_octets &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; output_octets) &lt;span style=&#34;color:#66d9ef&#34;&gt;FROM&lt;/span&gt; accounting &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;bob&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;AND&lt;/span&gt; started &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;=&lt;/span&gt; strftime(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;%s&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;now&amp;#39;&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;30&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:#75715e&#34;&gt;-- Change the plan: the next login uses the new plan&#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;UPDATE&lt;/span&gt; subscribers &lt;span style=&#34;color:#66d9ef&#34;&gt;SET&lt;/span&gt; plan &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;family&amp;#39;&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;bob&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;-- Change the limit of a plan: family to 200 GiB (200 × 1073741824)&#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;UPDATE&lt;/span&gt; plans &lt;span style=&#34;color:#66d9ef&#34;&gt;SET&lt;/span&gt; quota_octets &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;214748364800&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;WHERE&lt;/span&gt; plan &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;family&amp;#39;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When &lt;code&gt;max_sessions&lt;/code&gt; is made smaller, slots numbered above the new limit are no longer allocated. Sessions that are online are not affected, and after they end that slot is no longer used. Change the data of &lt;code&gt;plans&lt;/code&gt; and &lt;code&gt;subscribers&lt;/code&gt; with a migration file with a new number, or keep it in an external database (see &amp;ldquo;Maintain line data&amp;rdquo; in &amp;ldquo;Authenticate by line identity&amp;rdquo;).&lt;/p&gt;&#xA;&lt;h3 id=&#34;monitoring&#34;&gt;Monitoring&#xA;&lt;/h3&gt;&lt;p&gt;The metric of &lt;code&gt;slot_usage&lt;/code&gt; is &lt;code&gt;rradius_query_slot_usage{state}&lt;/code&gt;, counted by every node every 30 seconds:&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:#75715e&#34;&gt;# rradius.toml (excerpt, other settings omitted)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;queries&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;slot_usage&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;sql&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT state, count(*) AS slots FROM session_slots GROUP BY state&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;help&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Session slots by state: free, reserved or active.&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;labels&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;state&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;value&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;slots&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd query slot_usage --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;How many connections are online now: &lt;code&gt;max(rradius_query_slot_usage{state=&amp;quot;active&amp;quot;})&lt;/code&gt;. &lt;code&gt;reserved&lt;/code&gt; means logged in but the NAS has not sent an Accounting-Start yet. Every node outputs the same numbers, so in a cluster use &lt;code&gt;max()&lt;/code&gt;, not &lt;code&gt;sum()&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Connection slots are created only at the first login of a subscriber, so the &lt;code&gt;free&lt;/code&gt; number is &amp;ldquo;slots not used by subscribers who have logged in&amp;rdquo;, not the capacity for all subscribers.&lt;/li&gt;&#xA;&lt;li&gt;Cost: this query uses the covering index of &lt;code&gt;session_slots_expiry&lt;/code&gt; (&lt;code&gt;SCAN session_slots USING COVERING INDEX session_slots_expiry&lt;/code&gt;). On 2026-11-16, on an in-memory SQLite 3.54.1 database with 200,000 rows, the median was about 4.3 ms. Not measured again.&lt;/li&gt;&#xA;&lt;li&gt;How much traffic has been used is a different matter. The sum over &lt;code&gt;accounting&lt;/code&gt; gets slower as the number of sessions of a subscriber grows, so do not put it in a metric that runs every 30 seconds.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;known-limitations-5&#34;&gt;Known limitations&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;It checks only at login.&lt;/strong&gt; The traffic a session uses while online is checked only at the subscriber&amp;rsquo;s next login, and a connection that is online is not interrupted. To enforce it midway (throttle or disconnect above the limit), you need CoA and Disconnect-Request, which are enterprise features.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The metering period is a rolling last N days,&lt;/strong&gt; not a calendar month. There is no billing day and no time zone.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The traffic sum gets slower with the number of sessions of a subscriber.&lt;/strong&gt; There is the &lt;code&gt;accounting_user&lt;/code&gt; index and only one subscriber is looked at, but with many subscribers and many sessions, measure first. If needed, keep a separate table with a running total per subscriber.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When the quota is used up, the NAS only sees a Reject.&lt;/strong&gt; The reason is in the log. Monitor the log for &lt;code&gt;session limit&lt;/code&gt; and &lt;code&gt;quota&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;There is no prepaid balance and no online charging,&lt;/strong&gt; and no built-in function. Use of connection slots comes from &lt;code&gt;slot_usage&lt;/code&gt; above.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When a NAS crashes without sending a Stop,&lt;/strong&gt; its connection slot stays taken until it expires (3 Interim intervals, 900 seconds). When the NAS comes back and sends Accounting-On, the slots are released at once.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Case of account names.&lt;/strong&gt; Connection slots and traffic go by the name used at login. To make them case-insensitive, set &lt;code&gt;[auth.username]&lt;/code&gt; in the auth chain (see &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;chapter 07&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;common-problems-4&#34;&gt;Common problems&#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;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 succeeds but there is no &lt;code&gt;Filter-Id&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;There is no lua handler in the configuration, or &lt;code&gt;policy&lt;/code&gt; is not &lt;code&gt;all_accept&lt;/code&gt;, or the &lt;code&gt;normal_filter&lt;/code&gt; of the plan is an empty string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Always Reject, and the log has &lt;code&gt;session limit&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Connection slots are taken. Look at &lt;code&gt;session_slots&lt;/code&gt; for rows that have expired but are not yet reclaimed (nothing is reclaimed when no request comes in)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Always Reject, and the log has &lt;code&gt;quota&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The plan is &lt;code&gt;reject&lt;/code&gt; and the traffic is used up. Check the sum over &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;Traffic does not increase&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The NAS does not send Interim-Update or Stop. &lt;code&gt;input_octets&lt;/code&gt; in &lt;code&gt;accounting&lt;/code&gt; is a cumulative 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;A subscriber over the limit is not throttled&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Throttling takes effect only at the next login. &lt;code&gt;Filter-Id&lt;/code&gt; must be mapped to a bandwidth by the 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;return-rates-by-bng-rate-limit&#34;&gt;Return rates by BNG: rate-limit&#xA;&lt;/h2&gt;&lt;h3 id=&#34;goal-6&#34;&gt;Goal&#xA;&lt;/h3&gt;&lt;p&gt;For the same plan, BNGs from different vendors want different rate attributes: some accept only a profile name, and some accept numbers. Each BNG is one client, and a table records which &amp;ldquo;style&amp;rdquo; it uses.&lt;/p&gt;&#xA;&lt;h3 id=&#34;tables-6&#34;&gt;Tables&#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;Table&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;plans&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;down_kbps&lt;/code&gt; (toward the subscriber) and &lt;code&gt;up_kbps&lt;/code&gt; (from the subscriber toward the network), in kbit/s. &lt;code&gt;profile&lt;/code&gt; is the name of the profile of the same name on the BNG&lt;/td&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;subscribers&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Account, password, &lt;code&gt;plan&lt;/code&gt;, &lt;code&gt;enabled&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;nas_styles&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;client&lt;/code&gt; is the &lt;code&gt;name&lt;/code&gt; of a &lt;code&gt;[[radius.clients]]&lt;/code&gt; entry, and &lt;code&gt;style&lt;/code&gt; is the style. A client with no row uses &lt;code&gt;profile&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;configuration-highlights-6&#34;&gt;Configuration highlights&#xA;&lt;/h3&gt;&lt;p&gt;One client per BNG, with a &lt;code&gt;name&lt;/code&gt; that matches &lt;code&gt;nas_styles.client&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:#75715e&#34;&gt;# rradius.toml (excerpt, other settings omitted)&lt;/span&gt;&#xA;&lt;/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;bng-default&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;127.0.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;localhost.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;bng-nokia&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.70.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;nokia.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 scenario has three more, &lt;code&gt;bng-mikrotik&lt;/code&gt;, &lt;code&gt;bng-wispr&lt;/code&gt; and &lt;code&gt;bng-erx&lt;/code&gt;. The auth chain is again &lt;code&gt;all_accept&lt;/code&gt;: the sql handler checks the password, and the lua handler &lt;code&gt;rate.lua&lt;/code&gt; returns the rate attributes.&lt;/p&gt;&#xA;&lt;h3 id=&#34;script-highlights-6&#34;&gt;Script highlights&#xA;&lt;/h3&gt;&lt;p&gt;Each entry in the &lt;code&gt;styles&lt;/code&gt; table of &lt;code&gt;rate.lua&lt;/code&gt; is a function. To support another BNG, add an entry:&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;Style&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Attributes returned&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;profile&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Filter-Id = &amp;lt;profile&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A standard attribute. The rate is in the profile of the same name on the BNG&lt;/td&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;alc_sla&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Alc-SLA-Prof-Str = &amp;lt;profile&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A vendor attribute, the name of the SLA profile&lt;/td&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;erx&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;ERX-Ingress-Policy-Name = &amp;lt;profile&amp;gt;-up&lt;/code&gt;, &lt;code&gt;ERX-Egress-Policy-Name = &amp;lt;profile&amp;gt;-down&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Ingress is the subscriber&amp;rsquo;s upload, and egress is the subscriber&amp;rsquo;s download&lt;/td&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;mikrotik&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Mikrotik-Rate-Limit = &amp;lt;up&amp;gt;k/&amp;lt;down&amp;gt;k&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Seen from the router: rx is the subscriber&amp;rsquo;s upload and tx is the subscriber&amp;rsquo;s download. &lt;code&gt;k&lt;/code&gt; is kbit/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;wispr&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;WISPr-Bandwidth-Max-Down&lt;/code&gt;, &lt;code&gt;WISPr-Bandwidth-Max-Up&lt;/code&gt;, in bit/s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;32-bit integers, at most 4294967295 bit/s. A faster plan cannot be sent, so it is rejected and logged&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;For the styles that send only a name, the unit and direction of the rate are decided by the profile on the BNG. For the styles that send numbers, the unit and direction come from the definition of the attribute. Before you connect for real, check the documentation of your BNG.&lt;/p&gt;&#xA;&lt;p&gt;Take the demo plan &lt;code&gt;fiber-500&lt;/code&gt; (&lt;code&gt;down_kbps&lt;/code&gt; 500000, &lt;code&gt;up_kbps&lt;/code&gt; 250000, &lt;code&gt;profile&lt;/code&gt; is &lt;code&gt;fiber-500&lt;/code&gt;) as an example. The values each style actually sends:&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;Style&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Attributes and values&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;profile&lt;/code&gt; (default)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Filter-Id = fiber-500&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;alc_sla&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Alc-SLA-Prof-Str = fiber-500&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;erx&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;ERX-Ingress-Policy-Name = fiber-500-up&lt;/code&gt;, &lt;code&gt;ERX-Egress-Policy-Name = fiber-500-down&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;wispr&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;WISPr-Bandwidth-Max-Down = 500000000&lt;/code&gt;, &lt;code&gt;WISPr-Bandwidth-Max-Up = 250000000&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;mikrotik&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Mikrotik-Rate-Limit = 250000k/500000k&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 policy names of &lt;code&gt;erx&lt;/code&gt; are &lt;code&gt;profile&lt;/code&gt; plus &lt;code&gt;-up&lt;/code&gt; and &lt;code&gt;-down&lt;/code&gt;, and policies with these two names must exist on the BNG first. The profiles of &lt;code&gt;profile&lt;/code&gt; and &lt;code&gt;alc_sla&lt;/code&gt; must also exist on the BNG first.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The units and directions of the styles that send numbers (&lt;code&gt;wispr&lt;/code&gt;, &lt;code&gt;mikrotik&lt;/code&gt;) are written according to the definitions of the attributes and were not verified on real hardware&lt;/strong&gt; (the tests of this manual and of the examples check only the values of the attributes, and never connected a real BNG). Before going live, measure the rate once on a real device with a test subscriber. A rate that is off by a factor of 1000 is usually a unit mismatch (see &amp;ldquo;Common problems&amp;rdquo; below).&lt;/p&gt;&#xA;&lt;p&gt;The style is decided by looking up &lt;code&gt;nas_styles&lt;/code&gt; with the Lua variable &lt;code&gt;client&lt;/code&gt; (the name of the matching client). When &lt;code&gt;nas_styles&lt;/code&gt; holds a style the script does not know, or the plan of the subscriber does not exist, the login is rejected and a log line is written.&lt;/p&gt;&#xA;&lt;h3 id=&#34;testing-and-notes-6&#34;&gt;Testing and notes&#xA;&lt;/h3&gt;&lt;p&gt;Verified. &lt;code&gt;bng-default&lt;/code&gt; is &lt;code&gt;127.0.0.1&lt;/code&gt;. &lt;code&gt;alice&lt;/code&gt; (&lt;code&gt;fiber-100&lt;/code&gt;) logs in and gets &lt;code&gt;Filter-Id = fiber-100&lt;/code&gt;. The plan &lt;code&gt;gone&lt;/code&gt; of &lt;code&gt;dave&lt;/code&gt; does not exist, so he is rejected, and the log says &lt;code&gt;rate limit: the plan of dave does not exist&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For the other styles, the request has to come from the address of that BNG. In the lab directory, change the address of &lt;code&gt;bng-default&lt;/code&gt; to something else (for example &lt;code&gt;10.70.0.9&lt;/code&gt;), change the one you want to test to &lt;code&gt;127.0.0.1&lt;/code&gt;, and then reload:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kill -HUP &amp;lt;pid of the server&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 nokia.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --password alice-password --load pap,concurrency=1 --requests 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The client list can be reloaded, and the log says &lt;code&gt;configuration reloaded from rradius.toml&lt;/code&gt;. Switching through the four in turn, the replies &lt;code&gt;alice&lt;/code&gt; gets:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;bng-nokia     Alc-SLA-Prof-Str = fiber-100&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;bng-mikrotik  Mikrotik-Rate-Limit = 50000k/100000k&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;bng-wispr     WISPr-Bandwidth-Max-Down = 100000000, WISPr-Bandwidth-Max-Up = 50000000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;bng-erx       ERX-Ingress-Policy-Name = fiber-100-up, ERX-Egress-Policy-Name = fiber-100-down&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Each one is followed by &lt;code&gt;Acct-Interim-Interval = 300&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Notes:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The client name is the mapping key. When you change the &lt;code&gt;name&lt;/code&gt; of a &lt;code&gt;[[radius.clients]]&lt;/code&gt; entry, change &lt;code&gt;nas_styles&lt;/code&gt; with it. Otherwise that BNG falls back to the &lt;code&gt;profile&lt;/code&gt; style and gets only &lt;code&gt;Filter-Id&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;One client can be a whole network range, and the BNGs in the same range must use the same style. Put BNGs of different vendors in different clients.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;add-a-style&#34;&gt;Add a style&#xA;&lt;/h3&gt;&lt;p&gt;Each entry in the &lt;code&gt;styles&lt;/code&gt; table at the top of &lt;code&gt;rate.lua&lt;/code&gt; is a function. It receives the plan (&lt;code&gt;plan.plan&lt;/code&gt;, &lt;code&gt;plan.down_kbps&lt;/code&gt;, &lt;code&gt;plan.up_kbps&lt;/code&gt;, &lt;code&gt;plan.profile&lt;/code&gt;) and returns attributes with &lt;code&gt;set_attr&lt;/code&gt;. For example, a vendor that puts the rate in a single string attribute (&lt;code&gt;My-Vendor-Rate&lt;/code&gt; is a made-up name, and it needs a dictionary definition first):&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;  myvendor &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt;(plan)&#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;My-Vendor-Rate&amp;#39;&lt;/span&gt;, string.format(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;%d/%d&amp;#39;&lt;/span&gt;, plan.down_kbps, plan.up_kbps))&#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;p&gt;A function that returns &lt;code&gt;false&lt;/code&gt; means this plan cannot be sent (this is how &lt;code&gt;wispr&lt;/code&gt; rejects a plan that is too fast). No return value means it was sent. &lt;code&gt;set_attr&lt;/code&gt; checks the attribute name and the type of the value against the dictionary. When the name is not in the dictionary or the value is not of that type, the login is rejected because of a script error, and the log says &lt;code&gt;Lua script error&lt;/code&gt;. For a vendor that is not included, first add its attributes to the dictionary (see &lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;chapter 06&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;h3 id=&#34;add-a-bng&#34;&gt;Add a BNG&#xA;&lt;/h3&gt;&lt;ol&gt;&#xA;&lt;li&gt;Add a &lt;code&gt;[[radius.clients]]&lt;/code&gt; to &lt;code&gt;rradius.toml&lt;/code&gt; (name, address, &lt;code&gt;secret_file&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;Add a row to &lt;code&gt;nas_styles&lt;/code&gt;, written as a migration file with a new number (for example &lt;code&gt;3_bng_new.sql&lt;/code&gt;), put it on every node and restart the nodes one by one (see &lt;a class=&#34;link&#34; href=&#34;../18-operations/#adding-a-migration&#34; &gt;chapter 18&lt;/a&gt;). &lt;code&gt;client&lt;/code&gt; must be the same as the &lt;code&gt;name&lt;/code&gt; in the configuration file:&lt;/li&gt;&#xA;&lt;/ol&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; nas_styles (client, style) &lt;span style=&#34;color:#66d9ef&#34;&gt;VALUES&lt;/span&gt; (&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;bng-new&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;wispr&amp;#39;&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A client not listed in &lt;code&gt;nas_styles&lt;/code&gt; uses &lt;code&gt;profile&lt;/code&gt; and gets only &lt;code&gt;Filter-Id&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;maintain-the-data-1&#34;&gt;Maintain the data&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;plans&lt;/code&gt;, &lt;code&gt;subscribers&lt;/code&gt; and &lt;code&gt;nas_styles&lt;/code&gt; are ordinary tables, and there is no dedicated management command. Write data changes as a migration file with a new number. When there are many subscribers and they change often, keep the data in an external database or the billing system, and let the script query it with &lt;code&gt;db_query&lt;/code&gt; or &lt;code&gt;http_request&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;chapter 09&lt;/a&gt;, &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;chapter 10&lt;/a&gt;). The SQL looks like this:&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; plans (plan, down_kbps, up_kbps, profile) &lt;span style=&#34;color:#66d9ef&#34;&gt;VALUES&lt;/span&gt; (&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;fiber-2g&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;2000000&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;2000000&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;fiber-2g&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;UPDATE&lt;/span&gt; subscribers &lt;span style=&#34;color:#66d9ef&#34;&gt;SET&lt;/span&gt; plan &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;fiber-500&amp;#39;&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;alice&amp;#39;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;known-limitations-6&#34;&gt;Known limitations&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;No style has been verified with a real BNG.&lt;/strong&gt; For the styles that send numbers, check the unit and direction against the documentation yourself.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The &lt;code&gt;wispr&lt;/code&gt; style cannot send a plan above 4294967295 bit/s (about 4.29 Gbit/s).&lt;/strong&gt; The attribute has only 32 bits. For a faster plan, the script rejects the login and writes &lt;code&gt;is faster than WISPr-Bandwidth can say&lt;/code&gt;, and does not send a truncated value. For such a plan, switch this BNG to a style that sends only a name.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A plan has only one download value and one upload value.&lt;/strong&gt; There is no burst, no time of day, and no throttling after usage runs out. For throttling, see &amp;ldquo;Plans and usage control&amp;rdquo;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;It is decided only at login.&lt;/strong&gt; Changing a plan does not affect connections that are already online, and it takes effect at their next login. Changing the rate of a live connection needs CoA (an enterprise feature, not in the core).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;One client uses only one style.&lt;/strong&gt; For a BNG that needs attributes of two styles at the same time, build them in the script yourself.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The dictionary must know the attributes.&lt;/strong&gt; Otherwise &lt;code&gt;set_attr&lt;/code&gt; fails. See &amp;ldquo;Add a style&amp;rdquo; above.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;common-problems-5&#34;&gt;Common problems&#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;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;Always Reject, and the log has &lt;code&gt;unknown or disabled user&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The subscriber is not in &lt;code&gt;subscribers&lt;/code&gt;, or &lt;code&gt;enabled = 0&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;Always Reject, and the log has &lt;code&gt;the plan of … does not exist&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;subscribers.plan&lt;/code&gt; has no matching plan in &lt;code&gt;plans&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;Always Reject, and the log has &lt;code&gt;which this script does not know&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The name in &lt;code&gt;nas_styles.style&lt;/code&gt; is not in the &lt;code&gt;styles&lt;/code&gt; table of &lt;code&gt;rate.lua&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;Always Reject, and the log has &lt;code&gt;is faster than WISPr-Bandwidth can say&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The plan rate is above the limit of the &lt;code&gt;wispr&lt;/code&gt; style (4294967295 bit/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;Always Reject, and the log has &lt;code&gt;Lua script error&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A style function used an attribute that is not in the dictionary, or a value of the wrong type&lt;/td&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 succeeds but the BNG does not limit the rate&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The BNG has no profile or policy of that name; or, for a style that sends numbers, the unit or direction differs from the BNG&amp;rsquo;s; or this client is not listed in &lt;code&gt;nas_styles&lt;/code&gt; and &lt;code&gt;Filter-Id&lt;/code&gt; was returned&lt;/td&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 rate is off by a factor of 1000&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A unit mismatch: &lt;code&gt;wispr&lt;/code&gt; is bit/s, and the &lt;code&gt;k&lt;/code&gt; in the &lt;code&gt;mikrotik&lt;/code&gt; string is kbit/s. Check the BNG documentation&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;single-file-examples&#34;&gt;Single-file examples&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;rradius-server/examples/&lt;/code&gt; has three single-file scripts related to this chapter. They are simpler than the scenarios above, and the table structure is written in a comment at the top of the file, which you create yourself. All three check policy only and do not check passwords, and they are used the same way:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;As the &lt;code&gt;script&lt;/code&gt; of &lt;code&gt;[lua]&lt;/code&gt;, so accounting always arrives here.&lt;/li&gt;&#xA;&lt;li&gt;Also as a lua handler in the auth chain, after an sql or ldap handler, with &lt;code&gt;policy = &amp;quot;all_accept&amp;quot;&lt;/code&gt;, so a login must pass both.&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:#75715e&#34;&gt;# rradius.toml (excerpt, other settings omitted)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;lua&lt;/span&gt;]&#xA;&lt;/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;simultaneous-use.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;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 users WHERE 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;simultaneous-use.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;All three were tested in the lab directory made from the quick start, with the tables created from the &lt;code&gt;CREATE TABLE&lt;/code&gt; at the top of the file and &lt;code&gt;rradius-bench&lt;/code&gt;. Verified.&lt;/p&gt;&#xA;&lt;h3 id=&#34;ip-poollua-the-smallest-address-pool&#34;&gt;ip-pool.lua: the smallest address pool&#xA;&lt;/h3&gt;&lt;p&gt;One table &lt;code&gt;ip_pool (ip, holder, expires)&lt;/code&gt;. At login it picks 8 addresses at random whose &lt;code&gt;expires&lt;/code&gt; has passed and claims one with &lt;code&gt;UPDATE … WHERE expires &amp;lt;= ?&lt;/code&gt;. Start and Interim-Update extend the lease by &lt;code&gt;LEASE&lt;/code&gt; (900 seconds), and Stop releases. It is a different design from the ip-pool 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;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;code&gt;ip-pool.lua&lt;/code&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;ip-pool scenario&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;Pools&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Several, by subscriber&lt;/td&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 again&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Does not recognize the address the user is already using, and takes another&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reuses the existing address&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Stickiness&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;None&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The last address is returned within a day&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reservation&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;None, a login leases for 900 seconds&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reserved for 120 seconds, confirmed only by the 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;Deciding on a Stop&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Only whether &lt;code&gt;holder&lt;/code&gt; is this subscriber&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Looks at the session ID&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Tested: with only one address in the pool, &lt;code&gt;alice&lt;/code&gt; logs in the first time and gets &lt;code&gt;10.0.0.1&lt;/code&gt;. Logging in again before the Stop is rejected, and the log says &lt;code&gt;no address free for alice&lt;/code&gt;. After an &lt;code&gt;acct-stop&lt;/code&gt; with &lt;code&gt;--attr 8=ip:10.0.0.1&lt;/code&gt;, &lt;code&gt;bob&lt;/code&gt; gets it.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The comment in the file explains its limits: after the same subscriber gets the same address back, an old Stop that is retransmitted still releases it, and so does a Stop replayed from the accounting spool. For production, start from the ip-pool scenario.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;simultaneous-uselua-simultaneous-connections&#34;&gt;simultaneous-use.lua: simultaneous connections&#xA;&lt;/h3&gt;&lt;p&gt;One table &lt;code&gt;active_sessions&lt;/code&gt;, with primary key &lt;code&gt;(client, session_id)&lt;/code&gt;. Start and Interim-Update write to it (&lt;code&gt;INSERT OR REPLACE&lt;/code&gt;), and Stop deletes. At login it counts the sessions of this subscriber with news within &lt;code&gt;STALE_AFTER&lt;/code&gt; (900 seconds), and rejects when the count reaches &lt;code&gt;MAX_SESSIONS&lt;/code&gt; (2).&lt;/p&gt;&#xA;&lt;p&gt;The difference from usage-control: a session counts only from its Accounting-Start, so two logins at the same instant can both pass, and the copy on each node may be slightly stale, so the limit is not exact. Tested: after &lt;code&gt;alice&lt;/code&gt; sends two &lt;code&gt;acct-start&lt;/code&gt; requests, her login is rejected, and &lt;code&gt;bob&lt;/code&gt; can still log in. The interval at which the NAS sends Interim-Update must be shorter than &lt;code&gt;STALE_AFTER&lt;/code&gt;, or sessions that are still online stop being counted.&lt;/p&gt;&#xA;&lt;h3 id=&#34;quota-and-hourslua-total-time-and-time-of-day&#34;&gt;quota-and-hours.lua: total time and time of day&#xA;&lt;/h3&gt;&lt;p&gt;Two tables: &lt;code&gt;quota_users&lt;/code&gt; (&lt;code&gt;quota_seconds&lt;/code&gt;, &lt;code&gt;from_hour&lt;/code&gt;, &lt;code&gt;to_hour&lt;/code&gt;, with time in UTC) and &lt;code&gt;quota_sessions&lt;/code&gt; (one row per Stop). At login it checks whether now is within the allowed hours (they can span midnight, for example 22 to 6), then computes the remaining seconds and returns them to the NAS in &lt;code&gt;Session-Timeout&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Tested: &lt;code&gt;alice&lt;/code&gt; has 100 seconds and gets &lt;code&gt;Session-Timeout = 100&lt;/code&gt; the first time. The Stop of &lt;code&gt;rradius-bench&lt;/code&gt; carries &lt;code&gt;Acct-Session-Time = 60&lt;/code&gt;, so the next login gets &lt;code&gt;40&lt;/code&gt;, and the one after that is rejected. An account with both &lt;code&gt;from_hour&lt;/code&gt; and &lt;code&gt;to_hour&lt;/code&gt; equal to 0 is always rejected.&lt;/p&gt;&#xA;&lt;p&gt;Time is counted only at the Stop, so two simultaneous sessions each get the remaining time: two logins of 100 seconds can use up 200 seconds. For a strict limit, use it with &lt;code&gt;simultaneous-use.lua&lt;/code&gt; and set the limit to 1. Deleting the rows of a subscriber from &lt;code&gt;quota_sessions&lt;/code&gt; makes them start counting from the beginning, for example once a month.&lt;/p&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; A login is rejected, the log has no reason written by a script, and the authentication record shows &lt;code&gt;handler=&amp;quot;no_password_check&amp;quot;&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The account does not exist in &lt;code&gt;subscribers&lt;/code&gt; or is disabled, and the sql handler gave no answer. The &lt;code&gt;all_accept&lt;/code&gt; chain has a handler that checks the password but none of them accepted, so the server rejects, and does not let the following lua handler act for someone whose password was not checked.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Make sure the account exists and has &lt;code&gt;enabled = 1&lt;/code&gt;. This is expected behavior, not a configuration error.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The pool still has addresses, but a login gets &lt;code&gt;reject&lt;/code&gt;, and the log says &lt;code&gt;ip pool … is exhausted&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; All addresses are &lt;code&gt;reserved&lt;/code&gt;: authentication succeeded, but the NAS did not send an Accounting-Start (or sent it to another server). A reservation takes 120 seconds to expire, and the reclaim runs at most every 60 seconds.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Look at the number in each state with &lt;code&gt;rradiusd query pool_usage&lt;/code&gt;. Make sure the NAS sends accounting to this server and the shared secret is correct.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; Accounting is always answered, but the address stays &lt;code&gt;reserved&lt;/code&gt;, and the log has &lt;code&gt;address … reported by … for … is held by someone else&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The &lt;code&gt;Framed-IP-Address&lt;/code&gt; the NAS reports is not the one rradius gave, or &lt;code&gt;User-Name&lt;/code&gt; differs from the one at authentication.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Turn on &lt;code&gt;[log.trace]&lt;/code&gt; and compare the address and the account in the authentication reply with those in the accounting packet.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The accounting of IPoE is answered, but the state in the pools does not change.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The BNG does not send &lt;code&gt;Class&lt;/code&gt; back in accounting packets, so &lt;code&gt;accounting.lua&lt;/code&gt; cannot recognize the line. The log has &lt;code&gt;dual stack accounting: no Class in the packet of session …&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Turn on &lt;code&gt;[log.trace]&lt;/code&gt; to see whether the accounting request has &lt;code&gt;Class&lt;/code&gt;. Configure the BNG to copy the &lt;code&gt;Class&lt;/code&gt; of the Access-Accept into accounting.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; When you test line-identity, dual-stack-lines or rate-limit with &lt;code&gt;rradius-bench&lt;/code&gt;, the result is &lt;code&gt;timeouts 1&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The client address in these scenarios is the network range of the BNG, not &lt;code&gt;127.0.0.1&lt;/code&gt;, and the server drops the request as coming from an unknown client. &lt;code&gt;Discarded: unknown client&lt;/code&gt; in &lt;code&gt;status&lt;/code&gt; goes up.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Only in the lab directory, change the &lt;code&gt;address&lt;/code&gt; of that client to &lt;code&gt;&amp;quot;127.0.0.1&amp;quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; A subscriber with a fixed address suddenly cannot log in, and the log says &lt;code&gt;static ip: bad … for …&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; A value in &lt;code&gt;static_assignments&lt;/code&gt; is not valid, and the script rejects on purpose and does not change to dynamic.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Correct the data in the column the log names. Write IPv6 prefixes in lower case and compressed form.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The ip-pool login succeeds, but the Access-Accept has no &lt;code&gt;Framed-IP-Address&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The auth chain has no lua handler &lt;code&gt;allocate.lua&lt;/code&gt;, or &lt;code&gt;policy&lt;/code&gt; is not &lt;code&gt;all_accept&lt;/code&gt; (the first handler accepted and the chain stopped).&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Check &lt;code&gt;[auth]&lt;/code&gt; against &amp;ldquo;Configuration highlights&amp;rdquo; in &amp;ldquo;IPv4 address pool: ip-pool&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; An address never goes back to &lt;code&gt;free&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The NAS sent no Stop and no Interim-Update, so it waits until the entry expires (3 Interim intervals, 900 seconds). Or no request is coming in, and the reclaim is triggered by requests.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Use the leak query in &amp;ldquo;Operations: look up addresses, add and remove addresses&amp;rdquo; to see which rows have expired. After a request comes in, the next 60-second period releases them.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The same address was given to two subscribers.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; This should not happen. Common causes are two pools that deliberately share the same addresses (for example different VRFs) but are sent into the same routing table, the primary key &lt;code&gt;(pool, ip)&lt;/code&gt; of &lt;code&gt;ip_pool&lt;/code&gt; having been changed, or a fixed address inside a pool (see &amp;ldquo;Fixed addresses and prefixes&amp;rdquo;).&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Check the pool ranges and the primary key. Use the query in &amp;ldquo;What the unique indexes stop and what they do not&amp;rdquo; to find fixed addresses that collide.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; A subscriber&amp;rsquo;s simultaneous connections exceed the limit of the plan, or connection slots stay &lt;code&gt;reserved&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The NAS does not send Accounting-Start to this server, or the &lt;code&gt;[lua]&lt;/code&gt; script of this server is not the &lt;code&gt;accounting.lua&lt;/code&gt; of usage-control, so nobody confirms the slots.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Look at the &lt;code&gt;state&lt;/code&gt; in &lt;code&gt;session_slots&lt;/code&gt;. Make sure accounting is sent here and the &lt;code&gt;script&lt;/code&gt; in &lt;code&gt;[lua]&lt;/code&gt; is &lt;code&gt;accounting.lua&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; You changed &lt;code&gt;[queries.&amp;lt;name&amp;gt;]&lt;/code&gt; and reloaded, and the metric did not change.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; Named queries take effect only after a restart.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Restart the server.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09 External databases and named queries&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;10 Writing policies in Lua&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13 Accounting and sessions&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../15-access-recipes/&#34; &gt;15 Scenarios: network access for organizations&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16 Clusters and high availability&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../93-lua-reference/&#34; &gt;Appendix D: Lua API reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>15 Scenarios: network access for organizations</title>
            <link>https://embark.systems/en/rradius/oss/15-access-recipes/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/15-access-recipes/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Let devices that cannot do 802.1X, such as printers and IP phones, log in by MAC address and place them in their own VLANs&lt;/li&gt;&#xA;&lt;li&gt;Let a VPN gateway use accounts and groups from the company directory to decide who may connect and which set of rules applies&lt;/li&gt;&#xA;&lt;li&gt;Add a two-step login to a jump host: a password, then a TOTP code&lt;/li&gt;&#xA;&lt;li&gt;Ask an HTTP API on every login when the accounts live in another system&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: you have read &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;chapter 03&lt;/a&gt; and &amp;ldquo;Prepare a lab directory&amp;rdquo; in &lt;a class=&#34;link&#34; href=&#34;../14-isp-recipes/&#34; &gt;chapter 14&lt;/a&gt;, and you know the auth chain from &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;chapter 07&lt;/a&gt;. The details of connecting to LDAP and Active Directory are in &lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;chapter 08&lt;/a&gt;; the HTTP and TOTP functions for scripts are in &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;chapter 10&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#prepare-the-lab-directory&#34; &gt;Prepare the lab directory&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#mac-authentication-on-wired-networks-wired-mab&#34; &gt;MAC authentication on wired networks: wired-mab&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#remote-access-remote-access&#34; &gt;Remote access: remote-access&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#accounts-in-an-external-system-external-api&#34; &gt;Accounts in an external system: external-api&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#single-file-examples&#34; &gt;Single-file examples&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;prepare-the-lab-directory&#34;&gt;Prepare the lab directory&#xA;&lt;/h2&gt;&lt;p&gt;The three scenarios in this chapter are in &lt;code&gt;rradius-server/examples/scenarios/&lt;/code&gt; in the source tree. You copy them, change the dictionary path and replace the demo secrets the same way as in &lt;a class=&#34;link&#34; href=&#34;../14-isp-recipes/&#34; &gt;chapter 14&lt;/a&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cp -R rradius-server/examples/scenarios/wired-mab ~/rradius-lab/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ sed -i.bak &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;s#^dictionary = .*#dictionary = \&amp;#34;&lt;/span&gt;$PWD&lt;span style=&#34;color:#e6db74&#34;&gt;/share/dictionary\&amp;#34;#&amp;#34;&lt;/span&gt; ~/rradius-lab/wired-mab/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cd ~/rradius-lab/wired-mab&#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; f in *.secret; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; openssl rand -hex &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt; &amp;gt; $f; &lt;span style=&#34;color:#66d9ef&#34;&gt;done&lt;/span&gt;; chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;600&lt;/span&gt; *.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The client addresses in all three scenarios are subnets of a real network (switches, VPN gateway, hotspot), but &lt;code&gt;rradius-bench&lt;/code&gt; sends its requests from &lt;code&gt;127.0.0.1&lt;/code&gt;. In the lab directory only, change the &lt;code&gt;address&lt;/code&gt; of the client you want to test to &lt;code&gt;&amp;quot;127.0.0.1&amp;quot;&lt;/code&gt;. Otherwise the request is dropped as coming from an unknown client, and &lt;code&gt;rradius-bench&lt;/code&gt; shows only &lt;code&gt;timeouts 1&lt;/code&gt;. To see the reply attributes, add &lt;code&gt;[log.trace]&lt;/code&gt; as in chapter 14, with &lt;code&gt;clients&lt;/code&gt; set to the client name of this scenario.&lt;/p&gt;&#xA;&lt;h2 id=&#34;mac-authentication-on-wired-networks-wired-mab&#34;&gt;MAC authentication on wired networks: wired-mab&#xA;&lt;/h2&gt;&lt;h3 id=&#34;goal&#34;&gt;Goal&#xA;&lt;/h3&gt;&lt;p&gt;Printers, IP phones and cameras cannot do 802.1X. The switch uses MAC authentication (MAB) instead: it sends the device&amp;rsquo;s MAC address as the account to be checked. Known devices are placed in their own VLANs; unknown devices are rejected.&lt;/p&gt;&#xA;&lt;h3 id=&#34;tables&#34;&gt;Tables&#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;-- migrations/1_schema.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; mac_devices (&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  mac 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;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  vlan TEXT &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;  note TEXT&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;mac&lt;/code&gt; is always stored as 12 lowercase hexadecimal characters, however the switch writes it (&lt;code&gt;00-11-22-AA-BB-CC&lt;/code&gt;, &lt;code&gt;00:11:22:aa:bb:cc&lt;/code&gt; and &lt;code&gt;0011.22aa.bbcc&lt;/code&gt; are all normalized to &lt;code&gt;001122aabbcc&lt;/code&gt;). &lt;code&gt;note&lt;/code&gt; is for people; the script does not read it. The demo data has one printer (VLAN 30) and one meeting-room phone (VLAN 40).&lt;/p&gt;&#xA;&lt;h3 id=&#34;key-settings&#34;&gt;Key settings&#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:#75715e&#34;&gt;# rradius.toml (excerpt, other settings omitted)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;lua&lt;/span&gt;]&#xA;&lt;/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-auth.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;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.40.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;switches.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;There is no &lt;code&gt;[auth]&lt;/code&gt;. Authentication and accounting are both handled by &lt;code&gt;mac-auth.lua&lt;/code&gt;, and accounting is always answered.&lt;/li&gt;&#xA;&lt;li&gt;All switches in the management subnet share one client (chapter 05).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;key-points-of-the-script&#34;&gt;Key points of the script&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;mac-auth.lua&lt;/code&gt; (that is, &lt;code&gt;rradius-server/examples/mac-auth.lua&lt;/code&gt;):&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;It first turns away protocols other than RADIUS. It is the top-level script, so if the same server also has &lt;code&gt;[tacacs]&lt;/code&gt; enabled, accepting everything would authorize every command.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;It normalizes both &lt;code&gt;Calling-Station-Id&lt;/code&gt; and &lt;code&gt;User-Name&lt;/code&gt; to 12 hexadecimal characters, and the two must be equal. &lt;code&gt;User-Name&lt;/code&gt; can be anything the device says; &lt;code&gt;Calling-Station-Id&lt;/code&gt; is the device the switch actually sees.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;It looks the address up in &lt;code&gt;mac_devices&lt;/code&gt;. If it finds it, it returns three attributes that place the device in a VLAN:&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;set_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Tunnel-Type:1&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;VLAN&amp;#39;&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;Tunnel-Medium-Type:1&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;IEEE-802&amp;#39;&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;Tunnel-Private-Group-Id:1&amp;#39;&lt;/span&gt;, rows[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;].vlan)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;:1&lt;/code&gt; is the tag (RFC 2868). The three attributes use the same tag, which says that they describe the same tunnel.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The script does not check the password: whatever password the switch sends makes no difference, and only the address counts. So MAB works with both PAP and CHAP.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; A MAC address is not a secret. Anyone who can read it from the device label or from the wire can impersonate the device. Put these devices in a VLAN that can reach only the services they need.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;What about unknown devices.&lt;/strong&gt; The example script returns reject for an address it does not know, and the switch then decides what happens to that port (put it in a guest VLAN, keep it isolated, or cut the power). This is switch configuration, not rradius, and the commands differ from vendor to vendor.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; The switch-side setting &amp;ldquo;after a RADIUS reject, put the port in a guest or quarantine VLAN&amp;rdquo; has not been tried on a real switch.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;To have rradius place unknown devices in a guest VLAN itself, change the script: when the lookup finds nothing, do not return reject, but return accept with a guest VLAN:&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;-- mac-auth.lua (the changed part)&lt;/span&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; GUEST_VLAN &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;99&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;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;#39;SELECT vlan FROM mac_devices WHERE mac = ?&amp;#39;&lt;/span&gt;, {mac})&#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;rows &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;  set_attr(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Tunnel-Type:1&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;VLAN&amp;#39;&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;Tunnel-Medium-Type:1&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;IEEE-802&amp;#39;&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;Tunnel-Private-Group-Id:1&amp;#39;&lt;/span&gt;, GUEST_VLAN)&#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;p&gt;Verified: with the example changed this way, &lt;code&gt;00-ff-ff-ff-ff-ff&lt;/code&gt;, which is not in the table (&lt;code&gt;User-Name&lt;/code&gt; and &lt;code&gt;Calling-Station-Id&lt;/code&gt; the same), gets accept, and the trace line shows &lt;code&gt;Tunnel-Private-Group-Id = 0x013939&lt;/code&gt; (tag 1 plus the text &lt;code&gt;99&lt;/code&gt;). The known printer is still in VLAN 30. A request whose &lt;code&gt;User-Name&lt;/code&gt; and &lt;code&gt;Calling-Station-Id&lt;/code&gt; differ is still rejected.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; After this change, anyone who plugs a computer into the network cable gets into the guest VLAN. First make sure the guest VLAN reaches only the internet and cannot reach internal services.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;When the same switch serves both users who log in with an account and password and MAB devices, they are the same client, so you cannot separate them by client. Instead, use &lt;code&gt;mac-auth.lua&lt;/code&gt; as a lua handler in the auth chain, after the handler that checks passwords, with &lt;code&gt;first_match&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:#75715e&#34;&gt;# rradius.toml (excerpt, other settings omitted)&lt;/span&gt;&#xA;&lt;/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;]&#xA;&lt;/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 = ?&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;mac-auth.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;For an account the sql handler knows, the sql handler decides, and a wrong password is a reject that goes no further; only names it does not know are passed to &lt;code&gt;mac-auth.lua&lt;/code&gt; to be matched by address. When PEAP or TTLS of EAP also goes through this chain, remember that an accept from a lua handler does not count as proof of the password: an sql or ldap handler must really have compared it. So the MAB rule does not let PEAP through without a password (see &lt;a class=&#34;link&#34; href=&#34;../11-eap/#what-happens-inside-the-tunnel&#34; &gt;chapter 11, &amp;ldquo;What happens inside the tunnel&amp;rdquo;&lt;/a&gt;). Measured (the &lt;code&gt;users&lt;/code&gt; table has &lt;code&gt;alice&lt;/code&gt;, and &lt;code&gt;mac_devices&lt;/code&gt; has the wired-mab demo data): &lt;code&gt;alice&lt;/code&gt; with the right password is accept, and with a wrong password is reject (even when the request carries the printer&amp;rsquo;s &lt;code&gt;Calling-Station-Id&lt;/code&gt;); the printer&amp;rsquo;s address is accept and returns VLAN 30.&lt;/p&gt;&#xA;&lt;h3 id=&#34;how-to-test-and-notes&#34;&gt;How to test, and notes&#xA;&lt;/h3&gt;&lt;p&gt;Verified. First change the &lt;code&gt;address&lt;/code&gt; of &lt;code&gt;access-switches&lt;/code&gt; to &lt;code&gt;&amp;quot;127.0.0.1&amp;quot;&lt;/code&gt;. Write the MAC address as both the account and the password, and carry &lt;code&gt;Calling-Station-Id&lt;/code&gt; with &lt;code&gt;--attr 31=text:…&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 switches.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user 00-11-22-AA-BB-CC --password 00-11-22-AA-BB-CC \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --attr 31=text:00-11-22-AA-BB-CC --load pap,concurrency=1 --requests 1&#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;  pap: 1430/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Results for different cases:&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;Printer, with &lt;code&gt;User-Name&lt;/code&gt; and &lt;code&gt;Calling-Station-Id&lt;/code&gt; both &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;Phone, with &lt;code&gt;User-Name&lt;/code&gt; &lt;code&gt;00a0c9123456&lt;/code&gt; and &lt;code&gt;Calling-Station-Id&lt;/code&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 (written differently, equal after normalization)&lt;/td&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;User-Name&lt;/code&gt; &lt;code&gt;00a0.c912.3456&lt;/code&gt; (dotted form), &lt;code&gt;Calling-Station-Id&lt;/code&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;The printer&amp;rsquo;s address sent with &lt;code&gt;--load chap&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;User-Name&lt;/code&gt; is the printer, &lt;code&gt;Calling-Station-Id&lt;/code&gt; is another address&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;No &lt;code&gt;Calling-Station-Id&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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 address that is not in the table&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reject&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;In the trace line, the three reply attributes look like this:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… rradius_trace: response client=&amp;#34;access-switches&amp;#34; source=127.0.0.1 user=&amp;#34;00-11-22-AA-BB-CC&amp;#34; code=2 attributes=&amp;#34;Message-Authenticator = &amp;lt;hidden&amp;gt;, Tunnel-Type = 16777229, Tunnel-Medium-Type = 16777222, Tunnel-Private-Group-Id = 0x013330&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The trace shows the raw values with the tag: &lt;code&gt;16777229&lt;/code&gt; is &lt;code&gt;0x0100000d&lt;/code&gt; in hexadecimal, where the leading &lt;code&gt;01&lt;/code&gt; is tag 1 and &lt;code&gt;0d&lt;/code&gt; (13) is &lt;code&gt;VLAN&lt;/code&gt;; &lt;code&gt;16777222&lt;/code&gt; is tag 1 plus &lt;code&gt;IEEE-802&lt;/code&gt; (6); &lt;code&gt;0x013330&lt;/code&gt; is tag 1 plus the text &lt;code&gt;30&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Notes:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The script looks the table up on every login, so adding a device row does not need a reload. For now, add data 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:#75715e&#34;&gt;-- migrations/3_add_cameras.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; 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 the server for the migration to be applied (restart a cluster one node at a time). Verified: after adding this file and restarting, a request with &lt;code&gt;User-Name&lt;/code&gt; &lt;code&gt;0011.2233.44aa&lt;/code&gt; and &lt;code&gt;Calling-Station-Id&lt;/code&gt; &lt;code&gt;00:11:22:33:44:aa&lt;/code&gt; got VLAN 50. When there are many devices and they change often, writing them one by one as migrations is inconvenient, and you need a separate process to manage this table (for example an import from an external system).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;chain=&amp;quot;script&amp;quot; handler=&amp;quot;script&amp;quot;&lt;/code&gt; in the authentication record means that the top-level script made this decision.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;remote-access-remote-access&#34;&gt;Remote access: remote-access&#xA;&lt;/h2&gt;&lt;h3 id=&#34;goal-1&#34;&gt;Goal&#xA;&lt;/h3&gt;&lt;p&gt;Two kinds of remote login on the same server:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;VPN gateway: employees log in with accounts from the company directory (LDAP or Active Directory). Only people in the &lt;code&gt;vpn-users&lt;/code&gt; group may connect, and different access rules are returned depending on the group.&lt;/li&gt;&#xA;&lt;li&gt;Jump host: after the password, an Access-Challenge asks for the TOTP code from the authenticator app on the user&amp;rsquo;s phone.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The two devices are two clients, and each names an auth chain (&lt;code&gt;auth&lt;/code&gt;). Both share &lt;code&gt;accounting.lua&lt;/code&gt; for accounting, written as in the quick start.&lt;/p&gt;&#xA;&lt;h3 id=&#34;tables-1&#34;&gt;Tables&#xA;&lt;/h3&gt;&lt;p&gt;The VPN accounts are in the directory and are not stored here. The jump host uses two tables:&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;Table&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Content&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;mfa_users&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;password&lt;/code&gt; (a stored password with a prefix, for example &lt;code&gt;{crypt}$6$…&lt;/code&gt; or &lt;code&gt;{argon2}$…&lt;/code&gt;), &lt;code&gt;totp_secret&lt;/code&gt; (Base32, the same as in the authenticator on the user&amp;rsquo;s phone), &lt;code&gt;last_step&lt;/code&gt; (the time step used last), &lt;code&gt;failed_attempts&lt;/code&gt;, &lt;code&gt;locked_until&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;mfa_pending&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Challenges waiting for a code: &lt;code&gt;state&lt;/code&gt; (a random value), &lt;code&gt;username&lt;/code&gt;, &lt;code&gt;expires&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;There is also &lt;code&gt;accounting&lt;/code&gt; for accounting. The demo account &lt;code&gt;ops1&lt;/code&gt; has the password &lt;code&gt;ops1-password&lt;/code&gt; (stored as a SHA-512 crypt hash), and its TOTP key is the well-known demo value &lt;code&gt;JBSWY3DPEHPK3PXP&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; &lt;code&gt;JBSWY3DPEHPK3PXP&lt;/code&gt; is a public demo key, and anyone can compute its codes. In production every user must have their own randomly generated key.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;key-settings-1&#34;&gt;Key settings&#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:#75715e&#34;&gt;# rradius.toml (excerpt, other settings omitted)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;lua&lt;/span&gt;]&#xA;&lt;/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;accounting.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;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;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=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;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;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;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;]&#xA;&lt;/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;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;vpn-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;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.60.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;vpn-gw.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;vpn&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;jump-host&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.20&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;jump-host.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;mfa&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;How the settings fit together:&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;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;How it is used here&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;auth.chains.&amp;lt;name&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;none&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;Two named auth chains, with the same fields as &lt;code&gt;[auth]&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;radius.clients[].auth&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;none&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;Which named auth chain the client uses&lt;/td&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.chains.&amp;lt;name&amp;gt;.username.strip_realm&lt;/code&gt;&lt;/td&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;both&lt;/code&gt;: a user who types &lt;code&gt;CORP\alice&lt;/code&gt; or &lt;code&gt;alice@corp.example.com&lt;/code&gt; becomes &lt;code&gt;alice&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;auth.chains.&amp;lt;name&amp;gt;.username.lowercase&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&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;Convert to lower case&lt;/td&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;password_check&lt;/code&gt; of the ldap handler&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;bind&lt;/code&gt;&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;First find the user with the service account, then check the password by binding as the user&lt;/td&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;required_groups&lt;/code&gt; of the ldap handler&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;no group required&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;Accept only if the user belongs to one of the groups&lt;/td&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;group_reply&lt;/code&gt; of the ldap handler&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;none&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;Reply attributes added when the user belongs to a group&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;For the full description of each key, see &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt;; for the other keys of the ldap handler (&lt;code&gt;ca_file&lt;/code&gt;, timeouts, number of connections and so on), see &lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;chapter 08&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The second half of &lt;code&gt;filter&lt;/code&gt; makes disabled accounts in AD (bit 2 of &lt;code&gt;userAccountControl&lt;/code&gt;) impossible to find, the same as if they did not exist. For the OpenLDAP form (&lt;code&gt;pwdAccountLockedTime&lt;/code&gt;) see &amp;ldquo;Log in with directory accounts&amp;rdquo; in &lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;chapter 08&lt;/a&gt;; check it on your own directory first.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;required_groups&lt;/code&gt; looks at &lt;code&gt;memberOf&lt;/code&gt; by default and counts only direct members. To count nested groups in AD, use &lt;code&gt;group_base_dn&lt;/code&gt; plus &lt;code&gt;group_filter = &amp;quot;(member:1.2.840.113556.1.4.1941:={dn})&amp;quot;&lt;/code&gt;; see &amp;ldquo;Decide by group whether a user may log in&amp;rdquo; in &lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;chapter 08&lt;/a&gt; (this form has not been tested on AD).&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;password_check = &amp;quot;bind&amp;quot;&lt;/code&gt; needs the plain-text password, so the VPN gateway must send passwords with PAP.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;Filter-Id&lt;/code&gt; of &lt;code&gt;group_reply&lt;/code&gt; must match a rule of the same name on the VPN gateway (a filter or group policy).&lt;/li&gt;&#xA;&lt;li&gt;When the directory server&amp;rsquo;s certificate is not signed by a CA the system trusts, add &lt;code&gt;ca_file&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Both clients name an auth chain, so authentication never reaches &lt;code&gt;accounting.lua&lt;/code&gt; under &lt;code&gt;[lua]&lt;/code&gt;, which handles accounting only.&lt;/p&gt;&#xA;&lt;h3 id=&#34;key-points-of-the-script-1&#34;&gt;Key points of the script&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;two-step-totp.lua&lt;/code&gt; (that is, &lt;code&gt;rradius-server/examples/two-step-totp.lua&lt;/code&gt;) works in two steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The request has no &lt;code&gt;State&lt;/code&gt;: it compares &lt;code&gt;mfa_users.password&lt;/code&gt; with &lt;code&gt;password_verify&lt;/code&gt;, the same way the auth chain compares stored passwords. If it matches, it makes a random value with &lt;code&gt;random_token()&lt;/code&gt;, writes it to &lt;code&gt;mfa_pending&lt;/code&gt; (valid for 60 seconds), and returns &lt;code&gt;challenge&lt;/code&gt; with &lt;code&gt;State&lt;/code&gt; and &lt;code&gt;Reply-Message = Enter your code&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The request carries &lt;code&gt;State&lt;/code&gt;: it claims the challenge with &lt;code&gt;DELETE … WHERE state = ? AND username = ? AND expires &amp;gt;= ?&lt;/code&gt;, and it counts only if 1 row was deleted, so a challenge can be used only once. Then it checks the code with &lt;code&gt;totp_verify&lt;/code&gt;: 6 digits, 30-second steps, one step of tolerance either way. Finally it updates &lt;code&gt;last_step&lt;/code&gt; only if this step is newer, so the same code cannot be used twice.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;After 5 wrong codes in a row, the account is locked for 5 minutes. The lock is written in the cluster database, so every node sees it. The answer to a challenge may go to another node, and that node&amp;rsquo;s copy may be slightly old.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The script limits only the number of guesses at the code, not guesses at the password: if guessing the password also locked the account, anyone who knew an account name could lock it on purpose. A script that checks passwords itself is not protected by &lt;code&gt;[auth.lockout]&lt;/code&gt;. To limit password guesses as well, check the password in the auth chain (&lt;code&gt;[auth.lockout]&lt;/code&gt; counts failures, chapter 07) and leave only the code to the script.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Enterprise edition:&lt;/strong&gt; The enterprise edition has a built-in TOTP/HOTP second factor, so you do not need to write this script.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;When you switch to your own accounts, use Base32 for the code key, one key per person. After generating it, give it to the user as a QR code (&lt;code&gt;otpauth://totp/…&lt;/code&gt;) to scan. After you replace the demo key, regenerate the QR code and the &lt;code&gt;otpauth&lt;/code&gt; URL too.&lt;/p&gt;&#xA;&lt;h3 id=&#34;how-to-test-and-notes-1&#34;&gt;How to test, and notes&#xA;&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;Jump host: verified.&lt;/strong&gt; Change the &lt;code&gt;address&lt;/code&gt; of &lt;code&gt;jump-host&lt;/code&gt; in the lab directory to &lt;code&gt;&amp;quot;127.0.0.1&amp;quot;&lt;/code&gt;, and send the first step:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 jump-host.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user ops1 --password ops1-password --load pap,concurrency=1 --requests 1&#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;  pap: 614/s, sent 1, accept 0, reject 0, challenge 1, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;challenge 1&lt;/code&gt; is the Access-Challenge returned by the script; with a wrong password you get &lt;code&gt;reject 1&lt;/code&gt;. &lt;code&gt;rradius-bench&lt;/code&gt; does not answer a challenge, so for the second step use a client that handles Access-Challenge, for example FreeRADIUS&amp;rsquo;s &lt;code&gt;radclient&lt;/code&gt;, or a real jump host. With &lt;code&gt;radclient&lt;/code&gt;, compute the code with &lt;code&gt;oathtool&lt;/code&gt; (for the demo key &lt;code&gt;JBSWY3DPEHPK3PXP&lt;/code&gt;: SHA-1, 6 digits, 30-second steps, the same as &lt;code&gt;totp_verify&lt;/code&gt; in the code) and send it with the &lt;code&gt;State&lt;/code&gt; value received in the first step:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ oathtool --totp -b JBSWY3DPEHPK3PXP&#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;State value&amp;gt;,Message-Authenticator=0x00&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 &amp;#34;$(cat jump-host.secret)&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; These two lines with &lt;code&gt;oathtool&lt;/code&gt; and &lt;code&gt;radclient&lt;/code&gt; have not been run in this version; the algorithm part was checked against &lt;code&gt;rradius-core/src/totp.rs&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;On a real jump host: after you enter the password, it shows &lt;code&gt;Enter your code&lt;/code&gt;, and it sends the code back as the next password together with &lt;code&gt;State&lt;/code&gt;. For an SSH jump host that uses pam_radius, write one line in &lt;code&gt;/etc/pam_radius.conf&lt;/code&gt; with the rradius address, the shared secret (the content of &lt;code&gt;jump-host.secret&lt;/code&gt;) and a timeout; a timeout of 5 seconds or more is recommended, and with push approval it must be longer, see &amp;ldquo;Single-file examples&amp;rdquo;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; The pam_radius setting has not been run on a real jump host. It comes from the previous version of the manual.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;For this chapter the second step was verified with a test client that handles challenges: the correct code gets an Access-Accept, and sending the same &lt;code&gt;State&lt;/code&gt; again gets an Access-Reject. The server&amp;rsquo;s authentication records:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;jump-host&amp;#34; source=127.0.0.1 user=&amp;#34;ops1&amp;#34; account=&amp;#34;ops1&amp;#34; chain=&amp;#34;mfa&amp;#34; handler=&amp;#34;lua&amp;#34; decision=&amp;#34;challenge&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;jump-host&amp;#34; source=127.0.0.1 user=&amp;#34;ops1&amp;#34; account=&amp;#34;ops1&amp;#34; chain=&amp;#34;mfa&amp;#34; handler=&amp;#34;lua&amp;#34; decision=&amp;#34;accept&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;jump-host&amp;#34; source=127.0.0.1 user=&amp;#34;ops1&amp;#34; account=&amp;#34;ops1&amp;#34; chain=&amp;#34;mfa&amp;#34; handler=&amp;#34;lua&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;chain=&amp;quot;mfa&amp;quot;&lt;/code&gt; means that the request went through the auth chain named by &lt;code&gt;jump-host&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;VPN gateway:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; The VPN auth chain needs a real directory server. For this chapter, &lt;code&gt;check&lt;/code&gt; was used only to confirm that the configuration is valid, and the behavior when the directory cannot be reached was confirmed (see below). The actual results for groups and reply attributes have not been run against a directory.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Change the &lt;code&gt;address&lt;/code&gt; of &lt;code&gt;vpn-gw&lt;/code&gt; to &lt;code&gt;&amp;quot;127.0.0.1&amp;quot;&lt;/code&gt; and change &lt;code&gt;jump-host&lt;/code&gt; back to its original address: when both clients are &lt;code&gt;127.0.0.1&lt;/code&gt;, &lt;code&gt;check&lt;/code&gt; gives &lt;code&gt;radius clients: duplicate client network &#39;127.0.0.1/32&#39;&lt;/code&gt;. If you log in while the directory does not exist, &lt;code&gt;rradius-bench&lt;/code&gt; waits until it times out, and the server log says:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::ldap_handler: auth ldap handler: ldaps://dc1.corp.example.com: I/O error: failed to lookup address information: …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::ldap_handler: auth ldap handler: ldaps://dc2.corp.example.com: I/O error: failed to lookup address information: …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::ldap_handler: auth ldap handler: no server reachable; rejecting&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::lua_engine: RADIUS Access-Request from client vpn-gw not answered: the authentication backend could not be used&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When the directory cannot be reached, the server does not answer instead of returning Access-Reject: the NAS retransmits or asks the next RADIUS server, and users are not treated as having a wrong password because the directory is briefly down. When DNS cannot find the name, the second half of the error message depends on the operating system.&lt;/p&gt;&#xA;&lt;p&gt;Notes:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This scenario has no &lt;code&gt;[sessions]&lt;/code&gt;, so &lt;code&gt;session list&lt;/code&gt; gives &lt;code&gt;sessions.list is not set in rradius.toml&lt;/code&gt;. To use it, add it as in the quick start (chapter 13).&lt;/li&gt;&#xA;&lt;li&gt;The time the user spends typing the code is between two requests and does not use up the NAS&amp;rsquo;s RADIUS timeout; but a challenge is valid for only 60 seconds.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;accounts-in-an-external-system-external-api&#34;&gt;Accounts in an external system: external-api&#xA;&lt;/h2&gt;&lt;h3 id=&#34;goal-2&#34;&gt;Goal&#xA;&lt;/h3&gt;&lt;p&gt;A membership or billing system already has accounts and passwords. rradius does not store accounts; on every login it asks the system&amp;rsquo;s API over HTTPS. If the API says yes, rradius returns the plan name given by the API as &lt;code&gt;Filter-Id&lt;/code&gt;. Accounting is still written to a local table.&lt;/p&gt;&#xA;&lt;h3 id=&#34;tables-2&#34;&gt;Tables&#xA;&lt;/h3&gt;&lt;p&gt;Only &lt;code&gt;accounting&lt;/code&gt; for accounting, written as in the quick start.&lt;/p&gt;&#xA;&lt;h3 id=&#34;key-settings-2&#34;&gt;Key settings&#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:#75715e&#34;&gt;# rradius.toml (excerpt, other settings omitted)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;lua&lt;/span&gt;]&#xA;&lt;/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;accounting.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;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;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;]&#xA;&lt;/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;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;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;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;How it is used here&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;lua.http.allowed_hosts&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;required&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;The script may call only the hosts listed here. A bare host name allows only HTTPS on port 443; &lt;code&gt;host:port&lt;/code&gt; allows that port; only &lt;code&gt;http://host:port&lt;/code&gt; allows plain HTTP&lt;/td&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.timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;2000&lt;/code&gt;&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;Time limit for one call, from connecting to reading the whole response. Make it shorter than the NAS&amp;rsquo;s retransmit 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;lua.http.max_concurrent&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;64&lt;/code&gt;&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;Number of calls in progress at the same time per host; requests over the limit fail 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;&lt;code&gt;auth.handlers[].verifies_password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&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;Tells the auth chain that this script really compared the password&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;Without &lt;code&gt;[lua.http]&lt;/code&gt;, there is no &lt;code&gt;http_request&lt;/code&gt; in the script.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;verifies_password = true&lt;/code&gt; lets the auth chain have only this one lua handler: its accept also counts as proof of the password, so the inner PAP of EAP-TTLS is let through (chapter 11). Set it only when the script really verifies the password.&lt;/li&gt;&#xA;&lt;li&gt;A call to a URL that is not listed in &lt;code&gt;allowed_hosts&lt;/code&gt; is refused, and the metric &lt;code&gt;rradius_script_http_requests_total{result=&amp;quot;denied&amp;quot;}&lt;/code&gt; goes up by one.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;key-points-of-the-script-2&#34;&gt;Key points of the script&#xA;&lt;/h3&gt;&lt;p&gt;The API that &lt;code&gt;member-api.lua&lt;/code&gt; assumes (replace it with what your system really provides):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;POST https://members.example.com/v1/radius/login&lt;/code&gt;, with the header &lt;code&gt;Authorization: Bearer &amp;lt;API key&amp;gt;&lt;/code&gt; and the body &lt;code&gt;username=&amp;lt;account&amp;gt;&amp;amp;password=&amp;lt;password&amp;gt;&lt;/code&gt; (&lt;code&gt;application/x-www-form-urlencoded&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;200: the account and password are correct and the user may go online; the response header &lt;code&gt;X-Plan&lt;/code&gt; is the plan name (optional).&lt;/li&gt;&#xA;&lt;li&gt;401, 403: the account or password is wrong, or the user may not go online.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The script has no JSON function, so ask the API to answer with status codes and headers. The key points of the script:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Only PAP carries the plain-text password. A CHAP or MS-CHAPv2 request has no &lt;code&gt;User-Password&lt;/code&gt;, so the script refuses it directly and does not ask the API.&lt;/li&gt;&#xA;&lt;li&gt;The account and password come from the user, so always encode them with &lt;code&gt;url_encode&lt;/code&gt; before putting them in the body.&lt;/li&gt;&#xA;&lt;li&gt;When the API gives no answer (timeout, cannot connect, too busy), the script rejects and writes one log line; do not write the password to the log.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;X-Plan&lt;/code&gt; is put into &lt;code&gt;Filter-Id&lt;/code&gt; only if it looks like a name (letters, digits, underscore, hyphen); the script also returns &lt;code&gt;Session-Timeout = 14400&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The API key is written in the script (&lt;code&gt;API_KEY&lt;/code&gt;); let only the account that runs rradius read this file.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;how-to-test-and-notes-2&#34;&gt;How to test, and notes&#xA;&lt;/h3&gt;&lt;p&gt;Verified, with a fake API on the local machine. For the lab, replace the API in the lab directory with plain HTTP on the local machine:&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:#75715e&#34;&gt;# rradius.toml (changed in the lab directory)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&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;http://127.0.0.1:8080&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;p&gt;Change &lt;code&gt;API&lt;/code&gt; in &lt;code&gt;member-api.lua&lt;/code&gt; to &lt;code&gt;&#39;http://127.0.0.1:8080/v1/radius/login&#39;&lt;/code&gt;, and change the &lt;code&gt;address&lt;/code&gt; of &lt;code&gt;hotspot&lt;/code&gt; to &lt;code&gt;&amp;quot;127.0.0.1&amp;quot;&lt;/code&gt;. The fake API is written in Python. It accepts only &lt;code&gt;alice&lt;/code&gt;/&lt;code&gt;alice-password&lt;/code&gt; and returns &lt;code&gt;X-Plan: gold&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;code&gt;member_api.py&lt;/code&gt; is &lt;strong&gt;not a tool provided by rradius&lt;/strong&gt;; it is only a demonstration. It uses only the Python 3 standard library and runs once you save it as a file; do not use it as a real service.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&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-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# member_api.py&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; http.server&lt;span style=&#34;color:#f92672&#34;&gt;,&lt;/span&gt; urllib.parse&#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;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Handler&lt;/span&gt;(http&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;server&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;BaseHTTPRequestHandler):&#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;def&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;do_POST&lt;/span&gt;(self):&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        length &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; int(self&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;headers&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;get(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Content-Length&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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        form &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; urllib&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;parse&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;parse_qs(self&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;rfile&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;read(length)&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;decode())&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        ok &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; (self&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;headers&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;get(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Authorization&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;Bearer member-api-key-change-me&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:#f92672&#34;&gt;and&lt;/span&gt; form&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;get(&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; [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;alice&amp;#39;&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;and&lt;/span&gt; form&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;get(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;password&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;alice-password&amp;#39;&lt;/span&gt;])&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        self&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;send_response(&lt;span style=&#34;color:#ae81ff&#34;&gt;200&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; ok &lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;401&lt;/span&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; ok:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            self&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;send_header(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;X-Plan&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;gold&amp;#39;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        self&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;send_header(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Content-Length&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;0&amp;#39;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        self&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;end_headers()&#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;http&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;server&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;HTTPServer((&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;127.0.0.1&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;8080&lt;/span&gt;), Handler)&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;serve_forever()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Start it with &lt;code&gt;python3 member_api.py&lt;/code&gt; in another terminal, then start rradius. Results:&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;&lt;code&gt;alice&lt;/code&gt;/&lt;code&gt;alice-password&lt;/code&gt;, PAP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;accept, &lt;code&gt;Filter-Id = gold, 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;Wrong password&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reject (the API returns 401, nothing is logged)&lt;/td&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;alice&lt;/code&gt;, &lt;code&gt;--load chap&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reject, the API is 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;--load session&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;login accept, and both Start and Stop get an Accounting-Response&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Stop the fake API, then log in&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reject, and the log says &lt;code&gt;member API gave no answer: the connection was refused&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 &lt;code&gt;rradius_script_http_requests_total&lt;/code&gt; metric in &lt;code&gt;/metrics&lt;/code&gt; is split into the results &lt;code&gt;ok&lt;/code&gt;, &lt;code&gt;timeout&lt;/code&gt;, &lt;code&gt;error&lt;/code&gt;, &lt;code&gt;denied&lt;/code&gt;, &lt;code&gt;too_large&lt;/code&gt; and &lt;code&gt;busy&lt;/code&gt;. This round gave &lt;code&gt;ok&lt;/code&gt; 3 and &lt;code&gt;error&lt;/code&gt; 1. A 401 from the API also counts as &lt;code&gt;ok&lt;/code&gt;: the HTTP call succeeded, and the answer was &amp;ldquo;no&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;Notes:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;When the API is slow, every waiting login holds one in-flight slot (&lt;code&gt;radius.max_auth_inflight&lt;/code&gt;, default &lt;code&gt;4096&lt;/code&gt;, chapter 19). &lt;code&gt;timeout_ms&lt;/code&gt; must be shorter than the NAS&amp;rsquo;s retransmit time, so the NAS does not send again while the script is still waiting.&lt;/li&gt;&#xA;&lt;li&gt;When the API is down, this script rejects everyone, and users see a wrong-password result. Watch &lt;code&gt;timeout&lt;/code&gt; and &lt;code&gt;error&lt;/code&gt; of &lt;code&gt;rradius_script_http_requests_total&lt;/code&gt; (chapter 17) to tell that the problem is the API.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;single-file-examples&#34;&gt;Single-file examples&#xA;&lt;/h2&gt;&lt;p&gt;Three scripts under &lt;code&gt;rradius-server/examples/&lt;/code&gt; are related to this chapter:&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;Description&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Verified&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;mac-auth.lua&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The same as the script of the wired-mab scenario&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Verified (same as wired-mab)&lt;/td&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;two-step-totp.lua&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The same as the script of the remote-access scenario&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Verified (same as remote-access)&lt;/td&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;push-approval.lua&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Push approval: after the password, the user taps &amp;ldquo;approve&amp;rdquo; on the phone&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Configuration checked with &lt;code&gt;check&lt;/code&gt; only&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;push-approval.lua&lt;/code&gt; goes last in an &lt;code&gt;all_accept&lt;/code&gt; auth chain, and runs only after the handlers before it have checked the password:&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:#75715e&#34;&gt;# conf.d/push.toml&lt;/span&gt;&#xA;&lt;/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;]&#xA;&lt;/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 users WHERE 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;push-approval.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;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;push.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;7000&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This snippet passes &lt;code&gt;check&lt;/code&gt; when you put it in the base file from &lt;code&gt;config init&lt;/code&gt; (chapter 04). The push service that the script assumes:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;POST https://push.example.com/v1/push&lt;/code&gt;, with the body &lt;code&gt;username=&amp;lt;account&amp;gt;&lt;/code&gt;, returns 201 and the header &lt;code&gt;X-Push-Id&lt;/code&gt;, which means the push has reached the user&amp;rsquo;s phone.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;GET https://push.example.com/v1/push/&amp;lt;id&amp;gt;?wait=&amp;lt;seconds&amp;gt;&lt;/code&gt; waits until the user answers or the time runs out, and returns 200 with the header &lt;code&gt;X-Push-Result&lt;/code&gt;: &lt;code&gt;approved&lt;/code&gt;, &lt;code&gt;denied&lt;/code&gt; or &lt;code&gt;pending&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The script waits at most &lt;code&gt;WAIT_SECONDS&lt;/code&gt; (30 seconds), and each request lets the service wait at most &lt;code&gt;POLL_SECONDS&lt;/code&gt; (5 seconds), so &lt;code&gt;timeout_ms&lt;/code&gt; must be longer than 5 seconds; the snippet uses 7000.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; &lt;code&gt;push-approval.lua&lt;/code&gt; was checked with &lt;code&gt;check&lt;/code&gt; only. It has not been run against a push service.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Waiting takes time, so think about three things first:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The NAS&amp;rsquo;s RADIUS timeout must be longer than &lt;code&gt;WAIT_SECONDS&lt;/code&gt;. Otherwise the NAS gives up or retransmits while the user is still looking at the phone. For example, if &lt;code&gt;WAIT_SECONDS&lt;/code&gt; is 30 seconds, set the timeout on the pam_radius server line to 35 seconds; on a VPN gateway, set its RADIUS server timeout.&lt;/li&gt;&#xA;&lt;li&gt;Every waiting login holds one slot of &lt;code&gt;max_auth_inflight&lt;/code&gt;. When many people wait at the same time, raise this value.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;lua.max_execution_ms&lt;/code&gt; (default &lt;code&gt;1000&lt;/code&gt;) counts only the time the script itself runs, not the time spent waiting for an HTTP response.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The result of &lt;code&gt;rradius-bench&lt;/code&gt; is &lt;code&gt;timeouts 1&lt;/code&gt;, and the server log has &lt;code&gt;RADIUS packet from unknown client 127.0.0.1 discarded&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The client address in the scenario is a real subnet, and &lt;code&gt;127.0.0.1&lt;/code&gt; is not in it. &lt;code&gt;Discarded: unknown client&lt;/code&gt; in &lt;code&gt;status&lt;/code&gt; goes up.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change the &lt;code&gt;address&lt;/code&gt; of the client you want to test to &lt;code&gt;&amp;quot;127.0.0.1&amp;quot;&lt;/code&gt; in the lab directory only.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; MAB is always rejected, and the log has no error.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The switch did not send &lt;code&gt;Calling-Station-Id&lt;/code&gt;, or it is not the same address as &lt;code&gt;User-Name&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Turn on &lt;code&gt;[log.trace]&lt;/code&gt; to see the attributes of the request, and compare the two values.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The VPN login gets no answer, and the log has &lt;code&gt;no server reachable; rejecting&lt;/code&gt; and &lt;code&gt;not answered: the authentication backend could not be used&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; No directory server can be reached: the name cannot be found, the port is closed, or the certificate is not trusted.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Make sure the server can reach the addresses listed in &lt;code&gt;urls&lt;/code&gt;; if the directory&amp;rsquo;s certificate is not signed by a CA the system trusts, add &lt;code&gt;ca_file&lt;/code&gt; (chapter 08).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The jump host rejects a correct code.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The challenge was answered after more than 60 seconds; the same code was already used; the clocks of the server and the phone differ by more than one step (30 seconds); or there were 5 wrong codes in a row and the account is locked for 5 minutes.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Make sure the clocks on both sides are synchronized, and wait for the next code before trying again.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; All &lt;code&gt;external-api&lt;/code&gt; logins are rejected, and the log has &lt;code&gt;script http_request refused: https://… is not in lua.http.allowed_hosts&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The URL the script calls does not match &lt;code&gt;allowed_hosts&lt;/code&gt;: the host, the port, or http/https is different.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Write &lt;code&gt;allowed_hosts&lt;/code&gt; to match the URL: for HTTPS on port 443 write only the host, for other ports write &lt;code&gt;host:port&lt;/code&gt;, and for plain HTTP write &lt;code&gt;http://host:port&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; All CHAP or MS-CHAPv2 logins of &lt;code&gt;external-api&lt;/code&gt; are rejected.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; These two methods do not carry a plain-text password, so the script has nothing to give to the API.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Make the NAS use PAP; or use the inner PAP of EAP-TTLS (chapter 11), which is protected by TLS on the outside.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05 RADIUS service and NAS clients&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;08 LDAP and Active Directory&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;10 Writing policies in Lua&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;11 802.1X and EAP&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13 Accounting and sessions&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../14-isp-recipes/&#34; &gt;14 Scenarios: broadband and ISP&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../93-lua-reference/&#34; &gt;Appendix D: Lua API reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>16 Clusters and high availability</title>
            <link>https://embark.systems/en/rradius/oss/16-cluster/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/16-cluster/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Set up a three-node cluster and confirm that data written to one node can be read from the others&lt;/li&gt;&#xA;&lt;li&gt;Understand leader, followers, replication and snapshots, and know what the server does when it loses the leader&lt;/li&gt;&#xA;&lt;li&gt;Handle a node failure: restart a node, or rebuild its data from the other nodes&lt;/li&gt;&#xA;&lt;li&gt;Add a new node to the cluster and remove a node safely&lt;/li&gt;&#xA;&lt;li&gt;Deploy a three-node cluster with Docker Compose or Kubernetes&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: you have worked through &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;chapter 03&lt;/a&gt; and know how to start the server and test logins with &lt;code&gt;rradius-bench&lt;/code&gt;; you have read &lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;chapter 04&lt;/a&gt; and know &lt;code&gt;check&lt;/code&gt; and reload. The exercises in this chapter run three to four nodes on one machine. You need &lt;code&gt;rradiusd&lt;/code&gt; and &lt;code&gt;rradius-bench&lt;/code&gt; built from the source, and &lt;code&gt;rradius-server/examples/scenarios/ha-cluster/&lt;/code&gt; from the source.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#concepts&#34; &gt;Concepts&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#cluster-settings&#34; &gt;cluster settings&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#three-nodes-on-one-machine&#34; &gt;Three nodes on one machine&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#check-that-the-cluster-has-formed&#34; &gt;Check that the cluster has formed&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#check-that-writes-are-replicated&#34; &gt;Check that writes are replicated&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#stop-the-leader&#34; &gt;Stop the leader&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#lose-the-majority&#34; &gt;Lose the majority&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#restarting-nodes-and-rebuilding-data&#34; &gt;Restarting nodes and rebuilding data&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#add-a-node&#34; &gt;Add a node&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#remove-a-node&#34; &gt;Remove a node&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#check-the-settings-of-each-node&#34; &gt;Check the settings of each node&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#see-the-state-of-the-whole-cluster&#34; &gt;See the state of the whole cluster&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#several-hosts-the-ha-cluster-scenario&#34; &gt;Several hosts: the ha-cluster scenario&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#deploy-with-docker-compose&#34; &gt;Deploy with Docker Compose&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#deploy-on-kubernetes&#34; &gt;Deploy on Kubernetes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#across-data-centers&#34; &gt;Across data centers&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#cluster-metrics&#34; &gt;Cluster metrics&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;concepts&#34;&gt;Concepts&#xA;&lt;/h2&gt;&lt;h3 id=&#34;a-single-node-is-also-a-cluster&#34;&gt;A single node is also a cluster&#xA;&lt;/h3&gt;&lt;p&gt;rradius keeps its accounts, reply attributes and accounting data in an SQLite database embedded in each node (hiqlite). The nodes replicate this database with the Raft protocol, and every node holds a complete copy.&lt;/p&gt;&#xA;&lt;p&gt;So the configuration always needs &lt;code&gt;[cluster]&lt;/code&gt;, even on a single machine. When you run only one machine, it is a cluster with one node:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Without &lt;code&gt;[[cluster.nodes]]&lt;/code&gt;, the cluster has only node 1, the Raft port is &lt;code&gt;127.0.0.1:8100&lt;/code&gt; and the API port is &lt;code&gt;127.0.0.1:8200&lt;/code&gt;. Both ports listen on &lt;code&gt;127.0.0.1&lt;/code&gt; only by default.&lt;/li&gt;&#xA;&lt;li&gt;To grow to three nodes later, the tables and scripts stay as they are. You only change &lt;code&gt;[cluster]&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;leader-followers-and-writes&#34;&gt;Leader, followers and writes&#xA;&lt;/h3&gt;&lt;p&gt;At any moment the cluster has at most one leader. The other nodes are followers.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Read:&lt;/strong&gt; the script&amp;rsquo;s &lt;code&gt;sql_query&lt;/code&gt; and the &lt;code&gt;sql&lt;/code&gt; handler&amp;rsquo;s password lookup read the local copy. They do not use the network.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Write:&lt;/strong&gt; the script&amp;rsquo;s &lt;code&gt;sql_execute&lt;/code&gt; and commands such as &lt;code&gt;user add&lt;/code&gt; go to the leader. A write succeeds after the leader has the confirmation of a majority of the nodes. A write that a follower receives is forwarded to the leader.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Because a write needs a majority, the cluster can write only while a majority of the nodes is alive:&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;Nodes&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Majority&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;How many can be down at the same time&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;1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;3&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;4&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;3&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;5&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;3&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;A cluster of two nodes is more fragile than one node: when either stops, writes stop. So when only one or two voters would remain, &lt;code&gt;cluster remove&lt;/code&gt; removes a node only with &lt;code&gt;--force&lt;/code&gt; (see &lt;a class=&#34;link&#34; href=&#34;#remove-a-node&#34; &gt;Remove a node&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;When the leader stops, the remaining nodes elect a new leader by themselves. Nobody has to step in.&lt;/p&gt;&#xA;&lt;h3 id=&#34;stopping-one-node-and-stopping-two&#34;&gt;Stopping one node and stopping two&#xA;&lt;/h3&gt;&lt;p&gt;What happens to authentication and accounting when you stop nodes of a three-node cluster (for the details of each kind of request when there is no leader, see &amp;ldquo;When there is no leader&amp;rdquo; below):&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;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 asks another node. When the stopped node is the leader, logins that need a write get no answer during the election (for the time, see &lt;a class=&#34;link&#34; href=&#34;#across-data-centers&#34; &gt;Across data centers&lt;/a&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Normal. When the stopped node is the leader, writes time out during the election; with an accounting spool they go to the spool first and are replayed later, possibly once more than needed&lt;/td&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;Logins that only read data (&lt;code&gt;sql&lt;/code&gt;, &lt;code&gt;ldap&lt;/code&gt;) read the local copy and are answered as usual; logins that write (verification codes, IP allocation) get no answer, so the NAS retransmits or asks another node. When &lt;code&gt;stop_without_leader_ms&lt;/code&gt; is set, even read-only logins get no answer after that time&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Cannot write to the database; with an accounting spool the request is written locally and answered, and 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;p&gt;Accounting can be replayed, and can also be recorded twice because of a retransmit after a timeout, so the accounting script has to be safe to run more than once (for example keyed on &lt;code&gt;Acct-Session-Id&lt;/code&gt; with &lt;code&gt;INSERT OR IGNORE&lt;/code&gt;); see &lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;chapter 13&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;When the database cannot be used, the server does not answer instead of rejecting.&lt;/strong&gt; When a login cannot be decided because the cluster database timed out or found no leader, RADIUS sends no reply and TACACS+ answers ERROR. The NAS or device then asks another node, and the user does not see &amp;ldquo;wrong password&amp;rdquo;. Such requests are counted in &lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;database&amp;quot;}&lt;/code&gt;, and the log says &lt;code&gt;not answered: the cluster database could not be used&lt;/code&gt;. The server rejects only when it is sure the account does not exist or the password is wrong, and all database calls of the script succeeded.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;A node cut off from the others reads old data.&lt;/strong&gt; While it is separated from the majority, an account disabled on the other side, a NAS deleted there, or a key revoked there is still valid on this node until the network recovers. If you cannot accept that, set &lt;code&gt;stop_without_leader_ms&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;a-node-serves-only-after-it-has-caught-up&#34;&gt;A node serves only after it has caught up&#xA;&lt;/h3&gt;&lt;p&gt;When a node starts, it does not answer requests at once. It does these things in order:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Start the local cluster node. A node that starts for the first time has to join the cluster first.&lt;/li&gt;&#xA;&lt;li&gt;Wait for a leader that can accept writes, for at most &lt;code&gt;migrations_wait_ms&lt;/code&gt; (60000 ms by default).&lt;/li&gt;&#xA;&lt;li&gt;If there is a &lt;code&gt;migrations_dir&lt;/code&gt;, apply the migrations that are not yet applied (&lt;a class=&#34;link&#34; href=&#34;../18-operations/&#34; &gt;chapter 18&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;Write a marker of its own through the leader, and wait until the local copy reads this marker back. Only then has it caught up. The log says &lt;code&gt;cluster node N has caught up with the cluster&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Open the RADIUS, TACACS+ and metrics ports. The log says &lt;code&gt;Servers started&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Step 4 guarantees that a node that was down for two hours answers its first request with the accounts added during those two hours already visible. The metrics port also opens only after this, so during startup even &lt;code&gt;/livez&lt;/code&gt; cannot be reached.&lt;/p&gt;&#xA;&lt;h3 id=&#34;snapshots&#34;&gt;Snapshots&#xA;&lt;/h3&gt;&lt;p&gt;Raft records every write in a log. The log keeps growing, so after every &lt;code&gt;snapshot_every&lt;/code&gt; applied entries (100000 by default) the node saves a snapshot of the database, and older log entries can then be discarded. A node that is new or has fallen too far behind takes a snapshot from the leader and then catches up with the log from there.&lt;/p&gt;&#xA;&lt;p&gt;A snapshot is for replication, not a backup. The core edition has no backup feature; for how to protect the data, see &lt;a class=&#34;link&#34; href=&#34;../18-operations/&#34; &gt;chapter 18&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;when-there-is-no-leader&#34;&gt;When there is no leader&#xA;&lt;/h3&gt;&lt;p&gt;A node that has lost contact with the other nodes and cannot reach a majority has no leader that it can write to. What it does then depends on &lt;code&gt;stop_without_leader_ms&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;Situation&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;code&gt;stop_without_leader_ms&lt;/code&gt; not set (default)&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Set, and there has been no leader for longer than this time&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;Logins that only read data (for example the &lt;code&gt;sql&lt;/code&gt; handler looking up a password)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Answered as usual from the local copy; the data may be old&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No answer; counted in &lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;no_leader&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;Status-Server&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Answered as usual&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No 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;Logins whose script writes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No answer (the write fails)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No 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;Accounting&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;For the first few seconds the write waits for a leader and there is no answer; once there has been no leader for more than 5 seconds the write fails at once, and with an accounting spool the request is written to the spool and answered, without one there is no answer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same as on the left&lt;/td&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+ authentication and authorization&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Answered as usual from the local copy&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;TACACS+ accounting&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Handed to the script as usual&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Not affected by &lt;code&gt;stop_without_leader_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;&lt;code&gt;/readyz&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;200&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;503 &lt;code&gt;no leader&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;Two more rules about time:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Once there has been no leader for more than 5 seconds, new writes fail at once and do not wait any more. An accounting request whose write failed goes to the accounting spool when there is one (&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;chapter 13&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;The exception is the first write after the majority is lost: it was handed to the cluster before the 5 seconds had passed, so it waits until the cluster&amp;rsquo;s 30 second timeout before it fails, and &lt;code&gt;query_timeout_ms&lt;/code&gt; does not limit it. The message is &lt;code&gt;the cluster took the write and said nothing of it within 30 s; it may have been committed&lt;/code&gt; (the write may have taken effect by then, so do not assume it was not written). When only the leader itself is left in the cluster, the message is &lt;code&gt;local client write timed out&lt;/code&gt; and the login gets no answer. Measured: with two of three nodes stopped, the first write on the remaining node failed after 30 seconds, later writes failed within 12 milliseconds, and reads kept succeeding at once. This was measured with authentication writes; accounting writes and overlapping writes were not measured.&lt;/li&gt;&#xA;&lt;li&gt;A leader that has not had the confirmation of a majority for more than 5 seconds also counts as having no leader. An old leader that has been cut off does not think it can still write.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;When should you set &lt;code&gt;stop_without_leader_ms&lt;/code&gt;? When the NAS has several RADIUS servers configured. With it set, a node that is cut off stops answering, so the NAS asks the other nodes that are still in the cluster, and &lt;code&gt;/readyz&lt;/code&gt; lets a load balancer take the node out. The Kubernetes example sets 10000. For a NAS that has only one server to ask, it is better not to set it: at least the read-only logins can still pass.&lt;/p&gt;&#xA;&lt;h3 id=&#34;cluster-ports-and-security&#34;&gt;Cluster ports and security&#xA;&lt;/h3&gt;&lt;p&gt;Every node opens two ports for the cluster:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;raft&lt;/code&gt;: used between nodes for replication.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;api&lt;/code&gt;: used between nodes to forward writes and for membership management; commands such as &lt;code&gt;user&lt;/code&gt;, &lt;code&gt;session&lt;/code&gt; and &lt;code&gt;cluster&lt;/code&gt; also talk to the cluster through it.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;These two ports are protected only by shared secrets (&lt;code&gt;secret_raft&lt;/code&gt;, &lt;code&gt;secret_api&lt;/code&gt;), and the traffic itself is &lt;strong&gt;not encrypted&lt;/strong&gt;. So:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Set &lt;code&gt;listen&lt;/code&gt; to the node&amp;rsquo;s internal address or WireGuard address, and do not let the outside network reach it.&lt;/li&gt;&#xA;&lt;li&gt;When the nodes are in different data centers or connected over a public network, the traffic between nodes has to go through an encrypted tunnel, for example WireGuard. The ha-cluster scenario is designed this way: the node addresses are in the WireGuard network &lt;code&gt;10.99.0.0/24&lt;/code&gt;, and &lt;code&gt;listen&lt;/code&gt; listens on the WireGuard interface only. How to set up WireGuard itself is outside the scope of this book.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; When there is &lt;code&gt;[[cluster.nodes]]&lt;/code&gt; and no &lt;code&gt;listen&lt;/code&gt;, the two ports listen on &lt;code&gt;0.0.0.0&lt;/code&gt;, and both &lt;code&gt;check&lt;/code&gt; and startup warn &lt;code&gt;cluster.listen is not set, so the cluster&#39;s Raft and API ports are on all interfaces, …&lt;/code&gt;. If you really want to listen on all addresses (for example in a container), write &lt;code&gt;listen = &amp;quot;0.0.0.0&amp;quot;&lt;/code&gt; and the warning goes away.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;cluster-settings&#34;&gt;cluster settings&#xA;&lt;/h2&gt;&lt;p&gt;Every key of &lt;code&gt;[cluster]&lt;/code&gt; needs a restart to take effect; on reload the log lists &lt;code&gt;[cluster]&lt;/code&gt; after &lt;code&gt;these need a restart to apply:&lt;/code&gt;. For the full types and defaults, see &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&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;&lt;code&gt;node_id&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The id of this node, at least 1; it has to appear in &lt;code&gt;nodes&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;data_dir&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;required&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Directory for the database and the Raft log, relative to 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;listen&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;127.0.0.1&lt;/code&gt; without &lt;code&gt;nodes&lt;/code&gt;, &lt;code&gt;0.0.0.0&lt;/code&gt; with &lt;code&gt;nodes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The address the &lt;code&gt;raft&lt;/code&gt; and &lt;code&gt;api&lt;/code&gt; ports listen on; the port numbers come from this node&amp;rsquo;s entry in &lt;code&gt;nodes&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;nodes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;only node 1, &lt;code&gt;127.0.0.1:8100&lt;/code&gt;, &lt;code&gt;127.0.0.1:8200&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The list of nodes of the cluster; each entry has &lt;code&gt;id&lt;/code&gt;, &lt;code&gt;raft&lt;/code&gt; and &lt;code&gt;api&lt;/code&gt;, all written as &lt;code&gt;host:port&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;secret_raft&lt;/code&gt;, &lt;code&gt;secret_raft_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;one of the two, required&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Shared secret of the Raft port, at least 16 characters, the same 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;secret_api&lt;/code&gt;, &lt;code&gt;secret_api_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;one of the two, required&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Shared secret of the API port, at least 16 characters, the same 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;migrations_dir&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;none&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Directory of SQL files applied at startup (&lt;a class=&#34;link&#34; href=&#34;../18-operations/&#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;migrations_wait_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;60000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Time limit for each of the three startup steps (wait for a leader, apply migrations, catch up), in milliseconds&lt;/td&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;snapshot_every&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;100000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Number of Raft log entries between two snapshots&lt;/td&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;read_connections&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;twice the number of worker threads, at most 32&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Number of connections that read the local database, 1 to 128 (&lt;a class=&#34;link&#34; href=&#34;../19-performance/&#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;code&gt;stop_without_leader_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;none (always answer)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After there has been no leader for longer than this time, do not answer logins and Status-Server, in milliseconds&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Rules for &lt;code&gt;nodes&lt;/code&gt; (&lt;code&gt;check&lt;/code&gt; fails when they are broken):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;There has to be a node with id 1: &lt;code&gt;cluster.nodes: node 1 is required&lt;/code&gt;. Node 1 is the one that creates the cluster on the first start.&lt;/li&gt;&#xA;&lt;li&gt;Ids cannot repeat, and cannot be 0.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;node_id&lt;/code&gt; has to be in the list: &lt;code&gt;cluster.node_id 4 is not in cluster.nodes&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Addresses have to be &lt;code&gt;host:port&lt;/code&gt;: &lt;code&gt;cluster.nodes: node 1 raft &#39;10.0.0.1&#39; must be host:port&lt;/code&gt;. &lt;code&gt;host&lt;/code&gt; can be a name, for example &lt;code&gt;rradius-0.rradius-cluster&lt;/code&gt; in Kubernetes.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;In the configuration of every node, &lt;code&gt;nodes&lt;/code&gt; lists all the nodes, including itself. Apart from the local values such as &lt;code&gt;node_id&lt;/code&gt; and &lt;code&gt;listen&lt;/code&gt;, the configurations of the nodes should preferably be identical. For how to check this with &lt;code&gt;config diff&lt;/code&gt;, see &lt;a class=&#34;link&#34; href=&#34;#check-the-settings-of-each-node&#34; &gt;Check the settings of each node&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;When &lt;code&gt;nodes&lt;/code&gt; is set and has more than one node, the default of &lt;code&gt;ready_delay_ms&lt;/code&gt; in &lt;code&gt;[shutdown]&lt;/code&gt; becomes 5000 (0 for a single node), to give the NAS and load balancers time to ask other nodes. &lt;code&gt;[shutdown]&lt;/code&gt; is described in &lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;chapter 04&lt;/a&gt;, and the order of shutdown in &lt;a class=&#34;link&#34; href=&#34;../18-operations/&#34; &gt;chapter 18&lt;/a&gt;.&lt;/p&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;The tables are replicated automatically, but the things below are not. Check them one by one when you plan 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;Note&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 file, scripts, dictionary, &lt;code&gt;migrations_dir&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;The content has to be the same. After a change, update every machine and reload or restart each one (check with &lt;code&gt;config diff&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;secret_raft_file&lt;/code&gt;, &lt;code&gt;secret_api_file&lt;/code&gt;, the 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;The content has to 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;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;Replace them on every machine when you renew them, and send SIGHUP to each&lt;/td&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 node replays only its own files&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Keep it on a persistent disk. When a node breaks, what it has not replayed yet is lost. &lt;code&gt;rradius_acct_spool_bytes&lt;/code&gt; above 0 means accounting that is not yet in the database; you can alert on 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;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 has to stay on one node (&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;chapter 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;Cluster state&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Each node sees its own&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;See &lt;a class=&#34;link&#34; href=&#34;#cluster-metrics&#34; &gt;Cluster metrics&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;Metrics and the timing of &lt;code&gt;[log.trace]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Each node&amp;rsquo;s own&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Add up the cluster total in the monitoring system; for a user you want to trace, set it on every machine&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; logins are mostly reads, and when there are not enough connections, requests queue. When memory is tight you can lower it; every 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; when you lower it, a restart after an abnormal exit (power loss, SIGKILL) is faster, but with many writes, snapshots that are too frequent slow the service down.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;More nodes do not raise the write limit.&lt;/strong&gt; Every write goes through the same leader and waits for the confirmation of a majority, and between separate hosts it also waits for the round trips between the nodes (see &lt;a class=&#34;link&#34; href=&#34;#across-data-centers&#34; &gt;Across data centers&lt;/a&gt;). Logins (reads) are handled by each node on its own, so the more nodes, the higher the total.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The defaults and ranges of the three are in the table above. All need a restart, and for how to measure see &lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;chapter 19&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;three-nodes-on-one-machine&#34;&gt;Three nodes on one machine&#xA;&lt;/h2&gt;&lt;p&gt;Goal: run three nodes on one machine, and use them for the practice in the following sections.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This is a way to practice, and it differs from a multi-host deployment in a few ways:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;All three nodes are on &lt;code&gt;127.0.0.1&lt;/code&gt;, so every node needs different ports and a different &lt;code&gt;data_dir&lt;/code&gt;. In production every host uses the same ports (for example 8100, 8200, 1812, 1813, 9812), and only the addresses differ.&lt;/li&gt;&#xA;&lt;li&gt;Stopping a node means stopping a process. You do not meet network partitions, packet loss or clock skew, which only happen with several hosts. The seconds measured in this chapter apply to this machine only.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;status --cluster&lt;/code&gt; cannot see the other nodes this way; see &lt;a class=&#34;link&#34; href=&#34;#see-the-state-of-the-whole-cluster&#34; &gt;See the state of the whole cluster&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;prepare-the-directory&#34;&gt;Prepare the directory&#xA;&lt;/h3&gt;&lt;p&gt;Run these commands from the root of the source 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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ export PATH&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$PWD&lt;span style=&#34;color:#e6db74&#34;&gt;/target/release:&lt;/span&gt;$PATH&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ mkdir -p ~/rradius-lab/cluster&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cp -R rradius-server/examples/scenarios/ha-cluster/accounting.lua &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;        rradius-server/examples/scenarios/ha-cluster/migrations ~/rradius-lab/cluster/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cd ~/rradius-lab/cluster&#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; f in raft api nas; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; openssl rand -hex &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt; &amp;gt; $f.secret; &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;$ chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;600&lt;/span&gt; *.secret&#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;accounting.lua&lt;/code&gt; and &lt;code&gt;migrations/&lt;/code&gt; are the same as in the quick-start scenario: the three tables &lt;code&gt;users&lt;/code&gt;, &lt;code&gt;user_reply&lt;/code&gt; and &lt;code&gt;accounting&lt;/code&gt;, and the demo accounts.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;raft.secret&lt;/code&gt; and &lt;code&gt;api.secret&lt;/code&gt; are the cluster secrets, and &lt;code&gt;nas.secret&lt;/code&gt; is the NAS shared secret. The three nodes share these three files; on several hosts, you copy the same files to every host.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;settings-for-node-1&#34;&gt;Settings for node 1&#xA;&lt;/h3&gt;&lt;p&gt;The exercises in this chapter use ports in the 27000 range, to avoid clashing with the default ports of other programs on the system:&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;Node&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;code&gt;node_id&lt;/code&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;code&gt;data_dir&lt;/code&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;code&gt;raft&lt;/code&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;code&gt;api&lt;/code&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;RADIUS auth/acct&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;TACACS+&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Metrics&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;1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;data1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27001&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27011&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27021/27031&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27051&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27041&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&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;2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;data2&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27002&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27012&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27022/27032&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27052&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27042&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;3&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;3&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;data3&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27003&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27013&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27023/27033&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27053&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27043&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;4 (used in &lt;a class=&#34;link&#34; href=&#34;#add-a-node&#34; &gt;Add a node&lt;/a&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;4&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;data4&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27004&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27014&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27024/27034&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27054&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27044&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&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:#75715e&#34;&gt;# node1.toml&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;dictionary&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/path/to/share/dictionary&amp;#34;&lt;/span&gt;   &lt;span style=&#34;color:#75715e&#34;&gt;# change to the absolute path of the dictionary&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;lua&lt;/span&gt;]&#xA;&lt;/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;accounting.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;query_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;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;127.0.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;data_dir&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;data1&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_raft_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;raft.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;secret_api_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;api.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;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;127.0.0.1:27001&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;127.0.0.1:27011&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;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;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;raft&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;127.0.0.1:27002&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;127.0.0.1:27012&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;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;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:#a6e22e&#34;&gt;raft&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;127.0.0.1:27003&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;127.0.0.1:27013&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;]&#xA;&lt;/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;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;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;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;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;sessions&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;list&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT username, nas, session_id, started, updated FROM accounting WHERE stopped IS NULL ORDER BY started, session_id&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;]&#xA;&lt;/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;127.0.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;auth_port&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;27021&lt;/span&gt;&#xA;&lt;/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;27031&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;status_server&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;localhost&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;127.0.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;nas.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;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;spool1&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;]&#xA;&lt;/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;127.0.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;port&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;27051&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;localhost&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;127.0.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;nas.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;metrics&lt;/span&gt;]&#xA;&lt;/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;127.0.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;port&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;27041&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A few choices that matter for the cluster:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;query_timeout_ms = 2000&lt;/code&gt;: the total time one request waits for the database. After the cluster loses the majority, the first write that was already handed to the cluster still waits 30 seconds before it fails (see the rule above), and this value does not shorten that; it limits the script&amp;rsquo;s reads and the writes that have not been handed over yet. The ha-cluster scenario uses the same value.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;migrations_wait_ms = 120000&lt;/code&gt;: when all three nodes restart together, the node that comes up first has to wait for the others, so give it a longer time.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;[radius.accounting_spool]&lt;/code&gt;: when the database cannot be written, accounting is written to the local disk first and sent again later (&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;chapter 13&lt;/a&gt;). Every node uses its own directory.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;[accounts]&lt;/code&gt;, &lt;code&gt;[sessions]&lt;/code&gt;: let this chapter confirm replication with &lt;code&gt;user add&lt;/code&gt; and &lt;code&gt;session list&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;chapter 07&lt;/a&gt;, &lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;chapter 13&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Copy &lt;code&gt;node1.toml&lt;/code&gt; to &lt;code&gt;node2.toml&lt;/code&gt; and &lt;code&gt;node3.toml&lt;/code&gt;, and change &lt;code&gt;node_id&lt;/code&gt;, &lt;code&gt;data_dir&lt;/code&gt;, the RADIUS, TACACS+ and metrics ports as in the table above, and the &lt;code&gt;dir&lt;/code&gt; of &lt;code&gt;[radius.accounting_spool]&lt;/code&gt; (&lt;code&gt;spool2&lt;/code&gt;, &lt;code&gt;spool3&lt;/code&gt;). The &lt;code&gt;[[cluster.nodes]]&lt;/code&gt; entries of the three files are exactly the same.&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; n in &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; 3; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; rradiusd check --config node$n.toml; &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;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;start-them-together&#34;&gt;Start them together&#xA;&lt;/h3&gt;&lt;p&gt;Start the three nodes together: the node that comes up first waits until a majority has gathered before it starts serving. Open a terminal for each node, or put them in the background like this and write the logs to files:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; n in &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; 3; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; rradiusd serve --config node$n.toml &amp;gt; node$n.log 2&amp;gt;&amp;amp;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &amp;amp; &lt;span style=&#34;color:#66d9ef&#34;&gt;done&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;On this machine, it takes about 9 seconds from start until &lt;code&gt;/readyz&lt;/code&gt; of all three nodes answers &lt;code&gt;ok&lt;/code&gt;. The log of node 1 (timestamps removed):&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;WARN hiqlite::store::state_machine::sqlite::writer: No metadata exists inside the DB yet&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;WARN hiqlite::store::state_machine::sqlite::writer: No metadata exists inside the DB yet&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ERROR hiqlite::init: Config: Raft node has not been initialized&#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;INFO rradius_core::cli: cluster node 1 started&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;INFO rradius_core::cli: cluster node 1 has caught up with the cluster&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;INFO rradius_core::cli: Servers started. Press Ctrl+C to stop.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;INFO rradius_core::radius: RADIUS Server listening on 127.0.0.1:27021 and 127.0.0.1:27031&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;INFO rradius_core::tacacs: TACACS+ Server listening on 127.0.0.1:27051&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;INFO rradius_core::metrics: Metrics listening on 127.0.0.1:27041&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Until the cluster has formed, the logs of nodes 2 and 3 have several lines of &lt;code&gt;ERROR hiqlite::init: … Raft is not initialized&lt;/code&gt; or &lt;code&gt;Connection refused&lt;/code&gt;: they are waiting for node 1 to create the cluster. As long as &lt;code&gt;has caught up with the cluster&lt;/code&gt; follows, you can ignore these ERROR lines.&lt;/p&gt;&#xA;&lt;h2 id=&#34;check-that-the-cluster-has-formed&#34;&gt;Check that the cluster has formed&#xA;&lt;/h2&gt;&lt;h3 id=&#34;cluster-members&#34;&gt;cluster members&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;cluster members&lt;/code&gt; asks the nodes in the configuration who the leader is, and then lists the members as the leader sees them:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd cluster members --config node1.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node 1  voter    leader  raft 127.0.0.1:27001  api 127.0.0.1:27011&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node 2  voter            raft 127.0.0.1:27002  api 127.0.0.1:27012&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node 3  voter            raft 127.0.0.1:27003  api 127.0.0.1:27013&#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;voter&lt;/code&gt;: a node that votes and counts toward the majority. A node that has just joined and is still catching up is a &lt;code&gt;learner&lt;/code&gt; for a while.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;leader&lt;/code&gt;: the current leader. Which node is the leader is not fixed.&lt;/li&gt;&#xA;&lt;li&gt;You can use the configuration file of any node; the command finds the leader by itself.&lt;/li&gt;&#xA;&lt;li&gt;Exit codes: 0 success; 2 a bad argument or configuration, or a wrong API secret; 3 no node reported a leader within 30 seconds.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;the-node-section-of-status&#34;&gt;The Node section of status&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;status&lt;/code&gt; reads the metrics port of one node. The &lt;code&gt;Node&lt;/code&gt; section is the cluster as this node sees it:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd status --config node2.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius status of 127.0.0.1:27042 over 1.0 s&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Node&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Ready                     ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Leader                    0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Has a leader              1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Caught up                 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Applied index             16&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Seconds without a leader  0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Version                   0.1.0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Seconds running           13&#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;/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;Line&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;&lt;code&gt;Ready&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The content of &lt;code&gt;/readyz&lt;/code&gt;: &lt;code&gt;ok&lt;/code&gt;, &lt;code&gt;no leader&lt;/code&gt;, &lt;code&gt;stopping&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;Leader&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Whether this node is the leader (1 is 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;Has a leader&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Whether this node has a leader that it can write to&lt;/td&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;Caught up&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Whether the node has caught up with the cluster since startup&lt;/td&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;Applied index&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Up to which Raft log entry the local copy has applied; the numbers of the nodes should be close&lt;/td&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;Seconds without a leader&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How long there has been no leader; 0 when there is a leader&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The other sections of &lt;code&gt;status&lt;/code&gt; are described in &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;chapter 17&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;check-that-writes-are-replicated&#34;&gt;Check that writes are replicated&#xA;&lt;/h2&gt;&lt;p&gt;Goal: write to one node and read from another.&lt;/p&gt;&#xA;&lt;p&gt;Add an account through the configuration of node 1, then log in once on each of the three nodes:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ printf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;erin-password\n&amp;#39;&lt;/span&gt; | rradiusd user add --config node1.toml erin&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;added erin&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd user show --config node3.toml erin&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;username=erin&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;enabled=1&#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; n in &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; 3; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; rradius-bench run --server 127.0.0.1 --auth-port 2702$n --secret &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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user erin --password erin-password --load pap,concurrency=1 --requests 1 | grep &amp;#39;pap:&amp;#39;; done&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  pap: 26/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  pap: 26/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  pap: 26/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now send one accounting request to node 2 and look at it from node 3:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --acct-port &lt;span style=&#34;color:#ae81ff&#34;&gt;27032&lt;/span&gt; --secret &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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user erin --load acct-start,concurrency=1 --requests 1 | grep &amp;#39;acct-start:&amp;#39;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  acct-start: 729/s, sent 1, accept 0, reject 0, challenge 0, accounting 1, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd session list --config node3.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;username=erin&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nas=192.0.2.1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;session_id=4220000000000000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;started=1795384786&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;updated=1795384786&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The script write on node 2 goes to the leader. The leader replies only after a majority has confirmed, and only then does node 2 send the Accounting-Response. When &lt;code&gt;accounting 1&lt;/code&gt; appears, the data is already in the cluster.&lt;/p&gt;&#xA;&lt;h2 id=&#34;stop-the-leader&#34;&gt;Stop the leader&#xA;&lt;/h2&gt;&lt;p&gt;Goal: stop the leader, and watch the cluster elect a new leader by itself and writes resume.&lt;/p&gt;&#xA;&lt;p&gt;First find the leader with &lt;code&gt;cluster members&lt;/code&gt; (node 1 above) and send it SIGTERM. At the same time send an accounting request to node 2 every 0.5 seconds and see whether writes are interrupted. The course measured on this machine:&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;Time since SIGTERM&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Old leader (node 1)&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Accounting to node 2&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;0 s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/readyz&lt;/code&gt; changes to 503 &lt;code&gt;stopping&lt;/code&gt;, but requests are still answered&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;As usual&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;5 s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Stops accepting new requests (&lt;code&gt;ready_delay_ms&lt;/code&gt; defaults to 5000) and waits for requests in progress&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;As usual&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;about 14.5 s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Closes the database, the process exits&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Starts to slow down, one request times 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;about 19 s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Node 3 is elected the new leader&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;about 25 s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Back to normal&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;During the 14.5 seconds of shutdown the old leader is still the leader, so writes continue as usual. The time with no leader is from when it closes the database until the new leader can accept writes, about 10 seconds on this machine.&lt;/li&gt;&#xA;&lt;li&gt;During this time, logins that only read data are not affected: followers answer from the local copy.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;rradius_cluster_leader&lt;/code&gt; on node 2 stays at 1: the metric is updated once per second, and during the election a follower still knows some leader. So do not judge from this metric alone whether writes are interrupted; look at the responses to accounting and at the accounting spool as well.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;After the new leader is elected:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd cluster members --config node2.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node 1  voter            raft 127.0.0.1:27001  api 127.0.0.1:27011&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node 2  voter            raft 127.0.0.1:27002  api 127.0.0.1:27012&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node 3  voter    leader  raft 127.0.0.1:27003  api 127.0.0.1:27013&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Node 1 has stopped, but it is still a voter: stopping is not the same as leaving the cluster. With one of three voters stopped, the remaining two are still a majority, so writes still work.&lt;/p&gt;&#xA;&lt;p&gt;Start node 1 again. It comes back as a follower and starts serving only after it has caught up:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;INFO rradius_core::cli: cluster node 1 started&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;INFO rradius_core::cli: cluster node 1 has caught up with the cluster&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;INFO rradius_core::cli: Servers started. Press Ctrl+C to stop.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Do not stop a node with &lt;code&gt;kill -9&lt;/code&gt;. A node that was killed has to rebuild its local database at the next start (see &lt;a class=&#34;link&#34; href=&#34;#restarting-nodes-and-rebuilding-data&#34; &gt;Restarting nodes and rebuilding data&lt;/a&gt;). In a multi-node cluster, the process exited about 15 seconds after SIGTERM on this machine, so the wait time of systemd, Docker and Kubernetes has to be longer than that; see &lt;a class=&#34;link&#34; href=&#34;../18-operations/&#34; &gt;chapter 18&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;lose-the-majority&#34;&gt;Lose the majority&#xA;&lt;/h2&gt;&lt;p&gt;Goal: see what a node does when it cannot reach a majority, and what &lt;code&gt;stop_without_leader_ms&lt;/code&gt; does.&lt;/p&gt;&#xA;&lt;p&gt;Add this to &lt;code&gt;[cluster]&lt;/code&gt; of node 1:&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:#75715e&#34;&gt;# node1.toml (add to [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;stop_without_leader_ms&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;p&gt;Restart node 1 so that it takes effect, then send SIGTERM to nodes 2 and 3 and wait until both processes have exited. After that, every ten or so seconds, send node 1 a PAP login, a Status-Server, an accounting request and a TACACS+ login. Measured results:&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;After the two nodes stopped&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;code&gt;Seconds without a leader&lt;/code&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;code&gt;/readyz&lt;/code&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;PAP login&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Status-Server&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Accounting&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;TACACS+ login&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;0 s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;0&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;200 &lt;code&gt;ok&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;answered&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;no answer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;8 s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;200 &lt;code&gt;ok&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;answered&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;no answer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;16 s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;10&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;503 &lt;code&gt;no leader&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;no answer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;no answer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;answered (written to the spool)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;69 s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;63&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;503 &lt;code&gt;no leader&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;no answer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;no answer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;answered (written to the spool)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;ERROR&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;Node 1 noticed after about 6 seconds that there was no leader.&lt;/li&gt;&#xA;&lt;li&gt;Accounting in the first few seconds got no answer: the script&amp;rsquo;s write was waiting for a leader. The first write after the majority is lost waits for the cluster&amp;rsquo;s 30 second timeout (not &lt;code&gt;query_timeout_ms&lt;/code&gt;), and the NAS retransmits.&lt;/li&gt;&#xA;&lt;li&gt;Once there has been no leader for more than 5 seconds, writes fail at once, and accounting is written to the spool and answered to the NAS.&lt;/li&gt;&#xA;&lt;li&gt;Once there has been no leader for more than 10 seconds (&lt;code&gt;stop_without_leader_ms&lt;/code&gt;), logins and Status-Server get no answer and are counted in &lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;no_leader&amp;quot;}&lt;/code&gt;; TACACS+ authentication answers ERROR (&lt;code&gt;rradius-bench&lt;/code&gt; prints &lt;code&gt;status: 0x07&lt;/code&gt;). &lt;code&gt;/livez&lt;/code&gt; stays 200: the process is alive, only not ready.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;What &lt;code&gt;status&lt;/code&gt; looks like:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd status --config node1.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius status of 127.0.0.1:27041 over 1.0 s&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Node&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Ready                     no leader&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Leader                    0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Has a leader              0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Caught up                 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Applied index             96&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Seconds without a leader  84&#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;Accounting spool&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Bytes waiting  545&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Replayed       0.0/s (0)&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The log keeps showing &lt;code&gt;Find DB leader error: Connect: Leader vote is in progress&lt;/code&gt;, and a failed script write is logged as &lt;code&gt;Lua script error (radius/accounting): runtime error: no leader for 83 s&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now start nodes 2 and 3. A few seconds after the cluster has a majority again, &lt;code&gt;/readyz&lt;/code&gt; of node 1 returns to &lt;code&gt;ok&lt;/code&gt;, and the 5 accounting requests in the spool are sent into the database automatically:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_cluster_leader 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_cluster_seconds_without_leader 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_acct_spool_written_total 5&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_acct_spool_replayed_total 5&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_acct_spool_bytes 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;restarting-nodes-and-rebuilding-data&#34;&gt;Restarting nodes and rebuilding data&#xA;&lt;/h2&gt;&lt;h3 id=&#34;normal-restart&#34;&gt;Normal restart&#xA;&lt;/h3&gt;&lt;p&gt;Stop a node (SIGTERM) and start it again. It comes back with the data in its own &lt;code&gt;data_dir&lt;/code&gt;, takes the writes made during its downtime from the leader, and serves only after it has caught up. This is the standard way for upgrades, for changing the &lt;code&gt;[cluster]&lt;/code&gt; settings and for replacing host hardware.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; When you start a node in the few seconds right after the cluster got its majority back and is still electing, the node&amp;rsquo;s read of &amp;ldquo;which migrations the cluster has applied&amp;rdquo; gets &lt;code&gt;has to forward request to: None&lt;/code&gt;. Now it reads again every 200 ms until the leader answers, with &lt;code&gt;migrations_wait_ms&lt;/code&gt; as the upper limit; after that it exits with exit code 1, and the last line is &lt;code&gt;not ready to apply migrations: cannot read applied migrations: …&lt;/code&gt;, carrying the last error. Older versions did not read again, and in this situation exited after a few seconds, so you had to rely on &lt;code&gt;Restart=on-failure&lt;/code&gt; of systemd or the restart policy of the container to start it once more. This retry is covered by a unit test; the gap during an election itself has not been reproduced on real machines.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;after-a-forced-stop&#34;&gt;After a forced stop&#xA;&lt;/h3&gt;&lt;p&gt;Kill node 3 with &lt;code&gt;kill -9&lt;/code&gt; and start it again. The log:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;WARN hiqlite_wal::log_store: LockFile data3/logs exists already - this is not a clean start!&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;WARN hiqlite::store::state_machine::sqlite::state_machine: Lock file already exists: data3/state_machine/lock\nNode did not shut down gracefully - auto-rebuilding State Machine&#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;INFO rradius_core::cli: cluster node 3 started&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;INFO rradius_core::cli: cluster node 3 has caught up with the cluster&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When a node was not shut down cleanly, the next start rebuilds the local database from the Raft log. With little data this is fast; with a lot of data it takes longer.&lt;/p&gt;&#xA;&lt;p&gt;The server also exits on its own in some situations, with exit code 1, so that the process manager restarts it:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The Raft core of the node stopped because of an error, for example a follower fell so far behind that the leader had already discarded the log entries it needs. The log says &lt;code&gt;cluster node N: its Raft core stopped (…); exiting so that a restart recovers it&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;A panic occurred in the cluster library: &lt;code&gt;cluster node: a panic in its database (…); exiting so that a restart recovers it&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;rebuild-from-the-other-nodes&#34;&gt;Rebuild from the other nodes&#xA;&lt;/h3&gt;&lt;p&gt;When the disk of a node has failed, its data directory is gone, or you suspect its data is wrong: stop it, empty its &lt;code&gt;data_dir&lt;/code&gt;, and start it again with the same configuration (the same &lt;code&gt;node_id&lt;/code&gt; and addresses). It copies the data back from the other nodes.&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rm -rf data3&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd serve --config node3.toml &amp;gt; node3.log 2&amp;gt;&amp;amp;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &amp;amp;&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;WARN hiqlite::init: Found remote metrics and we (3) are a Raft member&#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;INFO rradius_core::cli: cluster node 3 started&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;INFO rradius_core::cli: cluster node 3 has caught up with the cluster&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;On this machine it takes about 2 seconds from start to ready, after which &lt;code&gt;erin&lt;/code&gt; logs in on node 3 with accept. This way needs a majority of the other nodes to be still running.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; Do not empty the &lt;code&gt;data_dir&lt;/code&gt; of a majority of the nodes at the same time. The data exists only on the nodes of the cluster, and when the copies on a majority are gone, the data is gone.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;replace-a-failed-host&#34;&gt;Replace a failed host&#xA;&lt;/h3&gt;&lt;p&gt;When a host is broken and its data cannot be recovered, replace it with a new host. You do the same as above, but the configuration has to match:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The new host uses the &lt;strong&gt;same &lt;code&gt;node_id&lt;/code&gt;&lt;/strong&gt; and the same addresses (its &lt;code&gt;raft&lt;/code&gt; and &lt;code&gt;api&lt;/code&gt; in &lt;code&gt;[[cluster.nodes]]&lt;/code&gt;); the configuration file, secret files and &lt;code&gt;migrations_dir&lt;/code&gt; are the same as on the other nodes. If you have added or removed nodes before, &lt;code&gt;[[cluster.nodes]]&lt;/code&gt; has to list all the current members (look with &lt;code&gt;cluster members&lt;/code&gt; first).&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;data_dir&lt;/code&gt; is empty. When the old host&amp;rsquo;s data still exists but cannot be trusted, delete it completely before you start.&lt;/li&gt;&#xA;&lt;li&gt;Start. It gets the whole data from the other nodes, and it starts answering only after the log shows &lt;code&gt;cluster node N has caught up with the cluster&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Confirm: &lt;code&gt;rradius_cluster_applied_index&lt;/code&gt; is close to the other nodes and &lt;code&gt;rradius_cluster_leader&lt;/code&gt; is 1; log in once on it with an account that was added while it was down.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;A majority of the other nodes has to be online.&lt;/strong&gt; The new node gets its data from them.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;It is the same when the broken node is the leader.&lt;/strong&gt; The remaining nodes elect a new leader by themselves; logins that need a write get no answer during the election, and accounting goes to the spool and is sent later (for the seconds see &lt;a class=&#34;link&#34; href=&#34;#across-data-centers&#34; &gt;Across data centers&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;It does not matter if the leader has made a snapshot and discarded old log entries,&lt;/strong&gt; because the new node receives the snapshot directly.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Management commands wait a little longer.&lt;/strong&gt; In the time right after the leader stopped, commands such as &lt;code&gt;user&lt;/code&gt; connect to the old leader first and switch to the new one only after the connection times out, so they may take more than ten seconds, with 30 seconds as the limit.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The same id is not stopped by &lt;code&gt;node id N is in use&lt;/code&gt;:&lt;/strong&gt; when the old address does not answer, the check passes as usual (see &lt;a class=&#34;link&#34; href=&#34;#when-the-id-is-already-in-use&#34; &gt;When the id is already in use&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;What was tested:&lt;/strong&gt; on 2026-11-13, with the three nodes of &lt;code&gt;compose.cluster.yaml&lt;/code&gt;, in Docker on one host, a broken host was simulated by force-stopping and deleting the container and its data volume. A replaced follower caught up in about 2 seconds; after setting &lt;code&gt;snapshot_every = 50&lt;/code&gt; and writing about 200 entries so that the leader had made a snapshot, a replaced leader caught up in about 5 seconds, the applied index was the same on all three, and the account added in the meantime could log in on every node. It was not tested on several physical hosts or through WireGuard.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;restart-the-whole-cluster&#34;&gt;Restart the whole cluster&#xA;&lt;/h3&gt;&lt;p&gt;Stopping all three nodes together and starting them together is the same as the first start: every node waits until a majority has gathered and it has caught up before it serves, for at most &lt;code&gt;migrations_wait_ms&lt;/code&gt;. So &lt;code&gt;migrations_wait_ms&lt;/code&gt; has to be longer than the time you expect &amp;ldquo;the last node comes up&amp;rdquo; to take.&lt;/p&gt;&#xA;&lt;p&gt;When only one node is restarted and the other two have not come back (without &lt;code&gt;stop_without_leader_ms&lt;/code&gt;, and with all migrations already applied locally), the program is designed like this: if it cannot get a leader, it compares the migrations already applied in the local copy, and when they match it prints a warning and serves from the local copy. It was tested three times, and the results were not consistent:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Once as designed: after about 4 seconds it printed &lt;code&gt;cluster node 1: no usable leader within 3.981301833s; serving without a leader before catching up, so answers come from this node&#39;s replica, which may be behind&lt;/code&gt;, then served from the local copy, and &lt;code&gt;rradius_cluster_caught_up&lt;/code&gt; was 0. After the other two nodes came back, the log said &lt;code&gt;cluster node 1 has caught up with the cluster&lt;/code&gt; and &lt;code&gt;rradius_cluster_caught_up&lt;/code&gt; became 1.&lt;/li&gt;&#xA;&lt;li&gt;Twice (&lt;code&gt;migrations_wait_ms = 10000&lt;/code&gt;) it did not serve and exited with exit code 1: once it printed &lt;code&gt;node 2 did not join within 10s&lt;/code&gt;, the other time &lt;code&gt;cannot read applied migrations: no answer within 8.990975917s&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;A node with &lt;code&gt;stop_without_leader_ms&lt;/code&gt; set always exits when it cannot get a leader, with exit code 1, and does not serve from old data.&lt;/p&gt;&#xA;&lt;p&gt;Conclusion: when you have lost the majority, do not count on restarting one node to make it serve; bring the other nodes back first.&lt;/p&gt;&#xA;&lt;h2 id=&#34;add-a-node&#34;&gt;Add a node&#xA;&lt;/h2&gt;&lt;p&gt;Goal: let a fourth node join the running cluster, without restarting any other node.&lt;/p&gt;&#xA;&lt;p&gt;A new node joins by itself; there is no &amp;ldquo;join&amp;rdquo; command. The conditions:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The new node&amp;rsquo;s &lt;code&gt;data_dir&lt;/code&gt; is empty (or does not exist).&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;[[cluster.nodes]]&lt;/code&gt; of its configuration lists itself and the current leader. The simplest way is to list all the nodes.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;node_id&lt;/code&gt; is not used by any other running node.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Make &lt;code&gt;node4.toml&lt;/code&gt; following the table in &lt;a class=&#34;link&#34; href=&#34;#settings-for-node-1&#34; &gt;Settings for node 1&lt;/a&gt;, with &lt;code&gt;[[cluster.nodes]]&lt;/code&gt; listing nodes 1 to 4, and then start it:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd serve --config node4.toml &amp;gt; node4.log 2&amp;gt;&amp;amp;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &amp;amp;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;On this machine it is ready after about 4 seconds, and the log shows &lt;code&gt;cluster node 4 started&lt;/code&gt;, &lt;code&gt;has caught up with the cluster&lt;/code&gt; and &lt;code&gt;Servers started&lt;/code&gt; in turn. An account created before it joined can log in on node 4 at once:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --auth-port &lt;span style=&#34;color:#ae81ff&#34;&gt;27024&lt;/span&gt; --secret &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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user erin --password erin-password --load pap,concurrency=1 --requests 1 | grep &amp;#39;pap:&amp;#39;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  pap: 22/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd cluster members --config node1.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node 1  voter            raft 127.0.0.1:27001  api 127.0.0.1:27011&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node 2  voter            raft 127.0.0.1:27002  api 127.0.0.1:27012&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node 3  voter    leader  raft 127.0.0.1:27003  api 127.0.0.1:27013&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node 4  voter            raft 127.0.0.1:27004  api 127.0.0.1:27014  (not in this configuration)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;(not in this configuration)&lt;/code&gt; means that the list in &lt;code&gt;node1.toml&lt;/code&gt; does not have node 4. This does not affect operation: nodes 1 to 3 do not have to be restarted because of node 4, and they come back as usual when they are restarted. Looking with &lt;code&gt;node4.toml&lt;/code&gt; shows no such mark. Find time later to add node 4 to the configuration of the other nodes, so that the lists of all nodes agree and &lt;code&gt;cluster members&lt;/code&gt; stops reminding you.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Keep the total number of nodes odd. Going from 3 to 4 nodes changes the majority from 2 to 3, and the number of nodes that can be down at the same time is still only 1.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;A few details when a new node joins:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;A node that joins with empty data has to list the current leader.&lt;/strong&gt; It asks to join only the nodes listed in its own configuration, and the other nodes only tell it to go to the leader; if the leader is not in its list, it cannot join. When the configuration has &lt;code&gt;migrations_dir&lt;/code&gt;, it waits until &lt;code&gt;migrations_wait_ms&lt;/code&gt; and exits with exit code 1 with the message &lt;code&gt;node N did not join within …&lt;/code&gt;, and after the process manager restarts it, it starts over. So listing all current members is the safest. Measured on 2026-11-13: after the leader had changed to node 4, a node 1 with empty data whose configuration listed only 1 to 3 could not join; after node 4 was added, it joined within 8 seconds.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A node that restarts with its data is not affected.&lt;/strong&gt; It knows the members from its own data, and can return to the cluster even when the configuration does not list the leader (about 14 seconds in the same test).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A node with a different secret cannot join,&lt;/strong&gt; and the log of the new node gives the reason: a different &lt;code&gt;secret_raft&lt;/code&gt; gives &lt;code&gt;Invalid ChallengeResponse&lt;/code&gt;, a different &lt;code&gt;secret_api&lt;/code&gt; gives &lt;code&gt;Invalid API Secret&lt;/code&gt;; the members of the cluster do not change (measured on 2026-11-18).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When the new node&amp;rsquo;s &lt;code&gt;migrations_dir&lt;/code&gt; has one file more than the others,&lt;/strong&gt; on 2026-11-18 only joining and restarts of the other nodes were looked at; both worked as usual, and the logs did not mention the difference. The &lt;code&gt;migrations_dir&lt;/code&gt; of every node has to stay the same; this combination was not examined in depth.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;when-the-id-is-already-in-use&#34;&gt;When the id is already in use&#xA;&lt;/h3&gt;&lt;p&gt;When the &lt;code&gt;node_id&lt;/code&gt; of the new node is the id of a node that is still running, but with a different address, it refuses to start, with exit code 2:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cannot start cluster node 2: node id 2 is in use: the cluster has it at api 127.0.0.1:27012 (raft 127.0.0.1:27002), and that node answers, but this node&amp;#39;s configuration gives it api 127.0.0.1:27015 (raft 127.0.0.1:27005); use an id no node has (see `rradiusd cluster members`), or stop the running node first&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Joining with the same id would rewrite the address of that node in the cluster, so the program does not allow it. When you replace a host, either use a new id or stop the old node first.&lt;/p&gt;&#xA;&lt;h2 id=&#34;remove-a-node&#34;&gt;Remove a node&#xA;&lt;/h2&gt;&lt;p&gt;Goal: take node 4 out of the cluster.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;cluster remove&lt;/code&gt; checks these in order, and sends nothing when any check fails:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The id has to be a positive integer: &lt;code&gt;the node id must be a positive integer, not &#39;abc&#39;&lt;/code&gt;, exit code 2.&lt;/li&gt;&#xA;&lt;li&gt;The id has to be a member: &lt;code&gt;no node 9 in the cluster&lt;/code&gt;, exit code 1.&lt;/li&gt;&#xA;&lt;li&gt;The node has to be stopped already: a node that is running cannot be removed.&lt;/li&gt;&#xA;&lt;li&gt;The number of voters left after the removal cannot be less than three unless you add &lt;code&gt;--force&lt;/code&gt;; leaving zero is always refused.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;First try to remove it while node 4 is still running:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd cluster remove --config node1.toml &lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node 4 still answers at 127.0.0.1:27014: stop it first, then remove it&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Exit code 2. A node that is removed but keeps running continues to answer with the old data it holds, so you must stop it first.&lt;/p&gt;&#xA;&lt;p&gt;Stop node 4 (SIGTERM; it exits after 15 seconds on this machine), and then remove it:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd cluster remove --config node1.toml &lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;removed node 4&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd cluster members --config node1.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node 1  voter            raft 127.0.0.1:27001  api 127.0.0.1:27011&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node 2  voter            raft 127.0.0.1:27002  api 127.0.0.1:27012&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node 3  voter    leader  raft 127.0.0.1:27003  api 127.0.0.1:27013&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When the removal would leave the cluster with only two voters:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd cluster remove --config node1.toml &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;removing node 3 leaves two voters, and the cluster stops writing when either stops; give --force to remove it anyway&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd cluster remove --force --config node1.toml &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;removed node 3&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd cluster members --config node1.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node 1  voter    leader  raft 127.0.0.1:27001  api 127.0.0.1:27011&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node 2  voter            raft 127.0.0.1:27002  api 127.0.0.1:27012&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node 3  not in the cluster (listed in this configuration)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;not in the cluster (listed in this configuration)&lt;/code&gt; means it is in the configuration and not in the cluster.&lt;/p&gt;&#xA;&lt;p&gt;To add a removed node back, follow the conditions of &lt;a class=&#34;link&#34; href=&#34;#add-a-node&#34; &gt;Add a node&lt;/a&gt;: empty its &lt;code&gt;data_dir&lt;/code&gt; and start it. Node 3 above came back into the cluster as a voter within 2 seconds after &lt;code&gt;data3&lt;/code&gt; was emptied and it was started.&lt;/p&gt;&#xA;&lt;p&gt;Exit codes of &lt;code&gt;cluster remove&lt;/code&gt;: 0 success; 1 there is no such member, or the cluster refused the removal; 2 a bad argument or configuration, or a check did not pass; 3 no answer within 30 seconds. With exit code 3 the removal may already have been done, and the message tells you to confirm with &lt;code&gt;cluster members&lt;/code&gt; and not to simply run it again.&lt;/p&gt;&#xA;&lt;h3 id=&#34;why-you-must-stop-the-node-first&#34;&gt;Why you must stop the node first&#xA;&lt;/h3&gt;&lt;p&gt;Measured on 2026-11-13, in Docker on one host, with three to four nodes:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;A node that was removed but is still running answers with old data.&lt;/strong&gt; It no longer receives new writes, so an account added after the removal is rejected on it, and a disabled account can still log in. When the NAS still lists it as a RADIUS server, it gets wrong answers.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Restarting with old data hangs,&lt;/strong&gt; and logins get no answer.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Restarting with the data emptied and the configuration still listing itself joins the cluster again automatically.&lt;/strong&gt; So for a host you retire, turn the service off (for example &lt;code&gt;systemctl disable --now rradius&lt;/code&gt;), and do not only delete the data.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Management commands can hang.&lt;/strong&gt; If the first node in the configuration is &amp;ldquo;removed but still running&amp;rdquo;, commands such as &lt;code&gt;user&lt;/code&gt; wait for the 30 second timeout; stopping it first avoids this.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;other-notes&#34;&gt;Other notes&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Keep an odd number of nodes (3 or 5).&lt;/strong&gt; 3 can lose 1, 5 can lose 2; 4 can lose only 1, the same as 3.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;It is the same when the node to remove is the leader:&lt;/strong&gt; stop it first, the remaining nodes elect a new leader (writes during the election time out, see &lt;a class=&#34;link&#34; href=&#34;#across-data-centers&#34; &gt;Across data centers&lt;/a&gt;), and then remove it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When a stopped host is first in the configuration,&lt;/strong&gt; &lt;code&gt;cluster members&lt;/code&gt; and &lt;code&gt;cluster remove&lt;/code&gt; first wait for it to time out before they try the next host. Each host is waited for at most 2 seconds in the program (&lt;code&gt;PING_WAIT&lt;/code&gt;); the measurement on 2026-11-18 once saw about 5 seconds more, which was a version from before this value was changed. Delete the stopped node from the configuration, or move it to the end, and it does not happen.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When the majority is lost, the leader that &lt;code&gt;members&lt;/code&gt; sees may be out of date.&lt;/strong&gt; With three nodes, when only the former leader is left, it still reports itself as the leader (exit code 0), but it has no majority and writes do not succeed; when the remaining node is a follower, &lt;code&gt;members&lt;/code&gt; exits with exit code 3 after about 30 seconds. To judge whether you can write, look at &lt;code&gt;Has a leader&lt;/code&gt; in &lt;code&gt;rradiusd status&lt;/code&gt;, or just try one write (measured on 2026-11-18).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Stopping one node does not require removing it.&lt;/strong&gt; After an upgrade, a reboot or a hardware change, it comes back with the same &lt;code&gt;node_id&lt;/code&gt;; see &lt;a class=&#34;link&#34; href=&#34;#restarting-nodes-and-rebuilding-data&#34; &gt;Restarting nodes and rebuilding data&lt;/a&gt;. Removal is for nodes that will not come back.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;What was tested:&lt;/strong&gt; 2026-11-13 and 2026-11-18, Docker on one host, three to five nodes: removing the leader finished in about 5 seconds, during which logins to the remaining three every 0.05 seconds, about 1,480 of them, all succeeded, with a longest gap of 0.1 seconds (logins read the local copy and do not need a leader); adding a fourth node made it a voter in 1 to 3 seconds and it answered logins after about 4 seconds; adding and removing during writes, 394 writes did not fail. It was not tested on several physical hosts or through WireGuard, and the behavior of a real NAS during an election was not tested.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;check-the-settings-of-each-node&#34;&gt;Check the settings of each node&#xA;&lt;/h2&gt;&lt;p&gt;The settings of the nodes should differ only in the local values. &lt;code&gt;config diff&lt;/code&gt; compares two configurations (including defaults) and lists the differences; the two keys that are meant to differ, &lt;code&gt;cluster.node_id&lt;/code&gt; and &lt;code&gt;cluster.listen&lt;/code&gt;, are listed at the end under &lt;code&gt;node-specific:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd config diff node1.toml node2.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cluster.data_dir: &amp;#34;data1&amp;#34; | &amp;#34;data2&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cluster.stop_without_leader_ms: 10000 | (absent)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;metrics.port: 27041 | 27042&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radius.accounting_spool.dir: &amp;#34;spool1&amp;#34; | &amp;#34;spool2&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radius.acct_port: 27031 | 27032&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radius.auth_port: 27021 | 27022&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;tacacs.port: 27051 | 27052&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node-specific:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  cluster.node_id: 1 | 2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is the result of the one-machine practice, where ports and directories all differ. With several hosts there are far fewer differences, for example two nodes of the ha-cluster scenario:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd config diff node1.toml node2.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;metrics.bind: &amp;#34;10.99.0.1&amp;#34; | &amp;#34;10.99.0.2&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node-specific:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  cluster.listen: &amp;#34;10.99.0.1&amp;#34; | &amp;#34;10.99.0.2&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  cluster.node_id: 1 | 2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The exit code is 1 when there are differences, and 0 when they are exactly the same (differing only in &lt;code&gt;node-specific&lt;/code&gt;). After you change the configuration and before you push it to the nodes, use it to confirm that you did not change only one machine. Secrets are shown only as &lt;code&gt;differs (hidden)&lt;/code&gt;, and their content is never printed.&lt;/p&gt;&#xA;&lt;h2 id=&#34;see-the-state-of-the-whole-cluster&#34;&gt;See the state of the whole cluster&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;status --cluster&lt;/code&gt; asks the cluster for the member list and reads the metrics port of every member at the same time, one line per node:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd status --cluster --config node1.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius cluster status over 1.0 s, members from the cluster&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node   role    ready  auth/s  acct/s  discarded/s  in progress  address&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1      leader  ok     0.0     0.0     0.0          0            127.0.0.1:27041&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2      leader  ok     0.0     0.0     0.0          0            127.0.0.1:27041&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;3      leader  ok     0.0     0.0     0.0          0            127.0.0.1:27041&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;total          3/3    0.0     0.0     0.0          0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This output is wrong, and wrong as expected: all three lines are node 1. The reason is that &lt;code&gt;status --cluster&lt;/code&gt; reads the other members with the host name of each member&amp;rsquo;s &lt;code&gt;api&lt;/code&gt; address, plus &lt;strong&gt;this node&amp;rsquo;s own metrics port&lt;/strong&gt;. All three nodes are on &lt;code&gt;127.0.0.1&lt;/code&gt; and their metrics ports differ, so all three lines read &lt;code&gt;127.0.0.1:27041&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For it to be correct in production, every node has to:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;use the same &lt;code&gt;[metrics] port&lt;/code&gt;;&lt;/li&gt;&#xA;&lt;li&gt;set &lt;code&gt;[metrics] bind&lt;/code&gt; to an address the other nodes can reach, which is the host of the &lt;code&gt;api&lt;/code&gt; address.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;A member that cannot be read is shown as &lt;code&gt;unreachable&lt;/code&gt;, with the reason and the hint &lt;code&gt;every node&#39;s [metrics] bind has to be an address this host can reach, on the same port as here&lt;/code&gt; below it.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; the correct output of &lt;code&gt;status --cluster&lt;/code&gt; on several hosts. This chapter ran it on a single machine only, with the result above.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;code&gt;--cluster&lt;/code&gt; also works with &lt;code&gt;--watch&lt;/code&gt; and &lt;code&gt;--json&lt;/code&gt;. The fields of &lt;code&gt;status&lt;/code&gt; are described in &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;chapter 17&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;several-hosts-the-ha-cluster-scenario&#34;&gt;Several hosts: the ha-cluster scenario&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;rradius-server/examples/scenarios/ha-cluster/&lt;/code&gt; is an example for three hosts: &lt;code&gt;node1.toml&lt;/code&gt;, &lt;code&gt;node2.toml&lt;/code&gt; and &lt;code&gt;node3.toml&lt;/code&gt;, which differ 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;/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;Value&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;cluster.listen&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;each node&amp;rsquo;s WireGuard address &lt;code&gt;10.99.0.N&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The Raft and API ports listen on the WireGuard interface 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;&lt;code&gt;cluster.nodes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;10.99.0.1&lt;/code&gt; to &lt;code&gt;10.99.0.3&lt;/code&gt;, ports 8100, 8200&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Every host uses the same ports&lt;/td&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.migrations_wait_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;120000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The time to wait for the other nodes when all three restart together&lt;/td&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.query_timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;2000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The total time a request waits for the database; the first write after the majority is lost still waits 30 seconds, and later ones fail at once and are written 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;&lt;code&gt;radius.bind&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;0.0.0.0&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The NAS connects in from the physical 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;radius.clients&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;10.80.0.0/16&lt;/code&gt;, the shared secret the same on all three&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Every NAS configures all three nodes as RADIUS servers&lt;/td&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.status_server&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;NAS and load balancers use Status-Server to tell that a node is alive&lt;/td&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;&lt;code&gt;spool&lt;/code&gt;, at most 1 GiB&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;When the majority is lost, accounting is written locally 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;&lt;code&gt;metrics.bind&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;each node&amp;rsquo;s WireGuard address, port 9812&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Monitoring scrapes from the internal network; the three use the same port so that &lt;code&gt;status --cluster&lt;/code&gt; can read them&lt;/td&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.format&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;json&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Easy to collect centrally&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Copy the scenario to a working directory as described in &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;chapter 03&lt;/a&gt; and change &lt;code&gt;dictionary&lt;/code&gt; to the absolute path of the dictionary, and all three pass &lt;code&gt;check&lt;/code&gt; (with warnings about the example&amp;rsquo;s public secrets and file permissions):&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; n in &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; 3; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; rradiusd check --config node$n.toml; &lt;span style=&#34;color:#66d9ef&#34;&gt;done&lt;/span&gt; 2&amp;gt;&amp;amp;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; | grep -v WARN&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#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; does not open any port, so it can also run on a machine that has no &lt;code&gt;10.99.0.x&lt;/code&gt; address. To really run it, you need three hosts and WireGuard.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; how the ha-cluster scenario actually runs on three hosts connected through WireGuard. The behavior in this chapter was all verified on one machine with configurations whose ports were changed.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;When you deploy, remember:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;raft.secret&lt;/code&gt;, &lt;code&gt;api.secret&lt;/code&gt; and &lt;code&gt;nas.secret&lt;/code&gt; have to be the same on the three hosts. Replace them with values you generate yourself with &lt;code&gt;openssl rand -hex 32&lt;/code&gt;, with permissions 0600.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;migrations/2_demo_users.sql&lt;/code&gt; holds the demo accounts, and in production you delete it.&lt;/li&gt;&#xA;&lt;li&gt;The NAS configures all three nodes as servers. When &lt;code&gt;stop_without_leader_ms&lt;/code&gt; is set, a node that is cut off stops answering, and the NAS asks another one.&lt;/li&gt;&#xA;&lt;li&gt;RADIUS uses the node&amp;rsquo;s physical address, not the WireGuard address; requests also have to come from a network in &lt;code&gt;radius.clients&lt;/code&gt;, or there is no answer. When the host you manage from is not in that network, temporarily add a &lt;code&gt;[[radius.clients]]&lt;/code&gt; with only its address, test after a reload, and remove it when you are done.&lt;/li&gt;&#xA;&lt;li&gt;With EAP, one login has to finish on the same node: configure the NAS for primary and backup, or let the load balancer pin the node by source (&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;chapter 11&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;When one node starts first and the others have not, it waits until a majority has gathered (for at most &lt;code&gt;migrations_wait_ms&lt;/code&gt;). That is waiting, not a failure; it can serve only after the log shows &lt;code&gt;RADIUS Server listening&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Set every node to restart automatically (&lt;code&gt;Restart=on-failure&lt;/code&gt; of systemd, &lt;code&gt;restart: unless-stopped&lt;/code&gt; of Docker), because in some situations the server exits on its own with exit code 1 so that the process manager restarts it (see &lt;a class=&#34;link&#34; href=&#34;#after-a-forced-stop&#34; &gt;After a forced stop&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;deploy-with-docker-compose&#34;&gt;Deploy with Docker Compose&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;compose.cluster.yaml&lt;/code&gt; in the root of the source starts three nodes on one Docker host, and the configuration files are &lt;code&gt;docker/config/cluster/node1.toml&lt;/code&gt; to &lt;code&gt;node3.toml&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;Item&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Content&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;Services&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;node1&lt;/code&gt;, &lt;code&gt;node2&lt;/code&gt;, &lt;code&gt;node3&lt;/code&gt;, image &lt;code&gt;rradius-server&lt;/code&gt;, built from the &lt;code&gt;Dockerfile&lt;/code&gt; of the 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;RADIUS ports&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Host ports 1812/1813, 2812/2813, 3812/3813 map to 1812/1813 (UDP) of each container&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Configuration&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;./docker/config&lt;/code&gt; mounted read-only at &lt;code&gt;/etc/rradius&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&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One volume per node: &lt;code&gt;data1&lt;/code&gt;, &lt;code&gt;data2&lt;/code&gt;, &lt;code&gt;data3&lt;/code&gt;, mounted at &lt;code&gt;/var/lib/rradius&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;Secrets&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Compose secrets: &lt;code&gt;docker/secrets/raft.secret&lt;/code&gt;, &lt;code&gt;api.secret&lt;/code&gt;, &lt;code&gt;radius.secret&lt;/code&gt;, mounted at &lt;code&gt;/run/secrets/&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;Security&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Read-only root file system, &lt;code&gt;cap_drop: ALL&lt;/code&gt;, &lt;code&gt;no-new-privileges&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;Stop&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;stop_grace_period: 30s&lt;/code&gt;, &lt;code&gt;restart: unless-stopped&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 main points of the node configuration:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The three files differ only in &lt;code&gt;node_id&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;listen = &amp;quot;0.0.0.0&amp;quot;&lt;/code&gt;: the container has only one address, and the other containers have to be able to reach it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;nodes&lt;/code&gt; uses the service names: &lt;code&gt;node1:8100&lt;/code&gt;, &lt;code&gt;node1:8200&lt;/code&gt;, and so on.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;migrations_dir = &amp;quot;../migrations&amp;quot;&lt;/code&gt;, that is &lt;code&gt;docker/config/migrations/&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;[metrics]&lt;/code&gt; listens on &lt;code&gt;127.0.0.1:9812&lt;/code&gt; inside the container, for &lt;code&gt;status&lt;/code&gt; inside the container.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The steps to start (the comment at the top of &lt;code&gt;compose.cluster.yaml&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ sh docker/init-secrets.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ docker compose -f compose.cluster.yaml up --build&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;init-secrets.sh&lt;/code&gt; generates three random secret files, and does not overwrite ones that exist. To look at the state inside a container:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ docker compose -f compose.cluster.yaml exec node1 rradiusd status --config /etc/rradius/cluster/node1.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ docker compose -f compose.cluster.yaml exec node1 rradiusd cluster members --config /etc/rradius/cluster/node1.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For the exercise of stopping the leader, use &lt;code&gt;docker compose -f compose.cluster.yaml stop node1&lt;/code&gt; (it sends SIGTERM and waits at most 30 seconds).&lt;/p&gt;&#xA;&lt;p&gt;What this book verified: after making a copy in a working directory and generating the secrets with &lt;code&gt;init-secrets.sh&lt;/code&gt;, &lt;code&gt;docker compose -f compose.cluster.yaml config&lt;/code&gt; passes; with the dictionary and secret paths of the three node configurations replaced by local paths, &lt;code&gt;check&lt;/code&gt; passes for all.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; actually building the image with &lt;code&gt;compose.cluster.yaml&lt;/code&gt;, starting three containers and stopping the leader. The &lt;code&gt;exec&lt;/code&gt; commands above were not actually run. The behavior of a single node is the same as in the earlier exercises of this chapter, because the container runs the same program.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The three containers are on the same Docker host, and when this host stops, the whole cluster stops. It suits tests and small setups; to survive a host failure, spread the nodes over different hosts, as the ha-cluster scenario does. &lt;code&gt;[metrics]&lt;/code&gt; listens only on the address inside the container, so &lt;code&gt;status --cluster&lt;/code&gt; inside a container cannot read the other nodes.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;deploy-on-kubernetes&#34;&gt;Deploy on Kubernetes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;deploy/kubernetes/&lt;/code&gt; runs three nodes with a StatefulSet, applied with &lt;code&gt;kubectl apply -k deploy/kubernetes&lt;/code&gt;. The files:&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;Content&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;kustomization.yaml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Applies &lt;code&gt;statefulset.yaml&lt;/code&gt;, &lt;code&gt;services.yaml&lt;/code&gt; and &lt;code&gt;pdb.yaml&lt;/code&gt;; generates &lt;code&gt;config/&lt;/code&gt; into the ConfigMap &lt;code&gt;rradius-config&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;statefulset.yaml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;3 pods &lt;code&gt;rradius-0&lt;/code&gt; to &lt;code&gt;rradius-2&lt;/code&gt;, &lt;code&gt;podManagementPolicy: Parallel&lt;/code&gt;, one 1Gi PVC per pod&lt;/td&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;services.yaml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The headless Service &lt;code&gt;rradius-cluster&lt;/code&gt; (nodes find each other); the LoadBalancer Service &lt;code&gt;rradius&lt;/code&gt; (for the NAS)&lt;/td&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;pdb.yaml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PodDisruptionBudget &lt;code&gt;maxUnavailable: 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;config/rradius-0.toml&lt;/code&gt; to &lt;code&gt;rradius-2.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One per pod, differing only in &lt;code&gt;node_id&lt;/code&gt;: pod &lt;code&gt;rradius-N&lt;/code&gt; is node N+1&lt;/td&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;config/auth.lua&lt;/code&gt;, &lt;code&gt;config/1_schema.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The script and the migration&lt;/td&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.example.yaml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;What the Secret &lt;code&gt;rradius-secrets&lt;/code&gt; looks like; it is not applied&lt;/td&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;networkpolicy.yaml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Not applied by default: the RADIUS ports are open to the outside, the cluster ports only to the other nodes, the metrics port only to the &lt;code&gt;monitoring&lt;/code&gt; namespace&lt;/td&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;hostnetwork-patch.yaml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Not applied by default: when there is no load balancer that keeps the source address, lets the pod use the node&amp;rsquo;s network&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;build-and-load-the-image&#34;&gt;Build and load the image&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;statefulset.yaml&lt;/code&gt; uses &lt;code&gt;rradius-server:latest&lt;/code&gt; with &lt;code&gt;imagePullPolicy: IfNotPresent&lt;/code&gt;. Build it in the root of the source:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ docker build -t rradius-server:latest .&#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 Kubernetes built into Docker Desktop and OrbStack:&lt;/strong&gt; uses the local image directly, and you need not do anything else.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;kind:&lt;/strong&gt; &lt;code&gt;kind load docker-image rradius-server:latest&lt;/code&gt; loads the image into the kind nodes.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Production:&lt;/strong&gt; push it to your own registry, then enable the commented-out &lt;code&gt;images&lt;/code&gt; in &lt;code&gt;kustomization.yaml&lt;/code&gt; and change it to that name and version:&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-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;images&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;rradiusd&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;newName&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;registry.example.com/rradius-server&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;newTag&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;1.0&amp;#34;&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;h3 id=&#34;create-the-secret-first&#34;&gt;Create the Secret first&#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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kubectl create secret generic rradius-secrets &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;    --from-literal=raft=&amp;#34;$(openssl rand -hex 32)&amp;#34; \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --from-literal=api=&amp;#34;$(openssl rand -hex 32)&amp;#34; \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --from-literal=radius=&amp;#34;&amp;lt;your NAS shared secret&amp;gt;&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The Secret is mounted at &lt;code&gt;/run/secrets/rradius&lt;/code&gt;, and the configuration reads it with paths such as &lt;code&gt;secret_raft_file = &amp;quot;/run/secrets/rradius/raft&amp;quot;&lt;/code&gt;. The three pods use the same Secret, so the cluster secrets are the same by construction. Replace &lt;code&gt;radius&lt;/code&gt; with the shared secret your NAS actually uses. The example directory holds no real secrets, and &lt;code&gt;secret.example.yaml&lt;/code&gt; only explains the format.&lt;/p&gt;&#xA;&lt;h3 id=&#34;apply-and-wait&#34;&gt;Apply and wait&#xA;&lt;/h3&gt;&lt;p&gt;First change &lt;code&gt;[[radius.clients]] address&lt;/code&gt; in &lt;code&gt;config/rradius-0.toml&lt;/code&gt; to &lt;code&gt;rradius-2.toml&lt;/code&gt; from the documentation network &lt;code&gt;192.0.2.0/24&lt;/code&gt; to the network of your NAS (the same in all three; for the reason see &lt;a class=&#34;link&#34; href=&#34;#change-the-nas-addresses&#34; &gt;Change the NAS addresses&lt;/a&gt;), 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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kubectl apply -k deploy/kubernetes&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kubectl rollout status statefulset/rradius&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The three pods start together and begin to serve after a leader is elected; &lt;code&gt;rollout status&lt;/code&gt; ends when all three are ready. Then add accounts as described in &lt;a class=&#34;link&#34; href=&#34;#run-commands-in-a-pod&#34; &gt;Run commands in a pod&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;why-the-example-is-designed-this-way&#34;&gt;Why the example is designed this way&#xA;&lt;/h3&gt;&lt;p&gt;Every point corresponds to a behavior described earlier in this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;podManagementPolicy: Parallel&lt;/code&gt;:&lt;/strong&gt; the three pods start together. A node serves only after a majority has gathered, and if they started one by one, the first would wait forever.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;publishNotReadyAddresses: true&lt;/code&gt; (headless Service):&lt;/strong&gt; pods that are not ready yet keep their DNS names. Otherwise nodes that are waiting for a leader cannot find each other, and no leader can be elected.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;nodes&lt;/code&gt; uses DNS names:&lt;/strong&gt; in the form &lt;code&gt;rradius-0.rradius-cluster:8100&lt;/code&gt;; &lt;code&gt;listen = &amp;quot;0.0.0.0&amp;quot;&lt;/code&gt;, because the other pods connect through the pod address.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Probes:&lt;/strong&gt; the metrics port opens only after the node has caught up with the cluster, so only the &lt;code&gt;startupProbe&lt;/code&gt; runs first (&lt;code&gt;/livez&lt;/code&gt;, every 5 seconds, at most 60 times). After that the &lt;code&gt;livenessProbe&lt;/code&gt; looks at &lt;code&gt;/livez&lt;/code&gt; and the &lt;code&gt;readinessProbe&lt;/code&gt; at &lt;code&gt;/readyz&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;stop_without_leader_ms = 10000&lt;/code&gt;:&lt;/strong&gt; a pod that is cut off stops answering and &lt;code&gt;/readyz&lt;/code&gt; becomes 503, so the Service does not send the NAS traffic to it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;ready_delay_ms&lt;/code&gt; defaults to 5000:&lt;/strong&gt; after SIGTERM &lt;code&gt;/readyz&lt;/code&gt; returns 503 first, the Service moves the traffic away first, and only then does the pod stop accepting requests. &lt;code&gt;terminationGracePeriodSeconds: 30&lt;/code&gt; covers the whole shutdown.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;externalTrafficPolicy: Local&lt;/code&gt;:&lt;/strong&gt; rradius tells NAS apart by source address, and the source address has to reach the pod unchanged.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;PodDisruptionBudget &lt;code&gt;maxUnavailable: 1&lt;/code&gt;:&lt;/strong&gt; for voluntary disruptions such as draining a Kubernetes node, only one pod is moved at a time and two of three stay, which keeps the majority.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;[metrics] bind = &amp;quot;0.0.0.0&amp;quot;&lt;/code&gt;:&lt;/strong&gt; the kubelet probes from the pod address. The three pods use the same port 9812, so by the program&amp;rsquo;s rules &lt;code&gt;status --cluster&lt;/code&gt; should be able to read the other members; after &lt;code&gt;networkpolicy.yaml&lt;/code&gt; is applied, 9812 is open only to the &lt;code&gt;monitoring&lt;/code&gt; namespace, and the pods can no longer read each other.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;change-the-nas-addresses&#34;&gt;Change the NAS addresses&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;[[radius.clients]]&lt;/code&gt; in &lt;code&gt;config/rradius-*.toml&lt;/code&gt; is the documentation network &lt;code&gt;192.0.2.0/24&lt;/code&gt;, and you have to change it to the actual addresses of your NAS. Do not write a network that is too large: if the network also covers the addresses of the Kubernetes nodes, packets whose source address was changed by the load balancer are also accepted, and all NAS are treated as the same client.&lt;/p&gt;&#xA;&lt;h3 id=&#34;verify-that-the-source-address-is-not-rewritten&#34;&gt;Verify that the source address is not rewritten&#xA;&lt;/h3&gt;&lt;p&gt;When packets pass through a Kubernetes Service, the source address is often changed to the address of a node or a gateway, with one of two results:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The rewritten address is not in the network of any client: rradius does not recognize it and &lt;strong&gt;does not answer&lt;/strong&gt;, counts it in &lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;unknown_client&amp;quot;}&lt;/code&gt;, and the log (rate limited) says &lt;code&gt;RADIUS packet from unknown client &amp;lt;address&amp;gt; discarded&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The rewritten address happens to fall in the network of some client, for example when a client uses a wide network such as &lt;code&gt;10.0.0.0/8&lt;/code&gt;: the request is accepted anyway and &lt;strong&gt;everything looks normal&lt;/strong&gt;, but all NAS are treated as the same client. In this case no counter increases, and you can only see it in the authentication records.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;So always verify after applying: send one request from a NAS and look in the authentication record (&lt;code&gt;log.auth&lt;/code&gt;, on by default) to see whether &lt;code&gt;source=&lt;/code&gt; is the address of that NAS. The request may go to any pod, so look at all three:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kubectl logs rradius-0 | grep rradius_auth | tail -3&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;192.0.2.0/24&amp;#34; source=192.0.2.10 user=&amp;#34;alice&amp;#34; …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If &lt;code&gt;source=&lt;/code&gt; is the address of a node, a gateway or the pod network, it has been rewritten. When there are no records at all, look at whether &lt;code&gt;unknown_client&lt;/code&gt; increases:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kubectl port-forward pod/rradius-0 9812:9812 &amp;amp;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s localhost:9812/metrics | grep &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;reason=&amp;#34;unknown_client&amp;#34;&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;Most cloud load balancers support &lt;code&gt;externalTrafficPolicy: Local&lt;/code&gt;, but some UDP load balancers rewrite the source address themselves, so read the documentation of the cloud.&lt;/li&gt;&#xA;&lt;li&gt;For packets sent from a Mac to a LoadBalancer in the Kubernetes built into OrbStack, &lt;code&gt;source=&lt;/code&gt; is the gateway of the pod network, so you cannot verify on OrbStack whether the source address is kept. For trying it out locally, you can temporarily change the client to that address.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; the behavior of the two kinds of load balancers above is written from the comments in &lt;code&gt;deploy/kubernetes/&lt;/code&gt; of the source and the general behavior of Kubernetes. This book did not measure it on a real cluster.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;without-a-suitable-load-balancer-hostnetwork&#34;&gt;Without a suitable load balancer: hostNetwork&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;hostnetwork-patch.yaml&lt;/code&gt; lets the pods use the node&amp;rsquo;s network directly. The NAS packets go to the node&amp;rsquo;s address, and the source address is not rewritten. Enable &lt;code&gt;patches&lt;/code&gt; in &lt;code&gt;kustomization.yaml&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-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;patches&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#f92672&#34;&gt;path&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;hostnetwork-patch.yaml&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;The patch sets &lt;code&gt;podAntiAffinity&lt;/code&gt;, so one node can hold only one rradius pod, and you need at least three Kubernetes nodes.&lt;/li&gt;&#xA;&lt;li&gt;The NAS is configured with the addresses of the three nodes, as primary and backup or in rotation, either way.&lt;/li&gt;&#xA;&lt;li&gt;When a pod moves to another node its address changes, and the NAS side has to be changed to follow, so it suits fixed nodes, for example pinned with &lt;code&gt;nodeSelector&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The metrics port and the cluster ports open on every address of the node, including the public ones.&lt;/strong&gt; The example has &lt;code&gt;[metrics] bind = &amp;quot;0.0.0.0&amp;quot;&lt;/code&gt;, so 9812 is then open to the outside without authentication and without TLS; the cluster ports 8100 and 8200 are the same. NetworkPolicy has no control over pods that use hostNetwork, so &lt;code&gt;networkpolicy.yaml&lt;/code&gt; cannot stop this. Use the node&amp;rsquo;s firewall to let only the internal network reach 9812, 8100 and 8200, or change &lt;code&gt;[metrics] bind&lt;/code&gt; to the node&amp;rsquo;s internal address (the addresses of the three nodes differ, so the configuration files no longer differ only in &lt;code&gt;node_id&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;tacacs&#34;&gt;TACACS+&#xA;&lt;/h3&gt;&lt;p&gt;When the configuration adds &lt;code&gt;[tacacs]&lt;/code&gt;, add a TCP container port to &lt;code&gt;statefulset.yaml&lt;/code&gt;, and enable the commented-out &lt;code&gt;tacacs&lt;/code&gt; part of &lt;code&gt;services.yaml&lt;/code&gt;. TCP through &lt;code&gt;externalTrafficPolicy: Local&lt;/code&gt; also keeps the source address, and the verification method is the same as above.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The container runs as uid 10001 with all capabilities dropped, and whether it can bind a low port such as 49 depends on how the container runtime handles low ports; this book did not verify it. The safe way is to set the &lt;code&gt;port&lt;/code&gt; of &lt;code&gt;[tacacs]&lt;/code&gt; to 1024 or above (for example &lt;code&gt;49490&lt;/code&gt;), keep the &lt;code&gt;port&lt;/code&gt; of the Service at 49, and let &lt;code&gt;targetPort&lt;/code&gt; point at that port.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;probes-and-latency&#34;&gt;Probes and latency&#xA;&lt;/h3&gt;&lt;p&gt;The metrics port (&lt;code&gt;[metrics] bind = &amp;quot;0.0.0.0&amp;quot;&lt;/code&gt;, because the kubelet probes the pod address from the node) has two paths; for the details see &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;chapter 17&lt;/a&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;Path&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;200&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;503&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Use in the example&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;/livez&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The process responds&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Never&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;startupProbe&lt;/code&gt;, &lt;code&gt;livenessProbe&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;/readyz&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Can answer authentication&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Stopping (SIGTERM received); &lt;code&gt;stop_without_leader_ms&lt;/code&gt; is set and there has been no leader for longer than that; or an external database with &lt;code&gt;required_for_ready&lt;/code&gt; cannot be reached (content &lt;code&gt;database &amp;lt;name&amp;gt; unreachable&lt;/code&gt;, &lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;chapter 09&lt;/a&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;readinessProbe&lt;/code&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;A pod that is not ready is taken out of the &lt;code&gt;rradius&lt;/code&gt; Service,&lt;/strong&gt; and the NAS requests go to the other pods. The example sets &lt;code&gt;stop_without_leader_ms = 10000&lt;/code&gt;: when one of three is left, the remaining one stops answering after about 10 seconds and becomes not ready; &lt;code&gt;/livez&lt;/code&gt; stays 200 and the container is not restarted.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When a pod is deleted or updated,&lt;/strong&gt; the kubelet sends SIGTERM and &lt;code&gt;/readyz&lt;/code&gt; becomes 503 at once. The pod keeps answering as usual for 5 seconds (the default &lt;code&gt;ready_delay_ms&lt;/code&gt; of a three-node cluster), and the &lt;code&gt;readinessProbe&lt;/code&gt; runs every 5 seconds and takes it out after 1 failure, so the Service stops sending requests first, and only then does the pod stop accepting, wait for the requests in progress and exit. The whole process takes about 15 seconds, within &lt;code&gt;terminationGracePeriodSeconds: 30&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Without &lt;code&gt;stop_without_leader_ms&lt;/code&gt;, &lt;code&gt;/readyz&lt;/code&gt; is always 200 except while stopping:&lt;/strong&gt; a node without a leader still answers read-only logins from the local copy, and taking it out of the Service would make all logins fail instead.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The &lt;code&gt;startupProbe&lt;/code&gt; waits at most 5 minutes&lt;/strong&gt; (every 5 seconds, at most 60 times): the metrics port opens only after the node has caught up with the cluster, and that needs a leader first. Without the &lt;code&gt;startupProbe&lt;/code&gt;, the &lt;code&gt;livenessProbe&lt;/code&gt; restarts the container before a leader is elected.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;run-commands-in-a-pod&#34;&gt;Run commands in a pod&#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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kubectl exec -i rradius-0 -- rradiusd user add --config /etc/rradius/rradius-0.toml alice&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kubectl exec rradius-0 -- rradiusd cluster members --config /etc/rradius/rradius-0.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kubectl exec rradius-0 -- rradiusd status --cluster --config /etc/rradius/rradius-0.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;user add&lt;/code&gt; reads the password from standard input, so it needs &lt;code&gt;-i&lt;/code&gt;. For how to apply a changed configuration (the ConfigMap changes its name, pods restart one by one), and what to change when you add a migration, see &lt;a class=&#34;link&#34; href=&#34;../18-operations/&#34; &gt;chapter 18&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What this book verified: after making a copy in a working directory, &lt;code&gt;kubectl kustomize&lt;/code&gt; can generate the ConfigMap, 2 Services, the PodDisruptionBudget and the StatefulSet; with the dictionary and secret paths of the three &lt;code&gt;rradius-*.toml&lt;/code&gt; replaced by local paths, &lt;code&gt;check&lt;/code&gt; passes for all.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; actually applying to a Kubernetes cluster, the start of the pods, deleting the leader pod, and the effect of &lt;code&gt;hostnetwork-patch.yaml&lt;/code&gt; and &lt;code&gt;networkpolicy.yaml&lt;/code&gt;. The &lt;code&gt;kubectl exec&lt;/code&gt; commands above were not actually run.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;across-data-centers&#34;&gt;Across data centers&#xA;&lt;/h2&gt;&lt;p&gt;What happens to the cluster when the three nodes are in different data centers, with a few to a few dozen milliseconds between the nodes? The numbers in this section were simulated on one host, and &lt;strong&gt;they are for judging &amp;ldquo;is it worth designing in this direction&amp;rdquo;, not a promise for a real wide-area network.&lt;/strong&gt; Measurements without a date were carried over from the old manual and were not measured again; those with a date were measured on that day. The raw numbers and the measurement scripts are not in this repository.&lt;/p&gt;&#xA;&lt;h3 id=&#34;test-conditions&#34;&gt;Test conditions&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Environment:&lt;/strong&gt; one host with an Apple M4 Max (14 cores), Docker on OrbStack, one container per node; the image is the core &lt;code&gt;rradius-server&lt;/code&gt; plus &lt;code&gt;iproute2&lt;/code&gt;. The node configuration is &lt;code&gt;docker/config/auth.lua&lt;/code&gt; and the &lt;code&gt;sql&lt;/code&gt; handler (logins read the local copy, and every accounting packet makes one &lt;code&gt;INSERT&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;How the delay was added:&lt;/strong&gt; &lt;code&gt;tc netem&lt;/code&gt; adds a one-way delay (half of the round-trip time, RTT) on the egress of every node toward the other two nodes, and the path from the RADIUS client to the nodes gets none. The RTT was calibrated with &lt;code&gt;ping&lt;/code&gt; between the nodes, and the tables below always use the measured value.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Limits of the simulation:&lt;/strong&gt; only a fixed delay, with no jitter, no packet loss, and the same in both directions; the nodes are on the same host, and CPU and memory are not the bottleneck.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Load:&lt;/strong&gt; &lt;code&gt;rradius-bench&lt;/code&gt;, fixed concurrency 64, 2 seconds of warm-up and 10 seconds of measurement, 3 runs for each RTT point. The read load is &lt;code&gt;pap&lt;/code&gt; logins (reading the local copy); the write load is &lt;code&gt;acct-start&lt;/code&gt; (every packet makes one &lt;code&gt;INSERT INTO accounting&lt;/code&gt;, which has to go through Raft). The client hits the leader of that time.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;steady-state-reads-are-not-affected-writes-are-roughly-inversely-proportional-to-rtt&#34;&gt;Steady state: reads are not affected, writes are roughly inversely proportional to RTT&#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;RTT between nodes (measured)&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Login (read) throughput&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Login p50/p99&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Accounting Start (write) throughput&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Write p50/p99&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;0.2 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;86,100/s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;0.7/1.4 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;42,700/s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1.3/3.3 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;5.1 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;85,800/s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;0.7/1.5 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;3,940/s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;14.6/25.6 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;19.2 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;85,200/s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;0.7/1.5 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;826/s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;78/119 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;50.5 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;85,300/s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;0.7/1.6 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;318/s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;198/309 ms&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;Reads do not change with RTT:&lt;/strong&gt; they read the local copy and do not use the network.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;At fixed concurrency, write throughput is roughly inversely proportional to RTT:&lt;/strong&gt; throughput times RTT is about 20,000, 15,900 and 16,100 at 5, 19 and 50 ms; the latency of one write is about 2.9, 4.1 and 3.9 times the RTT. That is, at concurrency 64, the write limit is about &lt;code&gt;64 ÷ (4 × RTT)&lt;/code&gt;. For more you have to add concurrency, which was not tested.&lt;/li&gt;&#xA;&lt;li&gt;These write throughputs were measured against the leader; the throughput of sending writes to a follower (which has to forward them to the leader first) was not measured.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;kill-the-leader&#34;&gt;Kill the leader&#xA;&lt;/h3&gt;&lt;p&gt;The leader was killed with &lt;code&gt;docker kill&lt;/code&gt; (SIGKILL), and the client sent a writing accounting Start to a surviving node every 50 ms. The election time is from the kill until &lt;code&gt;rradius_cluster_is_leader&lt;/code&gt; of one of the surviving nodes becomes 1; the write unavailable time is from the kill until the first write sent after it gets a response.&lt;/p&gt;&#xA;&lt;p&gt;The table below is the measurement from &lt;strong&gt;before the reconnect interval was patched&lt;/strong&gt;, 5 runs per point:&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;RTT between nodes (measured)&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Election time&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Write unavailable time&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;0.15 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;5.7–6.9 s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;6.7–15.2 s (about 15 s in 4 of 5 runs)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;5.2 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;5.0–6.4 s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;10.1–15.2 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;20.0 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;6.0–6.9 s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;7.2–17.6 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;50.1 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;6.4–6.8 s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;7.4–17.8 s&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;The election time is about 5 to 7 seconds, and within the measured range it does not depend on RTT.&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Writes recover a little later than the election.&lt;/strong&gt; The reason: the client of the cluster database (hiqlite 0.16) caches &amp;ldquo;who the current leader is&amp;rdquo; and updates it only in the reconnect loop; the original reconnect interval was 1 second for the first 5 attempts and 5 seconds after that, so when the election finished after the 5th second, it waited another 5 seconds. Now rradius loads a modified hiqlite (&lt;code&gt;vendor/hiqlite&lt;/code&gt;) that changes the 5 seconds to 1 second (&lt;code&gt;RECONNECT_SLOW_INTERVAL&lt;/code&gt;; the change is recorded in &lt;code&gt;MODIFICATIONS&lt;/code&gt; in that directory), so it reconnects every second; during this time the node logs one line per second, &lt;code&gt;Could not connect Client API WebSocket to node1&lt;/code&gt; (the old leader). This interval is an internal constant of hiqlite and there is no setting to adjust it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Measured on 2026-11-23 (three nodes, Docker on one host, RTT 0, leader stopped):&lt;/strong&gt; the election took 6.3 to 6.7 seconds, and the first successful write came at 7.2 to 7.5 seconds, that is about 0.5 to 1 second after the election; under the same conditions the version from before the change took 15.1 to 15.5 seconds (3 runs). So &lt;strong&gt;the write interruption measured on one machine is about 7 to 8 seconds&lt;/strong&gt; (the election about 6 to 7 seconds, plus the client reconnecting). Each was measured only 3 times, only on single-host Docker with RTT about 0; wide-area networks and longer elections were not measured.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When you plan for several data centers, you can take about 20 seconds as the margin for the write interruption.&lt;/strong&gt; This number comes from the 15 to 18 seconds before the change in the table above, was not measured on the version after the change or on a wide-area network, and is a conservative estimate, not an expected value.&lt;/li&gt;&#xA;&lt;li&gt;Logins (reads) are not affected and still read the local copy.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;partition&#34;&gt;Partition&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;netem&lt;/code&gt; dropped all packets between the nodes (in both directions), and the path of the RADIUS client was not affected. Each case was run once, with samples about 5, 12, 22 and 32 seconds after the partition; each time one &lt;code&gt;pap&lt;/code&gt; and one accounting Start (timeout 2 seconds) were sent to every node. The results for RTT 0.2 and 20 ms were the same unless noted.&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;Case&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;The isolated node&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;The majority side&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Recovery (after the network is reconnected)&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;One follower isolated&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Logins are answered as usual (reading the old copy); accounting gets no answer; within about 10 seconds &lt;code&gt;rradius_cluster_leader&lt;/code&gt; becomes 0 and &lt;code&gt;seconds_without_leader&lt;/code&gt; keeps rising; &lt;code&gt;applied_index&lt;/code&gt; stops&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Only the leader answers accounting (at 0.2 ms both nodes answered; at 20 ms the other node did not answer in 4 samples); logins are normal&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Caught up in 24.8 s (0.2 ms) and 29.3 s (20 ms)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Leader isolated&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Logins are answered as usual; accounting gets no answer; &lt;code&gt;rradius_cluster_is_leader&lt;/code&gt; is still 1, but &lt;code&gt;rradius_cluster_leader&lt;/code&gt; becomes 0 after about 10 seconds; &lt;code&gt;applied_index&lt;/code&gt; stops&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A new leader is elected (visible in the sample at the 12th second at 0.2 ms and the 22nd second at 20 ms); &lt;strong&gt;accounting still got no answer in the sample at 32 seconds&lt;/strong&gt; (including from the new leader); logins are normal&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Caught up in 1.3 s (0.2 ms) and 1.6 s (20 ms); the old leader becomes a follower&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;The isolated node&amp;rsquo;s copy stays at the state of the moment of the partition and still answers logins. If you cannot accept that, set &lt;code&gt;stop_without_leader_ms&lt;/code&gt; (it was not set this time, and the behavior with it set was not tested).&lt;/li&gt;&#xA;&lt;li&gt;Accounting writes on the majority side took very long to recover after the leader changed; this time they had not recovered 32 seconds after the partition. It may have the same cause as killing the leader above, but in a partition the old leader was still alive, and this was not verified.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Recovery time after isolating a follower (Linux, no need to tune &lt;code&gt;tcp_retries2&lt;/code&gt;):&lt;/strong&gt; both the connection between Raft nodes (port 8100) and the API connection have &lt;code&gt;TCP_USER_TIMEOUT&lt;/code&gt; set to 10 seconds: when data was sent and no acknowledgment came for 10 seconds, the kernel closes the connection, and then it reconnects. Without this setting, a connection that got no response during the isolation doubles its retransmit interval each time, and after reconnection it has to wait for the next retransmit before it can send, so the recovery time grows with how long the isolation lasted. On 2026-11-25 the same three-node Docker environment (RTT 0) was used to measure &amp;ldquo;from reconnection until this node knows the leader, has caught up with the data and a write through it gets a response&amp;rdquo;, the median of 3 runs each:&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;Isolation time&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Without this setting (2026-11-24, 1 run each)&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;With this setting (3 runs each)&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;12 seconds&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;15.3 s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;6.4 s (5.1 to 6.4)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;30 seconds&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;29.4 s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;6.4 s (5.1 to 8.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;60 seconds&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;47.3 s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;4.0 s (3.7 to 4.5)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;However long the isolation, recovery is within 10 seconds. The data to catch up was only 3 to 12 entries, so the synchronization is not slow. This setting takes effect only on Linux, and other systems keep the previous behavior.&lt;/p&gt;&#xA;&lt;p&gt;With 100 ms RTT between the nodes and 5% packet loss on every packet, without isolating, writing continuously for 5 minutes (accounting Start, concurrency 16), the difference with and without this setting: throughput 30.2/s against 29.7/s, the leader did not change, and there was no &lt;code&gt;Raft WebSocket stream ended&lt;/code&gt; log, so this value did not cause a connection to be wrongly judged as down. &lt;strong&gt;Worse networks (loss lasting more than 10 seconds, a long total outage) were not measured&lt;/strong&gt;; in those cases it is expected that the connection is closed, and it reconnects after recovery.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;History (2026-11-20, the version without &lt;code&gt;TCP_USER_TIMEOUT&lt;/code&gt;, 1 run each):&lt;/em&gt; with isolation of 4, 12, 30 and 60 seconds, recovery took 4.9, 15.2, 25.5 and 49.8 seconds; after lowering &lt;code&gt;net.ipv4.tcp_retries2&lt;/code&gt; of the nodes from 15 to 5, recovery after 12, 30 and 60 seconds of isolation became 5.1, 7.6 and 5.1 seconds. The current version does not need this kernel parameter to be tuned.&lt;/p&gt;&#xA;&lt;h3 id=&#34;rolling-upgrade&#34;&gt;Rolling upgrade&#xA;&lt;/h3&gt;&lt;p&gt;First measure the highest write throughput at that RTT, take half of it, and divide it equally among the three nodes, with one &lt;code&gt;rradius-bench&lt;/code&gt; per node (&lt;code&gt;acct-start&lt;/code&gt;, fixed rate, timeout 1 second, no retransmit); in addition every node has a write probe every 50 ms. One node at a time (the two followers first, the leader last), run &lt;code&gt;docker stop -t 30&lt;/code&gt; and &lt;code&gt;docker start&lt;/code&gt;, and wait until the log shows &lt;code&gt;cluster node N has caught up with the 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;RTT between nodes (measured)&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Load (total)&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Stop to caught up, per node&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;The stop itself&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Requests that timed out&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Longest gap on the other nodes during the upgrade&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;0.2 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;21,600/s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;15.9, 17.6, 21.3 s (leader last)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;14.6 s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;5,500–6,500 per node, about 0.2–0.3%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;0.1–1.4 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;19.8 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;350/s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17.1, 17.1, 21.5 s (leader last)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;14.8 s&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1,500–2,600 per node, about 3.6–6.2%&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;0.1–6.9 s (6.9 when the leader was stopped)&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;Upgrading one node at a time, the other two keep answering.&lt;/strong&gt; Most of the requests that timed out were sent to the node being stopped (the client did not switch to another node).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The executables of the core edition and the enterprise edition have the same name (&lt;code&gt;rradiusd&lt;/code&gt;),&lt;/strong&gt; so when you change versions you only replace that file, and you confirm with &lt;code&gt;rradiusd --version&lt;/code&gt; which version each node is. A cluster with nodes of two different versions at the same time was not tested for this manual and is not guaranteed to work; if you need to do it, try it first on a test cluster.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Upgrading one node takes about 16 to 21 seconds&lt;/strong&gt; (about 15 seconds to stop, plus the start and catching up), and the leader takes the longest; when the leader is stopped, the write gap on the other nodes is the longest.&lt;/li&gt;&#xA;&lt;li&gt;Not tested: old and new versions mixed (this time the same image was restarted), and the catch-up time with a large amount of data.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;three-topologies&#34;&gt;Three topologies&#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;A single cluster across three data centers&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;A main cluster plus a cold standby&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;An independent cluster in each data center&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;How&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The three nodes are spread over three data centers, in one cluster&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One data center runs the cluster; the other normally has no nodes, and uses &lt;code&gt;[cluster.backup]&lt;/code&gt; of the enterprise edition (&lt;a class=&#34;link&#34; href=&#34;../01-overview/&#34; &gt;chapter 01&lt;/a&gt;) to save a copy regularly, and when something happens restores the copy as a new cluster&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Each data center has a three-node cluster, unrelated to 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;Login (read)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Not affected (0.7 ms measured)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same as the main cluster&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same as a single data center&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Write (IP allocation, verification codes, accounting)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;About 3 to 4 RTT each; at concurrency 64, about 830/s at 20 ms and about 320/s at 50 ms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same as a single data center&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same as a single data center&lt;/td&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 data center loses contact entirely&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The other two data centers have a majority; the election takes about 5 to 7 seconds, and you have to allow a margin for the write interruption (see above)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;When the main data center is lost you depend on a restore, and writes after the last copy are lost; the switch needs a person&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The other data centers are not affected; the users of the lost data center have to be served elsewhere&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Cost&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Writes are slow and the gaps during upgrades grow; you have to check yourself how much worse the real network is than the simulation&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The standby data center has no hot data normally; how long a restore takes was not measured&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounts, settings and migrations have to be done once in each cluster, and you manage the consistency yourself&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;A hot standby cannot be done at present.&lt;/strong&gt; Keeping a node in the standby data center that only replicates and does not vote (a learner) needs a new node to stay a learner; now a new node is a learner first and is promoted to voter automatically when it has finished copying, and there is no setting that makes it stay a learner.&lt;/p&gt;&#xA;&lt;h3 id=&#34;what-was-not-tested&#34;&gt;What was not tested&#xA;&lt;/h3&gt;&lt;p&gt;Jitter and packet loss, different delays in the two directions, physical hosts and environments through WireGuard, the retransmit behavior of a real NAS during an election, the throughput of sending writes to a follower, higher concurrency, five nodes, a partition with &lt;code&gt;stop_without_leader_ms&lt;/code&gt; set, the behavior of the accounting spool under high latency, partitions longer than 30 seconds, and the time a backup restore takes.&lt;/p&gt;&#xA;&lt;h2 id=&#34;cluster-metrics&#34;&gt;Cluster metrics&#xA;&lt;/h2&gt;&lt;p&gt;The &lt;code&gt;/metrics&lt;/code&gt; of every node has these, and the values are this node&amp;rsquo;s own view:&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;Type&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;&lt;code&gt;rradius_cluster_leader&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1 means there is a leader that can be written to&lt;/td&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_is_leader&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1 means this node is the leader&lt;/td&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_applied_index&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The number of the Raft log entry the local copy has applied&lt;/td&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_seconds_without_leader&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How many seconds there has been no leader; 0 when there is a leader&lt;/td&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_caught_up&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1 means it has caught up with the cluster since startup; 0 means it is serving from a copy that may be behind&lt;/td&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_db_batched_writes_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Script writes committed in one transaction together with other writes&lt;/td&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_db_split_batches_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How many times a combined transaction failed and was split to find the statement that failed&lt;/td&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;no_leader&amp;quot;}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Requests not answered because of &lt;code&gt;stop_without_leader_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;&lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;database&amp;quot;}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Requests not answered because the database could not be used (for example a write failed)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Suggested directions for alerts:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Across the whole cluster, the sum of &lt;code&gt;rradius_cluster_is_leader&lt;/code&gt; should be 1. 0 means there is no leader.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;rradius_cluster_seconds_without_leader&lt;/code&gt; stays above 0.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;rradius_cluster_applied_index&lt;/code&gt; of a node stays behind the other nodes.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;rradius_cluster_caught_up&lt;/code&gt; is 0 for too long.&lt;/li&gt;&#xA;&lt;li&gt;The bytes of the accounting spool (&lt;code&gt;rradius_acct_spool_bytes&lt;/code&gt;) keep growing, which means writes to the database are failing.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The &lt;code&gt;deploy/monitoring/&lt;/code&gt; directory of the source has ready-made rules; see &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;chapter 17&lt;/a&gt;. The full description of every metric is in &lt;a class=&#34;link&#34; href=&#34;../92-metrics-reference/&#34; &gt;Appendix C&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;cluster.nodes: node 1 is required&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; There is no node with id 1 in &lt;code&gt;[[cluster.nodes]]&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Number the node ids from 1.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;cluster.node_id 4 is not in cluster.nodes&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The &lt;code&gt;node_id&lt;/code&gt; of this node is not listed in its own configuration.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add its own entry to &lt;code&gt;[[cluster.nodes]]&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;cluster.secret_raft must be at least 16 characters&lt;/code&gt;, or &lt;code&gt;exactly one of cluster.secret_api or cluster.secret_api_file must be set&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The cluster secret is too short, or both ways of writing it were given, or neither.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Generate it with &lt;code&gt;openssl rand -hex 32 &amp;gt; raft.secret&lt;/code&gt; and write only &lt;code&gt;secret_raft_file&lt;/code&gt; in the configuration.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; or startup warns &lt;code&gt;cluster.listen is not set, so the cluster&#39;s Raft and API ports are on all interfaces, …&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; There is &lt;code&gt;[[cluster.nodes]]&lt;/code&gt; but no &lt;code&gt;listen&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Set it to the node&amp;rsquo;s internal or WireGuard address; if you really want to listen on all addresses, write &lt;code&gt;listen = &amp;quot;0.0.0.0&amp;quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The logs of the second and third node have many &lt;code&gt;ERROR hiqlite::init: … Raft is not initialized&lt;/code&gt; or &lt;code&gt;Connection refused&lt;/code&gt; at the beginning.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; Node 1 has not created the cluster yet, or the other nodes have not started.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Wait. When &lt;code&gt;has caught up with the cluster&lt;/code&gt; appears, it is fine. If it never appears, confirm that all three nodes have started and that the &lt;code&gt;raft&lt;/code&gt; and &lt;code&gt;api&lt;/code&gt; addresses can reach each other.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The node exits after starting and prints &lt;code&gt;not ready to apply migrations: node 2 did not join within 10s (the limit is migrations_wait_ms; raise it if a migration file takes longer)&lt;/code&gt;, exit code 1.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; A majority could not gather within &lt;code&gt;migrations_wait_ms&lt;/code&gt;: the other nodes are not running, or cannot be reached.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Bring the other nodes up first; when you restart together, set &lt;code&gt;migrations_wait_ms&lt;/code&gt; longer.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; At startup it prints &lt;code&gt;cannot start cluster node 2: node id 2 is in use: …&lt;/code&gt;, exit code 2.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; A node with a different address in the cluster already uses this id and is still running.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Use an id nobody uses (look at &lt;code&gt;cluster members&lt;/code&gt; first), or stop that node first.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;cluster members&lt;/code&gt; or &lt;code&gt;status --cluster&lt;/code&gt; prints &lt;code&gt;127.0.0.1:27011 refused the api secret: [cluster] secret_api differs from the cluster&#39;s&lt;/code&gt;, exit code 2.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The API secret of this configuration differs from the cluster&amp;rsquo;s.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Use the same &lt;code&gt;api.secret&lt;/code&gt; as the cluster.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;cluster members&lt;/code&gt; hangs for 30 seconds and prints &lt;code&gt;the cluster did not answer within 30 s&lt;/code&gt;, exit code 3.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; None of the nodes in the configuration answers, or none has a leader.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Confirm that the nodes are running and the API ports can be reached; when the majority is lost, bring the nodes back first.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;cluster remove&lt;/code&gt; prints &lt;code&gt;node 4 still answers at 127.0.0.1:27014: stop it first, then remove it&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The node to remove is still running.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Stop it first, then remove it.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;cluster remove&lt;/code&gt; prints &lt;code&gt;removing node 3 leaves two voters, and the cluster stops writing when either stops; give --force to remove it anyway&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; Only two voters would remain after the removal.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add a new node first and then remove the old one; add &lt;code&gt;--force&lt;/code&gt; only when you are sure you want to shrink to two nodes.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;/readyz&lt;/code&gt; of a node returns 503 &lt;code&gt;no leader&lt;/code&gt;, logins get no answer, and &lt;code&gt;Discarded: no leader&lt;/code&gt; increases.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;stop_without_leader_ms&lt;/code&gt; is set, and this node has had no leader for longer than that.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Let it reconnect to the other nodes, or bring the stopped nodes back. &lt;code&gt;/livez&lt;/code&gt; is still 200, so do not restart it because of this.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; Every line of &lt;code&gt;status --cluster&lt;/code&gt; has the same address, or other nodes show &lt;code&gt;unreachable&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The metrics ports of the nodes differ, or &lt;code&gt;[metrics] bind&lt;/code&gt; is an address other hosts cannot reach.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Give every node the same metrics port, and set &lt;code&gt;bind&lt;/code&gt; to the host of the &lt;code&gt;api&lt;/code&gt; address.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; A node that was killed warns &lt;code&gt;Node did not shut down gracefully - auto-rebuilding State Machine&lt;/code&gt; when it starts.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; It was not shut down cleanly last time.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Nothing to do; it rebuilds itself. After that, stop it with SIGTERM and give it enough time.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; On Kubernetes a pod never becomes ready and the &lt;code&gt;startupProbe&lt;/code&gt; fails.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; No leader can be elected: the other pods did not start, the &lt;code&gt;raft&lt;/code&gt; or &lt;code&gt;api&lt;/code&gt; secrets differ, or &lt;code&gt;rradius-cluster&lt;/code&gt; has no &lt;code&gt;publishNotReadyAddresses&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Look at the reason with &lt;code&gt;kubectl logs&lt;/code&gt;; keep the secrets in the same Secret.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; On Kubernetes requests from the NAS get no answer, and &lt;code&gt;unknown_client&lt;/code&gt; increases.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The source address was rewritten by the load balancer.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; See &lt;a class=&#34;link&#34; href=&#34;#verify-that-the-source-address-is-not-rewritten&#34; &gt;Verify that the source address is not rewritten&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The &lt;code&gt;client=&lt;/code&gt; in the authentication records of different NAS is always the same, and &lt;code&gt;source=&lt;/code&gt; is the address of a node or a gateway.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The source address was rewritten and happens to fall in the network of some client, so all NAS are treated as the same one.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; The same as above; shrink &lt;code&gt;[[radius.clients]]&lt;/code&gt; to the actual network of the NAS.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; All three pods are ready, but after one is stopped all requests get no answer for a while.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The stopped one was the leader, and the remaining two are still electing.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; It recovers within seconds; if it lasts, look at &lt;code&gt;rradius_cluster_leader&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; A newly added migration is not applied (Kubernetes).&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The &lt;code&gt;items&lt;/code&gt; of &lt;code&gt;statefulset.yaml&lt;/code&gt; is missing that line, so the file does not appear in &lt;code&gt;migrations/&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; See &lt;a class=&#34;link&#34; href=&#34;../18-operations/&#34; &gt;chapter 18&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04 Configuration file basics&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13 Accounting and sessions&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../18-operations/&#34; &gt;18 Day-to-day operations&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;19 Performance tuning and load testing&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../20-security/&#34; &gt;20 Security hardening&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../92-metrics-reference/&#34; &gt;Appendix C: Metrics reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>17 Monitoring, status and logs</title>
            <link>https://embark.systems/en/rradius/oss/17-monitoring/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/17-monitoring/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Turn on the metrics port and know what &lt;code&gt;/metrics&lt;/code&gt;, &lt;code&gt;/livez&lt;/code&gt; and &lt;code&gt;/readyz&lt;/code&gt; each answer, and when&lt;/li&gt;&#xA;&lt;li&gt;Have Prometheus scrape the metrics and apply the alert rules shipped in the repo&lt;/li&gt;&#xA;&lt;li&gt;Use &lt;code&gt;status&lt;/code&gt; to see the live state of one node or of the whole cluster, and get JSON for other programs to read&lt;/li&gt;&#xA;&lt;li&gt;Adjust the log level and format, and read every authentication record&lt;/li&gt;&#xA;&lt;li&gt;Turn on a trace for a specific user or client for a limited time, without a restart&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: you have finished &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;Chapter 03&lt;/a&gt;, so you have a working quick-start scenario and the two commands &lt;code&gt;rradiusd&lt;/code&gt; and &lt;code&gt;rradius-bench&lt;/code&gt;. The full description of every metric is in &lt;a class=&#34;link&#34; href=&#34;../92-metrics-reference/&#34; &gt;Appendix C&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#concept-three-ways-to-look-at-the-server&#34; &gt;Concept: three ways to look at the server&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#prepare-the-lab-environment&#34; &gt;Prepare the lab environment&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#turn-on-the-metrics-port&#34; &gt;Turn on the metrics port&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#liveness-and-readiness&#34; &gt;Liveness and readiness&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#reading-metrics&#34; &gt;Reading /metrics&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#let-prometheus-scrape-the-metrics&#34; &gt;Let Prometheus scrape the metrics&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#alert-rules-and-alertmanager&#34; &gt;Alert rules and Alertmanager&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#live-state-with-status&#34; &gt;Live state with status&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#the-sections-of-status&#34; &gt;The sections of status&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#looking-at-the-whole-cluster&#34; &gt;Looking at the whole cluster&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#adjusting-the-log&#34; &gt;Adjusting the log&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#authentication-records&#34; &gt;Authentication records&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#tracing-a-specific-user-or-client&#34; &gt;Tracing a specific user or client&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#when-log-lines-are-dropped&#34; &gt;When log lines are dropped&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;concept-three-ways-to-look-at-the-server&#34;&gt;Concept: three ways to look at the server&#xA;&lt;/h2&gt;&lt;p&gt;rradius gives you three ways to observe it, each for a different purpose:&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;Channel&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Where you look&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What it is good 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;HTTP on the metrics port&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/metrics&lt;/code&gt;, &lt;code&gt;/livez&lt;/code&gt;, &lt;code&gt;/readyz&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Long-term collection, graphs and alerts in Prometheus; letting a load balancer or Kubernetes decide whether to send traffic&lt;/td&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;status&lt;/code&gt; command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reads the same metrics port and arranges it on one page&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;You are at a terminal and want to know right now &amp;ldquo;how many requests per second, and are packets being dropped&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;The log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The server&amp;rsquo;s standard error output (stderr)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Finding out why one login was rejected or why a reload failed; a trace shows the full request and response&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;How they relate: &lt;code&gt;status&lt;/code&gt; has no data source of its own. It reads &lt;code&gt;/metrics&lt;/code&gt; and &lt;code&gt;/readyz&lt;/code&gt;. So without &lt;code&gt;[metrics]&lt;/code&gt; there is no &lt;code&gt;status&lt;/code&gt;. The log and the metrics are independent of each other: when the log cannot be written, the server keeps answering requests and only records in the metrics how many lines were dropped.&lt;/p&gt;&#xA;&lt;p&gt;Metrics are &lt;strong&gt;counted by each node on its own&lt;/strong&gt;, accumulated since the process started. A reload does not reset them; a restart does. To see a total across a cluster, add up the numbers from every node; &lt;code&gt;status --cluster&lt;/code&gt; does the adding for you.&lt;/p&gt;&#xA;&lt;h2 id=&#34;prepare-the-lab-environment&#34;&gt;Prepare the lab environment&#xA;&lt;/h2&gt;&lt;p&gt;This chapter uses the default ports: RADIUS 1812 and 1813, metrics 9812. TACACS+ uses 4949, as in &lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;Chapter 12&lt;/a&gt;, because the standard port 49 is below 1024 and a normal account cannot listen on it.&lt;/p&gt;&#xA;&lt;p&gt;Copy the quick-start scenario and replace the example secrets (the same way as in Chapter 03):&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cp -R rradius-server/examples/scenarios/quick-start ~/rradius-lab/monitoring&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cd ~/rradius-lab/monitoring&#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; f in raft api localhost; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; openssl rand -hex &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt; &amp;gt; $f.secret; &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;$ chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;600&lt;/span&gt; *.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Change the dictionary path to an absolute path as in Chapter 03. The &lt;code&gt;[radius]&lt;/code&gt; and &lt;code&gt;[metrics]&lt;/code&gt; sections of quick-start already use the default ports, so you do not need to change them.&lt;/p&gt;&#xA;&lt;p&gt;So that every section of &lt;code&gt;status&lt;/code&gt; has something to show, add TACACS+, login-failure lockout, an accounting log file and one named query at the end of the file. Each is covered in its own chapter; here they are only borrowed to produce metrics:&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:#75715e&#34;&gt;# rradius.toml (add at the end of the file)&lt;/span&gt;&#xA;&lt;/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;lockout&lt;/span&gt;]&#xA;&lt;/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_failures&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;radius&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;accounting_log&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;acct.jsonl&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;]&#xA;&lt;/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;127.0.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;port&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;4949&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;lab-switch&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;127.0.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;localhost.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;queries&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;accounts_by_state&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;sql&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT CASE enabled WHEN 1 THEN &amp;#39;enabled&amp;#39; ELSE &amp;#39;disabled&amp;#39; END AS state, COUNT(*) AS value FROM users GROUP BY enabled&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;help&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Accounts in the users table, by state.&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;labels&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;state&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;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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;[auth.lockout]&lt;/code&gt; is in &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;Chapter 07&lt;/a&gt;, &lt;code&gt;[radius.accounting_log]&lt;/code&gt; in &lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;Chapter 13&lt;/a&gt;, &lt;code&gt;[tacacs]&lt;/code&gt; in &lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;Chapter 12&lt;/a&gt;, and &lt;code&gt;[queries]&lt;/code&gt; in &lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;Chapter 09&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The TACACS+ client borrows &lt;code&gt;localhost.secret&lt;/code&gt; only to save creating one more file. In production every client uses its own shared secret.&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd serve --config rradius.toml&#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;… INFO rradius_core::tacacs: TACACS+ Server listening on 127.0.0.1:4949&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::radius: RADIUS Server listening on 127.0.0.1:1812 and 127.0.0.1:1813&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::metrics: Metrics listening on 127.0.0.1:9812&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In another terminal, send some traffic: one successful login, four wrong passwords (&lt;code&gt;bob&lt;/code&gt; is locked after the third), one accounting request, one TACACS+ login, one request with a wrong shared secret, and one Status-Server.&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-console&#34; data-lang=&#34;console&#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;&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 localhost.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;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --auth-port &lt;span style=&#34;color:#ae81ff&#34;&gt;1812&lt;/span&gt; --acct-port &lt;span style=&#34;color:#ae81ff&#34;&gt;1813&lt;/span&gt; --secret &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$S&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&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;    --user alice --password alice-password --load pap,concurrency=1 --requests 1&#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;for&lt;/span&gt; i in &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt; 4; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; rradius-bench run --server 127.0.0.1 --auth-port &lt;span style=&#34;color:#ae81ff&#34;&gt;1812&lt;/span&gt; --secret &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$S&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&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;    --user bob --password wrong --load pap,concurrency=1 --requests 1; done&#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;$ rradius-bench run --server 127.0.0.1 --auth-port &lt;span style=&#34;color:#ae81ff&#34;&gt;1812&lt;/span&gt; --acct-port &lt;span style=&#34;color:#ae81ff&#34;&gt;1813&lt;/span&gt; --secret &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$S&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&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;    --user alice --load acct-start,concurrency=1 --requests 1&#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;$ rradius-bench run --server 127.0.0.1 --tacacs-port &lt;span style=&#34;color:#ae81ff&#34;&gt;4949&lt;/span&gt; --secret &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$S&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&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;    --user alice --password alice-password --load tacacs-pap,concurrency=1 --requests 1&#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;$ rradius-bench run --server 127.0.0.1 --auth-port &lt;span style=&#34;color:#ae81ff&#34;&gt;1812&lt;/span&gt; --secret wrongsecret &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;    --user alice --password alice-password --load pap,concurrency=1 --requests 1 --timeout 1&#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;  pap: 0/s, sent 1, accept 0, reject 0, challenge 0, accounting 0, timeouts 1, invalid 0, late 0, socket errors 0, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --auth-port &lt;span style=&#34;color:#ae81ff&#34;&gt;1812&lt;/span&gt; --secret &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$S&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; --load status-auth,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The server does not answer the request with the wrong shared secret, so &lt;code&gt;rradius-bench&lt;/code&gt; sees &lt;code&gt;timeouts 1&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;turn-on-the-metrics-port&#34;&gt;Turn on the metrics port&#xA;&lt;/h2&gt;&lt;p&gt;The server opens this HTTP port only if the configuration file has &lt;code&gt;[metrics]&lt;/code&gt; (even an empty table):&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Reload&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;&lt;code&gt;metrics.bind&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;127.0.0.1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The address to listen 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;&lt;code&gt;metrics.port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;9812&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The TCP port to listen on&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The full key table is in &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This port is simple:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It accepts only &lt;code&gt;GET&lt;/code&gt;. Other methods get 405, including &lt;code&gt;HEAD&lt;/code&gt;, so &lt;code&gt;curl -I&lt;/code&gt; sees 405.&lt;/li&gt;&#xA;&lt;li&gt;It has only three paths, &lt;code&gt;/metrics&lt;/code&gt;, &lt;code&gt;/livez&lt;/code&gt; and &lt;code&gt;/readyz&lt;/code&gt;; anything else gets 404. A query string after the URL (&lt;code&gt;?x=1&lt;/code&gt;) does not change the result.&lt;/li&gt;&#xA;&lt;li&gt;It closes the connection after every answer. It serves at most 16 connections at the same time and closes the extra ones immediately.&lt;/li&gt;&#xA;&lt;li&gt;If the request headers exceed 8 KiB or are not finished within 5 seconds, the connection is closed; the answer must also be read within 5 seconds.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Measured:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s -o /dev/null -w &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;%{http_code}\n&amp;#34;&lt;/span&gt; http://127.0.0.1:9812/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;404&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s -o /dev/null -w &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;%{http_code}\n&amp;#34;&lt;/span&gt; -X POST http://127.0.0.1:9812/metrics&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;405&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s -o /dev/null -w &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;%{http_code}\n&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;http://127.0.0.1:9812/metrics?x=1&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;200&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; The metrics port has no user name or password and no TLS. Anyone who can reach it can read things such as client names and the results of named queries. Bind &lt;code&gt;bind&lt;/code&gt; only to an internal network address, and use a firewall so that only Prometheus and the management hosts can reach it. When you bind &lt;code&gt;0.0.0.0&lt;/code&gt;, &lt;code&gt;status&lt;/code&gt; connects to the local loopback instead.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;liveness-and-readiness&#34;&gt;Liveness and readiness&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;/livez&lt;/code&gt; and &lt;code&gt;/readyz&lt;/code&gt; both answer with plain text, one line plus a newline:&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;Path&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Answer&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;When&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;/livez&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;200 &lt;code&gt;ok&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Whenever the metrics port can answer. It is also 200 while the server is stopping&lt;/td&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;/readyz&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;503 &lt;code&gt;stopping&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After SIGTERM or SIGINT is received and the server starts stopping, until the process exits&lt;/td&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;/readyz&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;503 &lt;code&gt;no leader&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;cluster.stop_without_leader_ms&lt;/code&gt; is set and the time without a leader has passed it; login requests are not answered during this 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;/readyz&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;503 &lt;code&gt;database &amp;lt;name&amp;gt; unreachable&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An external database with &lt;code&gt;required_for_ready = true&lt;/code&gt; cannot be reached; with several, the names are sorted alphabetically and separated by &lt;code&gt;, &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;/readyz&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;200 &lt;code&gt;ok&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;None of the above&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;When several conditions hold at once, the order is: &lt;code&gt;stopping&lt;/code&gt; first, then &lt;code&gt;no leader&lt;/code&gt;, and the databases last. On a node without &lt;code&gt;stop_without_leader_ms&lt;/code&gt;, &lt;code&gt;/readyz&lt;/code&gt; stays 200 when there is no leader, because the node still answers logins with its local data (see &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 16&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;How to use them:&lt;/strong&gt; use &lt;code&gt;/livez&lt;/code&gt; for the liveness probe, and restart the process when it fails. Use &lt;code&gt;/readyz&lt;/code&gt; for the readiness probe, and when it fails, stop sending traffic to the node but do not restart it. &lt;code&gt;deploy/kubernetes/statefulset.yaml&lt;/code&gt; in the repo is set up this way: &lt;code&gt;startupProbe&lt;/code&gt; and &lt;code&gt;livenessProbe&lt;/code&gt; look at &lt;code&gt;/livez&lt;/code&gt;, and &lt;code&gt;readinessProbe&lt;/code&gt; looks at &lt;code&gt;/readyz&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;When stopping:&lt;/strong&gt; measured with &lt;code&gt;[shutdown] ready_delay_ms&lt;/code&gt; set to &lt;code&gt;2000&lt;/code&gt; and then SIGTERM sent:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kill -TERM &amp;lt;pid&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s -w &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34; HTTP %{http_code}\n&amp;#34;&lt;/span&gt; http://127.0.0.1:9812/readyz&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;stopping&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; HTTP 503&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s -w &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34; HTTP %{http_code}\n&amp;#34;&lt;/span&gt; http://127.0.0.1:9812/livez&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; HTTP 200&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The server&amp;rsquo;s log:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::cli: stopping: /readyz answers 503; requests are answered for 2000 ms more, then those being handled are waited for, for at most 5000 ms&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::cli: stopping: no more requests taken&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::cli: stopping: every request taken was answered&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;During the &lt;code&gt;ready_delay_ms&lt;/code&gt; period, &lt;code&gt;/readyz&lt;/code&gt; is already 503 but requests are still answered as usual, which gives the load balancer time to move traffic away. &lt;code&gt;[shutdown]&lt;/code&gt; is described in &lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;Chapter 04&lt;/a&gt;, and the shutdown procedure is in &lt;a class=&#34;link&#34; href=&#34;../18-operations/&#34; &gt;Chapter 18&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;External databases:&lt;/strong&gt; set &lt;code&gt;required_for_ready = true&lt;/code&gt; in &lt;code&gt;[databases.&amp;lt;name&amp;gt;]&lt;/code&gt;. The server runs &lt;code&gt;SELECT 1&lt;/code&gt; against it every 5 seconds on a connection of its own. Two failures in a row count as unreachable, and one success restores it. Measured with a PostgreSQL that does not exist (a port on &lt;code&gt;127.0.0.1&lt;/code&gt; with nothing listening) set as required:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s -w &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34; HTTP %{http_code}\n&amp;#34;&lt;/span&gt; http://127.0.0.1:9812/readyz&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;database billing unreachable&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; HTTP 503&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If the database cannot be reached at startup, the log says so once first:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::external_db: databases.billing: not reachable at startup: error communicating with database: Connection refused (os error 61); /readyz answers 503 until it is&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The configuration of external databases is in &lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;Chapter 09&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; The &lt;code&gt;no leader&lt;/code&gt; answer can only be reproduced with a multi-node cluster, and this chapter did not run it. The behavior is based on &lt;code&gt;rradius-core/src/metrics.rs&lt;/code&gt; and &lt;code&gt;specs/server-metrics&lt;/code&gt; (Health Endpoints).&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;reading-metrics&#34;&gt;Reading /metrics&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;/metrics&lt;/code&gt; answers in the Prometheus text format (&lt;code&gt;Content-Type: text/plain; version=0.0.4&lt;/code&gt;). Each metric family starts with two lines, &lt;code&gt;# HELP&lt;/code&gt; and &lt;code&gt;# TYPE&lt;/code&gt;, followed by the samples:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s http://127.0.0.1:9812/metrics | grep -A6 &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;^# HELP rradius_radius_responses_total&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# HELP rradius_radius_responses_total RADIUS responses sent, excluding replays and Status-Server.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# TYPE rradius_radius_responses_total counter&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_radius_responses_total{code=&amp;#34;access_accept&amp;#34;} 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_radius_responses_total{code=&amp;#34;access_reject&amp;#34;} 5&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_radius_responses_total{code=&amp;#34;access_challenge&amp;#34;} 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_radius_responses_total{code=&amp;#34;accounting_response&amp;#34;} 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A few rules to know when reading:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Three types.&lt;/strong&gt; A counter only goes up, and you read it with &lt;code&gt;rate()&lt;/code&gt; or &lt;code&gt;increase()&lt;/code&gt;. A gauge is the current value and can go up and down. A histogram is the distribution of response times.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Label combinations exist from the start.&lt;/strong&gt; For example &lt;code&gt;access_challenge&lt;/code&gt; has a line with &lt;code&gt;0&lt;/code&gt; even if it never happened. So a query does not compute a wrong rate because some value appears &amp;ldquo;for the first time&amp;rdquo;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Some metric families appear only when the matching setting exists.&lt;/strong&gt; For example, without &lt;code&gt;[auth.lockout]&lt;/code&gt; there is no &lt;code&gt;rradius_auth_lockout_*&lt;/code&gt;. The conditions for each are listed in &lt;a class=&#34;link&#34; href=&#34;../92-metrics-reference/&#34; &gt;Appendix C&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Client names come from the configuration.&lt;/strong&gt; The &lt;code&gt;client&lt;/code&gt; label of &lt;code&gt;rradius_radius_client_responses_total&lt;/code&gt; is the &lt;code&gt;name&lt;/code&gt; of a &lt;code&gt;[[radius.clients]]&lt;/code&gt; entry, so it does not grow with traffic. When a reload removes a client, its samples disappear with it.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The metric families this chapter covers:&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 family&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What it shows&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_radius_*&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How many RADIUS requests came in, what was answered, how many were dropped and why, how long it took, and how many are being handled 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;&lt;code&gt;rradius_tacacs_*&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+ connections, each kind of request, requests that could not be decoded, response times&lt;/td&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_traffic_bytes_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Protocol packet bytes received and written by RADIUS (UDP) and 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;rradius_eap_*&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP conversations in progress, how conversations end&lt;/td&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_*&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The number of successful and failed reloads, the time of the last success&lt;/td&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_build_info&lt;/code&gt;, &lt;code&gt;rradius_start_time_seconds&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Version, start 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;rradius_log_dropped_lines_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Dropped log lines&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The other metric families have their own main chapters: the cluster and &lt;code&gt;rradius_db_*&lt;/code&gt; are in &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 16&lt;/a&gt;, the accounting spool and the accounting log file are in &lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;Chapter 13&lt;/a&gt;, lockout and password comparison are in &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;Chapter 07&lt;/a&gt;, Netlogon is in &lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;Chapter 08&lt;/a&gt;, external databases and named queries are in &lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;Chapter 09&lt;/a&gt;, and HTTP calls from scripts are in &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;Chapter 10&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;requests-without-a-response&#34;&gt;Requests without a response&#xA;&lt;/h3&gt;&lt;p&gt;The metric you will look at most when troubleshooting is &lt;code&gt;rradius_radius_discarded_total&lt;/code&gt;. It counts packets the server received but did not answer, split by &lt;code&gt;reason&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;reason&lt;/code&gt;&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;&lt;code&gt;overload&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The requests being handled at the same time have reached &lt;code&gt;max_auth_inflight&lt;/code&gt; or &lt;code&gt;max_acct_inflight&lt;/code&gt; (Chapter 19)&lt;/td&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;unknown_client&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The source address does not belong to 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;&lt;code&gt;invalid&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Malformed, or the authenticator or Message-Authenticator is wrong; the most common cause is a shared secret mismatch&lt;/td&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;database&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The cluster database cannot be used, so the login gets no 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;no_leader&lt;/code&gt;&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 there has been no leader for too long&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The request with the wrong shared secret sent above is counted here:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_radius_discarded_total{reason=&amp;#34;invalid&amp;#34;} 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;rradius_radius_duplicates_total&lt;/code&gt; counts retransmits separately: the NAS did not get an answer and sent the same request again, and the server answers it from the retransmit cache or drops it while it is still being handled. It is not counted in &lt;code&gt;discarded&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;response-times&#34;&gt;Response times&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;rradius_radius_response_seconds&lt;/code&gt; and &lt;code&gt;rradius_tacacs_response_seconds&lt;/code&gt; are histograms. RADIUS is split by &lt;code&gt;kind&lt;/code&gt; (&lt;code&gt;auth&lt;/code&gt;, &lt;code&gt;acct&lt;/code&gt;), measured from passing the retransmit check to sending the response; requests with no response are not counted. TACACS+ is split by &lt;code&gt;type&lt;/code&gt; (&lt;code&gt;authen&lt;/code&gt;, &lt;code&gt;author&lt;/code&gt;, &lt;code&gt;acct&lt;/code&gt;), and each authentication packet is counted once.&lt;/p&gt;&#xA;&lt;p&gt;The upper bounds of the buckets (in seconds) are fixed:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0.00005 0.0001 0.00025 0.0005 0.001 0.0025 0.005 0.01 0.025 0.05 0.1 0.25 0.5 1 2.5 5 10 +Inf&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;They run from 50 microseconds to 10 seconds. A local login usually falls under 1 millisecond; anything over 10 seconds has long been given up by the NAS. The unit of &lt;code&gt;_sum&lt;/code&gt; is seconds.&lt;/p&gt;&#xA;&lt;h2 id=&#34;let-prometheus-scrape-the-metrics&#34;&gt;Let Prometheus scrape the metrics&#xA;&lt;/h2&gt;&lt;p&gt;The repo&amp;rsquo;s &lt;code&gt;deploy/monitoring/&lt;/code&gt; has the alert rules and an Alertmanager example. The rules assume the scrape job is named &lt;code&gt;rradius&lt;/code&gt;, so write the Prometheus configuration like this:&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-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# prometheus.yml (excerpt)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;scrape_configs&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#f92672&#34;&gt;job_name&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;rradius&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;static_configs&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - &lt;span style=&#34;color:#f92672&#34;&gt;targets&lt;/span&gt;: [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.0.0.11:9812&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.0.0.12:9812&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.0.0.13:9812&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:#f92672&#34;&gt;rule_files&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;rradius.rules.yml&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;alerting&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;alertmanagers&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#f92672&#34;&gt;static_configs&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        - &lt;span style=&#34;color:#f92672&#34;&gt;targets&lt;/span&gt;: [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;alertmanager:9093&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;List every node of the cluster. The metrics are counted by each node on its own, so leaving one out loses its share.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;[metrics] bind&lt;/code&gt; of every node must be an internal address that Prometheus can reach, not &lt;code&gt;127.0.0.1&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;A few common queries, taken directly from the rules 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-promql&#34; data-lang=&#34;promql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Share of Access-Reject in Accept + Reject, per second, per host&lt;/span&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;sum&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;by&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;instance&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;rate&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;rradius_radius_responses_total{code&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&amp;#34;&lt;span style=&#34;color:#e6db74&#34;&gt;access_reject&lt;/span&gt;&amp;#34;}[&lt;span style=&#34;color:#e6db74&#34;&gt;10m&lt;/span&gt;]&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;  &lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;sum&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;by&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;instance&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;rate&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;rradius_radius_responses_total{code&lt;span style=&#34;color:#f92672&#34;&gt;=~&lt;/span&gt;&amp;#34;&lt;span style=&#34;color:#e6db74&#34;&gt;access_accept|access_reject&lt;/span&gt;&amp;#34;}[&lt;span style=&#34;color:#e6db74&#34;&gt;10m&lt;/span&gt;]&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;&#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;# p99 of login response time (seconds)&lt;/span&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;histogram_quantile&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0.99&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;sum&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;by&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;le, instance&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;rate&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;rradius_radius_response_seconds_bucket{kind&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&amp;#34;&lt;span style=&#34;color:#e6db74&#34;&gt;auth&lt;/span&gt;&amp;#34;}[&lt;span style=&#34;color:#e6db74&#34;&gt;5m&lt;/span&gt;]&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;&#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;# Packets dropped because of overload in five minutes&lt;/span&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;increase&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;rradius_radius_discarded_total{reason&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&amp;#34;&lt;span style=&#34;color:#e6db74&#34;&gt;overload&lt;/span&gt;&amp;#34;}[&lt;span style=&#34;color:#e6db74&#34;&gt;5m&lt;/span&gt;]&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;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; This chapter was not connected to a real Prometheus and Grafana. The scrape configuration and queries above were only checked against the files in &lt;code&gt;deploy/monitoring/&lt;/code&gt; and the real output of &lt;code&gt;/metrics&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;alert-rules-and-alertmanager&#34;&gt;Alert rules and Alertmanager&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;deploy/monitoring/rradius.rules.yml&lt;/code&gt; has 19 rules in five groups. Metrics that exist only with the matching setting (external databases, the accounting log file, named queries) do not appear when the setting is absent, and the related rules never fire.&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;Group&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Rule&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Condition (excerpt)&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Severity&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;availability&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RradiusDown&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;up{job=&amp;quot;rradius&amp;quot;} == 0&lt;/code&gt; for 2 minutes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;critical&lt;/td&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;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RradiusNoLeader&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_cluster_leader == 0&lt;/code&gt; for 1 minute&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;critical&lt;/td&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;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RradiusNotCaughtUp&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_cluster_caught_up == 0&lt;/code&gt; for 5 minutes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;warning&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;traffic&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RradiusOverload&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;overload&lt;/code&gt; drops within 5 minutes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;critical&lt;/td&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;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RradiusDiscardingForTheDatabase&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;database&lt;/code&gt; or &lt;code&gt;no_leader&lt;/code&gt; drops within 5 minutes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;warning&lt;/td&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;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RradiusManyRejects&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;More than half Rejects within 10 minutes, and more than 0.2 per second&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;warning&lt;/td&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;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RradiusInvalidPackets&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;invalid&lt;/code&gt; drops continuing within 10 minutes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;warning&lt;/td&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;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RradiusSlowLogins&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Login p99 over 1 second, for 10 minutes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;warning&lt;/td&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&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RradiusAccountingSpoolBacklog&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The accounting spool holds data, for 15 minutes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;warning&lt;/td&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;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RradiusAccountingSpoolLoss&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Records rejected or corrupted in the spool within 1 hour&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;critical&lt;/td&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;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RradiusAccountingLogDropping&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The accounting log file drops or fails to write within 10 minutes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;warning&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;dependencies&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RradiusExternalDatabaseUnreachable&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius_external_db_reachable == 0&lt;/code&gt; for 2 minutes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;critical&lt;/td&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;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RradiusExternalDatabaseFailing&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Failures of the &lt;code&gt;unavailable&lt;/code&gt; kind within 5 minutes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;warning&lt;/td&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;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RradiusExternalDatabasePoolFull&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Connections in use equal the limit, for 5 minutes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;warning&lt;/td&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;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RradiusNamedQueryStale&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A named query has not succeeded for more than 120 seconds&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;warning&lt;/td&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;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RradiusNamedQueryFailing&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A named query fails within 10 minutes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;warning&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;operations&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RradiusReloadFailed&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A reload fails within 10 minutes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;warning&lt;/td&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;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RradiusLogLinesDropped&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Log lines dropped within 10 minutes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;warning&lt;/td&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;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RradiusEapSessionsLost&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP conversations pushed out (&lt;code&gt;evicted&lt;/code&gt;) or refused (&lt;code&gt;overload&lt;/code&gt;) within 10 minutes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;warning&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The full condition and description text of every rule is in the rules file, which is the authority. Which metric each rule uses is also written under each metric in Appendix C.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;rradius.rules.test.yml&lt;/code&gt; holds the test cases for &lt;code&gt;promtool test rules&lt;/code&gt;: it feeds in fake time series and checks which alerts fire at what time. After you change the rules, run these in &lt;code&gt;deploy/monitoring/&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ promtool check rules rradius.rules.yml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ promtool test rules rradius.rules.test.yml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;alertmanager.yml&lt;/code&gt; groups alerts by &lt;code&gt;alertname&lt;/code&gt; and &lt;code&gt;instance&lt;/code&gt;, sends them by webhook to &lt;code&gt;http://snmp-notifier:9464/alerts&lt;/code&gt;, and also sends them when an alert resolves (&lt;code&gt;send_resolved: true&lt;/code&gt;). &lt;code&gt;snmp_notifier&lt;/code&gt; is a separate project that turns alerts into SNMP traps, for management systems that only receive traps. If you already have your own Alertmanager configuration, merge its &lt;code&gt;route&lt;/code&gt; and &lt;code&gt;receivers&lt;/code&gt; into yours.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; The machine used to write this chapter has no &lt;code&gt;promtool&lt;/code&gt;, so the two commands above were not run; forwarding through Alertmanager and SNMP traps was not run either.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;three-ways-to-connect&#34;&gt;Three ways to connect&#xA;&lt;/h3&gt;&lt;p&gt;rradius outputs Prometheus metrics and has &lt;strong&gt;no built-in SNMP&lt;/strong&gt;. Choose one by your monitoring system:&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;Your monitoring system&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What to do&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Verified?&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;Prometheus and Alertmanager (or a system that can receive Alertmanager webhooks)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Load &lt;code&gt;rradius.rules.yml&lt;/code&gt;; Alertmanager sends the alerts&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The syntax and logic of the rules were checked with &lt;code&gt;promtool&lt;/code&gt; (as recorded in the earlier version of the chapter); no real notification channel was connected&lt;/td&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 receives SNMP traps&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The Alertmanager webhook goes to &lt;code&gt;snmp_notifier&lt;/code&gt;, which sends SNMP traps (v2c or v3)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Recorded in the earlier version: tested locally with three containers, Alertmanager, &lt;code&gt;snmp_notifier&lt;/code&gt; and &lt;code&gt;snmptrapd&lt;/code&gt;; &lt;code&gt;snmptrapd&lt;/code&gt; received a v2c trap carrying the alert name, node, severity and summary. v3 and a real monitoring system were not tested. It was not rerun this time, &lt;strong&gt;not verified on real hardware&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;A monitoring system that can read HTTP (for example the HTTP agent item of Zabbix)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Read &lt;code&gt;GET /metrics&lt;/code&gt; directly, pick the metrics to watch, and set your own thresholds; the thresholds in the rules file can serve as a reference&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Not verified on real hardware&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;Only knows SNMP polling (&lt;code&gt;snmpwalk&lt;/code&gt; must see rradius numbers)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Not supported&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;See &lt;a class=&#34;link&#34; href=&#34;#why-there-is-no-snmp-polling&#34; &gt;Why there is no SNMP polling&lt;/a&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;what-to-do-for-each-alert&#34;&gt;What to do for each alert&#xA;&lt;/h3&gt;&lt;p&gt;The table below is arranged from the description text and the &lt;code&gt;for&lt;/code&gt; setting of &lt;code&gt;rradius.rules.yml&lt;/code&gt;. &amp;ldquo;For&amp;rdquo; is the &lt;code&gt;for&lt;/code&gt; of the rule; when it is not written, the alert fires as soon as the condition holds.&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;Alert&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Suggested handling&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;RradiusDown&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The process died, or the &lt;code&gt;[metrics]&lt;/code&gt; address cannot be reached from Prometheus; look at the state and logs in systemd or the container&lt;/td&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;RradiusNoLeader&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The node is cut off, or the cluster lost its majority. The node cannot write: accounting goes to the spool and logins that need a write are rejected; see &lt;a class=&#34;link&#34; href=&#34;../16-cluster/#when-there-is-no-leader&#34; &gt;Chapter 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;&lt;code&gt;RradiusNotCaughtUp&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The local replica has been behind the cluster for more than 5 minutes: the node just joined or just restarted, or there is a lot of data; if there is no progress, look at 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;RradiusOverload&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;More requests are coming in than the node can handle: look for a slow database, directory or script; read it together with &lt;code&gt;RradiusSlowLogins&lt;/code&gt; and &lt;a class=&#34;link&#34; href=&#34;../21-troubleshooting/&#34; &gt;Chapter 21&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;RradiusDiscardingForTheDatabase&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The database cannot answer, or there is no leader to write to; read it together with &lt;code&gt;RradiusNoLeader&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;RradiusManyRejects&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A directory failure, a configuration error, or someone trying passwords; look at the reject reasons in 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;RradiusInvalidPackets&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Usually the shared secret of one device 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;RradiusSlowLogins&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The database, directory or script got slow; 1 second is only a starting point, adjust it to the device timeouts&lt;/td&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;RradiusAccountingSpoolBacklog&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The spool has held accounting for more than 15 minutes, so the database or the cluster has a problem; it replays by itself after recovery, see &lt;a class=&#34;link&#34; href=&#34;../13-accounting/#the-accounting-spool&#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;&lt;code&gt;RradiusAccountingSpoolLoss&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Some records were rejected or found corrupted during replay and did not reach the database; 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;RradiusAccountingLogDropping&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Some requests were not written to the accounting log file: the disk is too slow, full or not writable (the metrics exist only when &lt;code&gt;[radius.accounting_log]&lt;/code&gt; is 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;code&gt;RradiusExternalDatabaseUnreachable&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An external database with &lt;code&gt;required_for_ready&lt;/code&gt; cannot be reached; the &lt;code&gt;/readyz&lt;/code&gt; of this node answers 503 and the load balancer moves it out. Check the database and 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;RradiusExternalDatabaseFailing&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Calls to an external database fail (&lt;code&gt;reason=&amp;quot;unavailable&amp;quot;&lt;/code&gt;): the database is down or slow, or the network is broken&lt;/td&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;RradiusExternalDatabasePoolFull&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The connection pool has been full for more than 5 minutes and calls are queueing: queries got slow, or &lt;code&gt;pool_size&lt;/code&gt; is too small&lt;/td&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;RradiusNamedQueryStale&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A named query has not succeeded for more than 2 minutes, so numbers that depend on it (for example address pool usage) are old; look at &lt;code&gt;RradiusNamedQueryFailing&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;&lt;code&gt;RradiusNamedQueryFailing&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The &lt;code&gt;reason&lt;/code&gt; label is &lt;code&gt;timeout&lt;/code&gt;, &lt;code&gt;error&lt;/code&gt; or &lt;code&gt;shape&lt;/code&gt; (the columns of the result do not match the labels and value); see &lt;a class=&#34;link&#34; href=&#34;../09-external-databases/#named-queries-turn-sql-into-metrics&#34; &gt;Chapter 09&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;RradiusReloadFailed&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The node keeps running with the old configuration; the log says why; fix it and reload 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;&lt;code&gt;RradiusLogLinesDropped&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The place the log goes to is too slow, see &lt;a class=&#34;link&#34; href=&#34;#when-log-lines-are-dropped&#34; &gt;When log lines are dropped&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;RradiusEapSessionsLost&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;More 802.1X conversations at the same time than the node keeps; some were pushed out or refused; see &lt;a class=&#34;link&#34; href=&#34;../21-troubleshooting/#eap-is-stuck-or-fails&#34; &gt;Chapter 21&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;Thresholds are a starting point, not the right answer.&lt;/strong&gt; The rules were written from the meaning of the metrics and from synthetic data, and were not calibrated on your traffic. After going live, look at a few weeks of real numbers, and then adjust the &lt;code&gt;for&lt;/code&gt; times and the ratio and time thresholds such as &lt;code&gt;RradiusManyRejects&lt;/code&gt; and &lt;code&gt;RradiusSlowLogins&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;turning-alerts-into-snmp-traps&#34;&gt;Turning alerts into SNMP traps&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;snmp_notifier&lt;/code&gt; (a separate open-source project, &lt;a class=&#34;link&#34; href=&#34;https://github.com/maxwo/snmp_notifier&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;&#xA;    &gt;https://github.com/maxwo/snmp_notifier&lt;/a&gt;, not part of rradius) receives the Alertmanager webhook and sends one SNMP trap for each group of alerts. The steps below come from &lt;code&gt;deploy/monitoring/README.md&lt;/code&gt; and the earlier version of the chapter. The flags and behavior of &lt;code&gt;snmp_notifier&lt;/code&gt; are &lt;strong&gt;not verified on real hardware&lt;/strong&gt;; go by its own &lt;code&gt;--help&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Put the &lt;code&gt;route&lt;/code&gt; and &lt;code&gt;receivers&lt;/code&gt; of &lt;code&gt;alertmanager.yml&lt;/code&gt; into your Alertmanager configuration. The receiver sends alerts to &lt;code&gt;http://snmp-notifier:9464/alerts&lt;/code&gt;, and also sends them when resolved (&lt;code&gt;send_resolved: true&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Start &lt;code&gt;snmp_notifier&lt;/code&gt;, pointing at the monitoring system that receives traps:&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;snmp_notifier --snmp.destination&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;nms.example.net:162 --snmp.community&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&amp;lt;community string&amp;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;  --trap.default-oid&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&amp;lt;your enterprise number&amp;gt;.1 &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;  --trap.description-template&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/etc/snmp_notifier/description-template.tpl&#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;Its default trap OID (&lt;code&gt;1.3.6.1.4.1.98789.1&lt;/code&gt;) is not yours; replace it with a subtree under your own enterprise number. When an alert has an &lt;code&gt;oid&lt;/code&gt; label (or you name the label with &lt;code&gt;--trap.oid-label&lt;/code&gt;), that alert uses this value as the trap OID. &lt;code&gt;rradius.rules.yml&lt;/code&gt; currently sets no &lt;code&gt;oid&lt;/code&gt; label; to give important alerts different OIDs, add it to the &lt;code&gt;labels&lt;/code&gt; of the rule yourself.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;The v2c community string is plain text.&lt;/strong&gt; For authentication and encryption use v3: &lt;code&gt;--snmp.version=V3&lt;/code&gt; with the &lt;code&gt;--snmp.authentication-*&lt;/code&gt; and &lt;code&gt;--snmp.private-*&lt;/code&gt; options.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;A received trap looks like this (output of &lt;code&gt;snmptrapd&lt;/code&gt;, tidied up, taken from the earlier version of the chapter):&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;iso.3.6.1.6.3.1.1.4.1.0 = OID: iso.3.6.1.4.1.98789.1&#xA;iso.3.6.1.4.1.98789.2.1 = STRING: &amp;#34;1.3.6.1.4.1.98789.1[alertname=RradiusDown,instance=a:9812]&amp;#34;&#xA;iso.3.6.1.4.1.98789.2.2 = STRING: &amp;#34;critical&amp;#34;&#xA;iso.3.6.1.4.1.98789.2.3 = STRING: &amp;#34;1/1 alerts are firing:&#xA;  Status: critical&#xA;  - Alert: RradiusDown&#xA;    Summary: rradius on a:9812 cannot be scraped&amp;#34;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To make the monitoring system understand it, set the trap OID and the three fields (name, severity, description) as its trap rule.&lt;/p&gt;&#xA;&lt;h3 id=&#34;why-there-is-no-snmp-polling&#34;&gt;Why there is no SNMP polling&#xA;&lt;/h3&gt;&lt;p&gt;A built-in SNMP agent would have to handle SNMP encoding and (for v3) authentication and encryption inside rradius, which is a new attack surface, and there is no usable dependency (the project rule is to add no dependencies). The standard RADIUS server MIBs (RFC 4669, RFC 4671) also have only a few counters per client, and can answer far fewer questions than the Prometheus metrics. If a system that only does SNMP polling really has to be connected, a workable approach later is to let rradius connect through AgentX (RFC 2741) to net-snmp on the host and hang the metrics under one MIB subtree, leaving authentication and encryption to &lt;code&gt;snmpd&lt;/code&gt;. This has not been done; it needs a clear requirement before it is evaluated.&lt;/p&gt;&#xA;&lt;h3 id=&#34;what-was-verified&#34;&gt;What was verified&#xA;&lt;/h3&gt;&lt;p&gt;The following is recorded from the earlier version of the chapter and was not rerun this time:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Rules:&lt;/strong&gt; &lt;code&gt;promtool check rules&lt;/code&gt; passed; every &lt;code&gt;rradius_*&lt;/code&gt; metric name used by the 19 rules was checked against &lt;code&gt;/metrics&lt;/code&gt; of a running server or the source code; &lt;code&gt;promtool test rules&lt;/code&gt; used 9 synthetic time series to verify the alerts that should and should not fire.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Notification:&lt;/strong&gt; &lt;code&gt;amtool check-config&lt;/code&gt; passed; the path of Alertmanager sending a webhook to &lt;code&gt;snmp_notifier&lt;/code&gt; and then a v2c trap to &lt;code&gt;snmptrapd&lt;/code&gt; was tested locally in containers.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Not verified:&lt;/strong&gt; the thresholds of the rules under real traffic, SNMP v3 traps, a real monitoring system (Zabbix, a traditional NMS) as the receiver, and reading rradius with &lt;code&gt;snmpwalk&lt;/code&gt; (not supported).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;live-state-with-status&#34;&gt;Live state with status&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;status&lt;/code&gt; reads &lt;code&gt;[metrics]&lt;/code&gt; from the configuration file, connects to the metrics port of this node, takes two samples one second apart, and computes per-second rates:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd status --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius status of 127.0.0.1:9812 over 1.0 s&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Node&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Ready                     ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Leader                    1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Has a leader              1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Caught up                 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Applied index             5&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Seconds without a leader  0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Version                   0.1.0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Seconds running           41&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Reload&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Successful                1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Failed                    0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Last success (Unix time)  1795384693&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;RADIUS&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Auth requests              0.0/s (8)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Acct requests              0.0/s (1)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Access-Accept              0.0/s (2)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Access-Reject              0.0/s (6)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Access-Challenge           0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Accounting-Response        0.0/s (1)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Duplicates                 0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Discarded: overload        0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Discarded: unknown client  0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Discarded: invalid         0.0/s (1)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Discarded: database        0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Discarded: no leader       0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  In bytes                   0.0 B/s (396 B)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Out bytes                  0.0 B/s (128 B)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Auth in progress           0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Auth limit                 4096&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Acct in progress           0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Acct limit                 4096&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Queries&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  accounts_by_state last success (seconds ago)  2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  accounts_by_state rows                        2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  accounts_by_state failed runs                 0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;TACACS+&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Open connections  0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Authentication    0.0/s (1)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Authorization     0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Accounting        0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Replies           0.0/s (1)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Malformed         0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  In bytes          0.0 B/s (46 B)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Out bytes         0.0 B/s (28 B)&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;0.0/s (8)&lt;/code&gt;: the first number is the rate over this second, and the number in parentheses is the total since the start.&lt;/li&gt;&#xA;&lt;li&gt;Byte items such as &lt;code&gt;In bytes&lt;/code&gt; and &lt;code&gt;Out bytes&lt;/code&gt; are shown as &lt;code&gt;58.6 KiB/s (1.0 MiB)&lt;/code&gt;: the units are B, KiB, MiB, GiB and TiB, each 1024 times the one before (unlike the 1000-based units common on network interfaces and cloud bills), the rate has one decimal place, and the total is a whole number in B. &lt;code&gt;--json&lt;/code&gt; and &lt;code&gt;/metrics&lt;/code&gt; do no conversion: &lt;code&gt;rate&lt;/code&gt; is bytes per second and &lt;code&gt;total&lt;/code&gt; is bytes, for programs to read.&lt;/li&gt;&#xA;&lt;li&gt;When there is no traffic in this second, the p50 and p99 lines of RADIUS and TACACS+ do not appear.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Send traffic while you look, and the response times appear:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --auth-port &lt;span style=&#34;color:#ae81ff&#34;&gt;1812&lt;/span&gt; --secret &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$S&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&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;    --user alice --password alice-password --load pap,rate=200 --warmup 0 --duration 4 &amp;gt; /dev/null &amp;amp;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd status --config rradius.toml&#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;RADIUS&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Auth requests              200.5/s (414)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Acct requests              0.0/s (1)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Access-Accept              200.5/s (408)&#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;  Auth p50 (ms)              0.15&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Auth p99 (ms)              0.25&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;p50 and p99 are interpolated from the increase in each histogram bucket during this second, in milliseconds. The buckets have a limited width, so this is an estimate, not the actual order of each request.&lt;/p&gt;&#xA;&lt;h3 id=&#34;flags-and-exit-codes&#34;&gt;Flags and exit codes&#xA;&lt;/h3&gt;&lt;p&gt;Usage: &lt;code&gt;rradiusd status [--config &amp;lt;path&amp;gt;] [--cluster] [--watch | --json | --tui]&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;Flag&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;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;&lt;code&gt;--config&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The configuration file, default &lt;code&gt;/etc/rradius/rradius.toml&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;--watch&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Print once a second until you press Ctrl+C (exit code 0). When the output goes to a terminal, it clears the screen 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;&lt;code&gt;--json&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Print JSON instead, one object each 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;--cluster&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Look at all members of the cluster, see &lt;a class=&#34;link&#34; href=&#34;#looking-at-the-whole-cluster&#34; &gt;Looking at the whole cluster&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;--tui&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A full-screen interactive view, see &lt;a class=&#34;link&#34; href=&#34;#full-screen-view&#34; &gt;Full-screen view&lt;/a&gt;; it cannot be combined with &lt;code&gt;--json&lt;/code&gt; or &lt;code&gt;--watch&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&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;Exit code&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;0&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The result was printed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&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;A bad argument, the configuration file cannot be read, or the configuration has no &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;3&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The metrics port cannot be reached; with &lt;code&gt;--cluster&lt;/code&gt;, not one member could be reached&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;With &lt;code&gt;--watch&lt;/code&gt;, failing to connect does not end the command; it retries every second and prints the error. If the server restarts between two samples, the counters get smaller, and one extra line appears below the first line: &lt;code&gt;counters reset since the previous sample: the server restarted&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;full-screen-view&#34;&gt;Full-screen view&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;status --tui&lt;/code&gt; draws the sections above on a full screen and updates every second, so you do not have to run the command again and again. It draws exactly the sections that &lt;code&gt;status&lt;/code&gt; prints, so it has no data source of its own, and sections added by the enterprise edition or later are added as a page automatically.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;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;Left and right arrows, Tab&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Change section (wraps around at the end)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Up and down arrows&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Select an item in the section; an item with a rate is drawn as a line chart 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;[&lt;/code&gt;, &lt;code&gt;]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;When used with &lt;code&gt;--cluster&lt;/code&gt;, select the previous or next member; the starting selection is &amp;ldquo;all&amp;rdquo;, which shows the sections summed over all members 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;p&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Pause and resume: while paused the screen does not move but sampling keeps accumulating, and after resuming the chart has the points from this 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;q&lt;/code&gt;, Esc, Ctrl+C&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Quit; the terminal returns to its original screen and cursor&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Each section is drawn as an item table (name, rate per second or value, total), and the selected item is the highlighted row. When an item with a rate is selected, below the table is its line chart for the last 60 seconds: the horizontal axis runs from 60 seconds ago to now, and the vertical axis from 0 to the maximum rate in this period (at least 1). The history lives only in the memory of the running screen, so at first there are only the samples already taken; a sample where a server restart reset the counters is recorded as 0. Items without a rate (version, status text) have only the table and no chart. Sections added by the enterprise edition automatically get the same table and chart, with no extra setup.&lt;/p&gt;&#xA;&lt;p&gt;When used with &lt;code&gt;--cluster&lt;/code&gt;, there is a member table at the top. The first row &amp;ldquo;all&amp;rdquo; is the sum over all members, followed by one row per member (node, role, &lt;code&gt;/readyz&lt;/code&gt;, logins and accounting per second, requests being handled). When &amp;ldquo;all&amp;rdquo; is selected, each rate and total below is the sum over the members that answered, and the chart is the summed rate too. A member that cannot be reached is marked &lt;code&gt;unreachable&lt;/code&gt; in the table with the reason, the screen keeps updating, and it is not counted in the sum; when it is selected, the part below says it did not answer.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;--tui&lt;/code&gt; is a feature of every edition and does not need to be compiled in separately. When standard output is not a terminal (redirected to a file or a pipe), it exits with 2 and writes nothing.&lt;/p&gt;&#xA;&lt;h3 id=&#34;json-output&#34;&gt;JSON output&#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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd status --config rradius.toml --json&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&amp;#34;address&amp;#34;:&amp;#34;127.0.0.1:9812&amp;#34;,&amp;#34;counter_reset&amp;#34;:false,&amp;#34;interval_seconds&amp;#34;:1.003252166,&amp;#34;ready&amp;#34;:{&amp;#34;status&amp;#34;:200,&amp;#34;text&amp;#34;:&amp;#34;ok&amp;#34;},&amp;#34;sections&amp;#34;:[{&amp;#34;items&amp;#34;:[{&amp;#34;key&amp;#34;:&amp;#34;ready&amp;#34;,&amp;#34;label&amp;#34;:&amp;#34;Ready&amp;#34;,&amp;#34;value&amp;#34;:&amp;#34;ok&amp;#34;},…&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;(The real output is one single line; it is abridged here. The keys of an object are sorted alphabetically.)&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;sections&lt;/code&gt; is an array, and each element has &lt;code&gt;key&lt;/code&gt;, &lt;code&gt;title&lt;/code&gt; and &lt;code&gt;items&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Each item has &lt;code&gt;key&lt;/code&gt;, &lt;code&gt;label&lt;/code&gt;, and one of two sets: &lt;code&gt;value&lt;/code&gt; (the current value) or &lt;code&gt;rate&lt;/code&gt; plus &lt;code&gt;total&lt;/code&gt; (rate and total). For example &lt;code&gt;{&amp;quot;key&amp;quot;:&amp;quot;auth_requests&amp;quot;,&amp;quot;label&amp;quot;:&amp;quot;Auth requests&amp;quot;,&amp;quot;rate&amp;quot;:200.65753617774516,&amp;quot;total&amp;quot;:618}&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;When a program reads it, use &lt;code&gt;key&lt;/code&gt;, not &lt;code&gt;label&lt;/code&gt;. In this measurement the section keys were, in order, &lt;code&gt;node&lt;/code&gt;, &lt;code&gt;reload&lt;/code&gt;, &lt;code&gt;radius&lt;/code&gt;, &lt;code&gt;radius_top_clients&lt;/code&gt;, &lt;code&gt;queries&lt;/code&gt;, &lt;code&gt;tacacs&lt;/code&gt;, &lt;code&gt;eap&lt;/code&gt;, &lt;code&gt;acct_spool&lt;/code&gt;, &lt;code&gt;acct_log&lt;/code&gt;, &lt;code&gt;netlogon&lt;/code&gt;, &lt;code&gt;log&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;the-sections-of-status&#34;&gt;The sections of status&#xA;&lt;/h2&gt;&lt;p&gt;The sections appear in a fixed order, and &lt;strong&gt;a section or line with no matching metric is not printed&lt;/strong&gt;. For example, without &lt;code&gt;[radius.accounting_log]&lt;/code&gt; there is no Accounting log section; with a configuration that runs only TACACS+, the RADIUS section has no in progress and limit lines.&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 (key)&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Content&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Main 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;Node (&lt;code&gt;node&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The &lt;code&gt;/readyz&lt;/code&gt; answer, whether this node is the leader, whether there is a leader, whether it has caught up, which entry has been applied, seconds without a leader, version, seconds running&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;16&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reload (&lt;code&gt;reload&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The number of successful and failed reloads, the Unix time of the last success&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;RADIUS (&lt;code&gt;radius&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rates of requests and responses, retransmits, each kind of drop, in progress and limit, p50/p99&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;this chapter, 05, 19&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Busiest RADIUS clients (&lt;code&gt;radius_top_clients&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The top five clients by responses in this second; those with no response in this second are not listed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;05&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;External databases (&lt;code&gt;databases&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Connections of each external database, each kind of failure, whether it is reachable&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;09&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Queries (&lt;code&gt;queries&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How long ago each named query succeeded, how many rows, how many failures&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;09&lt;/td&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+ (&lt;code&gt;tacacs&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Open connections, each kind of request, requests that could not be decoded, p50/p99&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;12&lt;/td&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 (&lt;code&gt;eap&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Conversations in progress&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;11&lt;/td&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;code&gt;acct_spool&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Bytes waiting to be replayed, replays that succeeded, rejected, failures to write to the spool&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;Accounting log (&lt;code&gt;acct_log&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Written, dropped, open failures, write failures&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;Netlogon (&lt;code&gt;netlogon&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Connections to the domain controller and login results&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;08&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Log (&lt;code&gt;log&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Dropped log lines&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;this chapter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;When an external database cannot be reached, the Ready line of Node shows the text of &lt;code&gt;/readyz&lt;/code&gt; directly:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd status --config rradius.toml&#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;Node&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Ready                     database billing unreachable&#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;External databases&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  billing connections in use      0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  billing connections idle        0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  billing connections max         8&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  billing failures (unavailable)  0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  billing failures (mistake)      0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  billing failures (unknown)      0.0/s (0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  billing reachable               no&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Enterprise edition:&lt;/strong&gt; The &lt;code&gt;status&lt;/code&gt; of the enterprise edition has more sections, for RadSec, proxying and dynamic clients.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;looking-at-the-whole-cluster&#34;&gt;Looking at the whole cluster&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;status --cluster&lt;/code&gt; asks the cluster for its member list, then samples every member at the same time, one line per member:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd status --config rradius.toml --cluster&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius cluster status over 1.0 s, members from the cluster&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node   role    ready  auth/s  acct/s  discarded/s  in progress  address&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1      leader  ok     0.0     0.0     0.0          0            127.0.0.1:9812&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;total          1/1    0.0     0.0     0.0          0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;The member list is requested from the cluster&amp;rsquo;s API port with &lt;code&gt;cluster.secret_api&lt;/code&gt;. When no node&amp;rsquo;s API answers, it falls back to &lt;code&gt;cluster.nodes&lt;/code&gt; in the configuration file, and the first line says &lt;code&gt;members from this configuration: no node&#39;s api answered&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The metrics address of each member is the host of its API address plus the &lt;code&gt;[metrics]&lt;/code&gt; port of &lt;strong&gt;this&lt;/strong&gt; node. So the &lt;code&gt;[metrics]&lt;/code&gt; of every node must use the same port, and &lt;code&gt;bind&lt;/code&gt; must be an address this host can reach. Members that cannot be reached are listed below the table with the reason, together with the hint &lt;code&gt;every node&#39;s [metrics] bind has to be an address this host can reach, on the same port as here&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;role&lt;/code&gt; is &lt;code&gt;leader&lt;/code&gt;, &lt;code&gt;follower&lt;/code&gt; or &lt;code&gt;learner&lt;/code&gt;. The &lt;code&gt;total&lt;/code&gt; line adds up the members that could be reached; &lt;code&gt;1/1&lt;/code&gt; is how many could be reached out of how many there are.&lt;/li&gt;&#xA;&lt;li&gt;A member reached for the first time has no rate until the next sample; with &lt;code&gt;--watch&lt;/code&gt;, the list is requested again every 10 seconds.&lt;/li&gt;&#xA;&lt;li&gt;With &lt;code&gt;--json&lt;/code&gt;, the &lt;code&gt;status&lt;/code&gt; field of each member is the content of the single-node &lt;code&gt;status --json&lt;/code&gt;, and the outer object also has &lt;code&gt;members_from&lt;/code&gt;, &lt;code&gt;nodes&lt;/code&gt; and &lt;code&gt;total&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; The output above has only one node. The table with several nodes and the case of unreachable members are based on &lt;code&gt;rradius-core/src/status.rs&lt;/code&gt; and &lt;code&gt;specs/server-status&lt;/code&gt; (Status of the Whole Cluster). Setting up a multi-node cluster is in &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 16&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;adjusting-the-log&#34;&gt;Adjusting the log&#xA;&lt;/h2&gt;&lt;p&gt;The server writes all messages to stderr and writes nothing to standard output (stdout). Under systemd they go to the journal, and in a container they go to the container&amp;rsquo;s log.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Reload&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;&lt;code&gt;log.level&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;info&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;error&lt;/code&gt;, &lt;code&gt;warn&lt;/code&gt;, &lt;code&gt;info&lt;/code&gt; or &lt;code&gt;debug&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;log.format&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;text&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;text&lt;/code&gt; or &lt;code&gt;json&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;log.auth&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Write one authentication record for every authentication decision&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Changing &lt;code&gt;[log]&lt;/code&gt; itself needs a restart, but &lt;code&gt;[log.trace]&lt;/code&gt; under it takes effect on reload. Measured, changing &lt;code&gt;format&lt;/code&gt; at reload:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::reload: configuration reloaded from rradius.toml; these need a restart to apply: [log]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;The level governs only rradius&amp;rsquo;s own messages.&lt;/strong&gt; Other libraries (for example the cluster database) are fixed to write only &lt;code&gt;warn&lt;/code&gt; and above, even with &lt;code&gt;level = &amp;quot;debug&amp;quot;&lt;/code&gt;, so that you are not drowned in internal messages.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;text and json:&lt;/strong&gt; in text, each line is time, level, source (target) and message; in json, each line is an object with &lt;code&gt;timestamp&lt;/code&gt;, &lt;code&gt;level&lt;/code&gt;, &lt;code&gt;target&lt;/code&gt; and &lt;code&gt;message&lt;/code&gt;, and other fields flattened at the same level. The same startup message in the two formats, measured:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2026-11-22T21:57:39.189728Z  INFO rradius_core::cli: Servers started. Press Ctrl+C to stop.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&amp;#34;timestamp&amp;#34;:&amp;#34;2026-11-22T21:59:07.062005Z&amp;#34;,&amp;#34;level&amp;#34;:&amp;#34;INFO&amp;#34;,&amp;#34;message&amp;#34;:&amp;#34;Servers started. Press Ctrl+C to stop.&amp;#34;,&amp;#34;target&amp;#34;:&amp;#34;rradius_core::cli&amp;#34;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To have a log collection system parse the log, use json.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Outside values cannot break a line.&lt;/strong&gt; In values that come from outside, such as a user name, newlines and control characters are turned into escape sequences. A record always takes exactly one line, and nobody can forge a fake record with a user name.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The same event does not flood the log.&lt;/strong&gt; RADIUS packets from unknown clients and TACACS+ connections from unknown clients are logged at most one line per second, and the next line says how many happened in between; the counters count every one. Overload works the same way, measured:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::radius: RADIUS authentication overloaded: discarded 252 packets&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;authentication-records&#34;&gt;Authentication records&#xA;&lt;/h2&gt;&lt;p&gt;With &lt;code&gt;log.auth = true&lt;/code&gt; (the default), one record is written for every RADIUS or TACACS+ authentication decision, with target &lt;code&gt;rradius_auth&lt;/code&gt;, not affected by &lt;code&gt;level&lt;/code&gt;: it is written even with &lt;code&gt;level = &amp;quot;error&amp;quot;&lt;/code&gt;. Packets for which no decision was made (retransmits, overload drops, failed validation) are not written.&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;bob&amp;#34; account=&amp;#34;bob&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;sql&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::auth_chain: auth lockout: client localhost: account &amp;#34;bob&amp;#34; from &amp;#34;&amp;#34; is locked (this origin)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;bob&amp;#34; account=&amp;#34;bob&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;lockout&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;tacacs&amp;#34; client=&amp;#34;lab-switch&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; account=&amp;#34;alice&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;sql&amp;#34; decision=&amp;#34;accept&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The same record in json format:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&amp;#34;timestamp&amp;#34;:&amp;#34;2026-11-22T21:59:25.940382Z&amp;#34;,&amp;#34;level&amp;#34;:&amp;#34;INFO&amp;#34;,&amp;#34;message&amp;#34;:&amp;#34;authentication&amp;#34;,&amp;#34;protocol&amp;#34;:&amp;#34;radius&amp;#34;,&amp;#34;client&amp;#34;:&amp;#34;localhost&amp;#34;,&amp;#34;source&amp;#34;:&amp;#34;127.0.0.1&amp;#34;,&amp;#34;user&amp;#34;:&amp;#34;alice&amp;#34;,&amp;#34;account&amp;#34;:&amp;#34;alice&amp;#34;,&amp;#34;chain&amp;#34;:&amp;#34;default&amp;#34;,&amp;#34;handler&amp;#34;:&amp;#34;sql&amp;#34;,&amp;#34;decision&amp;#34;:&amp;#34;accept&amp;#34;,&amp;#34;target&amp;#34;:&amp;#34;rradius_auth&amp;#34;}&#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;Field&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;&lt;code&gt;protocol&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius&lt;/code&gt; or &lt;code&gt;tacacs&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;client&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The name of the client that matched&lt;/td&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;source&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The source address of the 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;&lt;code&gt;user&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The user name in the request; an empty string when there is 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;&lt;code&gt;account&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The account the auth chain actually looked up after normalization (after removing the realm and lowercasing)&lt;/td&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;chain&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The name of the auth chain; the one in &lt;code&gt;[auth]&lt;/code&gt; is called &lt;code&gt;default&lt;/code&gt;; &lt;code&gt;script&lt;/code&gt; when there is no auth chain and a script decides&lt;/td&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;handler&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The handler that made the decision, for example &lt;code&gt;sql&lt;/code&gt;, &lt;code&gt;lua&lt;/code&gt;, &lt;code&gt;ldap&lt;/code&gt;; &lt;code&gt;none&lt;/code&gt; when every handler was skipped; &lt;code&gt;normalization&lt;/code&gt; when the name was rejected by the auth chain; &lt;code&gt;lockout&lt;/code&gt; when the account is locked&lt;/td&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;decision&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accept&lt;/code&gt;, &lt;code&gt;reject&lt;/code&gt; or &lt;code&gt;challenge&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 record has only these fields. It does not contain passwords, CHAP or MS-CHAPv2 responses, or the TACACS+ &lt;code&gt;data&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;When you do not need authentication records (for example because accounting data is available elsewhere, or the log volume is too large), set &lt;code&gt;log.auth = false&lt;/code&gt;. Measured: after turning it off, a successful login no longer produces a &lt;code&gt;rradius_auth&lt;/code&gt; line.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; When the log cannot be written, lines are dropped (see &lt;a class=&#34;link&#34; href=&#34;#when-log-lines-are-dropped&#34; &gt;When log lines are dropped&lt;/a&gt;), so authentication records cannot be treated as a complete audit record. For a record with nothing missing, use the accounting data or the accounting log file of Chapter 13.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;tracing-a-specific-user-or-client&#34;&gt;Tracing a specific user or client&#xA;&lt;/h2&gt;&lt;p&gt;To see the full request and response of every login of one user, for example to confirm that a reply attribute was sent, turn on &lt;code&gt;[log.trace]&lt;/code&gt;. It always has a time limit and stops by itself when the time is up.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Reload&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;&lt;code&gt;log.trace.users&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[]&lt;/code&gt;&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;The &lt;code&gt;User-Name&lt;/code&gt; values to trace, which must match exactly&lt;/td&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.clients&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[]&lt;/code&gt;&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;The names of the RADIUS clients to trace, which must be the &lt;code&gt;name&lt;/code&gt; in &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;&lt;code&gt;log.trace.minutes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;none, required&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;How long to trace, 1 to 1440 minutes&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;users&lt;/code&gt; and &lt;code&gt;clients&lt;/code&gt; cannot both be empty. A match on either one is recorded. The trace covers only RADIUS, and &lt;code&gt;check&lt;/code&gt; rejects it when the configuration has no &lt;code&gt;[radius]&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Start tracing:&lt;/strong&gt; add this to &lt;code&gt;rradius.toml&lt;/code&gt; (before &lt;code&gt;[metrics]&lt;/code&gt;, or in a file in &lt;code&gt;conf.d/&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:#75715e&#34;&gt;# rradius.toml&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&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;alice&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;10&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then &lt;code&gt;check&lt;/code&gt; and send SIGHUP:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kill -HUP &amp;lt;pid&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The server&amp;rsquo;s log:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::radius: [log.trace] is on for 10 minutes: requests of these users and clients are written out in full, personal data included&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::reload: configuration reloaded from rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;See the result:&lt;/strong&gt; let &lt;code&gt;alice&lt;/code&gt; log in once, then let &lt;code&gt;carol&lt;/code&gt;, who is not on the list, log in once:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; account=&amp;#34;alice&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;sql&amp;#34; decision=&amp;#34;accept&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_trace: request client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; code=1 attributes=&amp;#34;Message-Authenticator = &amp;lt;hidden&amp;gt;, User-Name = alice, User-Password = &amp;lt;hidden&amp;gt;, NAS-IP-Address = 192.0.2.1, NAS-Identifier = rradius-bench&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_trace: response client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; code=2 attributes=&amp;#34;Message-Authenticator = &amp;lt;hidden&amp;gt;, Session-Timeout = 3600, Filter-Id = staff&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;carol&amp;#34; account=&amp;#34;carol&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;none&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;Each matching request gives two lines, &lt;code&gt;request&lt;/code&gt; and &lt;code&gt;response&lt;/code&gt;, with target &lt;code&gt;rradius_trace&lt;/code&gt;, not affected by &lt;code&gt;level&lt;/code&gt;. When no response was sent, the second line is &lt;code&gt;no response&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;code&lt;/code&gt; is the RADIUS packet code: 1 is Access-Request and 2 is Access-Accept.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;alice&lt;/code&gt; received &lt;code&gt;Session-Timeout = 3600&lt;/code&gt; and &lt;code&gt;Filter-Id = staff&lt;/code&gt;, which are exactly the reply attributes you could not see with &lt;code&gt;rradius-bench&lt;/code&gt; in Chapter 03.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;carol&lt;/code&gt; is not on the list, so she has only the authentication record and no trace.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Which values are hidden:&lt;/strong&gt; these attributes are always shown as &lt;code&gt;&amp;lt;hidden&amp;gt;&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Attributes marked with the &lt;code&gt;encrypt&lt;/code&gt; or &lt;code&gt;secret&lt;/code&gt; option in the dictionary.&lt;/li&gt;&#xA;&lt;li&gt;Attributes whose name (case-insensitive) contains &lt;code&gt;pass&lt;/code&gt;, &lt;code&gt;secret&lt;/code&gt;, &lt;code&gt;key&lt;/code&gt;, &lt;code&gt;token&lt;/code&gt;, &lt;code&gt;chap&lt;/code&gt;, &lt;code&gt;arap&lt;/code&gt;, &lt;code&gt;-pw&lt;/code&gt;, &lt;code&gt;-cpw&lt;/code&gt;, &lt;code&gt;digest&lt;/code&gt;, &lt;code&gt;signature&lt;/code&gt;, &lt;code&gt;psk&lt;/code&gt;, &lt;code&gt;pmk&lt;/code&gt; or &lt;code&gt;credential&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The standard attributes numbered 2, 3, 24, 60, 69, 70, 79 and 80 (User-Password, CHAP-Password, State, CHAP-Challenge, ARAP-Password, Tunnel-Password, EAP-Message, Message-Authenticator), whatever name the dictionary gives them.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Other values are written as they are, each at most 128 characters (binary values at most 64 bytes, shown in hexadecimal).&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; A trace writes personal data such as user names, MAC addresses and IP addresses into the log in full, and that data goes wherever the log goes. Turn it on only when needed, turn it off when done, and keep &lt;code&gt;minutes&lt;/code&gt; short.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;How the time is counted:&lt;/strong&gt; &lt;code&gt;minutes&lt;/code&gt; starts counting again from when the configuration is loaded or from &lt;strong&gt;every&lt;/strong&gt; reload. If you reload for another reason while a trace is on, the countdown also starts over, and the log prints &lt;code&gt;[log.trace] is on for 10 minutes&lt;/code&gt; again.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;End it early:&lt;/strong&gt; delete &lt;code&gt;[log.trace]&lt;/code&gt; and reload.&lt;/p&gt;&#xA;&lt;h2 id=&#34;when-log-lines-are-dropped&#34;&gt;When log lines are dropped&#xA;&lt;/h2&gt;&lt;p&gt;The log is written by a background thread. If stderr is written too slowly (for example the receiver is stuck) and the queue is full, the server prefers to drop log lines rather than make requests wait. The number of dropped lines, and of lines that failed to write, is recorded in &lt;code&gt;rradius_log_dropped_lines_total&lt;/code&gt;; &lt;code&gt;RradiusLogLinesDropped&lt;/code&gt; in the rules file alerts when it increases.&lt;/p&gt;&#xA;&lt;p&gt;If you see it increase, the place the log goes to cannot keep up, for example the journal or the log collector is too slow, or the disk is full. The authentication records and traces of this period may be incomplete.&lt;/p&gt;&#xA;&lt;p&gt;When SIGTERM or Ctrl+C makes the server prepare to exit, it waits at most 5 seconds for the log in the queue to be written.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; In the measurements for this chapter, &lt;code&gt;rradius_log_dropped_lines_total&lt;/code&gt; stayed at 0, and no blocked-log situation was produced. The behavior is based on &lt;code&gt;rradius-core/src/logging.rs&lt;/code&gt; and &lt;code&gt;specs/server-logging&lt;/code&gt; (Log Output Never Delays Requests).&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;status&lt;/code&gt; prints &lt;code&gt;status needs [metrics]: the command reads this node&#39;s /metrics. Add to rradius.toml:&lt;/code&gt;, followed by a suggested configuration, and exit code 2.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The configuration file has no &lt;code&gt;[metrics]&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add &lt;code&gt;[metrics]&lt;/code&gt; and restart the server (&lt;code&gt;[metrics]&lt;/code&gt; needs a restart to take effect).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;status&lt;/code&gt; prints &lt;code&gt;cannot reach the metrics port at 127.0.0.1:9812: Connection refused (os error 61)&lt;/code&gt;, exit code 3.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The server is not running, or the configuration file &lt;code&gt;status&lt;/code&gt; reads is not the one the server uses, so the port differs. The error code number differs by operating system.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Make sure the server is running and &lt;code&gt;--config&lt;/code&gt; points to the same configuration.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;/readyz&lt;/code&gt; keeps answering 503 &lt;code&gt;database billing unreachable&lt;/code&gt;, but logins work.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;[databases.billing]&lt;/code&gt; has &lt;code&gt;required_for_ready = true&lt;/code&gt;, and this database cannot be reached.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Fix the connection to the database; if this database does not affect logins, remove &lt;code&gt;required_for_ready&lt;/code&gt; so that it does not affect the readiness state (needs a restart).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The log shows &lt;code&gt;reload failed, keeping the running configuration: rradius.toml: log.trace.minutes: 0 is not from 1 to 1440&lt;/code&gt;, and &lt;code&gt;Failed&lt;/code&gt; in the Reload section of &lt;code&gt;status&lt;/code&gt; goes up by 1.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The new configuration has an error at reload, and the server keeps using the original configuration.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Run &lt;code&gt;check&lt;/code&gt; before reloading. &lt;code&gt;minutes&lt;/code&gt; must be between 1 and 1440.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;log.trace.minutes is required: tracing has to end by itself&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;[log.trace]&lt;/code&gt; has no &lt;code&gt;minutes&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add &lt;code&gt;minutes&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;log.trace lists no users and no clients&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;users&lt;/code&gt; and &lt;code&gt;clients&lt;/code&gt; are both empty.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Write at least one user or client.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;log.trace.clients: &#39;nobody&#39; is not the name of a RADIUS client&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;clients&lt;/code&gt; takes the &lt;code&gt;name&lt;/code&gt; of a client, not an address.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change it to a name in &lt;code&gt;[[radius.clients]]&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;log.trace needs [radius]: it only covers RADIUS&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The configuration has only &lt;code&gt;[tacacs]&lt;/code&gt;. The trace covers only RADIUS.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; For TACACS+ problems, look at the authentication records and the &lt;code&gt;debug&lt;/code&gt; level log.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;log.level: &#39;loud&#39; is not error, warn, info or debug&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The level is misspelled.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change it to one of the four values.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; After changing &lt;code&gt;[log]&lt;/code&gt; and reloading, the log says &lt;code&gt;these need a restart to apply: [log]&lt;/code&gt;, and the format did not change.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;[log]&lt;/code&gt; needs a restart to take effect (&lt;code&gt;[log.trace]&lt;/code&gt; is the exception).&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Schedule a restart.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;curl -I http://…/metrics&lt;/code&gt; gets &lt;code&gt;405 Method Not Allowed&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The metrics port accepts only &lt;code&gt;GET&lt;/code&gt;, and &lt;code&gt;-I&lt;/code&gt; sends &lt;code&gt;HEAD&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Use &lt;code&gt;curl -s&lt;/code&gt; to fetch the content. Set the health checks of the monitoring system to &lt;code&gt;GET&lt;/code&gt; too.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04 Configuration file basics&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09 External databases and named queries&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13 Accounting and sessions&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16 Clusters and high availability&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../18-operations/&#34; &gt;18 Day-to-day operations&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;19 Performance tuning and load testing&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../21-troubleshooting/&#34; &gt;21 Troubleshooting&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../92-metrics-reference/&#34; &gt;Appendix C: Metrics reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>18 Day-to-day operations</title>
            <link>https://embark.systems/en/rradius/oss/18-operations/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/18-operations/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Change the configuration with &amp;ldquo;&lt;code&gt;check&lt;/code&gt; → &lt;code&gt;config diff&lt;/code&gt; → reload → read the log and metrics&amp;rdquo;&lt;/li&gt;&#xA;&lt;li&gt;Tell which settings take effect on reload and which need a restart, and restart and shut down safely&lt;/li&gt;&#xA;&lt;li&gt;Upgrade the program, add migrations, and know which tasks need downtime&lt;/li&gt;&#xA;&lt;li&gt;Know how the core protects your data, and that it has no backup feature&lt;/li&gt;&#xA;&lt;li&gt;Do all of this under systemd, logrotate, Docker Compose, Kubernetes and Synology&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: you have done &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;Chapter 03&lt;/a&gt; and read &lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;Chapter 04&lt;/a&gt;, so you know the configuration file, &lt;code&gt;include&lt;/code&gt; and &lt;code&gt;[shutdown]&lt;/code&gt;. For the cluster parts, read &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 16&lt;/a&gt; first.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#standard-procedure-for-changing-configuration&#34; &gt;Standard procedure for changing configuration&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#what-reload-applies&#34; &gt;What reload applies&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#shutdown-and-restart&#34; &gt;Shutdown and restart&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#rolling-restart-of-a-cluster&#34; &gt;Rolling restart of a cluster&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#upgrading-the-program&#34; &gt;Upgrading the program&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#adding-a-migration&#34; &gt;Adding a migration&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#accounts-sessions-and-queries&#34; &gt;Accounts, sessions and queries&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#changing-secrets&#34; &gt;Changing secrets&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#purging-old-data&#34; &gt;Purging old data&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#data-directory-and-data-protection&#34; &gt;Data directory and data protection&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#logs-and-logrotate&#34; &gt;Logs and logrotate&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#managing-with-systemd&#34; &gt;Managing with systemd&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#on-docker-compose-and-synology&#34; &gt;On Docker Compose and Synology&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#on-kubernetes&#34; &gt;On Kubernetes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#monitoring-the-metrics-to-watch-first&#34; &gt;Monitoring: the metrics to watch first&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#pre-launch-checklist&#34; &gt;Pre-launch checklist&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#what-requires-downtime&#34; &gt;What requires downtime&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The examples in this chapter use the quick-start scenario (&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;Chapter 03&lt;/a&gt;), plus an accounting log and &lt;code&gt;[shutdown]&lt;/code&gt;. All ports are the defaults: RADIUS 1812 and 1813, metrics 9812.&lt;/p&gt;&#xA;&lt;h2 id=&#34;standard-procedure-for-changing-configuration&#34;&gt;Standard procedure for changing configuration&#xA;&lt;/h2&gt;&lt;p&gt;Every configuration change follows these four steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;check&lt;/code&gt;:&lt;/strong&gt; can the new configuration be loaded?&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;config diff&lt;/code&gt;:&lt;/strong&gt; compared with the running one, what exactly changed?&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;reload:&lt;/strong&gt; send SIGHUP so the server rereads the configuration.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Read the log and metrics:&lt;/strong&gt; confirm that the change was applied, or learn which parts need a restart.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;1-check&#34;&gt;1. check&#xA;&lt;/h3&gt;&lt;p&gt;Write the new configuration to a separate file, or back up the old one first, then check:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cp rradius.toml rradius.toml.orig&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ vi rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#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; reads the configuration file, the included files, the dictionary, the scripts and the secret files. Exit code 0 means it can be loaded and 2 means there is an error. It opens no ports and does not touch the data directory, so you can run it while the server is running.&lt;/p&gt;&#xA;&lt;h3 id=&#34;2-config-diff&#34;&gt;2. config diff&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;config diff&lt;/code&gt; fills in the defaults for both configurations and compares them key by key:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd config diff rradius.toml.orig rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;lua.max_execution_ms: 1000 | 500&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radius.auth_port: 1812 | 1822&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;Each line is &lt;code&gt;key: old value | new value&lt;/code&gt;; if one side has no value, it says &lt;code&gt;(absent)&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Secrets are shown only as &lt;code&gt;differs (hidden)&lt;/code&gt;; their content is not printed.&lt;/li&gt;&#xA;&lt;li&gt;Exit codes: 1 if there are differences, 0 if there are none (it prints &lt;code&gt;no differences&lt;/code&gt;), 2 if a configuration cannot be read.&lt;/li&gt;&#xA;&lt;li&gt;Differences in &lt;code&gt;cluster.node_id&lt;/code&gt; and &lt;code&gt;cluster.listen&lt;/code&gt; are listed at the end under &lt;code&gt;node-specific:&lt;/code&gt; and do not count as differences. This is handy when you compare the configurations of two cluster nodes (&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 16&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;To see one configuration in full with the defaults filled in, use &lt;code&gt;config show --config rradius.toml&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;In the differences above, &lt;code&gt;radius.auth_port&lt;/code&gt; needs a restart to take effect, while &lt;code&gt;lua.max_execution_ms&lt;/code&gt; takes effect on reload. The table in the next section tells you how to distinguish them.&lt;/p&gt;&#xA;&lt;h3 id=&#34;3-reload&#34;&gt;3. reload&#xA;&lt;/h3&gt;&lt;p&gt;Send SIGHUP to the server process:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kill -HUP &amp;lt;pid&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Under systemd, use &lt;code&gt;systemctl reload rradius&lt;/code&gt; (&lt;code&gt;ExecReload&lt;/code&gt; sends SIGHUP).&lt;/p&gt;&#xA;&lt;p&gt;A reload is all or nothing. The server first builds everything that needs replacing from the new configuration, and swaps it all in only if every step succeeds. If any step fails, nothing is replaced and the server keeps serving as before. Requests being handled finish with the scripts, auth chain and client settings they started with, and are not interrupted.&lt;/p&gt;&#xA;&lt;h3 id=&#34;4-read-the-log-and-metrics&#34;&gt;4. Read the log and metrics&#xA;&lt;/h3&gt;&lt;p&gt;Every reload leaves a line in the log. Everything applied:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;INFO rradius_core::reload: configuration reloaded from rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Some changes were not applied and need 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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;WARN rradius_core::reload: configuration reloaded from rradius.toml; these need a restart to apply: radius.auth_port&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The other changes are already in effect (&lt;code&gt;lua.max_execution_ms&lt;/code&gt; in the example), and the server is still on the old port. On every later reload, as long as the configuration still differs from the running one, the line is written again, until you restart.&lt;/p&gt;&#xA;&lt;p&gt;If the configuration has an error:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ERROR rradius_core::reload: reload failed, keeping the running configuration: rradius.toml: line 63: `x`: extra `=`, expected nothing&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The error message names the file and line, but does not quote the line, because it might contain a password. Fix it and send SIGHUP again.&lt;/p&gt;&#xA;&lt;p&gt;The metrics show the result of reloads:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_reload_total{result=&amp;#34;ok&amp;#34;} 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_reload_total{result=&amp;#34;error&amp;#34;} 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_reload_last_success_timestamp_seconds 1795385561&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;Reload&lt;/code&gt; section of &lt;code&gt;status&lt;/code&gt; shows the same data (&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;Chapter 17&lt;/a&gt;). Monitor the increase of &lt;code&gt;rradius_reload_total{result=&amp;quot;error&amp;quot;}&lt;/code&gt; to catch failed reloads that nobody noticed.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Each node in a cluster reads its own configuration file. After a change, edit every node and reload every node.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;what-reload-applies&#34;&gt;What reload applies&#xA;&lt;/h2&gt;&lt;p&gt;Settings that are applied and not applied on reload:&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;Takes effect on reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Needs a restart&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 top-level script &lt;code&gt;lua.script&lt;/code&gt;, and the scripts of the auth chain and handlers&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;dictionary&lt;/code&gt; (changing the content of a dictionary file is not reread either)&lt;/td&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 auth chain and settings in &lt;code&gt;[auth]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Any key of &lt;code&gt;[cluster]&lt;/code&gt;, including migrations&lt;/td&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 limits in &lt;code&gt;[lua]&lt;/code&gt; (except &lt;code&gt;max_memory_mb&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;lua.max_memory_mb&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 RADIUS and TACACS+ client lists and settings, including the content of &lt;code&gt;secret_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[metrics]&lt;/code&gt;, &lt;code&gt;[log]&lt;/code&gt; (except &lt;code&gt;log.trace&lt;/code&gt;), &lt;code&gt;[runtime]&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;log.trace&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;Chapter 17&lt;/a&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[databases]&lt;/code&gt;, &lt;code&gt;[queries]&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;[shutdown]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.bind&lt;/code&gt;, &lt;code&gt;auth_port&lt;/code&gt;, &lt;code&gt;acct_port&lt;/code&gt;, &lt;code&gt;sockets&lt;/code&gt;, &lt;code&gt;recv_buffer_bytes&lt;/code&gt;, &lt;code&gt;status_server&lt;/code&gt;, &lt;code&gt;max_auth_inflight&lt;/code&gt;, &lt;code&gt;max_acct_inflight&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;[accounts]&lt;/code&gt;, &lt;code&gt;[sessions]&lt;/code&gt; (read each time a command runs)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius.accounting_spool]&lt;/code&gt;; &lt;code&gt;queue&lt;/code&gt; of &lt;code&gt;[radius.accounting_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;file&lt;/code&gt; of &lt;code&gt;[radius.accounting_log]&lt;/code&gt; (the file is reopened on reload)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;tacacs.bind&lt;/code&gt;, &lt;code&gt;port&lt;/code&gt;, &lt;code&gt;max_connections&lt;/code&gt;, &lt;code&gt;max_connections_per_source&lt;/code&gt;, &lt;code&gt;max_body_len&lt;/code&gt;, &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;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Adding or removing a whole &lt;code&gt;[radius]&lt;/code&gt; or &lt;code&gt;[tacacs]&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;Whether each key can be reloaded is also written in the reload column of &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;shutdown-and-restart&#34;&gt;Shutdown and restart&#xA;&lt;/h2&gt;&lt;h3 id=&#34;shutdown-order&#34;&gt;Shutdown order&#xA;&lt;/h3&gt;&lt;p&gt;After SIGTERM (or Ctrl+C in the foreground, which is SIGINT), the server does the following in order:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;/readyz&lt;/code&gt; switches to 503 &lt;code&gt;stopping&lt;/code&gt;, but requests are still answered as usual for &lt;code&gt;shutdown.ready_delay_ms&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;It stops accepting new requests: RADIUS stops reading the socket, TACACS+ closes its listener, and replay of the accounting spool (the on-disk buffer that holds accounting requests while the database cannot be written) stops (what was already written stays on disk).&lt;/li&gt;&#xA;&lt;li&gt;It waits for the requests being handled to finish, for at most &lt;code&gt;shutdown.drain_ms&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;It closes the cluster node&amp;rsquo;s database and exits with exit code 0.&lt;/li&gt;&#xA;&lt;/ol&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Purpose&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;shutdown.ready_delay_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;0 for a single node; 5000 when &lt;code&gt;cluster.nodes&lt;/code&gt; has more than one&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Time for load balancers to see the 503 and move traffic away&lt;/td&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;shutdown.drain_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;5000&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Upper limit for waiting on requests being handled&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Both keys take effect on reload, using the configuration at the moment the stop signal arrives. See &lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;Chapter 04&lt;/a&gt; for details.&lt;/p&gt;&#xA;&lt;p&gt;Measured: with &lt;code&gt;ready_delay_ms = 3000&lt;/code&gt; in quick-start, sending SIGTERM and probing every 0.4 seconds:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;t=0.0 readyz=[stopping 503] accept 1, reject 0, challenge 0, accounting 0, timeouts 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;t=1.4 readyz=[stopping 503] accept 1, reject 0, challenge 0, accounting 0, timeouts 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;t=2.7 readyz=[stopping 503] accept 1, reject 0, challenge 0, accounting 0, timeouts 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;t=3.2 readyz=[ 000] accept 0, reject 0, challenge 0, accounting 0, timeouts 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;exited&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For the first 3 seconds &lt;code&gt;/readyz&lt;/code&gt; already answers 503 while logins are still accepted. After 3 seconds requests are no longer accepted and the process exits. The log:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;INFO rradius_core::cli: stopping: /readyz answers 503; requests are answered for 3000 ms more, then those being handled are waited for, for at most 5000 ms&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;INFO rradius_core::cli: stopping: no more requests taken&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;INFO rradius_core::cli: stopping: every request taken was answered&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;WARN hiqlite::store::state_machine::sqlite::writer: SQL writer is shutting down&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If requests are still not finished when &lt;code&gt;drain_ms&lt;/code&gt; runs out, a WARN is written that lists how many RADIUS requests and TACACS+ connections are left, and then they are cut off. If you send SIGTERM or SIGINT again during the stop, the server stops waiting and goes straight to closing the database; closing the database is never skipped. &lt;code&gt;/livez&lt;/code&gt; still answers 200 during the stop.&lt;/p&gt;&#xA;&lt;h3 id=&#34;effect-on-load-balancers&#34;&gt;Effect on load balancers&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;When a load balancer uses &lt;code&gt;/readyz&lt;/code&gt; to decide, &lt;code&gt;ready_delay_ms&lt;/code&gt; must be longer than its check interval times the number of failures, so that traffic moves away before the server stops accepting.&lt;/li&gt;&#xA;&lt;li&gt;When a NAS is configured with several RADIUS servers directly, nobody looks at &lt;code&gt;/readyz&lt;/code&gt;. After the server stops accepting, the NAS requests time out and the NAS asks the next server.&lt;/li&gt;&#xA;&lt;li&gt;A single node has no other server to ask, so the default is &lt;code&gt;ready_delay_ms = 0&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;how-long-shutdown-takes&#34;&gt;How long shutdown takes&#xA;&lt;/h3&gt;&lt;p&gt;In a cluster with more than one node, a node also waits about 9.5 seconds before closing the database, to let the cluster hand over (in measured logs the gap from &lt;code&gt;every request taken was answered&lt;/code&gt; to &lt;code&gt;SQL writer is shutting down&lt;/code&gt; is exactly 9.5 seconds). Measured:&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;Case&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;SIGTERM to process exit&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 node, &lt;code&gt;ready_delay_ms = 3000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;About 3 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;Leader of a three-node cluster, default values&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;About 14.5 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;Follower of a four-node cluster, default values&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;About 15 seconds&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;So give the process manager a long enough wait: the bundled systemd unit has &lt;code&gt;TimeoutStopSec=60&lt;/code&gt;, the Compose and Synology examples have &lt;code&gt;stop_grace_period: 30s&lt;/code&gt;, and the Kubernetes example has &lt;code&gt;terminationGracePeriodSeconds: 30&lt;/code&gt;. Docker waits only 10 seconds by default, which is not enough.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; If the wait is too short, the process is killed with SIGKILL. A node that was killed has to rebuild its local database from the Raft log at the next start, and the log says &lt;code&gt;Node did not shut down gracefully - auto-rebuilding State Machine&lt;/code&gt;. No data is lost, but the start is slower.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;restart&#34;&gt;Restart&#xA;&lt;/h3&gt;&lt;p&gt;A restart is SIGTERM followed by a start. At start, the node waits for the leader, applies migrations, and catches up with the cluster before it begins serving (&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 16&lt;/a&gt;). A single node answers no requests while it restarts.&lt;/p&gt;&#xA;&lt;h2 id=&#34;rolling-restart-of-a-cluster&#34;&gt;Rolling restart of a cluster&#xA;&lt;/h2&gt;&lt;p&gt;When you apply a setting that needs a restart, or upgrade the program, restart one node at a time:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Change this node&amp;rsquo;s configuration (or replace its program) and run &lt;code&gt;check&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Send SIGTERM and wait for the process to exit.&lt;/li&gt;&#xA;&lt;li&gt;Start it, wait for its &lt;code&gt;/readyz&lt;/code&gt; to return &lt;code&gt;ok&lt;/code&gt; and for &lt;code&gt;has caught up with the cluster&lt;/code&gt; to appear in the log.&lt;/li&gt;&#xA;&lt;li&gt;Use &lt;code&gt;cluster members&lt;/code&gt; to confirm that all three nodes are voters and there is a leader.&lt;/li&gt;&#xA;&lt;li&gt;Then do the next node.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Stopping one node at a time keeps a majority in a three-node cluster, so writes are not interrupted. When the leader is stopped, writes are slower for a while (about 7 to 8 seconds: 6 to 7 seconds of election plus about 1 second for clients to reconnect; measured on 2026-11-23 on a three-node Docker setup on one host, for both the core and the enterprise edition). If you know which node is the leader, leave it for last, so the election happens only once. For measurements of rolling upgrades across sites with higher latency, see &lt;a class=&#34;link&#34; href=&#34;../16-cluster/#across-data-centers&#34; &gt;Chapter 16, &amp;ldquo;Across data centers&amp;rdquo;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; When you change &lt;code&gt;secret_raft&lt;/code&gt; or &lt;code&gt;secret_api&lt;/code&gt; in &lt;code&gt;[cluster]&lt;/code&gt;, nodes with the old and new secret do not recognize each other. This change cannot be done one node at a time: stop the whole cluster, change it everywhere, and start it together. This is inferred from the program&amp;rsquo;s behavior and was not measured in this manual.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;upgrading-the-program&#34;&gt;Upgrading the program&#xA;&lt;/h2&gt;&lt;p&gt;Use &lt;code&gt;--version&lt;/code&gt; to see the core&amp;rsquo;s version:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd --version&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd 0.1.0 (community)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;default config: /etc/rradius/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The second line is the configuration file that is read when &lt;code&gt;--config&lt;/code&gt; is not given. It is fixed at build time.&lt;/p&gt;&#xA;&lt;p&gt;The upgrade steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Run &lt;code&gt;check&lt;/code&gt; with the new program against the current configuration. If the new version rejects a configuration key, &lt;code&gt;check&lt;/code&gt; points it out, so it does not fail only at start.&lt;/li&gt;&#xA;&lt;li&gt;Replace one node at a time as in &lt;a class=&#34;link&#34; href=&#34;#rolling-restart-of-a-cluster&#34; &gt;Rolling restart of a cluster&lt;/a&gt;. For a single node, stop it, replace the program and start it.&lt;/li&gt;&#xA;&lt;li&gt;After each node, look at &lt;code&gt;Version&lt;/code&gt; in &lt;code&gt;status&lt;/code&gt; and at the log.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; Nodes of different versions working together in one cluster. This manual had only one version to test, and the rolling upgrade steps are written from the program&amp;rsquo;s start-up and join behavior. If a new version changes the format of the cluster data, read the notes for that version.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;adding-a-migration&#34;&gt;Adding a migration&#xA;&lt;/h2&gt;&lt;p&gt;The SQL files in &lt;code&gt;cluster.migrations_dir&lt;/code&gt; are applied in order at start, before the server begins serving. The rules:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;File names are &lt;code&gt;&amp;lt;integer&amp;gt;_&amp;lt;name&amp;gt;.sql&lt;/code&gt;, starting at 1, with no gaps or repeats.&lt;/li&gt;&#xA;&lt;li&gt;Each file is one transaction. After it is applied, the file name and the SHA-256 of its content are recorded, and later starts skip it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;A file that has been applied cannot be edited or renamed.&lt;/strong&gt; To change a table, add a file with the next number.&lt;/li&gt;&#xA;&lt;li&gt;In a cluster, each file is applied only once, written through the cluster by the first node that starts and gets the leader; the other nodes receive it by replication.&lt;/li&gt;&#xA;&lt;li&gt;Each file runs for at most 30 seconds. If it takes longer, this start fails, the file keeps running to completion in the cluster, and the next start sees that it has been applied.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;migrations_wait_ms&lt;/code&gt; is the time limit for each of the three waits (for the leader, for applying, for catching up), so it must be longer than the slowest file.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;add-a-file&#34;&gt;Add a 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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ printf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;ALTER TABLE users ADD COLUMN note TEXT;\n&amp;#39;&lt;/span&gt; &amp;gt; migrations/3_user_note.sql&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#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; examines the file names and numbers (for a gap it prints the same message as in &lt;a class=&#34;link&#34; href=&#34;#numbering-gap&#34; &gt;Numbering gap&lt;/a&gt; below, with exit code 2), but it does not apply anything and does not compare the content of applied files; migrations are applied only at start. So you must restart after you add a file: reload does not apply it (&lt;code&gt;[cluster]&lt;/code&gt; needs a restart). After the restart the log has no special line; if applying fails, the start ends with exit code 2 and the message names the file.&lt;/p&gt;&#xA;&lt;p&gt;In a cluster, put the new file in the &lt;code&gt;migrations_dir&lt;/code&gt; of every node, then do a rolling restart. The first node to restart applies it. A node that has not yet received the new file will find, when it restarts, that the cluster has applied more files than its own directory has, warns, and serves as usual.&lt;/p&gt;&#xA;&lt;h3 id=&#34;editing-an-applied-file&#34;&gt;Editing an applied 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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ printf -- &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;-- edited\n&amp;#39;&lt;/span&gt; &amp;gt;&amp;gt; migrations/1_schema.sql&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd serve --config rradius.toml&#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;migration file &amp;#39;1_schema.sql&amp;#39; changed after it was applied&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Not even a comment line may be added. Change the file back to the original to start.&lt;/p&gt;&#xA;&lt;h3 id=&#34;numbering-gap&#34;&gt;Numbering gap&#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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ mv migrations/3_user_note.sql migrations/5_user_note.sql&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd serve --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;migration numbering must start at 1 without gaps or repeats: expected number 3, found &amp;#39;5_user_note.sql&amp;#39;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;File name and number errors are checked before the cluster node is started, so the program exits at once whether or not the cluster is ready; &lt;code&gt;check&lt;/code&gt; also catches this kind of error. A changed content is found only when the program starts and reads the record of what has been applied.&lt;/p&gt;&#xA;&lt;h2 id=&#34;accounts-sessions-and-queries&#34;&gt;Accounts, sessions and queries&#xA;&lt;/h2&gt;&lt;p&gt;The &lt;code&gt;user&lt;/code&gt;, &lt;code&gt;session&lt;/code&gt; and &lt;code&gt;query&lt;/code&gt; commands all talk to the running server through the cluster&amp;rsquo;s API port:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;When the server is not running, they wait 30 seconds and exit with exit code 3.&lt;/li&gt;&#xA;&lt;li&gt;They read &lt;code&gt;[accounts]&lt;/code&gt;, &lt;code&gt;[sessions]&lt;/code&gt; and &lt;code&gt;[queries.&amp;lt;name&amp;gt;]&lt;/code&gt; from the configuration file each time they run, so a change needs no reload.&lt;/li&gt;&#xA;&lt;li&gt;In a cluster, you can use the configuration of any node; writes are handed to the leader.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For the usage of each command: &lt;code&gt;user&lt;/code&gt; is in &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;Chapter 07&lt;/a&gt;, &lt;code&gt;session&lt;/code&gt; in &lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;Chapter 13&lt;/a&gt;, and &lt;code&gt;query&lt;/code&gt; in &lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;Chapter 09&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;changing-secrets&#34;&gt;Changing secrets&#xA;&lt;/h2&gt;&lt;p&gt;Each kind of secret is changed in a different way. The key points are which ones take effect on reload, which need a restart, and whose requests fail during the change.&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;Secret&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;How to change it&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;During the change&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;Shared secret of a RADIUS client (&lt;code&gt;secret_file&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Edit the file and send SIGHUP. Change it on the NAS too; the closer in time the two changes are, the better&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;While the two sides differ, requests from this NAS are discarded (&lt;code&gt;Discarded: invalid&lt;/code&gt;). Each NAS has its own secret, so only one NAS is affected at a time. For the steps and measurements, see &lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;Chapter 05&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;Shared secret of a TACACS+ client&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same as above&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The client list can be reloaded; open connections are also matched against the new list (&lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#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;LDAP service account (&lt;code&gt;bind_password_file&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;First change the service account&amp;rsquo;s password in the directory, then edit the file and send SIGHUP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;While the directory has changed but rradius has not reloaded yet, LDAP authentication fails (&lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;Chapter 08&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;External database (&lt;code&gt;password_file&lt;/code&gt; of &lt;code&gt;[databases.&amp;lt;name&amp;gt;]&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;First change the password in the database, then edit the file and &lt;strong&gt;restart&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[databases]&lt;/code&gt; cannot be reloaded (see the table above). In a cluster use a rolling restart (&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;Chapter 09&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;secret_raft&lt;/code&gt;, &lt;code&gt;secret_api&lt;/code&gt; (or &lt;code&gt;_file&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Must be the same on every node; change it for the whole cluster together&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[cluster]&lt;/code&gt; needs a restart. Nodes with different secrets cannot connect, so schedule a maintenance window (inferred from the program&amp;rsquo;s behavior, not verified on real hardware)&lt;/td&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 certificate and private key&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Replace the files and send SIGHUP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;New conversations use the new ones and ones in progress are not affected; if the new files have an error, the reload fails and the old ones stay in use (&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#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;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-console&#34; data-lang=&#34;console&#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; 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;ul&gt;&#xA;&lt;li&gt;Give only the account that runs rradius read permission on secret files (0600 or 0640). When the permissions are too wide, &lt;code&gt;check&lt;/code&gt;, start and reload warn; see &lt;a class=&#34;link&#34; href=&#34;../20-security/&#34; &gt;Chapter 20&lt;/a&gt; for details.&lt;/li&gt;&#xA;&lt;li&gt;A shared secret shorter than 16 bytes, or one that contains &lt;code&gt;change-me&lt;/code&gt; (the public value in the examples), also gives a warning and does not block the start. Some old devices limit the length or the characters of the secret, so make sure the device accepts it before you change it.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;purging-old-data&#34;&gt;Purging old data&#xA;&lt;/h2&gt;&lt;p&gt;Tables such as &lt;code&gt;accounting&lt;/code&gt; and &lt;code&gt;tacacs_log&lt;/code&gt; keep growing, and rradius does not purge them automatically. You can delete periodically from the accounting script: at most once an hour, and only one request in the whole cluster actually does the work.&lt;/p&gt;&#xA;&lt;p&gt;First use a migration to create a table that records the last run time. The following comes after quick-start&amp;rsquo;s &lt;code&gt;1_schema.sql&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;Chapter 03&lt;/a&gt;) as the next migration number:&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;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The number in the file name must follow your existing migrations, with no gap (see &amp;ldquo;Adding a migration&amp;rdquo; above). quick-start has &lt;code&gt;1_schema.sql&lt;/code&gt; and &lt;code&gt;2_demo_users.sql&lt;/code&gt;, so this one is &lt;code&gt;3_&lt;/code&gt;; in an environment where the demo file has been deleted, the number depends on your case.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Then 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 copy 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;-- Writes go through the cluster; only one request can change last_run, and it does the deletion.&lt;/span&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 one write does not take 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;p&gt;How it works:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;sql_query&lt;/code&gt; reads the local copy. Most requests end at this step and do not write to the cluster.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;sql_execute&lt;/code&gt; returns the number of affected rows. Within the same hour, many requests see &amp;ldquo;due&amp;rdquo; at the same time, but only one can update &lt;code&gt;last_run&lt;/code&gt; (it returns 1); the others return 0 and do not delete.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;stopped IS NOT NULL&lt;/code&gt; deletes only sessions that have ended and leaves open ones alone; &lt;code&gt;stopped &amp;lt; ?&lt;/code&gt; keeps the most recent 180 days.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;LIMIT 10000&lt;/code&gt; limits the amount at one time, and &lt;code&gt;ORDER BY rowid&lt;/code&gt; makes every cluster node delete the same rows. With a large backlog it takes several hours to clear.&lt;/li&gt;&#xA;&lt;li&gt;The same pattern can purge &lt;code&gt;tacacs_log&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;Chapter 12&lt;/a&gt;): change the condition to &lt;code&gt;logged &amp;lt; ?&lt;/code&gt;, and add another &lt;code&gt;housekeeping&lt;/code&gt; row that records its &lt;code&gt;name&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Things to note:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How long to keep data (180 days in the example) depends on law and company policy. A carrier may have a minimum retention period, so &lt;strong&gt;check before you delete&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The deletion runs while one accounting request is being handled, so that request is answered a little later. The amount deleted must finish within &lt;code&gt;[lua] query_timeout_ms&lt;/code&gt;, or &lt;code&gt;sql_execute&lt;/code&gt; times out.&lt;/li&gt;&#xA;&lt;li&gt;If you need to keep historical data, move it away with an external export process first, then delete; for the accounting log, see &lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;Chapter 13&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;data-directory-and-data-protection&#34;&gt;Data directory and data protection&#xA;&lt;/h2&gt;&lt;h3 id=&#34;what-is-in-the-data-directory&#34;&gt;What is in the data directory&#xA;&lt;/h3&gt;&lt;p&gt;Below &lt;code&gt;cluster.data_dir&lt;/code&gt; everything is managed by hiqlite. What you actually see is:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;data/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;├── logs/                    Raft log (*.wal, meta.hql, lock.hql)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;└── state_machine/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ├── db/hiqlite.db        the database itself (with -wal, -shm)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ├── snapshots/           snapshots&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ├── backups/             (not used by the core)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    └── lock                 lock while running&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;Do not change the files here while the server runs, and do not write to the database with other programs. All writes must go through the cluster, or the data on the nodes becomes inconsistent.&lt;/li&gt;&#xA;&lt;li&gt;The server removes &lt;code&gt;lock&lt;/code&gt; when it exits normally. If the next start finds &lt;code&gt;lock&lt;/code&gt; still there, it knows the last exit was not normal and rebuilds the database from the Raft log.&lt;/li&gt;&#xA;&lt;li&gt;To start from scratch (only for a single-node test environment): stop the server, delete the whole &lt;code&gt;data_dir&lt;/code&gt;, and the next start creates it again and applies the migrations again.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;the-core-has-no-backup-feature&#34;&gt;The core has no backup feature&#xA;&lt;/h3&gt;&lt;p&gt;The core has no built-in backup: there is no setting that copies the database out on a schedule, and no restore command. The ways the core can protect data, as far as you can see in the code, are these:&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;Method&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What it protects against&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Notes&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;Cluster replication&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One host failing&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Every node has a full copy. A three-node cluster can lose one node without losing data (&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 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;Rebuild from other nodes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A node&amp;rsquo;s disk or data directory failing&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Stop it, empty &lt;code&gt;data_dir&lt;/code&gt;, and start it with the original configuration; it copies the data back from the other nodes. Measured in Chapter 16&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Automatic rebuild after an abnormal exit&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Power loss, forced kill&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The next start rebuilds the local database from the Raft 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 spool&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting when the database cannot be written&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting is first written to local disk and replayed later (&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#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;Accounting log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Keeping every accounting request separately&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[radius.accounting_log]&lt;/code&gt; writes every accounting request as one JSON line; you can rotate it with logrotate and move it elsewhere (&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#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;External database&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Keeping data in a database you manage yourself&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Authentication and scripts can use PostgreSQL or MySQL in &lt;code&gt;[databases]&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;Chapter 09&lt;/a&gt;); those databases use their own backup 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;Configuration and migrations in version control&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rebuilding the whole environment&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The table structure and demo data are all in &lt;code&gt;migrations/&lt;/code&gt;; with the configuration file you can rebuild an empty cluster&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;None of these protects against a wrong write: an account deleted by mistake is replicated to every node at once. If the cluster loses the data of a majority of its nodes at the same time, the data is gone.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Enterprise edition:&lt;/strong&gt; The enterprise edition has cluster backup and restore.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Copying &lt;code&gt;data_dir&lt;/code&gt; directly after a stop as a backup has not been verified by the code or the tests, and this manual does not treat it as a backup procedure.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;logs-and-logrotate&#34;&gt;Logs and logrotate&#xA;&lt;/h2&gt;&lt;h3 id=&#34;the-servers-logs&#34;&gt;The server&amp;rsquo;s logs&#xA;&lt;/h3&gt;&lt;p&gt;The server writes its log to standard error, one entry per line, with time and level. It does not write a log file itself:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Under systemd, the log goes to the journal: &lt;code&gt;journalctl -u rradius&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;In a container, read it with &lt;code&gt;docker logs&lt;/code&gt; or &lt;code&gt;kubectl logs&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The level, the format (&lt;code&gt;text&lt;/code&gt; or &lt;code&gt;json&lt;/code&gt;) and the authentication record are set by &lt;code&gt;[log]&lt;/code&gt;, and a change needs a restart; to trace one user temporarily use &lt;code&gt;log.trace&lt;/code&gt;, which takes effect on reload. All of this is explained in &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;Chapter 17&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;rotating-the-accounting-log&#34;&gt;Rotating the accounting log&#xA;&lt;/h3&gt;&lt;p&gt;The file of &lt;code&gt;[radius.accounting_log]&lt;/code&gt; keeps growing, so rotate it. The server reopens the file when it receives SIGHUP: if the file was moved away, it creates a new one. Measured:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ mv acct.jsonl acct.jsonl.1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ kill -HUP &amp;lt;pid&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run … --load acct-start,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &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;$ wc -l acct.jsonl*&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;       1 acct.jsonl&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;       2 acct.jsonl.1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Accounting after the SIGHUP goes to the new &lt;code&gt;acct.jsonl&lt;/code&gt;, and the old file no longer grows.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;/etc/logrotate.d/rradius&lt;/code&gt; that comes with the package (&lt;code&gt;packages/common/rradius.logrotate&lt;/code&gt; in the source) does exactly this:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/var/log/rradius/*.jsonl {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    daily&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    rotate 30&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    missingok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    notifempty&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    nocreate&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    compress&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    delaycompress&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    postrotate&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        systemctl kill -s HUP rradius.service &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 || true&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    endscript&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;It rotates daily, keeps 30 copies, and compresses old files except the most recent one.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;nocreate&lt;/code&gt;: logrotate does not create the new file; the server creates it itself.&lt;/li&gt;&#xA;&lt;li&gt;It sends SIGHUP after rotation. This also reloads the configuration; when the configuration has not changed, it is just a reload with no change.&lt;/li&gt;&#xA;&lt;li&gt;Do not use &lt;code&gt;copytruncate&lt;/code&gt;: lines written between the copy and the truncation are lost.&lt;/li&gt;&#xA;&lt;li&gt;It handles only &lt;code&gt;*.jsonl&lt;/code&gt; under &lt;code&gt;/var/log/rradius/&lt;/code&gt;, so put the accounting log there, for example &lt;code&gt;file = &amp;quot;/var/log/rradius/accounting.jsonl&amp;quot;&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;managing-with-systemd&#34;&gt;Managing with systemd&#xA;&lt;/h2&gt;&lt;p&gt;The key points of the unit that comes with the package (&lt;code&gt;packages/common/rradius.service&lt;/code&gt; in the source):&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;Value&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;&lt;code&gt;ConditionPathExists&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/etc/rradius/rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Do not start without a 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;User&lt;/code&gt;, &lt;code&gt;Group&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Run as an ordinary user&lt;/td&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;ExecStart&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/usr/bin/rradiusd serve&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reads the default 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;ExecReload&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/bin/kill -HUP $MAINPID&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;systemctl reload rradius&lt;/code&gt; is a reload&lt;/td&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;Restart&lt;/code&gt;, &lt;code&gt;RestartSec&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;on-failure&lt;/code&gt;, &lt;code&gt;2&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;When the exit code is not 0, restart after 2 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;TimeoutStopSec&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;60&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Time to wait for shutdown&lt;/td&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;AmbientCapabilities&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;CAP_NET_BIND_SERVICE&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Can listen on ports below 1024, for example TACACS+ port 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;&lt;code&gt;ProtectSystem&lt;/code&gt;, &lt;code&gt;ReadWritePaths&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;strict&lt;/code&gt;, &lt;code&gt;/var/lib/rradius /var/log/rradius&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Can write only these two directories&lt;/td&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;LimitNOFILE&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;65536&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Upper limit of file descriptors&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;Put &lt;code&gt;data_dir&lt;/code&gt; and the accounting spool under &lt;code&gt;/var/lib/rradius&lt;/code&gt; and the accounting log under &lt;code&gt;/var/log/rradius&lt;/code&gt;, or they cannot be written.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Restart=on-failure&lt;/code&gt; catches the cases where the server exits by itself with exit code 1, for example when the Raft core of a cluster node stops (&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 16&lt;/a&gt;). Exit code 2 for a configuration error also triggers a restart, but the restart fails the same way; run &lt;code&gt;check&lt;/code&gt; after you change the configuration.&lt;/li&gt;&#xA;&lt;li&gt;Commonly used commands: &lt;code&gt;systemctl start|stop|restart|reload rradius&lt;/code&gt;, &lt;code&gt;systemctl status rradius&lt;/code&gt;, &lt;code&gt;journalctl -u rradius -f&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; This manual did not run this unit under systemd. The values in the table are copied from the file, and the behavior is inferred from systemd&amp;rsquo;s general rules and from this chapter&amp;rsquo;s measurements.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;on-docker-compose-and-synology&#34;&gt;On Docker Compose and Synology&#xA;&lt;/h2&gt;&lt;p&gt;The source&amp;rsquo;s &lt;code&gt;compose.yaml&lt;/code&gt; (single node), &lt;code&gt;compose.cluster.yaml&lt;/code&gt; (three nodes, &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 16&lt;/a&gt;) and &lt;code&gt;deploy/synology/compose.yaml&lt;/code&gt; (a Container Manager project on Synology) all use the same image:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The program runs as &lt;code&gt;ENTRYPOINT [&amp;quot;/usr/local/bin/rradiusd&amp;quot;]&lt;/code&gt; with the default arguments &lt;code&gt;serve --config /etc/rradius/rradius.toml&lt;/code&gt;, as the &lt;code&gt;rradius&lt;/code&gt; user; the data is in the volume &lt;code&gt;/var/lib/rradius&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;stop_grace_period: 30s&lt;/code&gt;: gives shutdown enough time. Docker&amp;rsquo;s default of 10 seconds is not enough.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;restart: unless-stopped&lt;/code&gt;: restarts automatically after an abnormal exit.&lt;/li&gt;&#xA;&lt;li&gt;The root file system is read-only, and the configuration is mounted read-only at &lt;code&gt;/etc/rradius&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Day-to-day operations:&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;Command&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;reload&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;docker compose kill -s HUP &amp;lt;service&amp;gt;&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;Restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;docker compose restart &amp;lt;service&amp;gt;&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;Read the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;docker compose logs -f &amp;lt;service&amp;gt;&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;Check status&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;docker compose exec &amp;lt;service&amp;gt; rradiusd status --config &amp;lt;config file&amp;gt;&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;Add an account&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;docker compose exec -T &amp;lt;service&amp;gt; rradiusd user add --config &amp;lt;config file&amp;gt; &amp;lt;account&amp;gt;&lt;/code&gt;, giving the password on standard input&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The project directory on Synology is &lt;code&gt;/volume1/docker/rradius/&lt;/code&gt;: &lt;code&gt;compose.yaml&lt;/code&gt;, &lt;code&gt;config/&lt;/code&gt; (copied from &lt;code&gt;docker/config/&lt;/code&gt; in the source, edit &lt;code&gt;rradius.toml&lt;/code&gt;), and &lt;code&gt;secrets/&lt;/code&gt; (three secret files). The configuration is mounted read-only, so to change it, edit the files in &lt;code&gt;config/&lt;/code&gt; on the NAS, then send SIGHUP to the container or restart the project. The data is in Docker&amp;rsquo;s named volume &lt;code&gt;data&lt;/code&gt;, not in a folder next to &lt;code&gt;config/&lt;/code&gt;; when you delete the project, take care not to delete the volume with it.&lt;/p&gt;&#xA;&lt;p&gt;Daily work on Synology:&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;Read the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The &amp;ldquo;Log&amp;rdquo; tab of the project in Container Manager, or SSH in and run &lt;code&gt;sudo docker compose -p rradius logs&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;Change the configuration&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Edit the files in &lt;code&gt;config/&lt;/code&gt;, then restart the project. With a configuration error the container exits at once and the log gives the reason; it is safer to run &lt;code&gt;rradiusd check&lt;/code&gt; on another computer 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;Update the version&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Build the new image on another computer, import it to the NAS, and restart the project (for building and importing see &lt;a class=&#34;link&#34; href=&#34;../02-install/#synology-nas&#34; &gt;Chapter 02&lt;/a&gt;). The data is in the &lt;code&gt;data&lt;/code&gt; volume and does not disappear because of an update&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Stop&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&amp;ldquo;Stop&amp;rdquo; on the project page. &lt;code&gt;stop_grace_period&lt;/code&gt; is 30 seconds, which gives the database time to close; do not use a forced stop, or the next start has to rebuild the local 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;Back up&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Back up the &lt;code&gt;config/&lt;/code&gt; and &lt;code&gt;secrets/&lt;/code&gt; folders. The data is in a volume managed by Docker, named &lt;code&gt;&amp;lt;project name&amp;gt;_data&lt;/code&gt; (&lt;code&gt;rradius_data&lt;/code&gt; when the project is called &lt;code&gt;rradius&lt;/code&gt;): stop the project first, then back up the folder that holds that volume with Hyper Backup, or use &lt;code&gt;docker run --rm -v rradius_data:/d -v $PWD:/b alpine tar czf /b/data.tgz -C /d .&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;For the backup methods and their limits, see &lt;a class=&#34;link&#34; href=&#34;#data-directory-and-data-protection&#34; &gt;Data directory and data protection&lt;/a&gt;. The location of volume folders on DSM and the use of Hyper Backup were not verified in this manual.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; This manual did not build the image and did not run anything on Docker or Synology. The commands in the table above are the general use of Docker Compose, matched to the signal behavior measured locally in this chapter.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;on-kubernetes&#34;&gt;On Kubernetes&#xA;&lt;/h2&gt;&lt;p&gt;How to operate the source&amp;rsquo;s &lt;code&gt;deploy/kubernetes/&lt;/code&gt; example (&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 16&lt;/a&gt;):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Changing configuration:&lt;/strong&gt; The configuration comes from a ConfigMap generated by kustomize. When the content changes, the ConfigMap name changes (&lt;code&gt;rradius-config-&amp;lt;hash&amp;gt;&lt;/code&gt;), the StatefulSet is updated with it, and the pods restart one by one according to &lt;code&gt;RollingUpdate&lt;/code&gt;. That is, changing configuration on Kubernetes is a rolling restart, not a reload. Before you change it, run &lt;code&gt;check&lt;/code&gt; locally against the files in &lt;code&gt;config/&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Adding a migration:&lt;/strong&gt; Besides putting the file in &lt;code&gt;config/&lt;/code&gt;, add a line to &lt;code&gt;files&lt;/code&gt; in &lt;code&gt;kustomization.yaml&lt;/code&gt; and a line to &lt;code&gt;items&lt;/code&gt; in &lt;code&gt;statefulset.yaml&lt;/code&gt;, to mount it under &lt;code&gt;migrations/&lt;/code&gt;. If you miss the latter, the file does not appear in the pod&amp;rsquo;s &lt;code&gt;migrations/&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Touch one pod at a time:&lt;/strong&gt; The PodDisruptionBudget &lt;code&gt;maxUnavailable: 1&lt;/code&gt; makes operations such as draining a Kubernetes node stop only one pod at a time.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Running commands:&lt;/strong&gt; &lt;code&gt;kubectl exec -i rradius-0 -- rradiusd user add --config /etc/rradius/rradius-0.toml alice&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Reading the log:&lt;/strong&gt; &lt;code&gt;kubectl logs rradius-0&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Data:&lt;/strong&gt; One PVC per pod (&lt;code&gt;data-rradius-N&lt;/code&gt;). Rebuilding a node (&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 16&lt;/a&gt;) here means deleting that pod&amp;rsquo;s PVC and the pod, and letting the StatefulSet recreate it with an empty volume.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Upgrading:&lt;/strong&gt; Change the image version and then run &lt;code&gt;kubectl apply -k deploy/kubernetes&lt;/code&gt;; again one pod at a time. The StatefulSet goes from &lt;code&gt;rradius-2&lt;/code&gt; down to &lt;code&gt;rradius-0&lt;/code&gt; and does not choose the leader to be last for you; when the leader is replaced there is a write gap during the election (for the number of seconds see &lt;a class=&#34;link&#34; href=&#34;../16-cluster/#across-data-centers&#34; &gt;Chapter 16&lt;/a&gt;), and accounting goes to the spool.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Node maintenance:&lt;/strong&gt; The PodDisruptionBudget makes voluntary disruptions such as &lt;code&gt;kubectl drain&lt;/code&gt; stop only one pod at a time. &lt;strong&gt;Do not run &lt;code&gt;kubectl delete pod --all&lt;/code&gt;:&lt;/strong&gt; with all three restarting together, the cluster temporarily loses its majority.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;It cannot scale automatically, and &lt;code&gt;replicas&lt;/code&gt; is not a knob for the number of nodes.&lt;/strong&gt; The cluster members are written in each pod&amp;rsquo;s configuration file, so the number of pods must equal the number of &lt;code&gt;[[cluster.nodes]]&lt;/code&gt;, and also the number of &lt;code&gt;rradius-N.toml&lt;/code&gt; files in &lt;code&gt;kustomization.yaml&lt;/code&gt; and &lt;code&gt;items&lt;/code&gt; (a pod without that file cannot read its configuration). So do not set an HPA.&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;kubectl scale --replicas=1&lt;/code&gt; is the same as stopping two nodes, and the behavior of the remaining one is what &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 16&lt;/a&gt; says about stopping two. When you scale back to 3, the returning pods may each restart once before they become ready: a node with &lt;code&gt;stop_without_leader_ms&lt;/code&gt; set exits with exit code 1 when it cannot find a leader at start (message &lt;code&gt;cluster was not ready to apply migrations&lt;/code&gt;), Kubernetes restarts it, and the second time it joins.&lt;/li&gt;&#xA;&lt;li&gt;To change the number of nodes, change every configuration, &lt;code&gt;kustomization.yaml&lt;/code&gt; and &lt;code&gt;items&lt;/code&gt; together; for how to add and remove nodes in the cluster itself see &lt;a class=&#34;link&#34; href=&#34;../16-cluster/#add-a-node&#34; &gt;Adding a node&lt;/a&gt; and &lt;a class=&#34;link&#34; href=&#34;../16-cluster/#remove-a-node&#34; &gt;Removing a node&lt;/a&gt;. This combination was not tried on Kubernetes in this manual.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Limiting who can read the metrics:&lt;/strong&gt; The metrics port has no authentication and no TLS, so when it is bound to &lt;code&gt;0.0.0.0&lt;/code&gt; everyone in the cluster can read it. &lt;code&gt;networkpolicy.yaml&lt;/code&gt; opens only the RADIUS port to the outside, the cluster port only to other rradius pods, and the metrics port only to the &lt;code&gt;monitoring&lt;/code&gt; namespace (change it to the namespace where Prometheus runs). To use it, add it to &lt;code&gt;resources&lt;/code&gt; in &lt;code&gt;kustomization.yaml&lt;/code&gt;. The kubelet&amp;rsquo;s probes come from the node itself and most network plugins allow them, but &lt;strong&gt;check after you apply it that the pods are still ready.&lt;/strong&gt; Pods that use &lt;code&gt;hostNetwork&lt;/code&gt; are not governed by a NetworkPolicy (&lt;a class=&#34;link&#34; href=&#34;../16-cluster/#without-a-suitable-load-balancer-hostnetwork&#34; &gt;Chapter 16&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; None of the operations above on Kubernetes were actually run. This manual only used &lt;code&gt;kubectl kustomize&lt;/code&gt; to confirm that the example produces resources, and ran &lt;code&gt;check&lt;/code&gt; on the three configurations.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;monitoring-the-metrics-to-watch-first&#34;&gt;Monitoring: the metrics to watch first&#xA;&lt;/h2&gt;&lt;p&gt;The full metrics list and the alert rules are in &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;Chapter 17&lt;/a&gt;. For day-to-day operations, connect the few below first; each corresponds to a situation where you need to act:&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;When it increases or looks wrong&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 increase 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;Logins are rejected&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A sudden increase: someone is trying passwords, the directory is down, or the configuration is wrong. Look at &lt;code&gt;handler&lt;/code&gt; in the authentication record&lt;/td&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;The source is not in the client list&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A new device has not been added yet, or someone is 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;Wrong signature or format&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Usually the shared secret of one device 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;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;The number of requests handled at once reached the limit&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Investigate if above 0: the database, directory or script has become slow, see &lt;a class=&#34;link&#34; href=&#34;../21-troubleshooting/&#34; &gt;Chapter 21&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;Rate of increase 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;Handling is slower than the NAS&amp;rsquo;s retransmit 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_cluster_leader&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Whether this node has a leader to write to&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;0 for more than a few seconds: the node is isolated, or the cluster has no majority (&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 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;&lt;code&gt;rradius_acct_spool_bytes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting in the spool not yet written to the database&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Stays above 0: the database or the cluster 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_acct_spool_rejected_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting given up on 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_accounting_log_dropped_total&lt;/code&gt;, &lt;code&gt;rradius_accounting_log_failures_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting that was not written to the accounting log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The disk is too slow, full or not writable&lt;/td&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;The number of failed reloads&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Above 0: read the log, fix it, and send SIGHUP 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;&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 dropped because they could not be written in time&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The destination of the log is too slow (&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#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;p99 of &lt;code&gt;rradius_radius_response_seconds&lt;/code&gt;, &lt;code&gt;rradius_tacacs_response_seconds&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How long responses take&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;It grows: the database, directory or script has become 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_tacacs_connections_total{result=&amp;quot;refused&amp;quot;}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+ connections refused because of the connection limit&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;It increases: &lt;code&gt;max_connections&lt;/code&gt; or &lt;code&gt;max_connections_per_source&lt;/code&gt; was reached (&lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;Chapter 12&lt;/a&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;Counters accumulate from start, each node counts its own, and reload does not reset them. Alert on the rate of increase, not on the absolute value.&lt;/li&gt;&#xA;&lt;li&gt;In an environment with external databases, named queries or EAP, also add the &lt;code&gt;rradius_external_db_*&lt;/code&gt;, &lt;code&gt;rradius_query_*&lt;/code&gt; and &lt;code&gt;rradius_eap_sessions_total&lt;/code&gt; groups; they are explained in Chapters 09, 11 and 17.&lt;/li&gt;&#xA;&lt;li&gt;Without Prometheus, run &lt;code&gt;rradiusd status --config rradius.toml --watch&lt;/code&gt; on the node to list the same data every second (&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;Chapter 17&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;Status-Server is the most accurate test of &amp;ldquo;alive or not&amp;rdquo;, because it takes the same path as authentication: &lt;code&gt;rradius-bench run --load status-auth&lt;/code&gt;, or &lt;code&gt;radclient&lt;/code&gt; with Message-Authenticator (&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/#status-server&#34; &gt;Chapter 05&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;The metrics port has no authentication and no TLS; bind it only to an internal address.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;pre-launch-checklist&#34;&gt;Pre-launch checklist&#xA;&lt;/h2&gt;&lt;p&gt;This is the integrated operations checklist. The security items are written one by one in &lt;a class=&#34;link&#34; href=&#34;../20-security/#checklist&#34; &gt;Chapter 20, &amp;ldquo;Checklist&amp;rdquo;&lt;/a&gt;; this list only points there and does not repeat them.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; &lt;code&gt;rradiusd check --config …&lt;/code&gt; passes, and gives no warnings (secret file permissions, shared secrets that are too short or contain &lt;code&gt;change-me&lt;/code&gt;, &lt;code&gt;unencrypted&lt;/code&gt;, and so on; see Chapter 20).&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; All &lt;code&gt;*.secret&lt;/code&gt; files are newly generated random values, not the ones that come with the examples (see &amp;ldquo;Changing secrets&amp;rdquo; above).&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; Certificates are not the demo ones; someone watches the expiry dates of the server certificate and of the NAS and device certificates.&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; The demo data files in &lt;code&gt;migrations/&lt;/code&gt; (for example &lt;code&gt;2_demo_users.sql&lt;/code&gt;) have been deleted or replaced with real data, before the first start, because an applied file cannot be changed.&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; and &lt;code&gt;[[tacacs.clients]]&lt;/code&gt; list only devices that really will send requests, and do not use &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; is bound only to an internal address; with several nodes, &lt;code&gt;[cluster] listen&lt;/code&gt; is bound to an internal network or a WireGuard 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 and limits their sources: 1812 and 1813 (UDP), 49 (TACACS+), and the cluster ports only between nodes.&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; You have run &lt;code&gt;rradiusd tuning --config …&lt;/code&gt; and set the receive buffer and the file descriptor limit as it recommends (&lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;Chapter 19&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; The server is managed by systemd, Compose or Kubernetes, which send SIGTERM on stop (not SIGKILL) and wait long enough; &lt;code&gt;data_dir&lt;/code&gt; and the accounting spool are on persistent local disk (see &amp;ldquo;How long shutdown takes&amp;rdquo; and &amp;ldquo;Managing with systemd&amp;rdquo; above).&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; Automatic restart is set (systemd &lt;code&gt;Restart=on-failure&lt;/code&gt;, Compose &lt;code&gt;restart: unless-stopped&lt;/code&gt;): when a node&amp;rsquo;s database breaks, the server exits with exit code 1 and relies on the restart to recover.&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; After start, look at the log: every port that should be open has a &lt;code&gt;listening&lt;/code&gt; line: &lt;code&gt;RADIUS Server listening on …&lt;/code&gt;, &lt;code&gt;TACACS+ Server listening on …&lt;/code&gt;, &lt;code&gt;Metrics listening on …&lt;/code&gt;. If a RADIUS or TACACS+ port cannot be bound, the server exits with exit code 1; if only the metrics port cannot be bound, it logs one error line and the process keeps running, so you must see &lt;code&gt;Metrics listening on …&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; Try one login and one accounting request from each kind of real device (not only test tools).&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; The accounting tables have a way to purge old data (&amp;ldquo;Purging old data&amp;rdquo; above), and the retention period is confirmed.&lt;/li&gt;&#xA;&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; Monitoring at least covers &amp;ldquo;alive&amp;rdquo; (Status-Server or &lt;code&gt;/livez&lt;/code&gt;) and &amp;ldquo;the metrics to watch first&amp;rdquo; above; log rotation is set (&amp;ldquo;Logs and logrotate&amp;rdquo;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;what-requires-downtime&#34;&gt;What requires downtime&#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;Change&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Single node&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Three-node cluster&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, auth chain, clients, shared secrets&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No, reload&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No, reload 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;Accounts, sessions (&lt;code&gt;user&lt;/code&gt; command, tables)&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;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;Ports, listen addresses, &lt;code&gt;[metrics]&lt;/code&gt;, &lt;code&gt;[log]&lt;/code&gt;, &lt;code&gt;dictionary&lt;/code&gt; and other settings that need a restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Yes, no service during the restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No, rolling 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;Adding a migration&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Yes, restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No, rolling 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;Upgrading the program&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, rolling restart (not verified on real hardware)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Adding or removing a node&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No (&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 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;Changing &lt;code&gt;secret_raft&lt;/code&gt;, &lt;code&gt;secret_api&lt;/code&gt;&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;Yes, the whole cluster together (inferred from the program&amp;rsquo;s behavior)&lt;/td&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 an applied migration&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Not allowed, use a new file&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Not allowed, use a new file&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-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; After a reload the log says &lt;code&gt;these need a restart to apply: radius.auth_port&lt;/code&gt;, and the server is still on the old port.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; This setting needs a restart to take effect.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Find a time to restart (use a rolling restart for a cluster). The other changes are already in effect.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The log says &lt;code&gt;reload failed, keeping the running configuration: …&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The new configuration has an error, and the server keeps serving as before.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Fix it at the file and line the message names, and send SIGHUP again after &lt;code&gt;check&lt;/code&gt; passes.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; You changed the configuration but the behavior did not change, and the log has no reload entry.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; SIGHUP was not sent; or in a cluster only one node was reloaded. Included files are also reread only on reload.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Send SIGHUP to every node and look at the log of every node.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; At start it prints &lt;code&gt;migration file &#39;1_schema.sql&#39; changed after it was applied&lt;/code&gt;, exit code 2.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; An applied migration file was changed.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change the file back to the original, and write the change you need as a new file with the next number.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; At start it prints &lt;code&gt;migration numbering must start at 1 without gaps or repeats: expected number 3, found &#39;5_user_note.sql&#39;&lt;/code&gt;, exit code 2.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The numbers in the file names have a gap or a repeat.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Number the files in order.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The server exits at start with a message that mentions &lt;code&gt;migrations_wait_ms&lt;/code&gt;, exit code 1.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; Within the time limit it could not find a leader, could not finish applying migrations, or the local copy could not catch up.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Make sure a majority of the nodes are running; if a file itself is slow, increase &lt;code&gt;migrations_wait_ms&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; After a stop, the log of the next start says &lt;code&gt;Node did not shut down gracefully - auto-rebuilding State Machine&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The last stop was forced, for example SIGKILL because the wait was too short.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Increase the wait of the process manager (&lt;code&gt;TimeoutStopSec&lt;/code&gt; in systemd, &lt;code&gt;stop_grace_period&lt;/code&gt; in Compose, &lt;code&gt;terminationGracePeriodSeconds&lt;/code&gt; in Kubernetes).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; After logrotate rotates, the accounting log stops growing, or the new file does not appear.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; SIGHUP was not sent after the rotation, and the server is still writing to the file that was moved.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Send SIGHUP in &lt;code&gt;postrotate&lt;/code&gt;, as the configuration that comes with the package does; do not use &lt;code&gt;copytruncate&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;user add&lt;/code&gt; waited 30 seconds and printed &lt;code&gt;the cluster did not answer within 30 s&lt;/code&gt;, exit code 3.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The server is not running, or the cluster has no leader.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Start the server first; for a cluster, first bring back a majority of the nodes.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04 Configuration file basics&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09 External databases and named queries&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13 Accounting and sessions&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16 Clusters and high availability&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;19 Performance tuning and load testing&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../21-troubleshooting/&#34; &gt;21 Troubleshooting&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../91-command-reference/&#34; &gt;Appendix B: Command reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>19 Performance tuning and load testing</title>
            <link>https://embark.systems/en/rradius/oss/19-performance/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/19-performance/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use &lt;code&gt;tuning&lt;/code&gt; to find the operating system limits that should be raised, and know how the suggested values are calculated&lt;/li&gt;&#xA;&lt;li&gt;Set the receive sockets, receive buffers, worker threads and the limits on concurrent requests&lt;/li&gt;&#xA;&lt;li&gt;Use &lt;code&gt;rradius-bench&lt;/code&gt; to measure the capacity of your own machine, and judge whether the numbers you get can be trusted&lt;/li&gt;&#xA;&lt;li&gt;Repeat a measurement with the &lt;code&gt;benchmarks/&lt;/code&gt; configurations that ship in the repo&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: you have finished &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;Chapter 03&lt;/a&gt; and can send a login with &lt;code&gt;rradius-bench&lt;/code&gt;; you have read the metrics and &lt;code&gt;status&lt;/code&gt; in &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;Chapter 17&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#concept-where-a-request-gets-stuck&#34; &gt;Concept: where a request gets stuck&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#check-the-operating-system-with-tuning&#34; &gt;Check the operating system with tuning&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#receive-sockets-and-receive-buffers&#34; &gt;Receive sockets and receive buffers&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#worker-threads-and-pin_threads&#34; &gt;Worker threads and pin_threads&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#limits-on-concurrent-requests&#34; &gt;Limits on concurrent requests&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#two-cluster-database-settings&#34; &gt;Two cluster database settings&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#how-to-use-rradius-bench&#34; &gt;How to use rradius-bench&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#measure-the-tool-itself-first-calibrate&#34; &gt;Measure the tool itself first: calibrate&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#measure-once-with-the-benchmarks-configurations&#34; &gt;Measure once with the benchmarks configurations&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#example-measurements-and-test-environment&#34; &gt;Example measurements and test environment&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#how-to-tell-whether-a-result-can-be-trusted&#34; &gt;How to tell whether a result can be trusted&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;concept-where-a-request-gets-stuck&#34;&gt;Concept: where a request gets stuck&#xA;&lt;/h2&gt;&lt;p&gt;A RADIUS request goes from the NAS to the server and back. On the way it passes several places that can clog. Where it clogs decides what you see and what you tune:&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;Place&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What you see when it clogs&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Where to look&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What to tune&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 operating system&amp;rsquo;s UDP receive buffer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The kernel drops packets before rradius sees them, the NAS times out, and the rradius metrics record nothing&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&amp;ldquo;UDP packets dropped&amp;rdquo; at the top of &lt;code&gt;tuning&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The receive buffer, &lt;code&gt;radius.sockets&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;rradius&amp;rsquo;s limit on concurrent requests&lt;/td&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; grows, and the log has &lt;code&gt;overloaded: discarded … packets&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;status&lt;/code&gt;, metrics&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;max_auth_inflight&lt;/code&gt;, &lt;code&gt;max_acct_inflight&lt;/code&gt;, or find out why the back end is 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;Back end: database, LDAP, script&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Response time (p99) gets longer, and more requests are in progress&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;p99 and in progress in &lt;code&gt;status&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The timeouts and connection counts in chapters 07 to 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;The measuring tool itself&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The tool&amp;rsquo;s CPU is full, so the numbers reflect the tool, not the server&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;busiest worker&lt;/code&gt; and the warnings of &lt;code&gt;rradius-bench&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Use more threads, or send from another machine&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The order of tuning: first use &lt;code&gt;tuning&lt;/code&gt; to raise the operating system limits until they are enough, then measure with &lt;code&gt;rradius-bench&lt;/code&gt; while you watch the server&amp;rsquo;s metrics. Do not start by changing the rradius configuration.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This chapter gives no figure for &amp;ldquo;how many requests per second rradius handles&amp;rdquo;. That depends on your hardware, operating system, auth chain and database. The numbers in &lt;a class=&#34;link&#34; href=&#34;#example-measurements-and-test-environment&#34; &gt;Example measurements&lt;/a&gt; only show how to read the output. Do not use them to plan capacity.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;check-the-operating-system-with-tuning&#34;&gt;Check the operating system with tuning&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;tuning&lt;/code&gt; reads the system values of this machine and your configuration file, and tells you which limits to raise, to what value, and how. It only reads: it changes no system setting, starts no node and opens no port.&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd tuning --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The usage is &lt;code&gt;rradiusd tuning [--config &amp;lt;path&amp;gt;]&lt;/code&gt;; &lt;code&gt;--config&lt;/code&gt; is optional. The configuration file is only used to make the advice fit your settings (for example &lt;code&gt;recv_buffer_bytes&lt;/code&gt;, &lt;code&gt;sockets&lt;/code&gt; and the connection limits). Without it, &lt;code&gt;tuning&lt;/code&gt; reads the default path (the second line of &lt;code&gt;rradiusd --version&lt;/code&gt;, decided by the prefix at build time, normally &lt;code&gt;/etc/rradius/rradius.toml&lt;/code&gt;, and &lt;code&gt;/usr/local/etc/rradius/rradius.toml&lt;/code&gt; for the FreeBSD port). If it cannot read that file, it prints one line saying so and calculates with all defaults; the system-level advice is still given. If you give &lt;code&gt;--config&lt;/code&gt;, the file must be readable. The exit code is 2 for a bad argument or a bad configuration file you named, and 0 otherwise. It has advice for three platforms: Linux, macOS and FreeBSD. On other platforms it prints one line, &amp;ldquo;no advice for this platform&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;Below is the real output on macOS for the lab configuration of Chapter 17:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd tuning --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius tuning advice for macOS&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;UDP packets dropped because a receive buffer was full, since the system started: 137278&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Raise the receive buffers below, then watch whether this count still grows.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Largest socket buffer (kern.ipc.maxsockbuf)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  current:   8388608&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  suggested: 33554432&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  why:       the receive buffer counts its bookkeeping against this limit too, so twice the buffer; raise it before recvspace&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  now:       sysctl -w kern.ipc.maxsockbuf=33554432&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  persist:   /etc/sysctl.conf: kern.ipc.maxsockbuf = 33554432&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;UDP receive buffer (net.inet.udp.recvspace)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  current:   786896&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  suggested: 16777216&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  why:       every RADIUS socket gets this size without [radius] recv_buffer_bytes; it should hold its share of max_auth_inflight requests. Setting [radius] recv_buffer_bytes instead leaves only the limit to raise&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  now:       sysctl -w net.inet.udp.recvspace=16777216&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  persist:   /etc/sysctl.conf: net.inet.udp.recvspace = 16777216&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Open files of the process (RLIMIT_NOFILE)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  current:   1048576 (ok)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  suggested: 65536&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  why:       the configuration may hold about 1310 files and connections open at once; twice that, at least 65536&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Open files of any process (kern.maxfilesperproc)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  current:   138240 (ok)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  suggested: 65536&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  why:       the system&amp;#39;s cap on the open files limit of one process&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;TCP listen queue (kern.ipc.somaxconn)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  current:   128&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  suggested: 1024&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  why:       the TCP listeners ask for 1024 waiting connections, and the system caps it here&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  now:       sysctl -w kern.ipc.somaxconn=1024&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  persist:   /etc/sysctl.conf: kern.ipc.somaxconn = 1024&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;RADIUS receive sockets ([radius] sockets)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  current:   1 (ok)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  suggested: 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  why:       only Linux shares the packets of one port out over several sockets, so it must be 1 here; check refuses another value&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;These suggestions are unmeasured starting points: apply them, then confirm with the dropped packet counts above.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;how-to-read-it&#34;&gt;How to read it&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The dropped packet count at the top matters most.&lt;/strong&gt; It is the number of UDP packets the kernel has dropped since boot because a socket&amp;rsquo;s receive buffer was full, summed over every program on the machine. If it is 0, the current buffers are enough, and the advice below is for higher load. If it is not 0, raise the limits as advised and then watch whether the number keeps growing. The machine above has run many load tests, so its number is large.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Each item:&lt;/strong&gt; &lt;code&gt;current&lt;/code&gt; is the value now, and &lt;code&gt;(ok)&lt;/code&gt; after it means it is already enough; &lt;code&gt;suggested&lt;/code&gt; is the suggested value; &lt;code&gt;why&lt;/code&gt; is the reason; &lt;code&gt;now&lt;/code&gt; is the command that takes effect at once; &lt;code&gt;persist&lt;/code&gt; is how to make it last after a reboot. An item that is already enough has no &lt;code&gt;now&lt;/code&gt; or &lt;code&gt;persist&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;The last line says it clearly:&lt;/strong&gt; these suggestions are not measured; they are a starting point. After you apply them, confirm with the dropped packet count and a load test.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;how-the-suggested-values-are-calculated&#34;&gt;How the suggested values are calculated&#xA;&lt;/h3&gt;&lt;p&gt;The suggested values are calculated from the configuration. The rules are in &lt;code&gt;rradius-core/src/tuning.rs&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;Item&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Calculation&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;Receive buffer of each RADIUS socket&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;max_auth_inflight ÷ sockets&lt;/code&gt; (rounded up) × 4096 bytes, at least 4 MiB, then rounded up to a whole MiB. Above, that is 4096 ÷ 1 × 4096 = 16 MiB&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Open files&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;First estimate the &amp;ldquo;files and connections that may be open at once&amp;rdquo;: 256 + &lt;code&gt;tacacs.max_connections&lt;/code&gt; + &lt;code&gt;cluster.read_connections&lt;/code&gt; + 2 × the number of cluster nodes. Above, that is 256 + 1024 + 28 + 2 = 1310. The suggested value is twice that, at least 65536&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TCP listen queue&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Checked only when there is a TCP listener (for example &lt;code&gt;[tacacs]&lt;/code&gt;). The suggestion is 1024, which is the queue length rradius asks the system for&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;4096 bytes is the maximum length of one RADIUS packet. It is used to estimate how much buffer each waiting packet takes.&lt;/p&gt;&#xA;&lt;h3 id=&#34;what-is-checked-on-each-platform&#34;&gt;What is checked on each platform&#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;Check&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Linux&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;macOS&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;FreeBSD&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;Source of the UDP drop count&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RcvbufErrors&lt;/code&gt; in &lt;code&gt;/proc/net/snmp&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;netstat -s -p udp&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;netstat -s -p udp&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;Packets dropped before they reach a socket&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/proc/net/softnet_stat&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&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;Receive buffer (&lt;code&gt;recv_buffer_bytes&lt;/code&gt; not set)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;net.core.rmem_default&lt;/code&gt;, &lt;code&gt;net.core.rmem_max&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;kern.ipc.maxsockbuf&lt;/code&gt; (twice the suggested value), &lt;code&gt;net.inet.udp.recvspace&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same as macOS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Receive buffer (&lt;code&gt;recv_buffer_bytes&lt;/code&gt; set)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;net.core.rmem_max&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;kern.ipc.maxsockbuf&lt;/code&gt; (twice the configured value)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same as macOS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Open files of the process&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RLIMIT_NOFILE&lt;/code&gt;; &lt;code&gt;persist&lt;/code&gt; gives the systemd &lt;code&gt;LimitNOFILE&lt;/code&gt; or &lt;code&gt;/etc/security/limits.conf&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RLIMIT_NOFILE&lt;/code&gt;; &lt;code&gt;persist&lt;/code&gt; gives a LaunchDaemon plist&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RLIMIT_NOFILE&lt;/code&gt;; &lt;code&gt;persist&lt;/code&gt; gives &lt;code&gt;/etc/login.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;System limit on open files of one process&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;kern.maxfilesperproc&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;kern.maxfilesperproc&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;TCP listen queue&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;net.core.somaxconn&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;kern.ipc.somaxconn&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;kern.ipc.soacceptqueue&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;Backlog of the network card&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;net.core.netdev_max_backlog&lt;/code&gt;: 16384 is suggested when packets are dropped before they reach a socket&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&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;&lt;code&gt;radius.sockets&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Suggested equal to the number of worker threads (do not set it)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Must be 1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Must be 1&lt;/td&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;runtime.pin_threads&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Only shows the current value and a note&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&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;ul&gt;&#xA;&lt;li&gt;On Linux, the sysctl advice goes in &lt;code&gt;/etc/sysctl.d/90-rradius.conf&lt;/code&gt;; on macOS and FreeBSD it goes in &lt;code&gt;/etc/sysctl.conf&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;On FreeBSD, the second line of the output reads &lt;code&gt;(this advice follows the FreeBSD documentation and has not been tested on FreeBSD)&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; This chapter ran &lt;code&gt;tuning&lt;/code&gt; only on macOS. The checks for Linux and FreeBSD follow &lt;code&gt;rradius-core/src/tuning.rs&lt;/code&gt; and were not run on those two platforms.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The line in which &lt;code&gt;tuning&lt;/code&gt; talks about &lt;code&gt;pin_threads&lt;/code&gt; points to &lt;a class=&#34;link&#34; href=&#34;#worker-threads-and-pin_threads&#34; &gt;Worker threads and pin_threads&lt;/a&gt; in this chapter.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;receive-sockets-and-receive-buffers&#34;&gt;Receive sockets and receive buffers&#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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Reload&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;&lt;code&gt;radius.sockets&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Linux: the number of worker threads; other platforms: &lt;code&gt;1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Restart needed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How many receive sockets to open for each address and port&lt;/td&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.recv_buffer_bytes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Not set (use the system default)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Restart needed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;SO_RCVBUF&lt;/code&gt; of each RADIUS socket, 4096 to 1073741824 bytes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The full table of keys is in &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt;. These two keys belong to &lt;code&gt;[radius]&lt;/code&gt;; the other &lt;code&gt;[radius]&lt;/code&gt; settings are in &lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;Chapter 05&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;code&gt;sockets&lt;/code&gt;:&lt;/strong&gt; On Linux, several sockets can listen on the same port, and the kernel shares the packets out among them so that every worker thread can receive. The kernel chooses by the source of the packet, so &lt;strong&gt;packets from one source always go to the same socket&lt;/strong&gt;. With only one NAS, more sockets do not help. (This is the behavior of the Linux kernel; this chapter did not measure it on Linux.) Other platforms do not share packets out this way, so the value can only be 1:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config s2.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s2.toml: radius.sockets = 2: only Linux shares UDP packets out over several sockets on one port, so it must be 1 here&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The first line of &lt;code&gt;config show&lt;/code&gt; gives the value calculated for this machine, for example &lt;code&gt;# computed on this machine: radius.sockets = 1, cluster.read_connections = 28&lt;/code&gt;. Normally do not set it; leave the default.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;code&gt;recv_buffer_bytes&lt;/code&gt;:&lt;/strong&gt; When it is not set, each socket uses the system&amp;rsquo;s default size, so the value to tune is a system value (&lt;code&gt;tuning&lt;/code&gt; tells you which one). When it is set, rradius asks the system for this size itself, and only the system limit needs raising. At startup, the log says how much it really got:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::radius: RADIUS: receive buffer 8388608 bytes on each socket (asked 8388608)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When you ask for more than the system limit, the system gives only the limit, and the log warns:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::radius: RADIUS: receive buffer 8388608 bytes on each socket (asked 16777216)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::radius: RADIUS: asked for a receive buffer of 16777216 bytes and each socket got 8388608; raise kern.ipc.maxsockbuf to at least 16777216&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;(This was measured on macOS with &lt;code&gt;kern.ipc.maxsockbuf = 8388608&lt;/code&gt;. The matching limit on Linux is &lt;code&gt;net.core.rmem_max&lt;/code&gt;.)&lt;/p&gt;&#xA;&lt;p&gt;If you run &lt;code&gt;tuning&lt;/code&gt; after you set &lt;code&gt;recv_buffer_bytes&lt;/code&gt;, it compares the configured value with the suggested value 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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd tuning --config rb.toml&#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;Receive buffer of each RADIUS socket ([radius] recv_buffer_bytes)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  current:   8388608&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  suggested: 16777216&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  why:       it should hold the socket&amp;#39;s share of max_auth_inflight requests&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  persist:   the configuration file: recv_buffer_bytes = 16777216 in [radius], then restart&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;worker-threads-and-pin_threads&#34;&gt;Worker threads and pin_threads&#xA;&lt;/h2&gt;&lt;p&gt;The number of rradius worker threads equals the number of CPUs the process can use (the value of &lt;code&gt;available_parallelism&lt;/code&gt; in the Rust standard library). There is no setting to change it.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Reload&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;&lt;code&gt;runtime.pin_threads&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Restart needed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Pin each worker thread to its own CPU; works only on Linux&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;Worker threads are pinned in order to the CPUs the process can use, and when there are fewer CPUs than threads, they take turns. If one of them cannot be pinned, none are pinned.&lt;/li&gt;&#xA;&lt;li&gt;Other threads created later are not affected. They use all the CPUs the process could use originally.&lt;/li&gt;&#xA;&lt;li&gt;On platforms other than Linux, &lt;code&gt;check&lt;/code&gt; refuses it:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config pin.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pin.toml: runtime.pin_threads is only supported on Linux&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Turn it on when this machine runs only rradius and you have measured that it is faster. On a machine that shares CPUs with other services, pinning threads can make them compete for the same CPU.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; &lt;code&gt;pin_threads = true&lt;/code&gt; can only be enabled on Linux, and this chapter did not measure its effect on Linux.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;limits-on-concurrent-requests&#34;&gt;Limits on concurrent requests&#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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Reload&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;&lt;code&gt;radius.max_auth_inflight&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;4096&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Restart needed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The number of authentication requests handled at the same time; requests over it are 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;&lt;code&gt;radius.max_acct_inflight&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;4096&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Restart needed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The number of accounting requests handled at the same time; requests over it are dropped&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;&amp;ldquo;In progress&amp;rdquo; runs from taking in the packet to sending the response, and includes the time spent waiting for the database, LDAP and scripts. When the limit is full, new packets are dropped without a response and counted in &lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;overload&amp;quot;}&lt;/code&gt;. The NAS retransmits when it gets no response, and usually the request can be handled a moment later.&lt;/p&gt;&#xA;&lt;p&gt;The metrics show the current use and the limit: &lt;code&gt;rradius_radius_requests_in_progress&lt;/code&gt; and &lt;code&gt;rradius_radius_requests_limit&lt;/code&gt;. The RADIUS section of &lt;code&gt;status&lt;/code&gt; also has the lines &lt;code&gt;Auth in progress&lt;/code&gt; and &lt;code&gt;Auth limit&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What overload looks like in a test:&lt;/strong&gt; Set &lt;code&gt;max_auth_inflight&lt;/code&gt; to &lt;code&gt;4&lt;/code&gt; on purpose, then load it with 256 requests in flight at the same time:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --auth-port &lt;span style=&#34;color:#ae81ff&#34;&gt;1812&lt;/span&gt; --secret bench-secret &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;    --load pap,concurrency=256 --duration 3 --warmup 1 --timeout 1 \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --metrics-url http://127.0.0.1:9812/metrics&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;measured 3.000 s after 1.000 s of warmup&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pap (fixed-concurrency): concurrency 256, 2 threads, 4 sockets, busiest worker 25%&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  pap: 66869/s, sent 201362, accept 200606, reject 0, challenge 0, accounting 0, timeouts 756, invalid 0, late 0, socket errors 0, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    latency us: p50 43.9, p90 95.6, p99 134.9, p99.9 280.3, max 2056.2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;server counters: auth 200396, acct 0, duplicates 0, discarded overload 632, unknown_client 0, invalid 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;warnings:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  server_discarded_overload: the server discarded 632 packets for overload&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The server log gets one line per second:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::radius: RADIUS authentication overloaded: discarded 252 packets&#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;timeouts 756&lt;/code&gt;: these requests were dropped, and the tool waited &lt;code&gt;--timeout 1&lt;/code&gt; second without a response.&lt;/li&gt;&#xA;&lt;li&gt;The exit code of &lt;code&gt;rradius-bench&lt;/code&gt; is 2, because there were timeouts.&lt;/li&gt;&#xA;&lt;li&gt;The rate looks higher and the latency lower, because dropped requests are not counted in the latency. Looking only at the rate misleads you. Always read the timeouts and the server&amp;rsquo;s discard count together with it.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;How to tune it:&lt;/strong&gt; The default of 4096 is enough for most cases. If you do see &lt;code&gt;overload&lt;/code&gt;, first find out why handling got slow (database, LDAP, script) instead of raising the limit first. When the back end is slow, a higher limit only lets more requests wait together. When you do raise it, remember that the suggested receive buffer grows too (see the calculation in the previous section), so run &lt;code&gt;tuning&lt;/code&gt; again.&lt;/p&gt;&#xA;&lt;h2 id=&#34;two-cluster-database-settings&#34;&gt;Two cluster database settings&#xA;&lt;/h2&gt;&lt;p&gt;The main chapter for these two keys is &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 16&lt;/a&gt;. Here we only say how they relate to performance:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;cluster.read_connections&lt;/code&gt;: the number of connections that read the local database. The default is twice the number of worker threads, at most 32 (28 on the machine above), and you can set 1 to 128. Account lookups during authentication and data reads by scripts use them. They also count in the open files of &lt;code&gt;tuning&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;cluster.snapshot_every&lt;/code&gt;: the number of Raft log records between two snapshots, 100000 by default. When there are many writes, how often snapshots happen affects how steady the writes are.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Changing either needs a restart.&lt;/p&gt;&#xA;&lt;h2 id=&#34;how-to-use-rradius-bench&#34;&gt;How to use rradius-bench&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;rradius-bench&lt;/code&gt; is the RADIUS and TACACS+ load testing tool that ships in the repo. It has two subcommands: &lt;code&gt;run&lt;/code&gt; sends load to a server, and &lt;code&gt;calibrate&lt;/code&gt; measures the tool itself. The full list of flags is in &lt;a class=&#34;link&#34; href=&#34;../91-command-reference/&#34; &gt;Appendix B&lt;/a&gt;, or run &lt;code&gt;rradius-bench run --help&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The deb, rpm and FreeBSD packages and the Docker image install only &lt;code&gt;rradiusd&lt;/code&gt;, not &lt;code&gt;rradius-bench&lt;/code&gt;. You have to build it from source (Chapter 02).&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;how-to-write-a-load&#34;&gt;How to write a load&#xA;&lt;/h3&gt;&lt;p&gt;You can give &lt;code&gt;--load&lt;/code&gt; several times. Each load runs at the same time on its own threads, and the report lists them separately:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;--load KIND[,concurrency=N][,rate=N][,window=N][,threads=N][,alive=N]&#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;Parameter&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;Default&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;concurrency&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Fixed concurrency: the number of requests in flight at the same time; when one comes back, another is sent. Given together with &lt;code&gt;rate&lt;/code&gt;, it is the upper limit in flight&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;256 when &lt;code&gt;rate&lt;/code&gt; is given&lt;/td&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;rate&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Fixed rate: how many to send per second, however fast the responses come&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;window&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The number of requests in flight at the same time on one socket, 1 to 256&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RADIUS 64, TACACS+ 1 (can only be 1)&lt;/td&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;threads&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How many threads this load uses&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Fixed concurrency 2, fixed rate 1&lt;/td&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;alive&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;session&lt;/code&gt; only: how many Interim-Updates to send between Start and Stop&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;0&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;You must give at least one of &lt;code&gt;concurrency&lt;/code&gt; and &lt;code&gt;rate&lt;/code&gt;. The number of sockets is &lt;code&gt;concurrency ÷ window&lt;/code&gt; (rounded up), shared out evenly among the threads, and there are never more threads than sockets.&lt;/p&gt;&#xA;&lt;p&gt;The two modes measure different things:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Fixed concurrency&lt;/strong&gt; (only &lt;code&gt;concurrency&lt;/code&gt; given): shows the most the server can take. Latency is counted from the actual send.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Fixed rate&lt;/strong&gt; (&lt;code&gt;rate&lt;/code&gt; given): shows how much latency there is under a given load. Latency is counted from the &lt;strong&gt;scheduled&lt;/strong&gt; send time, so when the server stalls, every delayed request shows up in the latency. Use this to answer &amp;ldquo;what is p99 at 20000 per second&amp;rdquo;.&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;Kind&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What it sends&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;pap&lt;/code&gt;, &lt;code&gt;chap&lt;/code&gt;, &lt;code&gt;chap-authenticator&lt;/code&gt;, &lt;code&gt;mschapv2&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Request, with each password method&lt;/td&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;acct-start&lt;/code&gt;, &lt;code&gt;acct-alive&lt;/code&gt;, &lt;code&gt;acct-stop&lt;/code&gt;, &lt;code&gt;acct-on&lt;/code&gt;, &lt;code&gt;acct-off&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting-Request&lt;/td&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;status-auth&lt;/code&gt;, &lt;code&gt;status-acct&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Status-Server, sent to the authentication port or the accounting port&lt;/td&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&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One login, Start, &lt;code&gt;alive&lt;/code&gt; Interim-Updates, Stop, all sharing the same session ID&lt;/td&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;peap&lt;/code&gt;, &lt;code&gt;ttls&lt;/code&gt;, &lt;code&gt;ttls-mschapv2&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A full EAP conversation (&lt;code&gt;ttls&lt;/code&gt; with inner PAP, &lt;code&gt;ttls-mschapv2&lt;/code&gt; with inner MS-CHAPv2); &lt;code&gt;concurrency&lt;/code&gt; and &lt;code&gt;rate&lt;/code&gt; count conversations. &lt;code&gt;eap-tls&lt;/code&gt; needs &lt;code&gt;--cert-file&lt;/code&gt; and &lt;code&gt;--key-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;tacacs-pap&lt;/code&gt;, &lt;code&gt;tacacs-chap&lt;/code&gt;, &lt;code&gt;tacacs-ascii&lt;/code&gt;, &lt;code&gt;tacacs-author&lt;/code&gt;, &lt;code&gt;tacacs-acct&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+, using &lt;code&gt;--tacacs-port&lt;/code&gt;; &lt;code&gt;--tacacs-connect keep&lt;/code&gt; (default, one connection used all the time) or &lt;code&gt;per-request&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Enterprise edition:&lt;/strong&gt; The &lt;code&gt;aka-prime&lt;/code&gt; load and &lt;code&gt;--transport tls&lt;/code&gt; (RadSec) are only useful against a server of the enterprise edition.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;other-common-flags&#34;&gt;Other common flags&#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;Flag&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;&lt;code&gt;--warmup&lt;/code&gt;, &lt;code&gt;--duration&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Warm up for some seconds first (default 2), then measure for some seconds (default 10). Requests sent during warm-up are not counted&lt;/td&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;--requests N&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Stop after N have been measured for each load, with no warm-up; for &lt;code&gt;session&lt;/code&gt; it counts flows. It cannot be used together with the two flags 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;&lt;code&gt;--users N&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;User names take turns from &lt;code&gt;&amp;lt;user&amp;gt;0&lt;/code&gt; to &lt;code&gt;&amp;lt;user&amp;gt;N-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;--timeout&lt;/code&gt;, &lt;code&gt;--retries&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How many seconds to wait for a response (default 5), and how many times to retransmit after a timeout (default 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;--metrics-url&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The server&amp;rsquo;s &lt;code&gt;http://host:port/metrics&lt;/code&gt;, read once before and once after the measurement, so the report shows how the server&amp;rsquo;s counters changed&lt;/td&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;--json&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Print a JSON report instead&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;exit-codes&#34;&gt;Exit codes&#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;Exit code&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;0&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;All were Accept (for accounting, all got a response)&lt;/td&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;There were Reject or Challenge, and no timeouts&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&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;There were timeouts, invalid responses or socket errors&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;3&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Bad arguments or setup failed, and nothing was sent&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Warnings do not change the exit code.&lt;/p&gt;&#xA;&lt;h2 id=&#34;measure-the-tool-itself-first-calibrate&#34;&gt;Measure the tool itself first: calibrate&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;calibrate&lt;/code&gt; starts a few fake servers that answer only Accept inside the tool&amp;rsquo;s own process, and loads them with the same code as &lt;code&gt;run&lt;/code&gt;. It measures the upper limit of &lt;strong&gt;this tool on this machine&lt;/strong&gt;. Compare the result of &lt;code&gt;run&lt;/code&gt; with it to know whether you measured the server or the tool.&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench calibrate --duration &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;what this tool can do here, against responders that do no other work:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  1 threads, window 1, concurrency 1: 44665/s, p50 18.3 us, p99 25.5 us, busiest worker 22%, timeouts 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  1 threads, window 64, concurrency 64: 165450/s, p50 364.5 us, p99 634.9 us, busiest worker 80%, timeouts 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  2 threads, window 64, concurrency 128: 215854/s, p50 495.6 us, p99 928.3 us, busiest worker 72%, timeouts 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  4 threads, window 64, concurrency 256: 173938/s, p50 1430.5 us, p99 1944.6 us, busiest worker 47%, timeouts 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;It always runs four combinations: 1 thread with window 1, and window 64 with 1, 2 and 4 threads. &lt;code&gt;--duration&lt;/code&gt; is how many seconds each combination runs (default 3).&lt;/li&gt;&#xA;&lt;li&gt;If the rate &lt;code&gt;run&lt;/code&gt; measures is close to the number here for the same combination, the bottleneck may be the tool, not the server.&lt;/li&gt;&#xA;&lt;li&gt;The numbers here were measured on the machine in &lt;a class=&#34;link&#34; href=&#34;#example-measurements-and-test-environment&#34; &gt;Example measurements and test environment&lt;/a&gt;. They will differ on another machine.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;measure-once-with-the-benchmarks-configurations&#34;&gt;Measure once with the benchmarks configurations&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;rradius-server/benchmarks/&lt;/code&gt; has a few configurations made for load testing:&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;What it measures&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;accept.toml&lt;/code&gt; + &lt;code&gt;accept.lua&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The script always accepts and accounting is always acknowledged: the server&amp;rsquo;s own processing path&lt;/td&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;acct-sql.toml&lt;/code&gt; + &lt;code&gt;acct-sql.lua&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Each accounting request writes one row to a table (&lt;code&gt;migrations/&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;acct-cpu.toml&lt;/code&gt; + &lt;code&gt;acct-cpu.lua&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Each accounting request makes the script compute for a while&lt;/td&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.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP-TLS, PEAP, TTLS, with one account &lt;code&gt;bench&lt;/code&gt;/&lt;code&gt;bench&lt;/code&gt; (&lt;code&gt;eap-migrations/&lt;/code&gt;); you make the certificates yourself and put them in &lt;code&gt;eap-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;tacacs.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+ authentication, authorization and accounting are always accepted, using port 4949, which needs no privilege&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; These files write the shared secret and the cluster secret directly into the configuration, and they accept everyone. Use them only for measurements on a test machine. Do not use them as a template for a production configuration.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;As with the scenarios, do not run them directly inside the repo; copy them out first. The dictionary path in the configuration is &lt;code&gt;../../share/dictionary&lt;/code&gt;, so keep two levels of depth when you copy, and make &lt;code&gt;share&lt;/code&gt; point to where the dictionaries are:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ mkdir -p ~/rradius-lab/bench/y &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; cd ~/rradius-lab/bench&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ ln -s &amp;lt;repo&amp;gt;/share share&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cp -R &amp;lt;repo&amp;gt;/rradius-server/benchmarks y/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cd y/benchmarks&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Replace &lt;code&gt;&amp;lt;repo&amp;gt;&lt;/code&gt; with the path of the source repo. The commands below all use the default ports (RADIUS 1812 and 1813, metrics 9812); &lt;code&gt;--auth-port&lt;/code&gt; and &lt;code&gt;--acct-port&lt;/code&gt; are written out only so you can see which port each one targets, and you can remove them when you use the default ports.&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd serve --config accept.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In another terminal:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --auth-port &lt;span style=&#34;color:#ae81ff&#34;&gt;1812&lt;/span&gt; --acct-port &lt;span style=&#34;color:#ae81ff&#34;&gt;1813&lt;/span&gt; --secret bench-secret &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;    --load pap,concurrency=64 --metrics-url http://127.0.0.1:9812/metrics&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;measured 10.000 s after 2.000 s of warmup&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pap (fixed-concurrency): concurrency 64, 1 threads, 1 sockets, busiest worker 53%&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  pap: 56218/s, sent 562179, accept 562179, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    latency us: p50 1079.3, p90 1452.0, p99 2443.3, p99.9 4329.5, max 387973.1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;server counters: auth 561914, acct 0, duplicates 0, discarded overload 0, unknown_client 0, invalid 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Line by line:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;measured 10.000 s after 2.000 s of warmup&lt;/code&gt;: it measured for 10 seconds after 2 seconds of warm-up.&lt;/li&gt;&#xA;&lt;li&gt;The second line: the mode of the load, the concurrency, and the numbers of threads and sockets; &lt;code&gt;busiest worker 53%&lt;/code&gt; is how much of the time the busiest thread was working (not waiting for a response).&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;pap: 56218/s&lt;/code&gt;: the number of responses received per second during the measurement. After it are the counts of each result: &lt;code&gt;invalid&lt;/code&gt; is a response that failed verification, and &lt;code&gt;late&lt;/code&gt; is a response that arrived after its request was no longer in flight.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;latency us&lt;/code&gt;: the quantiles of latency, in microseconds.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;server counters&lt;/code&gt;: the server counters read through &lt;code&gt;--metrics-url&lt;/code&gt;, as the increase during the measurement. &lt;code&gt;auth&lt;/code&gt; and &lt;code&gt;sent&lt;/code&gt; are not exactly the same, because the two sides start and stop counting at slightly different moments, so a small difference is normal. &lt;code&gt;duplicates&lt;/code&gt; and &lt;code&gt;discarded&lt;/code&gt; should both be 0.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;With &lt;code&gt;--json&lt;/code&gt;, the same content is one JSON document, with &lt;code&gt;schema&lt;/code&gt; 1:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --auth-port &lt;span style=&#34;color:#ae81ff&#34;&gt;1812&lt;/span&gt; --secret bench-secret &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;    --load pap,concurrency=8 --duration 1 --warmup 0 --json \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --metrics-url http://127.0.0.1:9812/metrics&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&amp;#34;schema&amp;#34;:1,&amp;#34;warmup_s&amp;#34;:0.0,&amp;#34;duration_s&amp;#34;:1.0,&amp;#34;trustworthy&amp;#34;:true,&amp;#34;loads&amp;#34;:[{&amp;#34;kind&amp;#34;:&amp;#34;pap&amp;#34;,&amp;#34;mode&amp;#34;:&amp;#34;fixed-concurrency&amp;#34;,…}],&amp;#34;server_metrics&amp;#34;:{…},&amp;#34;warnings&amp;#34;:[]}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;(The real output is one single line; it is shortened here.) Each load has &lt;code&gt;kind&lt;/code&gt;, &lt;code&gt;mode&lt;/code&gt;, &lt;code&gt;transport&lt;/code&gt;, &lt;code&gt;concurrency&lt;/code&gt;, &lt;code&gt;rate&lt;/code&gt;, &lt;code&gt;threads&lt;/code&gt;, &lt;code&gt;sockets&lt;/code&gt;, &lt;code&gt;reconnects&lt;/code&gt;, &lt;code&gt;send_lag_us&lt;/code&gt;, &lt;code&gt;worker_busy_max&lt;/code&gt; and &lt;code&gt;steps&lt;/code&gt;; each step has &lt;code&gt;step&lt;/code&gt;, &lt;code&gt;sent&lt;/code&gt;, &lt;code&gt;responses&lt;/code&gt; (&lt;code&gt;accept&lt;/code&gt;, &lt;code&gt;reject&lt;/code&gt;, &lt;code&gt;challenge&lt;/code&gt;, &lt;code&gt;accounting&lt;/code&gt;), &lt;code&gt;timeouts&lt;/code&gt;, &lt;code&gt;invalid&lt;/code&gt;, &lt;code&gt;late&lt;/code&gt;, &lt;code&gt;socket_errors&lt;/code&gt;, &lt;code&gt;retransmits&lt;/code&gt;, &lt;code&gt;throughput_per_s&lt;/code&gt;, &lt;code&gt;rounds&lt;/code&gt; and &lt;code&gt;latency_us&lt;/code&gt; (&lt;code&gt;p50&lt;/code&gt;, &lt;code&gt;p90&lt;/code&gt;, &lt;code&gt;p99&lt;/code&gt;, &lt;code&gt;p999&lt;/code&gt;, &lt;code&gt;max&lt;/code&gt;). &lt;code&gt;server_metrics&lt;/code&gt; is the change in the counters read through &lt;code&gt;--metrics-url&lt;/code&gt; (&lt;code&gt;packets&lt;/code&gt;, &lt;code&gt;duplicates&lt;/code&gt;, &lt;code&gt;discarded&lt;/code&gt;), and it is &lt;code&gt;null&lt;/code&gt; when &lt;code&gt;--metrics-url&lt;/code&gt; is not given. Use it when a script compares several measurements.&lt;/p&gt;&#xA;&lt;h2 id=&#34;example-measurements-and-test-environment&#34;&gt;Example measurements and test environment&#xA;&lt;/h2&gt;&lt;p&gt;The numbers below are &lt;strong&gt;only examples&lt;/strong&gt;. They show how to read a report and what different ways of writing a load measure. Do not use them to estimate your machine.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Test environment:&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;Item&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Content&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;Machine&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Apple M4 Max, 14 cores (10 performance cores + 4 efficiency cores), 36 GiB of memory&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Operating system&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;macOS 27.2.1 (26B131), arm64&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;rradius&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradiusd 0.1.0&lt;/code&gt;, commit &lt;code&gt;a261e4d&lt;/code&gt; of the core repo at the time of writing; a pre-built executable was used, and the build options were not checked 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;Server and tool&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The same machine, over loopback (&lt;code&gt;127.0.0.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;Machine load&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Running at the same time as other work; during the measurements the one-minute load average in &lt;code&gt;uptime&lt;/code&gt; rose from about 2.4 to about 8.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;Date&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;2026-11-23&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;Results (running at the same time as other work, for illustration only):&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;Configuration&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Load&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;accept.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;pap,concurrency=64&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;56218/s, p50 1.08 ms, p99 2.44 ms&lt;/td&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;accept.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;pap,concurrency=256&lt;/code&gt; (2 threads, 4 sockets)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;57766/s, p50 4.39 ms, p99 5.55 ms&lt;/td&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;accept.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;pap,concurrency=8&lt;/code&gt;, measured for 1 second&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;80212/s, p50 0.09 ms, p99 0.17 ms&lt;/td&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;accept.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;pap,rate=20000&lt;/code&gt;, measured for 5 seconds&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;20000/s, p50 0.04 ms, p99 0.07 ms, send lag p99 20 μ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;accept.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;acct-start,concurrency=256&lt;/code&gt; and &lt;code&gt;pap,rate=1000&lt;/code&gt; running together&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting 57260/s, p99 5.97 ms; logins at the same time 1000/s, p99 0.88 ms&lt;/td&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.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;tacacs-pap,concurrency=16&lt;/code&gt; (16 connections)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;106731/s, p50 0.15 ms, p99 0.22 ms&lt;/td&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.toml&lt;/code&gt; (server certificate with ECDSA P-256)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;peap,concurrency=8&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;4948 conversations/s, 9 round trips per conversation, p99 1.86 ms&lt;/td&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.toml&lt;/code&gt; (same)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;ttls,concurrency=8&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;6409 conversations/s, 5 round trips per conversation, p99 1.44 ms; with a &lt;code&gt;tool_saturated&lt;/code&gt; warning&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Several things can be seen from these lines, and these are what is worth taking away:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;More concurrency is not always better.&lt;/strong&gt; From 64 to 256, the rate hardly changed but the latency became four times larger: the extra requests only waited in the queue. The rate was even highest at concurrency 8. What you look for is the point where &amp;ldquo;the rate stops growing and the latency starts to rise&amp;rdquo;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Only a fixed rate shows the latency under a given load.&lt;/strong&gt; At 20000 per second the p99 is only 0.07 ms, much lower than measured with fixed concurrency, because there is no artificial queuing.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;When accounting and logins run together, check whether the login latency is dragged up.&lt;/strong&gt; Here the p99 of the 1000/s logins is 0.88 ms, higher than when they run alone.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;An EAP conversation has several round trips&lt;/strong&gt;, and &lt;code&gt;rounds per finished conversation&lt;/code&gt; is the number of round trips; the rate counts conversations, not packets.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;server counters: auth 0&lt;/code&gt; on the TACACS+ line is not an error.&lt;/strong&gt; &lt;code&gt;--metrics-url&lt;/code&gt; reads only the RADIUS counters; for TACACS+ requests, look at &lt;code&gt;rradius_tacacs_requests_total&lt;/code&gt; on the server.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Why these numbers cannot be compared directly:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The tool and the server are on the same machine, competing for the same CPUs, and they use loopback, so there is no real network. For a real measurement, send from another machine.&lt;/li&gt;&#xA;&lt;li&gt;On macOS &lt;code&gt;radius.sockets&lt;/code&gt; can only be 1, so all UDP packets go into the same socket; on Linux the default is one socket per worker thread, and the result would be different.&lt;/li&gt;&#xA;&lt;li&gt;Other work was running on the machine during the measurements, so the load kept changing. If you run the same command again, the numbers can differ a lot.&lt;/li&gt;&#xA;&lt;li&gt;The script in &lt;code&gt;accept.toml&lt;/code&gt; does nothing. A real configuration queries a database or LDAP or runs a script, and the rate will be much lower and the latency much higher.&lt;/li&gt;&#xA;&lt;li&gt;Each configuration was measured only once, with no repeated measurements to take an average.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;To plan capacity, use your own configuration and your own hardware, send from another machine, measure several times, and read the metrics of Chapter 17 at the same time.&lt;/p&gt;&#xA;&lt;h2 id=&#34;how-to-tell-whether-a-result-can-be-trusted&#34;&gt;How to tell whether a result can be trusted&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;rradius-bench&lt;/code&gt; checks by itself for several cases where &amp;ldquo;what you measured is not the server&amp;rdquo;, and lists warnings at the end of the report. Three of them mark the measurement as not trustworthy (&lt;code&gt;trustworthy&lt;/code&gt; in the JSON is &lt;code&gt;false&lt;/code&gt;, and the text report ends with &lt;code&gt;these numbers do not describe the server alone: see the warnings&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;Warning&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;When&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Not trustworthy&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;tool_saturated&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A thread of a fixed-concurrency load was working at least 90% of the time during the measurement&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;rate_not_met&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A fixed-rate load sent fewer than 99% of the scheduled requests, or the p99 of send lag is over 1000 microseconds&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;duplicate_path&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;With &lt;code&gt;--retries 0&lt;/code&gt;, the server&amp;rsquo;s retransmission count grew, so requests were treated as retransmissions&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;server_discarded_&amp;lt;reason&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The server dropped packets during the measurement, for example &lt;code&gt;server_discarded_overload&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No, but look at 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;metrics_unavailable&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;--metrics-url&lt;/code&gt; could not be read&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;Two examples from real runs. The rate is set higher than the tool can send:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --auth-port &lt;span style=&#34;color:#ae81ff&#34;&gt;1812&lt;/span&gt; --secret bench-secret &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;    --load pap,rate=500000 --duration 2 --warmup 1 --metrics-url http://127.0.0.1:9812/metrics&#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;warnings:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  rate_not_met: pap: sent 0 of 1000000 scheduled requests, send lag p99 0.0 us; the tool or the server could not keep up with this rate, so lower rate or raise concurrency and threads&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;these numbers do not describe the server alone: see the warnings&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;--metrics-url&lt;/code&gt; points to a port with no service (9899 is used on purpose here):&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --auth-port &lt;span style=&#34;color:#ae81ff&#34;&gt;1812&lt;/span&gt; --secret bench-secret &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;    --load pap,concurrency=1 --requests 5 --metrics-url http://127.0.0.1:9899/metrics&#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;warnings:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  metrics_unavailable: could not read the server&amp;#39;s metrics: Connection refused (os error 61)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Besides these warnings, check for yourself:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;sent&lt;/code&gt; matches the total of the responses, and &lt;code&gt;timeouts&lt;/code&gt;, &lt;code&gt;invalid&lt;/code&gt; and &lt;code&gt;socket errors&lt;/code&gt; are all 0.&lt;/li&gt;&#xA;&lt;li&gt;The server&amp;rsquo;s &lt;code&gt;duplicates&lt;/code&gt; and &lt;code&gt;discarded&lt;/code&gt; have not grown.&lt;/li&gt;&#xA;&lt;li&gt;During the measurement, watch the server with &lt;code&gt;rradiusd status --watch&lt;/code&gt;: whether &lt;code&gt;Auth in progress&lt;/code&gt; comes close to the limit, and how far the p99 differs from what the tool measured.&lt;/li&gt;&#xA;&lt;li&gt;Run &lt;code&gt;tuning&lt;/code&gt; once and see whether the UDP dropped packet count at the top grew after the measurement. If it grew, packets were dropped before rradius saw them.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;rradius-bench&lt;/code&gt; prints &lt;code&gt;rradius-bench: --load pap: needs concurrency or rate&lt;/code&gt;, with exit code 3.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;--load&lt;/code&gt; has only the kind.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add &lt;code&gt;concurrency=&lt;/code&gt; or &lt;code&gt;rate=&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; A TACACS+ load prints &lt;code&gt;window must be 1 for a TACACS+ load, which has one request at a time on each connection&lt;/code&gt;, with exit code 3.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; TACACS+ allows only one request at a time on a connection.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Remove &lt;code&gt;window&lt;/code&gt;, and use &lt;code&gt;concurrency&lt;/code&gt; to set the number of connections.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;radius.sockets = 2: only Linux shares UDP packets out over several sockets on one port, so it must be 1 here&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;sockets&lt;/code&gt; was set to more than 1 on a platform other than Linux.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Remove &lt;code&gt;sockets&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;runtime.pin_threads is only supported on Linux&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;pin_threads = true&lt;/code&gt; was set on a platform other than Linux.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Remove it.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;radius.recv_buffer_bytes = 100: it must be from 4096 to 1073741824&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The value is out of range.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change it to a value in range, or remove it to use the system default.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; At startup the log has &lt;code&gt;asked for a receive buffer of 16777216 bytes and each socket got 8388608; raise kern.ipc.maxsockbuf to at least 16777216&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The system limit is smaller than &lt;code&gt;recv_buffer_bytes&lt;/code&gt;, so the system gave only the limit.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Raise the system limit as the message says (&lt;code&gt;net.core.rmem_max&lt;/code&gt; on Linux), then restart.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The rate you measure is close to the &lt;code&gt;calibrate&lt;/code&gt; numbers, or the report has &lt;code&gt;tool_saturated&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The tool has become the bottleneck.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add &lt;code&gt;threads=&lt;/code&gt;, or send from another machine, or from several machines at the same time.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The report has &lt;code&gt;server_discarded_overload&lt;/code&gt;, &lt;code&gt;timeouts&lt;/code&gt; is not 0, and the exit code is 2.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The server&amp;rsquo;s requests in progress have reached the limit (see &lt;a class=&#34;link&#34; href=&#34;#limits-on-concurrent-requests&#34; &gt;Limits on concurrent requests&lt;/a&gt;).&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; First lower the concurrency to find the server&amp;rsquo;s limit; when it happens in production, first check why the back end became slow.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The report has &lt;code&gt;duplicate_path&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The server treated the tool&amp;rsquo;s requests as retransmissions, so what you measured is not the normal processing path.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Make sure &lt;code&gt;--retries&lt;/code&gt; is 0, and that no other program sends the same requests from the same source address.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../02-install/&#34; &gt;02 Installation&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05 RADIUS service and NAS clients&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;11 802.1X and EAP&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;12 TACACS+ device administration&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16 Clusters and high availability&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../21-troubleshooting/&#34; &gt;21 Troubleshooting&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../91-command-reference/&#34; &gt;Appendix B: Command reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../92-metrics-reference/&#34; &gt;Appendix C: Metrics reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>20 Security hardening</title>
            <link>https://embark.systems/en/rradius/oss/20-security/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/20-security/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use &lt;code&gt;check&lt;/code&gt; to find every security-related warning in the configuration at once, and fix them one by one&lt;/li&gt;&#xA;&lt;li&gt;Tighten secret files, shared secrets, Message-Authenticator and MS-CHAPv1&lt;/li&gt;&#xA;&lt;li&gt;Set the hash cost limits and the lockout after failed logins&lt;/li&gt;&#xA;&lt;li&gt;Restrict what scripts can do, and encrypt connections to databases and LDAP&lt;/li&gt;&#xA;&lt;li&gt;Open the metrics port and the cluster ports only where they should be open&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: you have done &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;Chapter 03&lt;/a&gt; and have a configuration that passes &lt;code&gt;check&lt;/code&gt;. Every item in this chapter links to its main chapter; here we only cover how to tighten it and what you see when it is not tightened.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#warnings-and-errors&#34; &gt;Warnings and errors&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#checklist&#34; &gt;Checklist&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#find-all-warnings-with-check&#34; &gt;Find all warnings with check&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#permissions-of-secret-files&#34; &gt;Permissions of secret files&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#shared-secret-length-and-example-values&#34; &gt;Shared secret length and example values&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#message-authenticator-and-limit_proxy_state&#34; &gt;Message-Authenticator and limit_proxy_state&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#turn-off-ms-chapv1&#34; &gt;Turn off MS-CHAPv1&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#stored-passwords-format-and-hash-cost-limits&#34; &gt;Stored passwords: format and hash cost limits&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#lockout-after-failed-logins&#34; &gt;Lockout after failed logins&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#limits-on-concurrent-work&#34; &gt;Limits on concurrent work&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#scripts-sandbox-time-limits-and-the-http-allowlist&#34; &gt;Scripts: sandbox, time limits and the HTTP allowlist&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#encrypting-connections-to-databases-and-ldap&#34; &gt;Encrypting connections to databases and LDAP&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#open-the-metrics-port-only-on-the-internal-network&#34; &gt;Open the metrics port only on the internal network&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#cluster-secrets-and-the-network-between-nodes&#34; &gt;Cluster secrets and the network between nodes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#trace-writes-personal-data&#34; &gt;Trace writes personal data&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#systemd-and-kubernetes-restrictions&#34; &gt;systemd and Kubernetes restrictions&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#keys-and-passwords-in-memory&#34; &gt;Keys and passwords in memory&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;All output in this chapter was produced by running &lt;code&gt;rradiusd&lt;/code&gt; 0.1.0 on a macOS machine. The timestamp at the start of each log line is replaced by &lt;code&gt;…&lt;/code&gt;; where a path appears in a message, it is the relative path written in the configuration file.&lt;/p&gt;&#xA;&lt;h2 id=&#34;warnings-and-errors&#34;&gt;Warnings and errors&#xA;&lt;/h2&gt;&lt;p&gt;rradius reacts to security problems in two ways:&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;Reaction&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;When&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;Warning (&lt;code&gt;WARN&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The configuration works but is not secure, for example a secret file that others can read&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;check&lt;/code&gt; still prints &lt;code&gt;configuration ok&lt;/code&gt; and exits with code 0; the server starts as usual&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Error&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The configuration itself is not valid, for example a cluster secret that is too short&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;check&lt;/code&gt; prints the reason and exits with code 2; the server does not start; on reload the old configuration is kept&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Warnings do not stop you, so they are easy to ignore. Most warnings appear at three points: &lt;code&gt;check&lt;/code&gt;, server start and every reload. A few appear only when the server is actually running; they are marked below.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Warning messages only name the setting, the file and the permissions. They never write the content of a password or key, or the length of a password. It is safe to hand the log to someone else.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;checklist&#34;&gt;Checklist&#xA;&lt;/h2&gt;&lt;p&gt;Go through the table item by item. The details of each item are in the sections below.&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;How to confirm it is done&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Section&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;Secret files can be read only by the owner (and its group)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;check&lt;/code&gt; has no &lt;code&gt;has mode&lt;/code&gt; warning&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;#permissions-of-secret-files&#34; &gt;Permissions of secret files&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;Files and directories of &lt;code&gt;include&lt;/code&gt; cannot be written by others&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;check&lt;/code&gt; has no &lt;code&gt;can be written by its group or by others&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;#permissions-of-secret-files&#34; &gt;Permissions of secret files&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;Shared secrets are randomly generated and at least 24 octets&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;check&lt;/code&gt; has no &lt;code&gt;shorter than 16 octets&lt;/code&gt; or &lt;code&gt;public shared secret&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;#shared-secret-length-and-example-values&#34; &gt;Shared secret length and example values&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;Message-Authenticator is left at the default &lt;code&gt;yes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;require_message_authenticator = &amp;quot;yes&amp;quot;&lt;/code&gt; in &lt;code&gt;config show&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;#message-authenticator-and-limit_proxy_state&#34; &gt;Message-Authenticator and limit_proxy_state&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;MS-CHAPv1 is left at the default, off (when there is an &lt;code&gt;[auth]&lt;/code&gt; auth chain)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[auth]&lt;/code&gt; has no &lt;code&gt;allow_mschapv1 = true&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;#turn-off-ms-chapv1&#34; &gt;Turn off MS-CHAPv1&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;All passwords in the account table have a scheme prefix&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The log has no &lt;code&gt;no scheme prefix&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;#stored-passwords-format-and-hash-cost-limits&#34; &gt;Stored passwords: format and hash cost limits&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;Lockout after failed logins is on&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The configuration has &lt;code&gt;[auth.lockout]&lt;/code&gt;, and &lt;code&gt;/metrics&lt;/code&gt; has &lt;code&gt;rradius_auth_lockouts_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;#lockout-after-failed-logins&#34; &gt;Lockout after failed logins&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;Scripts can call only hosts on the allowlist&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;allowed_hosts&lt;/code&gt; in &lt;code&gt;[lua.http]&lt;/code&gt; lists only the hosts you need&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;#scripts-sandbox-time-limits-and-the-http-allowlist&#34; &gt;Scripts: sandbox, time limits and the HTTP allowlist&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;Connections to databases and LDAP are encrypted&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No &lt;code&gt;tls = &amp;quot;off&amp;quot;&lt;/code&gt; or &lt;code&gt;allow_plaintext = true&lt;/code&gt;; the start-up log has no &lt;code&gt;unencrypted&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;#encrypting-connections-to-databases-and-ldap&#34; &gt;Encrypting connections to databases and LDAP&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;The metrics port is not exposed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;metrics.bind&lt;/code&gt; is &lt;code&gt;127.0.0.1&lt;/code&gt; or an internal address&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;#open-the-metrics-port-only-on-the-internal-network&#34; &gt;Open the metrics port only on the internal network&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;Cluster ports are bound only to an internal address&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;check&lt;/code&gt; has no &lt;code&gt;cluster.listen is not set&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;#cluster-secrets-and-the-network-between-nodes&#34; &gt;Cluster secrets and the network between nodes&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;Trace is turned off after use&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The configuration has no leftover &lt;code&gt;[log.trace]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;#trace-writes-personal-data&#34; &gt;Trace writes personal data&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;find-all-warnings-with-check&#34;&gt;Find all warnings with check&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; See all security warnings of the current configuration at once.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;check&lt;/code&gt; reads the configuration, the dictionary, the scripts and the secret files. It opens no port, so you can run it on a production machine at any time. Try it on an unmodified quick-start scenario:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::common::seal: cluster.secret_raft_file: &amp;#39;raft.secret&amp;#39; has mode 644, which others can reach or its group can write; make it 0600 or 0640&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::config: cluster.secret_raft is the public value shipped with the examples; replace it with a random one, for example from `openssl rand -hex 32`&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::common::seal: cluster.secret_api_file: &amp;#39;api.secret&amp;#39; has mode 644, which others can reach or its group can write; make it 0600 or 0640&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::config: cluster.secret_api is the public value shipped with the examples; replace it with a random one, for example from `openssl rand -hex 32`&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::common::seal: secret_file: &amp;#39;localhost.secret&amp;#39; has mode 644, which others can reach or its group can write; make it 0600 or 0640&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::reload: RADIUS client &amp;#39;localhost&amp;#39; has the public shared secret shipped with the examples; replace it with a random one, for example from `openssl rand -hex 32`&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The exit code is 0, but there are six warnings: three files have permissions that are too wide, and three secrets are the public values shipped with the examples. The next two sections show how to fix them. When all are fixed, &lt;code&gt;check&lt;/code&gt; should print only the line &lt;code&gt;configuration ok&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To block a configuration that has warnings in a deployment script, treat &lt;code&gt;WARN&lt;/code&gt; in standard error as a failure:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml 2&amp;gt;&amp;amp;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; | grep WARN &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;warnings found, fix them first&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;permissions-of-secret-files&#34;&gt;Permissions of secret files&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; Make the files that hold passwords and keys readable only by those who should read them.&lt;/p&gt;&#xA;&lt;p&gt;rradius checks the permissions of the following files when it reads them. If &amp;ldquo;others&amp;rdquo; have any permission, or the &amp;ldquo;group&amp;rdquo; can write (any bit of the permission mask &lt;code&gt;0o027&lt;/code&gt;), it logs a warning, but still reads and uses the file:&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;Main 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;code&gt;radius.clients[].secret_file&lt;/code&gt;, &lt;code&gt;tacacs.clients[].secret_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05&lt;/a&gt;, &lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#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;&lt;code&gt;cluster.secret_raft_file&lt;/code&gt;, &lt;code&gt;cluster.secret_api_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#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;&lt;code&gt;databases.&amp;lt;name&amp;gt;.password_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09&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;bind_password_file&lt;/code&gt; of the ldap handler&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;08&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;machine_password_file&lt;/code&gt; of the netlogon handler&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;08&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;radius.eap.key_file&lt;/code&gt; (private key of the server certificate)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;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;The warning has the form &amp;ldquo;setting name: &amp;lsquo;file name&amp;rsquo; has mode permissions&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;644&lt;/span&gt; localhost.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::common::seal: secret_file: &amp;#39;localhost.secret&amp;#39; has mode 644, which others can reach or its group can write; make it 0600 or 0640&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Measured results for various permissions:&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;Permissions&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Warning&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;600&lt;/code&gt;, &lt;code&gt;640&lt;/code&gt;, &lt;code&gt;400&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;644&lt;/code&gt;, &lt;code&gt;660&lt;/code&gt;, &lt;code&gt;604&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;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Fix:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;600&lt;/span&gt; *.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When you install from a package and run as the &lt;code&gt;rradius&lt;/code&gt; account, make the files owned by root, with group &lt;code&gt;rradius&lt;/code&gt; and permissions &lt;code&gt;640&lt;/code&gt;. The service account can then read but not change them:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ sudo chown root:rradius /etc/rradius/*.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ sudo chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;640&lt;/span&gt; /etc/rradius/*.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The warnings for the other files look like this (all tested):&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::common::seal: radius.eap.key_file: &amp;#39;server.key&amp;#39; has mode 644, which others can reach or its group can write; make it 0600 or 0640&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::common::seal: bind_password_file: &amp;#39;ldap.secret&amp;#39; has mode 644, which others can reach or its group can write; make it 0600 or 0640&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::common::seal: databases.legacy.password_file: &amp;#39;db.secret&amp;#39; has mode 660, which others can reach or its group can write; make it 0600 or 0640&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;files-and-directories-of-include&#34;&gt;Files and directories of include&#xA;&lt;/h3&gt;&lt;p&gt;A file read by &lt;code&gt;include&lt;/code&gt; can add clients and change auth chains, which amounts to deciding who can log in. So if the file itself, or the directory it is in, can be written by its group or by others, there is a warning:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;666&lt;/span&gt; conf.d/log.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::config: included configuration file conf.d/log.toml can be written by its group or by others, which lets them change who may log in&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;644&lt;/span&gt; conf.d/log.toml; chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;777&lt;/span&gt; conf.d&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::config: the directory of included configuration file conf.d/log.toml can be written by its group or by others, which lets them change who may log in&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The standard here is &amp;ldquo;others cannot write&amp;rdquo;, so a &lt;code&gt;644&lt;/code&gt; configuration file has no warning; &lt;code&gt;664&lt;/code&gt; does.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; When the main configuration file &lt;code&gt;rradius.toml&lt;/code&gt; or its directory can be written by the group or by others, start-up, every reload and &lt;code&gt;check&lt;/code&gt; warn &lt;code&gt;configuration file … can be written by its group or by others, which lets them change who may log in&lt;/code&gt; (for the directory, &lt;code&gt;the directory of configuration file …&lt;/code&gt;), the same as for included files; read-only access does not warn. The warning does not block start-up. You still have to make the main configuration file and its directory writable only by root yourself.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;For how to use &lt;code&gt;include&lt;/code&gt;, see &lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;Chapter 04&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;shared-secret-length-and-example-values&#34;&gt;Shared secret length and example values&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; Give each NAS a long random shared secret, and do the same for the cluster secrets.&lt;/p&gt;&#xA;&lt;h3 id=&#34;too-short&#34;&gt;Too short&#xA;&lt;/h3&gt;&lt;p&gt;A shared secret of a RADIUS or TACACS+ client that is shorter than 16 octets causes a warning. The warning does not write the secret or its length:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ printf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;short-secret\n&amp;#39;&lt;/span&gt; &amp;gt; localhost.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::reload: RADIUS client &amp;#39;localhost&amp;#39; has a shared secret shorter than 16 octets; use at least 24 random octets&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The same holds for a TACACS+ client (tested):&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::reload: TACACS+ client &amp;#39;router1&amp;#39; has a shared secret shorter than 16 octets; use at least 24 random octets&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The content of a TACACS+ packet is protected only by the shared secret, so a short secret hurts more there.&lt;/p&gt;&#xA;&lt;p&gt;The cluster&amp;rsquo;s &lt;code&gt;secret_raft&lt;/code&gt; and &lt;code&gt;secret_api&lt;/code&gt; are a hard rule: shorter than 16 characters and the server cannot 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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ printf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;abc\n&amp;#39;&lt;/span&gt; &amp;gt; raft.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: cluster.secret_raft must be at least 16 characters&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;public-values-shipped-with-the-examples&#34;&gt;Public values shipped with the examples&#xA;&lt;/h3&gt;&lt;p&gt;The secrets shipped with the example scenarios all contain &lt;code&gt;change-me&lt;/code&gt;. When a client&amp;rsquo;s shared secret or a cluster secret contains this string (case-insensitive), there is a warning:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::reload: RADIUS client &amp;#39;localhost&amp;#39; has the public shared secret shipped with the examples; replace it with a random one, for example from `openssl rand -hex 32`&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::config: cluster.secret_raft is the public value shipped with the examples; replace it with a random one, for example from `openssl rand -hex 32`&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;fix&#34;&gt;Fix&#xA;&lt;/h3&gt;&lt;p&gt;Generate a random value as the warning says. &lt;code&gt;openssl rand -hex 32&lt;/code&gt; produces 64 hexadecimal characters, far more than 24 octets:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ openssl rand -hex &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt; &amp;gt; nas1.secret&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;600&lt;/span&gt; nas1.secret&#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-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# rradius.toml&lt;/span&gt;&#xA;&lt;/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;nas1&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;192.0.2.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;nas1.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:#75715e&#34;&gt;# … (other settings omitted)&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;Use &lt;code&gt;secret_file&lt;/code&gt;; do not write the shared secret directly in &lt;code&gt;secret&lt;/code&gt; in the configuration file. Set exactly one of them: setting both or neither gives &lt;code&gt;exactly one of secret or secret_file must be set&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Use a different secret for each NAS (or each network). When one secret leaks, you only have to change one client.&lt;/li&gt;&#xA;&lt;li&gt;A shared secret can be changed with a reload, without a restart (&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;Chapter 05&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;message-authenticator-and-limit_proxy_state&#34;&gt;Message-Authenticator and limit_proxy_state&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; Accept only Access-Requests that carry a Message-Authenticator.&lt;/p&gt;&#xA;&lt;p&gt;The Message-Authenticator is a signature computed over the whole packet with the shared secret. The server uses it to confirm that the request comes from a NAS that knows the shared secret and that the content was not altered. There are two related settings. They can be written in &lt;code&gt;[radius]&lt;/code&gt; or as overrides in an individual &lt;code&gt;[[radius.clients]]&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;Setting&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Reload&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;&lt;code&gt;require_message_authenticator&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;quot;yes&amp;quot;&lt;/code&gt;&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;code&gt;yes&lt;/code&gt;: an Access-Request without a Message-Authenticator is dropped; &lt;code&gt;no&lt;/code&gt;: it is accepted; &lt;code&gt;auto&lt;/code&gt;: decided by the first request from this client after the server starts&lt;/td&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;limit_proxy_state&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;quot;yes&amp;quot;&lt;/code&gt;&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;Takes effect only when a Message-Authenticator is not required. &lt;code&gt;yes&lt;/code&gt;: an Access-Request that has Proxy-State but no Message-Authenticator is dropped&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 ignores both settings and always needs a correct Message-Authenticator. For the full description of the keys, see &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt;; for how to write clients, see &lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;Chapter 05&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-default-is-the-safest&#34;&gt;The default is the safest&#xA;&lt;/h3&gt;&lt;p&gt;If you set nothing, both are &lt;code&gt;yes&lt;/code&gt;. Use the &lt;code&gt;--no-message-authenticator&lt;/code&gt; option of &lt;code&gt;rradius-bench&lt;/code&gt; to imitate an old NAS that does not send a Message-Authenticator:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --password alice-password --no-message-authenticator \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --load pap,concurrency=1 --requests 1 --timeout 2&#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;  pap: 0/s, sent 1, accept 0, reject 0, challenge 0, accounting 0, timeouts 1, invalid 0, late 0, socket errors 0, retransmits 0&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The server does not answer, and the log has one line (at most once per second for the same port; the number after &lt;code&gt;discarded&lt;/code&gt; is the count accumulated in that time):&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::radius: RADIUS: discarded 1 Access-Requests lacking a Message-Authenticator, the last from 127.0.0.1; see require_message_authenticator and limit_proxy_state&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;Discarded: invalid&lt;/code&gt; in &lt;code&gt;status&lt;/code&gt; goes up.&lt;/p&gt;&#xA;&lt;h3 id=&#34;when-an-old-nas-does-not-send-message-authenticator&#34;&gt;When an old NAS does not send Message-Authenticator&#xA;&lt;/h3&gt;&lt;p&gt;Set &lt;code&gt;&amp;quot;no&amp;quot;&lt;/code&gt; only for that one NAS. Do not change the global value in &lt;code&gt;[radius]&lt;/code&gt;, and keep &lt;code&gt;limit_proxy_state&lt;/code&gt; at &lt;code&gt;yes&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:#75715e&#34;&gt;# rradius.toml&lt;/span&gt;&#xA;&lt;/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;old-switch&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;192.0.2.20&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;old-switch.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;require_message_authenticator&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;no&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;do-not-use-auto&#34;&gt;Do not use auto&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;auto&lt;/code&gt; lets the server learn from the first Access-Request of this client after start-up: if the first one has a Message-Authenticator, all later ones must have it; if the first has none, later ones are never required to, until a restart. A forged first packet can turn the protection off, so when the server learns &amp;ldquo;not required&amp;rdquo; it logs a warning (once per source address):&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::lua_engine: RADIUS client &amp;#39;localhost&amp;#39; (127.0.0.1): the first request had no Message-Authenticator, so require_message_authenticator (auto) became no and stays no until the server restarts; a forged first packet can switch this protection off; set it to &amp;#34;yes&amp;#34; or &amp;#34;no&amp;#34; in the client&amp;#39;s settings&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This was tested: with &lt;code&gt;auto&lt;/code&gt; set, after one request without a Message-Authenticator was sent first, later requests without it were also accepted.&lt;/p&gt;&#xA;&lt;p&gt;Fix: do as the message says and write &lt;code&gt;&amp;quot;yes&amp;quot;&lt;/code&gt; or &lt;code&gt;&amp;quot;no&amp;quot;&lt;/code&gt; explicitly.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;auto&lt;/code&gt; can also be used only on a client with a single address. On a network, &lt;code&gt;check&lt;/code&gt; refuses it:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: radius clients: client &amp;#39;127.0.0.0/24&amp;#39;: require_message_authenticator = &amp;#34;auto&amp;#34; needs a single host, not a network&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;limit_proxy_state = &amp;quot;auto&amp;quot;&lt;/code&gt; on a network gives the same message, with only the setting name different.&lt;/p&gt;&#xA;&lt;h2 id=&#34;turn-off-ms-chapv1&#34;&gt;Turn off MS-CHAPv1&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; Do not accept MS-CHAPv1 logins.&lt;/p&gt;&#xA;&lt;p&gt;MS-CHAPv1 is a very old method. When there is an &lt;code&gt;[auth]&lt;/code&gt; auth chain it is &lt;strong&gt;off by default&lt;/strong&gt;, and you do not need to write anything. Setups with no &lt;code&gt;[auth]&lt;/code&gt;, where a Lua script handles &lt;code&gt;MS-CHAP-Response&lt;/code&gt; itself, are outside the scope of this switch; the script has to decide. If you want to write it out explicitly in the configuration 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-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# rradius.toml&lt;/span&gt;&#xA;&lt;/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;]&#xA;&lt;/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;&lt;span style=&#34;color:#a6e22e&#34;&gt;allow_mschapv1&lt;/span&gt; = &lt;span style=&#34;color:#66d9ef&#34;&gt;false&lt;/span&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;# … (other settings omitted)&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;The default is &lt;code&gt;false&lt;/code&gt;; it can be reloaded. Write &lt;code&gt;allow_mschapv1 = true&lt;/code&gt; only to let a NAS log in that cannot do without it.&lt;/li&gt;&#xA;&lt;li&gt;When it is not written or is &lt;code&gt;false&lt;/code&gt;, an MS-CHAPv1 request is refused before any handler runs. It does not query the database and does not count towards lockout after failed logins.&lt;/li&gt;&#xA;&lt;li&gt;PAP, CHAP, MS-CHAPv2 and EAP are not affected. A TACACS+ MS-CHAP login is also refused, with FAIL.&lt;/li&gt;&#xA;&lt;li&gt;Write the value as a boolean. Written as a string it gives &lt;code&gt;`allow_mschapv1`: invalid type: string, expected a boolean&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;code&gt;rradius-bench&lt;/code&gt; has no MS-CHAPv1 load. Here a small program of our own sent one Access-Request with &lt;code&gt;MS-CHAP-Challenge&lt;/code&gt; and &lt;code&gt;MS-CHAP-Response&lt;/code&gt;. The server answered Access-Reject, and the log is:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::auth_chain: MS-CHAPv1 refused: client localhost, protocol radius, user &amp;#34;dave&amp;#34;; [auth] allow_mschapv1 is not true&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;dave&amp;#34; account=&amp;#34;&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;mschapv1_refused&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;handler=&amp;quot;mschapv1_refused&amp;quot;&lt;/code&gt; in the authentication record lets you find in the log which NASes still use MS-CHAPv1.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; MS-CHAPv1 was not sent from a real NAS or TACACS+ device. Only the RADIUS case was run, with the test packet above.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;stored-passwords-format-and-hash-cost-limits&#34;&gt;Stored passwords: format and hash cost limits&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; Every password in the account table states its format, and nobody can drag the server down with an extremely expensive hash.&lt;/p&gt;&#xA;&lt;h3 id=&#34;every-password-needs-a-scheme-prefix&#34;&gt;Every password needs a scheme prefix&#xA;&lt;/h3&gt;&lt;p&gt;For a password read by the sql handler, the format is decided by the prefix at the start, for example &lt;code&gt;{crypt}&lt;/code&gt;, &lt;code&gt;{argon2}&lt;/code&gt;, &lt;code&gt;{SHA256}&lt;/code&gt;, &lt;code&gt;{nthash}&lt;/code&gt;; &lt;code&gt;{clear}&lt;/code&gt; means plaintext (for the list of formats see &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;Chapter 07&lt;/a&gt;). A value without a prefix logs a warning in two cases:&lt;/p&gt;&#xA;&lt;p&gt;It looks like a hash (for example &lt;code&gt;$2y$…&lt;/code&gt;) but has no prefix: login is refused.&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::auth_chain: the stored password looks like a hash with no scheme prefix and is refused; add {crypt} or {argon2} before it, or {clear} if it is the password itself user=&amp;#34;eve&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It looks like a hexadecimal digest but has no prefix: &lt;strong&gt;it is compared as plaintext&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::auth_chain: the stored password looks like a digest with no scheme prefix and is compared as plaintext; add its prefix ({nthash}, {MD5}, {SHA}, {SHA256}, ...), or {clear} if it is the password itself user=&amp;#34;frank&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; The second case was tested: &lt;code&gt;frank&lt;/code&gt; has a 32-digit hexadecimal MD5 digest stored with no prefix. Logging in with the original password is refused, but &lt;strong&gt;logging in with the digest itself as the password succeeds&lt;/strong&gt;. Anyone who gets the account table can log in with the digest directly. When you see this warning, always add the correct prefix.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Each of these two warnings is logged once per account after the server starts.&lt;/p&gt;&#xA;&lt;h3 id=&#34;hash-cost-limits&#34;&gt;Hash cost limits&#xA;&lt;/h3&gt;&lt;p&gt;For formats such as &lt;code&gt;{PBKDF2…}&lt;/code&gt;, the &lt;code&gt;$5$&lt;/code&gt;/&lt;code&gt;$6$&lt;/code&gt;/bcrypt forms of &lt;code&gt;{crypt}&lt;/code&gt;, and &lt;code&gt;{argon2}&lt;/code&gt;, the computation cost is written inside the stored value. Someone who can write the account table can put in a value with an enormous iteration count, so that every login uses up CPU or memory. rradius reads the cost before computing, and if it is over the limit, it does not compute and treats it as a wrong password:&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;code&gt;[auth.password_limits]&lt;/code&gt;)&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What it limits&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;pbkdf2_iterations&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;5000000&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Iteration count of PBKDF2 and X-PBKDF2&lt;/td&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;crypt_rounds&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1000000&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Rounds of &lt;code&gt;$5$&lt;/code&gt;, &lt;code&gt;$6$&lt;/code&gt;, &lt;code&gt;$sha1$&lt;/code&gt; and extended DES (starting with &lt;code&gt;_&lt;/code&gt;) crypt&lt;/td&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;bcrypt_cost&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;15&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;bcrypt cost; each +1 doubles the work&lt;/td&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;argon2_memory_kib&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;262144 (256 MiB)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;argon2 memory&lt;/td&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;argon2_iterations&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;10&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;argon2 iteration count&lt;/td&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;argon2_lanes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;16&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;argon2 parallelism&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;Without this section, the default limits still apply. It can be reloaded.&lt;/li&gt;&#xA;&lt;li&gt;Every value must be greater than 0. Writing 0 gives &lt;code&gt;auth.password_limits.bcrypt_cost must be greater than 0&lt;/code&gt; (with the matching key name) and exit code 2.&lt;/li&gt;&#xA;&lt;li&gt;The worst case of &lt;code&gt;argon2_memory_kib&lt;/code&gt; is this value times the number of CPUs, because the number of checks running at once equals the number of CPUs. Lower it on machines with little memory.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Tested: &lt;code&gt;bob&lt;/code&gt; in the quick-start has a bcrypt with cost 10. Lower the limit to 9:&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:#75715e&#34;&gt;# rradius.toml&lt;/span&gt;&#xA;&lt;/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;password_limits&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;bcrypt_cost&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;9&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;bob&lt;/code&gt; is refused even with the correct password, and the log records it once (not again for the same account):&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::auth_chain: the stored password asks for more than [auth.password_limits].bcrypt_cost allows and is refused; raise the limit if the hash is meant to be used user=&amp;#34;bob&amp;#34; format=&amp;#34;crypt&amp;#34; parameter=&amp;#34;bcrypt_cost&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;rradius_password_checks_total{scheme=&amp;quot;crypt&amp;quot;,result=&amp;quot;failed&amp;quot;}&lt;/code&gt; also goes up. If your accounts really use a higher cost, raise the limit as the message says; otherwise someone changed the account table, and you should investigate.&lt;/p&gt;&#xA;&lt;p&gt;For the &lt;code&gt;[accounts] scheme&lt;/code&gt; that &lt;code&gt;user add&lt;/code&gt; uses to store passwords, see &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;Chapter 07&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;lockout-after-failed-logins&#34;&gt;Lockout after failed logins&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; Lock an account temporarily when the same account keeps guessing wrong passwords from the same device.&lt;/p&gt;&#xA;&lt;p&gt;By default there is no lockout, and the number of guesses is not limited. Adding &lt;code&gt;[auth.lockout]&lt;/code&gt; starts the counting:&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:#75715e&#34;&gt;# rradius.toml&lt;/span&gt;&#xA;&lt;/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;lockout&lt;/span&gt;]&#xA;&lt;/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_failures&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;window_seconds&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;lock_seconds&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;300&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;Default&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;&lt;code&gt;max_failures&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;10&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How many failures within &lt;code&gt;window_seconds&lt;/code&gt; lock 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;window_seconds&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;300&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Counting time, from the first failure&lt;/td&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;lock_seconds&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;300&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How long it stays locked&lt;/td&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;max_entries&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;100000&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How many pairs each node remembers at most&lt;/td&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;account_max_failures&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;not set&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Upper limit of the total failures of one account regardless of source; must be greater than &lt;code&gt;max_failures&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;max_in_flight&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;5 times &lt;code&gt;max_failures&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Logins of the same pair waiting for a result at the same time; any more are refused immediately&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;The unit of counting is &amp;ldquo;account + source device&amp;rdquo;: the source is &lt;code&gt;Calling-Station-Id&lt;/code&gt; for RADIUS and &lt;code&gt;rem_addr&lt;/code&gt; for TACACS+; when there is none, it is an empty string.&lt;/li&gt;&#xA;&lt;li&gt;While locked, requests are refused immediately and the password is not checked, even if it is correct. A successful login clears the count.&lt;/li&gt;&#xA;&lt;li&gt;A login that fails because the database is unavailable is not counted; an account that does not exist is counted all the same, so the lockout behavior does not show whether an account exists.&lt;/li&gt;&#xA;&lt;li&gt;The counts are kept in the memory of each node: a reload keeps them, a restart resets them, and nodes of a cluster do not share them.&lt;/li&gt;&#xA;&lt;li&gt;It can be reloaded.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Tested: &lt;code&gt;max_failures = 3&lt;/code&gt;, &lt;code&gt;lock_seconds = 60&lt;/code&gt;, &lt;code&gt;alice&lt;/code&gt; types a wrong password three times, then the correct one the fourth time:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; account=&amp;#34;alice&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;sql&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; account=&amp;#34;alice&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;sql&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::auth_chain: auth lockout: client localhost: account &amp;#34;alice&amp;#34; from &amp;#34;&amp;#34; is locked (this origin)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; account=&amp;#34;alice&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;sql&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; account=&amp;#34;alice&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;lockout&amp;#34; decision=&amp;#34;reject&amp;#34;&#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;from &amp;quot;&amp;quot;&lt;/code&gt; is an empty source: &lt;code&gt;rradius-bench&lt;/code&gt; does not send &lt;code&gt;Calling-Station-Id&lt;/code&gt;. A real NAS sends the MAC address of the device.&lt;/li&gt;&#xA;&lt;li&gt;On the last line, &lt;code&gt;handler=&amp;quot;lockout&amp;quot;&lt;/code&gt;: the password was not checked.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Metrics:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s http://127.0.0.1:9812/metrics | grep &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;^rradius_auth_lockout&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_auth_lockout_rejected_total 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_auth_lockouts_total 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_auth_lockout_untracked_total 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_auth_lockout_untracked_total 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When &lt;code&gt;rradius_auth_lockout_untracked_total&lt;/code&gt; goes up, the table is full and all of it is locked pairs, so new pairs are not tracked. Tested with &lt;code&gt;max_entries = 1&lt;/code&gt; and &lt;code&gt;max_failures = 1&lt;/code&gt;: &lt;code&gt;alice&lt;/code&gt; types one wrong password and is locked, then &lt;code&gt;bob&lt;/code&gt; types a wrong one:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::auth_lockout: auth lockout: the table of 1 keys is full of locks; failures of new keys are not counted&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;rradius_auth_lockout_untracked_total&lt;/code&gt; becomes 1. This line is logged at most once a minute. If you see it in production, you are usually under heavy guessing, and you need to block it at the network layer.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; &lt;code&gt;account_max_failures&lt;/code&gt; makes it useless for a password guesser to switch devices, but it also lets anyone type wrong passwords on purpose to lock one account on all devices. Whether to set it depends on which of the two you fear more.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Examples of wrong settings (the exit code is 2 for all):&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: auth.lockout.max_failures must be greater than 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: auth.lockout.account_max_failures must be greater than max_failures (10), not 5&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For the full description of auth chains, see &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;Chapter 07&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;limits-on-concurrent-work&#34;&gt;Limits on concurrent work&#xA;&lt;/h2&gt;&lt;p&gt;The core has no setting for a rate limit such as &amp;ldquo;requests per second&amp;rdquo;. The limits come from the number of requests handled at the same time:&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;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;When exceeded&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.max_auth_inflight&lt;/code&gt;, &lt;code&gt;max_acct_inflight&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;4096&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Dropped; &lt;code&gt;Discarded: overload&lt;/code&gt; goes up; the log has &lt;code&gt;RADIUS authentication overloaded: discarded … packets&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.max_connections&lt;/code&gt;, &lt;code&gt;max_connections_per_source&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1024, 64&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Connections over the limit are closed immediately&lt;/td&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.max_body_len&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;65536&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The connection is closed if the packet body is larger&lt;/td&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.idle_timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;300000&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The connection is closed if no complete packet arrives in this 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;auth.lockout.max_in_flight&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;see the previous section&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Refused immediately&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;For how to adjust these values to the machine, see &lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;Chapter 19&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Retransmit detection (answering with the earlier answer when the same NAS retransmits the same request) exists to avoid processing twice. It is not a security mechanism; it is described in &lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;Chapter 05&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;scripts-sandbox-time-limits-and-the-http-allowlist&#34;&gt;Scripts: sandbox, time limits and the HTTP allowlist&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; When a script fails or is badly written, the effect is limited to that one request.&lt;/p&gt;&#xA;&lt;h3 id=&#34;sandbox&#34;&gt;Sandbox&#xA;&lt;/h3&gt;&lt;p&gt;Lua scripts run in a restricted environment: there is no &lt;code&gt;io&lt;/code&gt; for reading and writing files, &lt;code&gt;os.execute&lt;/code&gt; does not exist, &lt;code&gt;require&lt;/code&gt;, &lt;code&gt;loadstring&lt;/code&gt;, &lt;code&gt;getfenv&lt;/code&gt; and &lt;code&gt;setfenv&lt;/code&gt; are removed, and the built-in libraries are read-only. Tested: when a script calls &lt;code&gt;io.open&lt;/code&gt; or &lt;code&gt;os.execute&lt;/code&gt;, that request is refused and the log is:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::lua_engine: Lua script error (radius/authentication): runtime error: api.lua:1: attempt to index nil with &amp;#39;open&amp;#39;\nstack traceback:\n\tapi.lua:1: in function &amp;lt;api.lua:1&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::lua_engine: Lua script error (radius/authentication): runtime error: api.lua:1: attempt to call a nil value\nstack traceback:\n\tapi.lua:1: in function &amp;lt;api.lua:1&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;time-and-memory&#34;&gt;Time and memory&#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;Setting&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Reload&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;&lt;code&gt;lua.max_execution_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1000&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;Time the script itself runs for each request; time waiting for the database is not counted&lt;/td&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.max_memory_mb&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;256&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Memory limit of each Lua VM&lt;/td&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.query_timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;5000&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;Total time each request waits for the database&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Tested with &lt;code&gt;max_execution_ms = 100&lt;/code&gt; and the script &lt;code&gt;while true do end&lt;/code&gt;: the request is refused:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::lua_engine: Lua script error (radius/authentication): runtime error: script exceeded the execution limit of 100 ms&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;According to the spec, catching this error in the script with &lt;code&gt;pcall&lt;/code&gt; does not help; the request still counts as failed (this was not tested separately).&lt;/p&gt;&#xA;&lt;h3 id=&#34;http-allowlist&#34;&gt;HTTP allowlist&#xA;&lt;/h3&gt;&lt;p&gt;The &lt;code&gt;http_request&lt;/code&gt; function of a script can call only the hosts listed in &lt;code&gt;allowed_hosts&lt;/code&gt; in &lt;code&gt;[lua.http]&lt;/code&gt;. Without a &lt;code&gt;[lua.http]&lt;/code&gt; section, &lt;code&gt;http_request&lt;/code&gt; does not exist at all: tested, calling it gives &lt;code&gt;attempt to call a nil value&lt;/code&gt; and the request is refused.&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:#75715e&#34;&gt;# rradius.toml&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&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;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;http://legacy.internal:8080&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;A host name alone allows only HTTPS on port 443. &lt;code&gt;host:port&lt;/code&gt; allows HTTPS on the given port. For plaintext HTTP you must write &lt;code&gt;http://host:port&lt;/code&gt;, which states clearly that you know it is not encrypted.&lt;/li&gt;&#xA;&lt;li&gt;Writing &lt;code&gt;https://…&lt;/code&gt; is refused: &lt;code&gt;lua.http.allowed_hosts: &#39;https://api.example.com&#39; is not host, host:port or http://host:port&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;An empty list is refused: &lt;code&gt;lua.http.allowed_hosts must list at least one host&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;HTTPS trusts the system root certificates by default; add an internal CA with &lt;code&gt;ca_file&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Tested: a script calls &lt;code&gt;http://127.0.0.1:8080/login&lt;/code&gt;, which is not on the list:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::lua_engine: script http_request refused: http://127.0.0.1 is not in lua.http.allowed_hosts&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;rradius_script_http_requests_total{result=&amp;quot;denied&amp;quot;}&lt;/code&gt; goes up. The script gets &lt;code&gt;nil&lt;/code&gt; and an error message from &lt;code&gt;http_request&lt;/code&gt;, and what to do about it is up to the script.&lt;/p&gt;&#xA;&lt;p&gt;When you build a URL, always encode values that come from users with &lt;code&gt;url_encode&lt;/code&gt; first. For how to write scripts see &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;Chapter 10&lt;/a&gt;, and for function details see &lt;a class=&#34;link&#34; href=&#34;../93-lua-reference/&#34; &gt;Appendix D&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;encrypting-connections-to-databases-and-ldap&#34;&gt;Encrypting connections to databases and LDAP&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; Passwords and query results do not travel over the network in plaintext.&lt;/p&gt;&#xA;&lt;h3 id=&#34;external-databases&#34;&gt;External databases&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;tls&lt;/code&gt; of &lt;code&gt;[databases.&amp;lt;name&amp;gt;]&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;Value&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;&lt;code&gt;&amp;quot;verify&amp;quot;&lt;/code&gt; (default)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Encrypted, and the certificate chain and host name are verified&lt;/td&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;off&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Not encrypted&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;When it is set to &lt;code&gt;&amp;quot;off&amp;quot;&lt;/code&gt; and &lt;code&gt;host&lt;/code&gt; is not local (&lt;code&gt;localhost&lt;/code&gt; or a loopback address), the server logs a warning at start-up:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::external_db: databases.remote: tls = &amp;#34;off&amp;#34; sends the password and the data to 192.0.2.10 unencrypted&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This warning appears only when the server starts; &lt;code&gt;check&lt;/code&gt; does not print it. Tested: with the same configuration, &lt;code&gt;check&lt;/code&gt; printed only &lt;code&gt;configuration ok&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;When the database uses a certificate signed by an internal CA, name the CA with &lt;code&gt;ca_file&lt;/code&gt;; do not change to &lt;code&gt;&amp;quot;off&amp;quot;&lt;/code&gt;. For details see &lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;Chapter 09&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;ldap&#34;&gt;LDAP&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;urls&lt;/code&gt; of the ldap handler:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;ldaps://&lt;/code&gt;: a TLS connection.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;ldap://&lt;/code&gt;: upgraded to an encrypted connection with StartTLS by default.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;ldap://&lt;/code&gt; with &lt;code&gt;allow_plaintext = true&lt;/code&gt;: &lt;strong&gt;not encrypted&lt;/strong&gt;. When &lt;code&gt;bind&lt;/code&gt; checks a password, the user&amp;rsquo;s password is sent to the directory server in plaintext.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;With &lt;code&gt;allow_plaintext = true&lt;/code&gt; and &lt;code&gt;ldap://&lt;/code&gt;, start-up, every reload and &lt;code&gt;check&lt;/code&gt; warn &lt;code&gt;ldap handler ldap://… is used without encryption because allow_plaintext is true&lt;/code&gt;, but &lt;code&gt;check&lt;/code&gt; still passes. Do not turn it on unless the directory server is on the same machine. Name an internal CA with &lt;code&gt;ca_file&lt;/code&gt;. For details see &lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;Chapter 08&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; Encrypted connections were not tested against a real LDAP or PostgreSQL/MySQL server. The settings and warnings were confirmed only with &lt;code&gt;check&lt;/code&gt; and an address that cannot be reached.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;open-the-metrics-port-only-on-the-internal-network&#34;&gt;Open the metrics port only on the internal network&#xA;&lt;/h2&gt;&lt;p&gt;The HTTP port opened by &lt;code&gt;[metrics]&lt;/code&gt; has &lt;code&gt;/metrics&lt;/code&gt;, &lt;code&gt;/livez&lt;/code&gt; and &lt;code&gt;/readyz&lt;/code&gt;, with no authentication at all; anyone who can reach it can read it. The metrics contain client names, database names and various counts.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;metrics.bind&lt;/code&gt; is &lt;code&gt;127.0.0.1&lt;/code&gt; by default. To let Prometheus on another machine scrape it, bind to an address on the internal or management network; do not bind &lt;code&gt;0.0.0.0&lt;/code&gt; on an external interface.&lt;/li&gt;&#xA;&lt;li&gt;Changing &lt;code&gt;[metrics]&lt;/code&gt; needs a restart.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;status&lt;/code&gt; command reads this very port, so run &lt;code&gt;status&lt;/code&gt; where it can reach the port.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For details see &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;Chapter 17&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;cluster-secrets-and-the-network-between-nodes&#34;&gt;Cluster secrets and the network between nodes&#xA;&lt;/h2&gt;&lt;p&gt;The Raft port and the API port of the cluster are protected only by &lt;code&gt;secret_raft&lt;/code&gt; and &lt;code&gt;secret_api&lt;/code&gt;; the connections themselves are not encrypted.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Both secrets must be at least 16 characters. Keep them in &lt;code&gt;secret_raft_file&lt;/code&gt; and &lt;code&gt;secret_api_file&lt;/code&gt;, with the permissions described in &lt;a class=&#34;link&#34; href=&#34;#permissions-of-secret-files&#34; &gt;Permissions of secret files&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;On a single machine (no &lt;code&gt;cluster.nodes&lt;/code&gt;), the cluster ports are bound by default only to &lt;code&gt;127.0.0.1&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;With &lt;code&gt;cluster.nodes&lt;/code&gt; but no &lt;code&gt;cluster.listen&lt;/code&gt;, the cluster ports are bound on all interfaces, and &lt;code&gt;check&lt;/code&gt; warns:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::config: cluster.listen is not set, so the cluster&amp;#39;s Raft and API ports are on all interfaces, with nothing but their shared secrets to protect them; set listen to this node&amp;#39;s private or WireGuard address, or to &amp;#34;0.0.0.0&amp;#34; to keep it and silence this warning&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Fix: set &lt;code&gt;listen&lt;/code&gt; to this node&amp;rsquo;s address on the internal network or on an encrypted tunnel such as WireGuard. When nodes must cross an untrusted network, make both the &lt;code&gt;raft&lt;/code&gt; and &lt;code&gt;api&lt;/code&gt; addresses in &lt;code&gt;cluster.nodes&lt;/code&gt; go through an encrypted tunnel. For cluster deployment and networking, see &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 16&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; The cluster network and WireGuard between several machines were not tested on real hardware. The warning above was reproduced with &lt;code&gt;check&lt;/code&gt; on a single machine.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;trace-writes-personal-data&#34;&gt;Trace writes personal data&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;[log.trace]&lt;/code&gt; writes the whole request and response of given users or clients into the log. While it is on, server start-up and every reload remind 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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::radius: [log.trace] is on for 5 minutes: requests of these users and clients are written out in full, personal data included&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In a tested trace line, &lt;code&gt;User-Password&lt;/code&gt; and &lt;code&gt;Message-Authenticator&lt;/code&gt; are shown as &lt;code&gt;&amp;lt;hidden&amp;gt;&lt;/code&gt;, and the other attributes are written as they are:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_trace: request client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; code=1 attributes=&amp;#34;Message-Authenticator = &amp;lt;hidden&amp;gt;, User-Name = alice, User-Password = &amp;lt;hidden&amp;gt;, NAS-IP-Address = 192.0.2.1, NAS-Identifier = rradius-bench&amp;#34;&#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;minutes&lt;/code&gt; must be from 1 to 1440; out of range gives &lt;code&gt;log.trace.minutes: 2000 is not from 1 to 1440&lt;/code&gt;. It stops by itself when the time is up.&lt;/li&gt;&#xA;&lt;li&gt;When you have finished troubleshooting, remove &lt;code&gt;[log.trace]&lt;/code&gt; from the configuration, and deal with the logs that were already written.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For how to use trace, see &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;Chapter 17&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;systemd-and-kubernetes-restrictions&#34;&gt;systemd and Kubernetes restrictions&#xA;&lt;/h2&gt;&lt;h3 id=&#34;systemd&#34;&gt;systemd&#xA;&lt;/h3&gt;&lt;p&gt;The &lt;code&gt;packages/common/rradius.service&lt;/code&gt; shipped with the packages already applies these restrictions:&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;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;&lt;code&gt;User=rradius&lt;/code&gt;, &lt;code&gt;Group=rradius&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Does not run as root&lt;/td&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;AmbientCapabilities=CAP_NET_BIND_SERVICE&lt;/code&gt;, &lt;code&gt;CapabilityBoundingSet=CAP_NET_BIND_SERVICE&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Grants only the right to bind low ports (TACACS+ port 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;&lt;code&gt;NoNewPrivileges=yes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Cannot gain more privileges&lt;/td&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;ProtectSystem=strict&lt;/code&gt;, &lt;code&gt;ReadWritePaths=/var/lib/rradius /var/log/rradius&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The whole system is read-only; only the data directory and the log directory are writable&lt;/td&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;ProtectHome=yes&lt;/code&gt;, &lt;code&gt;PrivateTmp=yes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Cannot see home directories; has its own &lt;code&gt;/tmp&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;So secret files owned by &lt;code&gt;root:rradius&lt;/code&gt; with permissions &lt;code&gt;640&lt;/code&gt; are the best fit: the service can read them but not change them. When your configuration uses another writable path (for example an accounting log kept elsewhere), add it to &lt;code&gt;ReadWritePaths&lt;/code&gt;, or put it under &lt;code&gt;/var/lib/rradius&lt;/code&gt; or &lt;code&gt;/var/log/rradius&lt;/code&gt;. For installation and the other settings of the unit, see &lt;a class=&#34;link&#34; href=&#34;../02-install/&#34; &gt;Chapter 02&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;kubernetes&#34;&gt;Kubernetes&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;deploy/kubernetes/networkpolicy.yaml&lt;/code&gt; (not in &lt;code&gt;kustomization.yaml&lt;/code&gt; by default; add it yourself):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;RADIUS 1812 and 1813/UDP: from anywhere.&lt;/li&gt;&#xA;&lt;li&gt;Cluster 8100 and 8200: only from other rradius pods.&lt;/li&gt;&#xA;&lt;li&gt;Metrics 9812: only from the namespace with the label &lt;code&gt;kubernetes.io/metadata.name: monitoring&lt;/code&gt;. Change the label to the namespace where your Prometheus runs.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;code&gt;deploy/kubernetes/secret.example.yaml&lt;/code&gt; only shows the shape of a Secret; the values in it are not real passwords. Follow the comment at the top of the file: generate &lt;code&gt;raft&lt;/code&gt; and &lt;code&gt;api&lt;/code&gt; with &lt;code&gt;openssl rand -hex 32&lt;/code&gt; and create them with &lt;code&gt;kubectl create secret&lt;/code&gt;. For deploying the cluster on Kubernetes, see &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 16&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; The systemd unit and the NetworkPolicy were only compared with the file contents, and were not tested on a Linux host or a Kubernetes cluster. A NetworkPolicy takes effect only when the network plugin supports it.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;keys-and-passwords-in-memory&#34;&gt;Keys and passwords in memory&#xA;&lt;/h2&gt;&lt;p&gt;After use, rradius&amp;rsquo;s own code overwrites these data in memory: the EAP MSK and the key material it is derived from, the password of a PAP request, the NT hash and the values derived from it, and the MPPE keys (after the reply attributes are encoded). The debug output format also does not show passwords.&lt;/p&gt;&#xA;&lt;p&gt;Data held inside third-party libraries, values handed to scripts, and copies left by the compiler are outside this scope.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; This section is based on the spec and the code; it was not checked with a memory dump.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; prints &lt;code&gt;configuration ok&lt;/code&gt;, but there are several &lt;code&gt;WARN&lt;/code&gt; lines before it.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; Warnings do not affect the exit code.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Handle them one by one as in &lt;a class=&#34;link&#34; href=&#34;#find-all-warnings-with-check&#34; &gt;Find all warnings with check&lt;/a&gt;. A deployment script can block on them with &lt;code&gt;grep WARN&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; After &lt;code&gt;chmod 600&lt;/code&gt;, a service installed from a package cannot read the secret file and fails to start.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The file is owned by root, and the service account &lt;code&gt;rradius&lt;/code&gt; cannot read it.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; &lt;code&gt;chown root:rradius&lt;/code&gt; and &lt;code&gt;chmod 640&lt;/code&gt;. &lt;code&gt;640&lt;/code&gt; gives no warning.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; fails: &lt;code&gt;cluster.secret_raft must be at least 16 characters&lt;/code&gt;, exit code 2.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The cluster secret is too short.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; &lt;code&gt;openssl rand -hex 32 &amp;gt; raft.secret&lt;/code&gt;. Every node uses the same one.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; fails: &lt;code&gt;require_message_authenticator = &amp;quot;auto&amp;quot; needs a single host, not a network&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;auto&lt;/code&gt; is used on a client that is a network, or &lt;code&gt;[radius]&lt;/code&gt; sets &lt;code&gt;auto&lt;/code&gt; and the network client does not override it.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Change it to &lt;code&gt;&amp;quot;yes&amp;quot;&lt;/code&gt; or &lt;code&gt;&amp;quot;no&amp;quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; fails: &lt;code&gt;`require_message_authenticator`: unknown variant, expected one of `yes`, `no`, `auto`&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The value is wrong, or written as a boolean.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Write the string &lt;code&gt;&amp;quot;yes&amp;quot;&lt;/code&gt; or &lt;code&gt;&amp;quot;no&amp;quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; Requests from an old NAS get no answer, and the log has &lt;code&gt;discarded … Access-Requests lacking a Message-Authenticator&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; That NAS does not send a Message-Authenticator.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; First see whether the NAS can turn it on. If not, set &lt;code&gt;require_message_authenticator = &amp;quot;no&amp;quot;&lt;/code&gt; only on its client.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; An account with the correct password keeps being refused, and the authentication record shows &lt;code&gt;handler=&amp;quot;lockout&amp;quot;&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The account failed too many times from this device and is locked.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Wait for &lt;code&gt;lock_seconds&lt;/code&gt; to pass; if it is urgent, restarting the server clears all counts. Find out who is guessing.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; An account with the correct password is refused, and the log has &lt;code&gt;asks for more than [auth.password_limits]&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The cost of the stored hash is over the limit.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Make sure the hash was generated by you, then raise the matching limit; if not, find out who changed the account table.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;check&lt;/code&gt; fails: &lt;code&gt;lua.http.allowed_hosts: &#39;…&#39; is not host, host:port or http://host:port&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;https://&lt;/code&gt; or a path was written.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; For HTTPS write only the host or &lt;code&gt;host:port&lt;/code&gt;; for plaintext HTTP write &lt;code&gt;http://host:port&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; An HTTP call from a script fails, and the log has &lt;code&gt;script http_request refused: … is not in lua.http.allowed_hosts&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The host is not on the allowlist, or its port or protocol differs from what is written on the allowlist.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Add it to &lt;code&gt;allowed_hosts&lt;/code&gt;. Changing &lt;code&gt;[lua]&lt;/code&gt; can be reloaded.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04 Configuration file basics&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05 RADIUS service and NAS clients&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;08 LDAP and Active Directory&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09 External databases and named queries&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;10 Writing policies in Lua&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;11 802.1X and EAP&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;12 TACACS+ device administration&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16 Clusters and high availability&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;19 Performance tuning and load testing&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../21-troubleshooting/&#34; &gt;21 Troubleshooting&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>21 Troubleshooting</title>
            <link>https://embark.systems/en/rradius/oss/21-troubleshooting/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/21-troubleshooting/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Look for a problem in a fixed order: &lt;code&gt;check&lt;/code&gt;, logs, trace, &lt;code&gt;status&lt;/code&gt;, metrics, &lt;code&gt;tuning&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Tell &amp;ldquo;no response&amp;rdquo;, &amp;ldquo;reject&amp;rdquo; and a TACACS+ ERROR apart, and know where to look for each&lt;/li&gt;&#xA;&lt;li&gt;Go from a single error message to its cause and fix&lt;/li&gt;&#xA;&lt;li&gt;Deal with the common problem types: client matching fails, shared secret mismatch, database unavailable, cluster has no leader, missing accounting records, overload, EAP stuck&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: you have read &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;Chapter 03&lt;/a&gt;, can send test requests with &lt;code&gt;rradius-bench&lt;/code&gt; and can read the state with &lt;code&gt;status&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#troubleshooting-order&#34; &gt;Troubleshooting order&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#no-response-reject-error&#34; &gt;No response, reject, ERROR&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#configuration-cannot-be-read&#34; &gt;Configuration cannot be read&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#reload-fails-or-has-no-effect&#34; &gt;Reload fails or has no effect&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#the-server-fails-to-start&#34; &gt;The server fails to start&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#client-matching-fails&#34; &gt;Client matching fails&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#shared-secret-mismatch&#34; &gt;Shared secret mismatch&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#always-rejected&#34; &gt;Always rejected&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#database-unavailable&#34; &gt;Database unavailable&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#cluster-has-no-leader&#34; &gt;Cluster has no leader&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#missing-accounting-records&#34; &gt;Missing accounting records&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#overload-and-udp-packet-loss&#34; &gt;Overload and UDP packet loss&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#eap-is-stuck-or-fails&#34; &gt;EAP is stuck or fails&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#tacacs-cannot-connect-or-answers-error&#34; &gt;TACACS+ cannot connect or answers ERROR&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#script-errors&#34; &gt;Script errors&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#needs-rradius-enterprise&#34; &gt;needs rradius-enterprise&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#walkthrough-a-new-nas-gets-no-response&#34; &gt;Walkthrough: a new NAS gets no response&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#what-to-include-when-reporting-a-problem&#34; &gt;What to include when reporting a problem&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes-message-table&#34; &gt;Common mistakes: message table&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The messages in this chapter were produced by causing the problems on purpose on a macOS machine and running &lt;code&gt;rradiusd&lt;/code&gt; 0.1.0. The few that were only checked against the code are marked next to them. The timestamp at the start of a log line is replaced with &lt;code&gt;…&lt;/code&gt;. The number after &lt;code&gt;os error&lt;/code&gt; depends on the operating system. In this chapter 48 (address already in use) and 61 (connection refused) are macOS values and may be other numbers on your system.&lt;/p&gt;&#xA;&lt;h2 id=&#34;troubleshooting-order&#34;&gt;Troubleshooting order&#xA;&lt;/h2&gt;&lt;p&gt;Whatever the problem, look in this order. The first three steps usually find it:&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;Step&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Command or place&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What to look at&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;1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradiusd check --config &amp;lt;file&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Whether the configuration has errors or warnings&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&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 server log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;WARN&lt;/code&gt;, &lt;code&gt;ERROR&lt;/code&gt;; one &lt;code&gt;rradius_auth&lt;/code&gt; authentication record line per authentication&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;3&lt;/td&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;The full request and response of a chosen user or client&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;4&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradiusd status --config &amp;lt;file&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Which kind of request is discarded, and the state of the database and cluster&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;5&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;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Details that &lt;code&gt;status&lt;/code&gt; does not list, such as per-client counters&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;6&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradiusd tuning --config &amp;lt;file&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Whether the operating system drops UDP packets&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;authentication-record&#34;&gt;Authentication record&#xA;&lt;/h3&gt;&lt;p&gt;Every authentication writes one line:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; account=&amp;#34;alice&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;sql&amp;#34; decision=&amp;#34;reject&amp;#34;&#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;This line is there:&lt;/strong&gt; the request reached the server, matched a client and passed the Message-Authenticator check. The problem is usually in the auth chain or the account data. Look at &lt;code&gt;handler&lt;/code&gt; and &lt;code&gt;decision&lt;/code&gt; (for the exception see the third case in &lt;a class=&#34;link&#34; href=&#34;#shared-secret-mismatch&#34; &gt;Shared secret mismatch&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;This line is missing:&lt;/strong&gt; the request was dropped earlier. Look at the lines starting with &lt;code&gt;Discarded&lt;/code&gt; in &lt;code&gt;status&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Common values of &lt;code&gt;handler&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;handler&lt;/code&gt;&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;&lt;code&gt;sql&lt;/code&gt;, &lt;code&gt;ldap&lt;/code&gt;, &lt;code&gt;lua&lt;/code&gt;, and so on&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;This handler made the decision&lt;/td&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;No handler gave an answer, usually because the account does not exist or is disabled&lt;/td&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;lockout&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Stopped by the failed-login lockout, the password was not checked&lt;/td&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;mschapv1_refused&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;By default (not written, or &lt;code&gt;allow_mschapv1 = false&lt;/code&gt;), MS-CHAPv1 is refused&lt;/td&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;length&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The User-Password length is wrong (not 16 to 128 bytes, or not a multiple of 16)&lt;/td&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-peap&lt;/code&gt;, &lt;code&gt;eap-tls&lt;/code&gt;, and so on&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The result of an EAP conversation&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 record can be turned off with &lt;code&gt;[log] auth = false&lt;/code&gt;; keep it on when troubleshooting. The log level is &lt;code&gt;[log] level&lt;/code&gt; (&lt;code&gt;error&lt;/code&gt;, &lt;code&gt;warn&lt;/code&gt;, &lt;code&gt;info&lt;/code&gt;, &lt;code&gt;debug&lt;/code&gt;), and a change needs a restart. For details see &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;Chapter 17&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;trace&#34;&gt;trace&#xA;&lt;/h3&gt;&lt;p&gt;The authentication record does not write attributes. To see what the NAS actually sent and what the server answered, turn on trace for that user:&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:#75715e&#34;&gt;# rradius.toml&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&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;alice&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 a reload (&lt;code&gt;kill -HUP &amp;lt;pid&amp;gt;&lt;/code&gt;), every request of &lt;code&gt;alice&lt;/code&gt; gets two more lines:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_trace: request client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; code=1 attributes=&amp;#34;Message-Authenticator = &amp;lt;hidden&amp;gt;, User-Name = alice, User-Password = &amp;lt;hidden&amp;gt;, NAS-IP-Address = 192.0.2.1, NAS-Identifier = rradius-bench&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_trace: response client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; code=2 attributes=&amp;#34;Message-Authenticator = &amp;lt;hidden&amp;gt;, Session-Timeout = 3600, Filter-Id = staff&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;code=2&lt;/code&gt; is Access-Accept and &lt;code&gt;code=3&lt;/code&gt; is Access-Reject. trace writes personal data, so remove it when you are done (&lt;a class=&#34;link&#34; href=&#34;../20-security/&#34; &gt;Chapter 20&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; trace only records requests that passed the shared secret check. Discarded requests do not appear in trace; look at &lt;code&gt;status&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;no-response-reject-error&#34;&gt;No response, reject, ERROR&#xA;&lt;/h2&gt;&lt;p&gt;The NAS sees only a few kinds of result, and each has different causes:&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;The NAS sees&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What the server did&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Where to look first&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;Access-Reject&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Authenticated and decided to reject&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The &lt;code&gt;handler&lt;/code&gt; in the authentication record&lt;/td&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 response (timeout)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Dropped the request, or could not answer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The &lt;code&gt;Discarded&lt;/code&gt; lines of &lt;code&gt;status&lt;/code&gt;, and &lt;code&gt;not answered&lt;/code&gt; in 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;TACACS+ ERROR&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Could not answer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;answered ERROR&lt;/code&gt; in the log&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;&amp;ldquo;No response&amp;rdquo; is deliberate. When the database is unavailable, there is no leader (with &lt;code&gt;stop_without_leader_ms&lt;/code&gt; set, or when the request needs a write) or the server is overloaded, the server does not send a Reject. It lets the NAS retransmit or ask another server, instead of kicking the user out.&lt;/p&gt;&#xA;&lt;p&gt;The RADIUS section of &lt;code&gt;status&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;RADIUS&#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;  Discarded: overload        0.0/s (56)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Discarded: unknown client  0.0/s (1)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Discarded: invalid         0.0/s (3)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Discarded: database        0.0/s (1)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Discarded: no leader       0.0/s (1)&#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;/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;This line grows&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Section&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;Discarded: unknown client&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The source address is not in the client list&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;#client-matching-fails&#34; &gt;Client matching fails&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: invalid&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Shared secret mismatch, missing Message-Authenticator, malformed packet&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;#shared-secret-mismatch&#34; &gt;Shared secret mismatch&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: database&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The database needed for authentication or accounting is unavailable&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;#database-unavailable&#34; &gt;Database unavailable&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: no leader&lt;/code&gt;&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 the cluster has no leader&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;#cluster-has-no-leader&#34; &gt;Cluster has no leader&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: overload&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;More requests are being handled at once than the limit&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;#overload-and-udp-packet-loss&#34; &gt;Overload and UDP packet loss&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 same counters in &lt;code&gt;/metrics&lt;/code&gt; are &lt;code&gt;rradius_radius_discarded_total{reason=&amp;quot;…&amp;quot;}&lt;/code&gt;, where &lt;code&gt;reason&lt;/code&gt; is &lt;code&gt;overload&lt;/code&gt;, &lt;code&gt;unknown_client&lt;/code&gt;, &lt;code&gt;invalid&lt;/code&gt;, &lt;code&gt;database&lt;/code&gt; or &lt;code&gt;no_leader&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;When you test with &lt;code&gt;rradius-bench&lt;/code&gt;, look at its counters and exit code:&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;rradius-bench&lt;/code&gt; result&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Exit code&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;accept 1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;reject 1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1&lt;/td&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;timeouts 1&lt;/code&gt; (the server did not answer, or the signature of the answer does not match)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;timeouts 1, … socket errors 1&lt;/code&gt; (the server is not running at all)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;separating-network-and-shared-secret-from-the-account&#34;&gt;Separating network and shared secret from the account&#xA;&lt;/h3&gt;&lt;p&gt;When the NAS times out and you cannot tell whether the packet did not arrive, the shared secret is wrong or the account is the problem, send a Status-Server first. It does not look up an account and does not run a script, so whether it gets an answer depends only on the earlier checks:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server &amp;lt;address&amp;gt; --secret &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 &amp;lt;secret file&amp;gt;&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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --load status-auth,concurrency=1 --requests 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you have FreeRADIUS &lt;code&gt;radclient&lt;/code&gt;, you can use it too (Status-Server must carry a correct Message-Authenticator, so add &lt;code&gt;Message-Authenticator=0x00&lt;/code&gt; to the input and let &lt;code&gt;radclient&lt;/code&gt; compute the 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-console&#34; data-lang=&#34;console&#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 &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 &amp;lt;secret file&amp;gt;&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;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;&#x9;&#x9;&lt;th&gt;Next step&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;An answer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The packet arrives, the source address is in the client list, the shared secret is correct and &lt;code&gt;radius.status_server&lt;/code&gt; is on&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The problem is in the request itself: look at the &lt;code&gt;handler&lt;/code&gt; in the authentication record (&lt;a class=&#34;link&#34; href=&#34;#always-rejected&#34; &gt;Always rejected&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;Timeout&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One of the earlier checks stopped it: the packet did not arrive, the source is not recognized, the shared secret is wrong, &lt;code&gt;radius.status_server = false&lt;/code&gt;, or the node has &lt;code&gt;stop_without_leader_ms&lt;/code&gt; set and no leader (the authentication port does not answer Status-Server)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Look at the &lt;code&gt;Discarded&lt;/code&gt; lines of &lt;code&gt;status&lt;/code&gt;, then capture packets in the next step&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Run this test from a host that is in the client list. From any other host the result only says &amp;ldquo;source not recognized&amp;rdquo;. When an unrecognized source is discarded, &lt;code&gt;Discarded: unknown client&lt;/code&gt; grows; when a signature does not match, &lt;code&gt;Discarded: invalid&lt;/code&gt; grows.&lt;/p&gt;&#xA;&lt;p&gt;To check whether the packet reaches the server, capture on the server:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ tcpdump -ni any udp port &lt;span style=&#34;color:#ae81ff&#34;&gt;1812&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you see the NAS requests, the network works and the problem is on the server side (source address, shared secret). If you see nothing at all, check the firewall, the routing, the server address and port on the NAS, and whether &lt;code&gt;radius.bind&lt;/code&gt; listens only on &lt;code&gt;127.0.0.1&lt;/code&gt;. The accounting port is 1813.&lt;/p&gt;&#xA;&lt;h2 id=&#34;configuration-cannot-be-read&#34;&gt;Configuration cannot be read&#xA;&lt;/h2&gt;&lt;p&gt;When &lt;code&gt;check&lt;/code&gt; fails, it prints one line with the reason and exits with code 2. The message starts with the file that has the error and includes the line number when there is one. Messages seen in testing:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config nope.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nope.toml: cannot read configuration: No such file or directory (os error 2)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/etc/rradius/rradius.toml: cannot read configuration: No such file or directory (os error 2)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Without &lt;code&gt;--config&lt;/code&gt;, it reads &lt;code&gt;/etc/rradius/rradius.toml&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;TOML mistakes:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: line 40: unclosed table, expected `]`&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: line 28: `auth_prot`: unknown field `auth_prot`, expected one of `bind`, `auth_port`, `acct_port`, …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: line 28: `auth_port`: invalid type: string, expected u16&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;When a key name is misspelled, the message lists all the keys the table accepts.&lt;/li&gt;&#xA;&lt;li&gt;A number in quotes becomes a string.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Files pulled in by &lt;code&gt;include&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;conf.d/dup.toml: line 1: duplicate key&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;conf.d/bad.toml: line 1: an included file has to begin with a table (`[section]`), not a setting: a setting before its first table would belong to the file before it&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Errors found only after merging (for example &lt;code&gt;radius clients: duplicate client name &#39;core&#39;&lt;/code&gt;) have no line number. A location such as &lt;code&gt;(in conf.d/10-clients.toml line 3)&lt;/code&gt; is added at the end; use it to find the entry that caused the error.&lt;/p&gt;&#xA;&lt;p&gt;The most common cause of &lt;code&gt;duplicate key&lt;/code&gt; is a file in &lt;code&gt;conf.d/&lt;/code&gt; that declares a table the main configuration file already has, such as &lt;code&gt;[radius]&lt;/code&gt;. A table can appear only once, so make the change in the original place.&lt;/p&gt;&#xA;&lt;p&gt;Dictionaries and scripts:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dict/missing: cannot read dictionary: No such file or directory (os error 2)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dictionary:1: ATTRIBUTE needs a name, number and type: ATTRIBUTE&#x9;Broken-Attr&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cannot compile script &amp;#39;accounting.lua&amp;#39;: syntax error: 2: Expected identifier when parsing variable name, got &amp;lt;eof&amp;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 dictionary error shows the file name, the line number and the content of that line.&lt;/li&gt;&#xA;&lt;li&gt;In your own dictionary, you can first bring in the shipped dictionary with &lt;code&gt;$INCLUDE&lt;/code&gt; and then add your own attributes (&lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;Chapter 06&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;A required part is missing:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: the [cluster] section is required&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For the message when none of &lt;code&gt;[lua]&lt;/code&gt;, &lt;code&gt;[radius]&lt;/code&gt; and &lt;code&gt;[tacacs]&lt;/code&gt; is present, see Common mistakes in &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;Chapter 03&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Clients and secret files:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: radius client &amp;#39;localhost&amp;#39;: exactly one of secret or secret_file must be set&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: radius client &amp;#39;localhost&amp;#39;: secret_file &amp;#39;localhost.secret&amp;#39; is empty&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: radius client &amp;#39;localhost&amp;#39;: cannot read secret_file &amp;#39;localhost.secret&amp;#39;: No such file or directory (os error 2)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: radius client &amp;#39;localhost&amp;#39;: unknown auth chain &amp;#39;staff&amp;#39; (no [auth.chains.staff])&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: radius clients: duplicate client network &amp;#39;127.0.0.1/32&amp;#39;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;Two clients with the same address are not allowed (a single address is written as &lt;code&gt;/32&lt;/code&gt;). The same name is not blocked: in testing it passes &lt;code&gt;check&lt;/code&gt;. Names appear in logs and metrics, so keep them unique yourself.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;EAP certificates:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: radius.eap.key_file &amp;#39;server.key&amp;#39; does not fit cert_file &amp;#39;server.pem&amp;#39;: keys may not be consistent: KeyMismatch&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: radius.eap.key_file &amp;#39;server.key&amp;#39;: I/O error: No such file or directory (os error 2)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: radius.eap.client_ca_file is required&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: radius.eap.fragment_size must be from 256 to 1400, not 2000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;client_ca_file&lt;/code&gt; is required when &lt;code&gt;methods&lt;/code&gt; has &lt;code&gt;tls&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For range and value errors, the message states the rule directly, for 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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: auth.lockout.max_failures must be greater than 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: log.trace.minutes: 0 is not from 1 to 1440&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: lua.http.allowed_hosts must list at least one host&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The error messages for security-related settings are collected in Common mistakes in &lt;a class=&#34;link&#34; href=&#34;../20-security/&#34; &gt;Chapter 20&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Warnings from &lt;code&gt;check&lt;/code&gt; do not affect the exit code. Read the &lt;code&gt;WARN&lt;/code&gt; lines before &lt;code&gt;configuration ok&lt;/code&gt; too; for what to do about them see &lt;a class=&#34;link&#34; href=&#34;../20-security/&#34; &gt;Chapter 20&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;reload-fails-or-has-no-effect&#34;&gt;Reload fails or has no effect&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;SIGHUP&lt;/code&gt; makes the server read the configuration again. Check the result only in the log:&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;Log&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;&lt;code&gt;INFO rradius_core::reload: configuration reloaded from rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Everything was applied&lt;/td&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;WARN rradius_core::reload: configuration reloaded from rradius.toml; these need a restart to apply: radius.auth_port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Everything else was applied; the listed ones take effect only after a 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;&lt;code&gt;ERROR rradius_core::reload: reload failed, keeping the running configuration: rradius.toml: auth.lockout.max_failures must be greater than 0&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The new configuration has an error; nothing was applied and the server keeps the old configuration&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;A failed reload does not stop the server, but the next restart will fail with the same error. So run &lt;code&gt;check&lt;/code&gt; before you reload, and use &lt;code&gt;config diff&lt;/code&gt; to confirm what changed:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd config diff rradius.toml.orig rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radius.clients[localhost].address: &amp;#34;127.0.0.1&amp;#34; | &amp;#34;127.0.0.2&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When &lt;code&gt;config diff&lt;/code&gt; finds differences, the exit code is 1.&lt;/p&gt;&#xA;&lt;p&gt;Metrics show it too: &lt;code&gt;rradius_reload_total{result=&amp;quot;error&amp;quot;}&lt;/code&gt; grows and &lt;code&gt;rradius_reload_last_success_timestamp_seconds&lt;/code&gt; does not change. The list of settings that need a restart is in &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;; the reload procedure is in &lt;a class=&#34;link&#34; href=&#34;../18-operations/&#34; &gt;Chapter 18&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-server-fails-to-start&#34;&gt;The server fails to start&#xA;&lt;/h2&gt;&lt;h3 id=&#34;the-port-is-already-in-use&#34;&gt;The port is already in use&#xA;&lt;/h3&gt;&lt;p&gt;When another program uses the RADIUS or TACACS+ port, the server exits with code 1 (RADIUS prints &lt;code&gt;RADIUS server error: …&lt;/code&gt;, TACACS+ prints &lt;code&gt;TACACS+ server error: …&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::cli: cluster node 1 started&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::cli: cluster node 1 has caught up with the cluster&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;RADIUS server error: cannot listen on 127.0.0.1:1812: Address already in use (os error 48)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When the cluster Raft port is in use, it exits with code 2:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cannot start cluster node 1: Config: Cannot bind Raft listen address &amp;#39;127.0.0.1:8100&amp;#39;: Error(&amp;#34;Address already in use (os error 48)&amp;#34;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Fix: find out who holds the port (on Linux use &lt;code&gt;ss -lunp&lt;/code&gt; and &lt;code&gt;ss -ltnp&lt;/code&gt;, on macOS use &lt;code&gt;lsof -i :&amp;lt;port&amp;gt;&lt;/code&gt;). The most common cause is an old rradius that has not finished stopping, or two configurations running on the same machine.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; When the metrics port is in use, the server does &lt;strong&gt;not&lt;/strong&gt; exit. The log only gets one extra line, &lt;code&gt;ERROR … metrics: cannot listen on &amp;lt;address&amp;gt;: Address already in use (os error 48); no metrics are served, and &lt;/code&gt;status&lt;code&gt; cannot read them&lt;/code&gt;. RADIUS keeps serving, but this server does not open &lt;code&gt;/metrics&lt;/code&gt;, &lt;code&gt;/livez&lt;/code&gt; or &lt;code&gt;/readyz&lt;/code&gt;. After every start, check that the log has &lt;code&gt;Metrics listening on …&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;the-previous-instance-has-not-finished-stopping&#34;&gt;The previous instance has not finished stopping&#xA;&lt;/h3&gt;&lt;p&gt;A cluster node takes some time to stop. If you start a new one before it has finished, the data directory is locked and the new one exits:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN hiqlite_wal::log_store: LockFile data/logs exists already - this is not a clean start!&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;thread &amp;#39;tokio-rt-worker&amp;#39; (…) panicked at …/hiqlite-wal-0.16.0/src/log_store.rs:47:21:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;LockFile data/logs is locked and in use by another process&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::cli: cluster node: a panic in its database (…/hiqlite-wal-0.16.0/src/log_store.rs:47); exiting so that a restart recovers it&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Fix: wait for the old process to exit (&lt;code&gt;pgrep -f rradiusd&lt;/code&gt;), then start. The systemd unit shipped in the package waits up to &lt;code&gt;TimeoutStopSec=60&lt;/code&gt; seconds when stopping.&lt;/p&gt;&#xA;&lt;h3 id=&#34;does-not-start-without-a-leader&#34;&gt;Does not start without a leader&#xA;&lt;/h3&gt;&lt;p&gt;With &lt;code&gt;cluster.stop_without_leader_ms&lt;/code&gt; set, if no leader is found at startup (for example only one of three nodes is running), the server waits for a while and then exits with code 1:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::cli: cluster node 1 started&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cluster was not ready: no usable leader within 53.980820917s, and stop_without_leader_ms is set&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Fix: first bring up a majority of the nodes. A node without &lt;code&gt;stop_without_leader_ms&lt;/code&gt; starts as usual and answers from its own data; see &lt;a class=&#34;link&#34; href=&#34;#cluster-has-no-leader&#34; &gt;Cluster has no leader&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;client-matching-fails&#34;&gt;Client matching fails&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; The NAS gets no response. The server log has no authentication record, only:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::radius: RADIUS packet from unknown client 127.0.0.1 discarded&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;Discarded: unknown client&lt;/code&gt; in &lt;code&gt;status&lt;/code&gt; grows.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The source address of the packet is not in the &lt;code&gt;address&lt;/code&gt; of any &lt;code&gt;[[radius.clients]]&lt;/code&gt;. In testing, changing the client to &lt;code&gt;127.0.0.2&lt;/code&gt; and sending from &lt;code&gt;127.0.0.1&lt;/code&gt; gives exactly this result.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use the address in the log, not the one you think it is. When the NAS has several interfaces, goes through NAT, or sends from an address other than the management interface, the source differs from what you expect.&lt;/li&gt;&#xA;&lt;li&gt;NAS devices in one network can be written as a single client with CIDR, for example &lt;code&gt;address = &amp;quot;10.0.0.0/24&amp;quot;&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Confirm that the reload succeeded after the change (look for &lt;code&gt;configuration reloaded&lt;/code&gt; in the log).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This warning is logged at most once per second so that a flood of unknown packets does not fill the log. When there was more than one in that time, &lt;code&gt;(N since the last line)&lt;/code&gt; is added at the end of the line, where N is the total in that period. For client settings see &lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;Chapter 05&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;shared-secret-mismatch&#34;&gt;Shared secret mismatch&#xA;&lt;/h2&gt;&lt;p&gt;When the NAS and the server have different shared secrets, the result depends on whether the request has a Message-Authenticator. All three cases were tested:&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;Client setting&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Server&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Log&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;With Message-Authenticator&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Any&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The signature does not match, discards it, &lt;code&gt;Discarded: invalid&lt;/code&gt; grows&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;No line at all&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;Without Message-Authenticator&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;require_message_authenticator = &amp;quot;yes&amp;quot;&lt;/code&gt; (default)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Discards it, &lt;code&gt;Discarded: invalid&lt;/code&gt; grows&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;discarded … Access-Requests lacking a Message-Authenticator&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;Without Message-Authenticator&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;quot;no&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The decrypted password is garbage, answers Access-Reject; the NAS cannot verify this answer with its own secret and treats it as not received&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An authentication record with &lt;code&gt;decision=&amp;quot;reject&amp;quot;&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 first case is the hardest to notice because the log is completely silent. If the NAS times out, the log has no authentication record and no &lt;code&gt;unknown client&lt;/code&gt;, check whether &lt;code&gt;Discarded: invalid&lt;/code&gt; is growing.&lt;/p&gt;&#xA;&lt;p&gt;Fix:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Set the shared secret again on both sides. Copy it from a file, do not type it by hand. The server strips the trailing newline when it reads &lt;code&gt;secret_file&lt;/code&gt;, so do not include a newline when you copy it to the NAS.&lt;/li&gt;&#xA;&lt;li&gt;Test once from the server itself with &lt;code&gt;rradius-bench --secret &amp;quot;$(cat &amp;lt;file&amp;gt;)&amp;quot;&lt;/code&gt;. If that works, the secret on the server side is correct and the problem is on the NAS side.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For handling a missing Message-Authenticator see &lt;a class=&#34;link&#34; href=&#34;../20-security/&#34; &gt;Chapter 20&lt;/a&gt;. For a wrong TACACS+ shared secret see &lt;a class=&#34;link&#34; href=&#34;#tacacs-cannot-connect-or-answers-error&#34; &gt;TACACS+ cannot connect or answers ERROR&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;always-rejected&#34;&gt;Always rejected&#xA;&lt;/h2&gt;&lt;p&gt;There is an authentication record with &lt;code&gt;decision=&amp;quot;reject&amp;quot;&lt;/code&gt;. Look at &lt;code&gt;handler&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;Authentication record&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Fix&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;handler=&amp;quot;sql&amp;quot;&lt;/code&gt; (or &lt;code&gt;ldap&lt;/code&gt;, and so on)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The handler found the account but the password is wrong&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Check the password; check that the method the NAS uses (PAP, CHAP, MS-CHAPv2) is compatible with the format the account stores (&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;Chapter 07&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;handler=&amp;quot;none&amp;quot;&lt;/code&gt;, &lt;code&gt;account&lt;/code&gt; has a value&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No handler recognizes this account: it does not exist, is disabled, or the query did not select it&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Use &lt;code&gt;user show&lt;/code&gt; or query the table directly&lt;/td&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;handler=&amp;quot;lockout&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Locked by failed logins&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;See &lt;a class=&#34;link&#34; href=&#34;../20-security/&#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;handler=&amp;quot;mschapv1_refused&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;MS-CHAPv1 is off by default&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Make the NAS use another method, or write &lt;code&gt;allow_mschapv1 = true&lt;/code&gt; once you are sure you need 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;handler=&amp;quot;length&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The User-Password length is wrong: the NAS did not pad the password to a multiple of 16, or the password is longer than 128 bytes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Look at the client and length in the WARN line logged at the same time; fix the NAS configuration, see &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/#password-length&#34; &gt;Chapter 07&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 following warnings mean the account data itself has a problem (all were tested):&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::auth_chain: the stored password asks for more than [auth.password_limits].bcrypt_cost allows and is refused; raise the limit if the hash is meant to be used user=&amp;#34;bob&amp;#34; format=&amp;#34;crypt&amp;#34; parameter=&amp;#34;bcrypt_cost&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::auth_chain: the stored password looks like a hash with no scheme prefix and is refused; add {crypt} or {argon2} before it, or {clear} if it is the password itself user=&amp;#34;eve&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The first line: the hash cost is above the limit. The second line: the hash has no format prefix. For the fix see &lt;a class=&#34;link&#34; href=&#34;../20-security/&#34; &gt;Chapter 20&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;correct-password-problem-with-reply-attributes&#34;&gt;Correct password, problem with reply attributes&#xA;&lt;/h3&gt;&lt;p&gt;When the name of a reply attribute is not in the dictionary, the whole response cannot be built and the server answers Access-Reject 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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::radius: RADIUS response attribute error: unknown attribute &amp;#39;No-Such-Attr&amp;#39;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; account=&amp;#34;alice&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;sql&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In testing, a row &lt;code&gt;No-Such-Attr&lt;/code&gt; was added to the &lt;code&gt;user_reply&lt;/code&gt; table and &lt;code&gt;alice&lt;/code&gt; was rejected even with the correct password. Fix: correct the attribute name in the table, or add the attribute to the dictionary (&lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;Chapter 06&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;h2 id=&#34;database-unavailable&#34;&gt;Database unavailable&#xA;&lt;/h2&gt;&lt;p&gt;When the database that authentication or accounting uses cannot be reached, the server &lt;strong&gt;does not answer&lt;/strong&gt; instead of rejecting.&lt;/p&gt;&#xA;&lt;h3 id=&#34;external-databases&#34;&gt;External databases&#xA;&lt;/h3&gt;&lt;p&gt;In testing, an sql handler pointed at a PostgreSQL address that nobody listens on:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::auth_chain: auth sql handler error: database legacy: pool timed out while waiting for an open connection&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::lua_engine: RADIUS Access-Request from client localhost not answered: the authentication backend could not be used&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;Discarded: database&lt;/code&gt; in &lt;code&gt;status&lt;/code&gt; grows and the NAS times out.&lt;/p&gt;&#xA;&lt;p&gt;When a database with &lt;code&gt;required_for_ready = true&lt;/code&gt; cannot be reached, &lt;code&gt;/readyz&lt;/code&gt; answers 503, so a load balancer can steer traffic away:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::external_db: databases.legacy: not reachable at startup: error communicating with database: Connection refused (os error 61); /readyz answers 503 until it is&#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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s -w &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39; http=%{http_code}\n&amp;#39;&lt;/span&gt; http://127.0.0.1:9812/readyz&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;database legacy unreachable http=503&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd status --config rradius.toml&#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;Node&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Ready                     database legacy unreachable&#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;External databases&#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;  legacy reachable               no&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;The check runs every 5 seconds; two failures in a row count as unreachable, and one success recovers it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;required_for_ready&lt;/code&gt; is &lt;code&gt;false&lt;/code&gt; by default: when a database without it goes down, &lt;code&gt;/readyz&lt;/code&gt; still answers 200 and only requests get no response.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Fix: check the database itself, the network and the credentials. &lt;code&gt;connect_timeout_ms&lt;/code&gt; must be shorter than the NAS retransmit time, so that the NAS has a chance to ask another server. For details see &lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;Chapter 09&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; Only one way of being unreachable was tested: the port is not listening. The messages for a database that is running but has wrong credentials or a TLS certificate that fails verification were not tested.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;cluster-database&#34;&gt;Cluster database&#xA;&lt;/h3&gt;&lt;p&gt;Problems with the cluster database (the account tables and the tables the accounting script writes) are usually caused by having no leader; see the next section.&lt;/p&gt;&#xA;&lt;h2 id=&#34;cluster-has-no-leader&#34;&gt;Cluster has no leader&#xA;&lt;/h2&gt;&lt;p&gt;A write has to be confirmed by the leader, so when there is no leader the database cannot be written. This was simulated with three nodes on one machine: after all three were up, nodes 2 and 3 were stopped and only node 1 was left.&lt;/p&gt;&#xA;&lt;h3 id=&#34;stop_without_leader_ms-not-set-default&#34;&gt;stop_without_leader_ms not set (default)&#xA;&lt;/h3&gt;&lt;p&gt;Node 1 keeps answering from its own data:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Login: it only reads data, so &lt;code&gt;alice&lt;/code&gt; is still &lt;code&gt;accept&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Accounting: the script has to write, fails, and there is no response:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::lua_engine: Lua script error (radius/accounting): runtime error: no leader for 5 s\nstack traceback:\n…\taccounting.lua:44: in function &amp;lt;accounting.lua:1&amp;gt;\n&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The Node section of &lt;code&gt;status&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Node&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Ready                     ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Leader                    1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Has a leader              0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Caught up                 1&#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;  Seconds without a leader  5&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;Has a leader 0&lt;/code&gt; with &lt;code&gt;Seconds without a leader&lt;/code&gt; growing means there is no leader. In testing the &lt;code&gt;Leader&lt;/code&gt; line still showed 1 at this point, so judge by &lt;code&gt;Has a leader&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;stop_without_leader_ms-set&#34;&gt;stop_without_leader_ms set&#xA;&lt;/h3&gt;&lt;p&gt;Add &lt;code&gt;stop_without_leader_ms = 10000&lt;/code&gt; to &lt;code&gt;[cluster]&lt;/code&gt;. After more than 10 seconds without a leader:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s -w &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39; http=%{http_code}\n&amp;#39;&lt;/span&gt; http://127.0.0.1:9812/readyz&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;no leader http=503&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd status --config rradius.toml&#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;Node&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Ready                     no leader&#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;  Has a leader              0&#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;  Seconds without a leader  16&#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;  Discarded: no leader       0.0/s (1)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;All RADIUS requests get no response, even read-only logins, so the NAS can ask another node.&lt;/li&gt;&#xA;&lt;li&gt;After nodes 2 and 3 come back, &lt;code&gt;/readyz&lt;/code&gt; returns to &lt;code&gt;ok&lt;/code&gt; and logins resume (tested).&lt;/li&gt;&#xA;&lt;li&gt;This setting also makes a node exit at startup when it finds no leader; see &lt;a class=&#34;link&#34; href=&#34;#the-server-fails-to-start&#34; &gt;The server fails to start&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Fix: bring back a majority of the nodes. In a three-node cluster, at least two must be running and able to reach each other. Check the network between the nodes, the addresses in &lt;code&gt;cluster.nodes&lt;/code&gt;, and whether the two cluster secrets are the same on every node. For how the cluster works and how to manage members see &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 16&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; The above is a simulation with three nodes on one machine. A network failure across machines, and nodes with different secrets, were not tested.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;missing-accounting-records&#34;&gt;Missing accounting records&#xA;&lt;/h2&gt;&lt;p&gt;A NAS that sends an accounting request counts it as delivered only when it receives an Accounting-Response. If it gets none, it retransmits, and after a few retransmissions it gives up and that record is lost. So &amp;ldquo;missing accounting records&amp;rdquo; almost always means &amp;ldquo;the server did not send an Accounting-Response&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;The server answers only after the accounting script succeeds. Two cases of script failure (both tested):&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The database is temporarily unavailable&lt;/strong&gt;, for example there is no leader:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::lua_engine: Lua script error (radius/accounting): runtime error: no leader for 6 s\nstack traceback:\n…\taccounting.lua:44: in function &amp;lt;accounting.lua:1&amp;gt;\n&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;The script or the SQL is wrong&lt;/strong&gt;, for example a mistyped table name:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::lua_engine: Lua script error (radius/accounting): runtime error: PrepareStatement: no such table: accountingx\nstack traceback:\n…&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Neither gets a response. If &lt;code&gt;Acct requests&lt;/code&gt; in &lt;code&gt;status&lt;/code&gt; grows and &lt;code&gt;Accounting-Response&lt;/code&gt; does not grow with it, this is the case.&lt;/p&gt;&#xA;&lt;h3 id=&#34;riding-out-a-database-outage-with-the-accounting-spool&#34;&gt;Riding out a database outage with the accounting spool&#xA;&lt;/h3&gt;&lt;p&gt;With &lt;code&gt;[radius.accounting_spool]&lt;/code&gt; set, in the first case (database unreachable or timed out) the request is first written to the spool on disk and then the NAS gets its response; when the database recovers, the request is replayed automatically:&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:#75715e&#34;&gt;# rradius.toml&lt;/span&gt;&#xA;&lt;/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;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;In testing: after two of three nodes were stopped, one Start was sent. The script still failed, but the NAS got a response (&lt;code&gt;accounting 1&lt;/code&gt; in &lt;code&gt;rradius-bench&lt;/code&gt;), and the metrics were:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_acct_spool_written_total 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_acct_spool_bytes 110&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;After nodes 2 and 3 were started again:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_acct_spool_written_total 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_acct_spool_replayed_total 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_acct_spool_bytes 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The Accounting spool section of &lt;code&gt;status&lt;/code&gt; has the same numbers (&lt;code&gt;Bytes waiting&lt;/code&gt;, &lt;code&gt;Replayed&lt;/code&gt;, &lt;code&gt;Rejected&lt;/code&gt;, &lt;code&gt;Not spooled&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The second case (wrong SQL) does &lt;strong&gt;not&lt;/strong&gt; go into the spool, because a replay would fail the same way. In testing &lt;code&gt;rradius_acct_spool_written_total&lt;/code&gt; stayed at 0. When you see this error, fix the script.&lt;/li&gt;&#xA;&lt;li&gt;If &lt;code&gt;Bytes waiting&lt;/code&gt; never goes down, replay keeps failing; look at the errors in the log. If &lt;code&gt;Rejected&lt;/code&gt; grows, some records were judged impossible to process and moved to the &lt;code&gt;rejected&lt;/code&gt; file in the spool directory.&lt;/li&gt;&#xA;&lt;li&gt;When the spool is full (&lt;code&gt;radius.accounting_spool.max_bytes&lt;/code&gt;), there is no response and &lt;code&gt;Not spooled&lt;/code&gt; grows; when the disk cannot be written, there is no response either.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For the spool settings, the replay rules and how to write the script see &lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;Chapter 13&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;overload-and-udp-packet-loss&#34;&gt;Overload and UDP packet loss&#xA;&lt;/h2&gt;&lt;h3 id=&#34;the-server-discards&#34;&gt;The server discards&#xA;&lt;/h3&gt;&lt;p&gt;When more requests are being handled at once than &lt;code&gt;max_auth_inflight&lt;/code&gt; (or &lt;code&gt;max_acct_inflight&lt;/code&gt;), the extra ones are dropped. In testing, &lt;code&gt;max_auth_inflight&lt;/code&gt; was set to 2 and 30 parallel logins of bcrypt accounts were sent:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::radius: RADIUS authentication overloaded: discarded 28 packets&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;Discarded: overload&lt;/code&gt; in &lt;code&gt;status&lt;/code&gt; grows, and &lt;code&gt;Auth limit&lt;/code&gt; shows the current limit.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-operating-system-discards&#34;&gt;The operating system discards&#xA;&lt;/h3&gt;&lt;p&gt;Before packets reach rradius, the operating system may drop them because the receive buffer of the socket is full. rradius cannot see this kind of drop; ask the operating system:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd tuning --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius tuning advice for macOS&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;UDP packets dropped because a receive buffer was full, since the system started: 137296&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Raise the receive buffers below, then watch whether this count still grows.&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This number is the total for the whole machine since boot. Run it again after a while and see whether it has grown.&lt;/p&gt;&#xA;&lt;p&gt;When the buffer that &lt;code&gt;radius.recv_buffer_bytes&lt;/code&gt; asks for is above the system limit, a warning is written at startup:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::radius: RADIUS: asked for a receive buffer of 67108864 bytes and each socket got 8388608; raise kern.ipc.maxsockbuf to at least 67108864&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The name of the system setting in the message is &lt;code&gt;net.core.rmem_max&lt;/code&gt; on Linux and &lt;code&gt;kern.ipc.maxsockbuf&lt;/code&gt; on macOS and FreeBSD. &lt;code&gt;tuning&lt;/code&gt; prints the value to change and the command.&lt;/p&gt;&#xA;&lt;p&gt;For the fix and for capacity planning see &lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;Chapter 19&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;eap-is-stuck-or-fails&#34;&gt;EAP is stuck or fails&#xA;&lt;/h2&gt;&lt;p&gt;EAP is a conversation with many rounds, going back and forth between the NAS and the server several times. In the authentication record &lt;code&gt;handler&lt;/code&gt; is &lt;code&gt;eap-peap&lt;/code&gt;, &lt;code&gt;eap-tls&lt;/code&gt; and so on, and a failure adds a line with the reason. Tested (PEAP, with &lt;code&gt;rradius-bench&lt;/code&gt; as the client):&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;Server log&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;code&gt;rradius-bench&lt;/code&gt;&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;Wrong inner password&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;EAP conversation with client localhost failed: the chain did not accept the inner name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;reject 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;The client asks for a method the server does not offer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;EAP conversation with client localhost failed: the peer asked only for methods this server does not offer&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;reject 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;The client does not trust the server certificate&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;No line at all&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;TLS: invalid peer certificate: UnknownIssuer&lt;/code&gt;, &lt;code&gt;invalid 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;The name in the server certificate is wrong&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;No line at all&lt;/strong&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;certificate not valid for name &amp;quot;wrong.example.net&amp;quot;; …&lt;/code&gt;, &lt;code&gt;invalid 1&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;In the last two cases the client gave up the conversation by itself, and the server only sees a conversation with no follow-up. The EAP section of &lt;code&gt;status&lt;/code&gt; shows these unfinished conversations under &lt;code&gt;Sessions under way&lt;/code&gt;; they are cleaned up after &lt;code&gt;radius.eap.session_timeout_ms&lt;/code&gt; (30000 milliseconds by default). So:&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; When a user says &amp;ldquo;cannot connect&amp;rdquo; and the log has no EAP failure record, first suspect that the client device does not trust the server certificate: the device does not have your CA installed, or the server name it is configured with does not match the certificate. Look at the messages on the device side.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;fragmentation-and-mtu&#34;&gt;Fragmentation and MTU&#xA;&lt;/h3&gt;&lt;p&gt;The TLS messages of EAP are larger than one RADIUS packet and have to be cut into several fragments. &lt;code&gt;radius.eap.fragment_size&lt;/code&gt; is the limit of each fragment; the default is 1000 and the range is 256 to 1400 bytes. When the path MTU between the NAS and the server is smaller, or a device in the middle drops IP fragments, large RADIUS packets disappear on the way and the EAP conversation gets stuck at the certificate exchange.&lt;/p&gt;&#xA;&lt;p&gt;Fix: reduce &lt;code&gt;fragment_size&lt;/code&gt; and try again.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; Packet loss caused by MTU needs real network equipment to reproduce, and was not tested. The fix above follows from what &lt;code&gt;fragment_size&lt;/code&gt; does.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;For EAP settings and certificates see &lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;Chapter 11&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;tacacs-cannot-connect-or-answers-error&#34;&gt;TACACS+ cannot connect or answers ERROR&#xA;&lt;/h2&gt;&lt;p&gt;When the shared secrets differ, the server cannot decode the packet body and closes the connection:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::tacacs: TACACS+ connection from 127.0.0.1 closed: a body did not decode, so the shared secret may be wrong&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;Malformed&lt;/code&gt; in the TACACS+ section of &lt;code&gt;status&lt;/code&gt; grows. On the &lt;code&gt;rradius-bench&lt;/code&gt; side you see &lt;code&gt;lengths: the fields of the reply do not add up to its length, so the shared secret may be wrong&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;When the database used for authentication is unavailable, TACACS+ does not stay silent but answers ERROR:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::lua_engine: TACACS+ authentication for client router1 answered ERROR: the authentication backend could not be used&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;What the device does after it receives ERROR (ask the next server, use a local account) depends on its configuration.&lt;/p&gt;&#xA;&lt;p&gt;A connection that sends no complete packet for longer than &lt;code&gt;tacacs.idle_timeout_ms&lt;/code&gt; (300000 milliseconds by default) is closed. In testing, the value was set to 2000 and one connection was opened that sent nothing:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::tacacs: TACACS+ connection from 127.0.0.1 closed: idle for 2s&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If a device keeps one connection open for a long time, this value must be longer than the interval at which the device sends packets. For TACACS+ settings see &lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;Chapter 12&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; TACACS+ was never tried with real network equipment, only with the &lt;code&gt;tacacs-pap&lt;/code&gt; and &lt;code&gt;tacacs-chap&lt;/code&gt; loads of &lt;code&gt;rradius-bench&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;connection-closed-limits&#34;&gt;Connection closed: limits&#xA;&lt;/h3&gt;&lt;p&gt;TACACS+ uses the number of connections as a limit. At the limit, a new connection is closed immediately (not left without a response):&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;Log&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Fix&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;TACACS+ overloaded: closed N connections&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The connections open at the same time reached &lt;code&gt;tacacs.max_connections&lt;/code&gt; (default 1024); N is the number of new connections closed since the previous line&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;If devices open connections and never close them, lower &lt;code&gt;idle_timeout_ms&lt;/code&gt;; raise &lt;code&gt;max_connections&lt;/code&gt; only when you really have that many connections. Both need a restart to take effect&lt;/td&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+ connection from &amp;lt;address&amp;gt; closed: it already holds max_connections_per_source = N connections&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The connections open from this source address reached &lt;code&gt;tacacs.max_connections_per_source&lt;/code&gt; (default 64)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;When the address is behind NAT or a jump host and the number of connections is legitimately high, raise &lt;code&gt;max_connections_per_source&lt;/code&gt;; this needs a 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;&lt;code&gt;TACACS+ connection from unknown client &amp;lt;address&amp;gt; closed&lt;/code&gt;&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;&#x9;&#x9;&lt;td&gt;Add the address and reload&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;These lines are also logged at most once per second, and may end with &lt;code&gt;(N since the last line)&lt;/code&gt;. &lt;code&gt;rradius_tacacs_connections_total{result=&amp;quot;refused&amp;quot;}&lt;/code&gt; is increased by 1 for every refused connection. For the limits see &lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;Chapter 12&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;script-errors&#34;&gt;Script errors&#xA;&lt;/h2&gt;&lt;p&gt;When a script fails, the request is treated as a reject (for accounting, as no response), and the log has &lt;code&gt;Lua script error (&amp;lt;protocol&amp;gt;/&amp;lt;phase&amp;gt;)&lt;/code&gt; followed by the reason and the line number:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::lua_engine: Lua script error (radius/authentication): runtime error: script exceeded the execution limit of 100 ms&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::lua_engine: Lua script error (radius/authentication): runtime error: api.lua:1: attempt to index nil with &amp;#39;open&amp;#39;\nstack traceback:\n\tapi.lua:1: in function &amp;lt;api.lua:1&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::lua_engine: Lua script error (radius/authentication): runtime error: api.lua:1: attempt to call a nil value\nstack traceback:\n\tapi.lua:1: in function &amp;lt;api.lua:1&amp;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;code&gt;exceeded the execution limit&lt;/code&gt;: the script ran too long and passed &lt;code&gt;lua.max_execution_ms&lt;/code&gt;. Find the loop or the slow part; time spent waiting for the database does not count.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;attempt to index nil&lt;/code&gt;, &lt;code&gt;attempt to call a nil value&lt;/code&gt;: something that does not exist was used. The sandbox removes &lt;code&gt;io&lt;/code&gt;, &lt;code&gt;os.execute&lt;/code&gt;, &lt;code&gt;require&lt;/code&gt; and so on; without &lt;code&gt;[lua.http]&lt;/code&gt;, &lt;code&gt;http_request&lt;/code&gt; does not exist either.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Messages that a script writes with &lt;code&gt;log(...)&lt;/code&gt; appear in the log with the script name and the client:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::lua_engine: script api.lua (radius/authentication, client localhost): api gave no answer: http://127.0.0.1 is not in lua.http.allowed_hosts&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For how to write and debug scripts see &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;Chapter 10&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;needs-rradius-enterprise&#34;&gt;needs rradius-enterprise&#xA;&lt;/h2&gt;&lt;p&gt;When &lt;code&gt;rradiusd&lt;/code&gt; reads a setting that exists only in the enterprise edition, it refuses clearly and exits with code 2:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: proxy: not supported by this program (proxying needs rradius-enterprise)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: radius.tls: not supported by this program (RadSec needs rradius-enterprise)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: radius.eap.resumption_ms: not supported by this program (session resumption needs rradius-enterprise)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: radius client &amp;#39;localhost&amp;#39;: mfa needs rradius-enterprise&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: radius client &amp;#39;localhost&amp;#39;: eap_methods: &amp;#39;sim&amp;#39; is not a method this server offers; it has tls, peap and ttls&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is not a mistake in the configuration. This program does not have that feature.&lt;/p&gt;&#xA;&lt;p&gt;Fix: remove that section or that key.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Enterprise edition:&lt;/strong&gt; The features above are available in the enterprise edition.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;walkthrough-a-new-nas-gets-no-response&#34;&gt;Walkthrough: a new NAS gets no response&#xA;&lt;/h2&gt;&lt;p&gt;This joins the methods above together. Scenario: a new NAS was installed and user logins keep timing out. The output in every step below is from testing.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Step 1: Is the configuration fine?&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The configuration has no errors and no warnings.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Step 2: Do requests reach the server?&lt;/strong&gt; Look in the log for an authentication record of this NAS. There is none, but there is:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… WARN rradius_core::radius: RADIUS packet from unknown client 127.0.0.1 discarded&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The source address the NAS uses is not in the client list. Add it (or correct &lt;code&gt;address&lt;/code&gt;), reload, and confirm that the log has &lt;code&gt;configuration reloaded from rradius.toml&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Step 3: Still timing out.&lt;/strong&gt; This time the log has nothing: no authentication record and no &lt;code&gt;unknown client&lt;/code&gt;. Look at &lt;code&gt;status&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd status --config rradius.toml&#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;  Discarded: unknown client  0.0/s (1)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Discarded: invalid         0.0/s (3)&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;Discarded: invalid&lt;/code&gt; is growing: the request carried a Message-Authenticator, but the signature does not match, which means the shared secrets differ. Set the shared secret again on both sides.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Step 4: Now there is a response, but it is a reject.&lt;/strong&gt; The log has an authentication record:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_auth: authentication protocol=&amp;#34;radius&amp;#34; client=&amp;#34;localhost&amp;#34; source=127.0.0.1 user=&amp;#34;alice&amp;#34; account=&amp;#34;alice&amp;#34; chain=&amp;#34;default&amp;#34; handler=&amp;#34;sql&amp;#34; decision=&amp;#34;reject&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;handler=&amp;quot;sql&amp;quot;&lt;/code&gt;: the account was found and the password is wrong. Ask the user to check the password. If it still fails, turn on trace for this user, look at which kind of password attribute the NAS sends (&lt;code&gt;User-Password&lt;/code&gt;, &lt;code&gt;CHAP-Password&lt;/code&gt; or an MS-CHAP attribute), and confirm that the format stored for the account can verify this method.&lt;/p&gt;&#xA;&lt;p&gt;The whole process used only &lt;code&gt;check&lt;/code&gt;, the log and &lt;code&gt;status&lt;/code&gt;, in the order of the table in &lt;a class=&#34;link&#34; href=&#34;#troubleshooting-order&#34; &gt;Troubleshooting order&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-to-include-when-reporting-a-problem&#34;&gt;What to include when reporting a problem&#xA;&lt;/h2&gt;&lt;p&gt;When you cannot find the cause yourself and need to ask someone for help, include the following. It saves many round trips:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The output of &lt;code&gt;rradiusd --version&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The full output and exit code of &lt;code&gt;rradiusd check --config &amp;lt;file&amp;gt;&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;rradiusd config show --config &amp;lt;file&amp;gt;&lt;/code&gt;: the full configuration with defaults filled in, secrets shown as &lt;code&gt;&amp;lt;hidden&amp;gt;&lt;/code&gt;, so you can paste it as it is. Do not paste the original configuration file, which may contain passwords in plain text.&lt;/li&gt;&#xA;&lt;li&gt;The log of the period when the problem happened, including the &lt;code&gt;WARN&lt;/code&gt; and &lt;code&gt;ERROR&lt;/code&gt; lines and the authentication records around it.&lt;/li&gt;&#xA;&lt;li&gt;The output of &lt;code&gt;rradiusd status --config &amp;lt;file&amp;gt;&lt;/code&gt;; add &lt;code&gt;--json&lt;/code&gt; if a program will read it.&lt;/li&gt;&#xA;&lt;li&gt;For UDP packet loss problems, also &lt;code&gt;rradiusd tuning --config &amp;lt;file&amp;gt;&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The output of trace contains personal data. Before you give it to anyone, mask data such as user names and addresses.&lt;/p&gt;&#xA;&lt;h2 id=&#34;common-mistakes-message-table&#34;&gt;Common mistakes: message table&#xA;&lt;/h2&gt;&lt;p&gt;You see this message; here are the cause and the fix. All of them are real output from testing; &lt;code&gt;…&lt;/code&gt; is a part that changes from case to case.&lt;/p&gt;&#xA;&lt;h3 id=&#34;check-and-startup&#34;&gt;check and startup&#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;Message&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Fix&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;cannot read configuration: No such file or directory (os error 2)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wrong configuration file path; without &lt;code&gt;--config&lt;/code&gt; it reads &lt;code&gt;/etc/rradius/rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Add &lt;code&gt;--config&lt;/code&gt; or correct the path&lt;/td&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;line N: unclosed table, expected `]`&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TOML syntax error&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Look at that 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;`X`: unknown field `X`, expected one of …&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Misspelled key, or put in the wrong table&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Compare with the keys listed in the message and &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&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;`X`: invalid type: string, expected u16&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A number in quotes, or a wrong type&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Change to the correct type&lt;/td&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;line 1: duplicate key&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A file in &lt;code&gt;conf.d/&lt;/code&gt; declares a table that already exists&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Merge into the original 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;&lt;code&gt;an included file has to begin with a table&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The first line of the &lt;code&gt;include&lt;/code&gt; file is not &lt;code&gt;[table]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Write the table name 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;&lt;code&gt;cannot read dictionary: …&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wrong dictionary path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Change &lt;code&gt;dictionary&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;dictionary:N: ATTRIBUTE needs a name, number and type: …&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wrong format in the dictionary file&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Fix that 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;cannot compile script &#39;…&#39;: syntax error: …&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Lua syntax error&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Fix 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;the [cluster] section is required&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;There is no &lt;code&gt;[cluster]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Add it (&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 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;&lt;code&gt;exactly one of secret or secret_file must be set&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The client has no shared secret, or both are set&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Keep only &lt;code&gt;secret_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;secret_file &#39;…&#39; is empty&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The secret file is empty&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Write the secret into 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;cannot read secret_file &#39;…&#39;: …&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The secret file does not exist or cannot be read&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Check the path and permissions&lt;/td&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;unknown auth chain &#39;X&#39; (no [auth.chains.X])&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The &lt;code&gt;auth&lt;/code&gt; of a client points to a chain that does not exist&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Add &lt;code&gt;[auth.chains.X]&lt;/code&gt; or rename&lt;/td&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;duplicate client network &#39;…&#39;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Two clients have the same address&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Merge them or delete 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;code&gt;duplicate client name &#39;…&#39;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Two clients in the same list have the same name (when no name is written, the address is the name)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Change the &lt;code&gt;name&lt;/code&gt; of one of them (&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;Chapter 05&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;cluster.secret_raft must be at least 16 characters&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The cluster secret is too short&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;openssl rand -hex 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;&lt;code&gt;key_file &#39;…&#39; does not fit cert_file &#39;…&#39;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The private key and the certificate are not a pair&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Use files that belong together&lt;/td&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.client_ca_file is required&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;tls&lt;/code&gt; is used but there is no CA&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Add &lt;code&gt;client_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;fragment_size must be from 256 to 1400, not N&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Out of range&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Change it to a value in range&lt;/td&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;… not supported by this program (… needs rradius-enterprise)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A setting that exists only in the enterprise edition&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Remove it, or switch to the enterprise edition&lt;/td&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 server error: cannot listen on …: Address already in use&lt;/code&gt; (exit code 1)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The RADIUS port is in use&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Stop the program that holds 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;Cannot bind Raft listen address &#39;…&#39;&lt;/code&gt; (exit code 2)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The cluster port is in use&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Stop the program that holds 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;metrics: cannot listen on …: Address already in use&lt;/code&gt; (the server keeps running)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The metrics port is in use&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Stop the program that holds it, then restart 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;&lt;code&gt;LockFile data/logs is locked and in use by another process&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The old process has not finished stopping&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wait for it to exit, then 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;cluster was not ready: no usable leader within …, and stop_without_leader_ms is set&lt;/code&gt; (exit code 1)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The cluster has no majority at startup&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Bring up the other nodes 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;&lt;code&gt;cluster was not ready to apply migrations: …&lt;/code&gt; (exit code 1)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;At startup, no leader within &lt;code&gt;migrations_wait_ms&lt;/code&gt;, so the migrations could not be applied, or the local replica could not catch up; the second half of the message sometimes says &amp;ldquo;the cluster node gives one migration file 30 s&amp;rdquo;: one file ran for more than 30 seconds&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Bring up a majority of the nodes first; when a file is slow by itself, increase &lt;code&gt;migrations_wait_ms&lt;/code&gt;, then start again (&lt;a class=&#34;link&#34; href=&#34;../18-operations/#common-mistakes&#34; &gt;Chapter 18&lt;/a&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;while-running&#34;&gt;While running&#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;Message&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Fix&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 packet from unknown client X discarded&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The source address is not in the client list&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Add a client with the address from 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;RADIUS: discarded N Access-Requests lacking a Message-Authenticator, …&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The NAS does not send a Message-Authenticator, or the secret is wrong and none was sent&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Turn on Message-Authenticator on the NAS; if that is not possible, set &lt;code&gt;&amp;quot;no&amp;quot;&lt;/code&gt; for that client 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;(no log, &lt;code&gt;Discarded: invalid&lt;/code&gt; grows)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Shared secret mismatch&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Set the shared secret again on both sides&lt;/td&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 Access-Request from client X not answered: the authentication backend could not be used&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The database or directory used for authentication is unavailable&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Look at the error on the previous 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;auth sql handler error: database X: pool timed out while waiting for an open connection&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The external database cannot be reached&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Check the database and 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;databases.X: not reachable at startup: …; /readyz answers 503 until it is&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A database with &lt;code&gt;required_for_ready&lt;/code&gt; cannot be reached&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;&lt;code&gt;Lua script error (radius/accounting): runtime error: no leader for 5 s&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The cluster has no leader, so it cannot write&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Bring back a majority of the 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;&lt;code&gt;/readyz&lt;/code&gt; answers &lt;code&gt;no leader&lt;/code&gt; (503)&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 there is no leader&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;&lt;code&gt;Lua script error (radius/accounting): runtime error: PrepareStatement: no such table: …&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The SQL of the accounting script is wrong; no response and not put in the spool&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Fix 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;RADIUS authentication overloaded: discarded N packets&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Over &lt;code&gt;max_auth_inflight&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Check for abnormal traffic; adjust the limit (&lt;a class=&#34;link&#34; href=&#34;../19-performance/&#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;code&gt;asked for a receive buffer of N bytes and each socket got M; raise … to at least N&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The system limit for socket buffers is too low&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Adjust it as &lt;code&gt;tuning&lt;/code&gt; says&lt;/td&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 response attribute error: unknown attribute &#39;X&#39;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The reply attribute is not in the dictionary&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Fix the data or the dictionary&lt;/td&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 stored password asks for more than [auth.password_limits].X allows and is refused&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The hash cost is above the limit&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../20-security/&#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;the stored password looks like a hash with no scheme prefix and is refused&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The hash has no format prefix&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Add the prefix&lt;/td&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 lockout: client X: account &amp;quot;Y&amp;quot; from &amp;quot;Z&amp;quot; is locked (…)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Too many failures&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wait for &lt;code&gt;lock_seconds&lt;/code&gt;; find out who is guessing&lt;/td&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 conversation with client X failed: the chain did not accept the inner name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The inner EAP password is wrong or the account does not exist&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same as 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;EAP conversation with client X failed: the peer asked only for methods this server does not offer&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The EAP method the device wants is not enabled&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Adjust &lt;code&gt;radius.eap.methods&lt;/code&gt; or the device 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;&lt;code&gt;TACACS+ connection from X closed: a body did not decode, so the shared secret may be wrong&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+ shared secret mismatch&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Set the shared secret again on both sides&lt;/td&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;The number of connections reached &lt;code&gt;tacacs.max_connections&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;#connection-closed-limits&#34; &gt;Connection closed: limits&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;TACACS+ connection from X closed: it already holds max_connections_per_source = N connections&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The number of connections from this source address reached the limit&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;&lt;code&gt;TACACS+ authentication for client X answered ERROR: the authentication backend could not be used&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The database used for authentication is unavailable&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Check 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;script exceeded the execution limit of N ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The script ran too long&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Fix the script, or adjust &lt;code&gt;lua.max_execution_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;&lt;code&gt;script http_request refused: … is not in lua.http.allowed_hosts&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The host the script calls is not on the allow list&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Add it to &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;stopping: after N ms, M RADIUS requests were still being handled and K TACACS+ connections open; they are cut off&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;At shutdown, the server waited &lt;code&gt;[shutdown] drain_ms&lt;/code&gt; and some requests were still not finished (script, LDAP or database too slow); those requests get no response and the device retransmits to another server&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Find out why it is slow, or increase &lt;code&gt;drain_ms&lt;/code&gt; (&lt;a class=&#34;link&#34; href=&#34;../18-operations/#how-long-shutdown-takes&#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;reload failed, keeping the running configuration: …&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The new configuration has an error&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Run &lt;code&gt;check&lt;/code&gt; first, fix it, then reload&lt;/td&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;configuration reloaded from …; these need a restart to apply: …&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Some settings take effect only after a restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Plan a restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;commands&#34;&gt;Commands&#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;Message&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Cause&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Fix&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;cannot reach the metrics port at 127.0.0.1:9812: Connection refused (os error 61)&lt;/code&gt; (&lt;code&gt;status&lt;/code&gt;, exit code 3)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The server is not running, or the &lt;code&gt;[metrics]&lt;/code&gt; address the server uses differs from the configuration the command reads&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Start the server, or point &lt;code&gt;--config&lt;/code&gt; at the configuration the server uses&lt;/td&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 cluster did not answer within 30 s&lt;/code&gt; (commands such as &lt;code&gt;user&lt;/code&gt;, exit code 3)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The server is not running&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Start the server (&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;Chapter 03&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;timeouts 1, … socket errors 1&lt;/code&gt; of &lt;code&gt;rradius-bench&lt;/code&gt; (exit code 2)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The server is not running or the port is wrong&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Check the address and the port&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;A log line that ends with &lt;code&gt;(N since the last line)&lt;/code&gt; is a message that anyone can trigger (unknown sources, refused connections and so on): each kind is logged at most once per second, and N is the total that happened between this line and the previous one, so a large N does not mean it happened only once.&lt;/p&gt;&#xA;&lt;p&gt;In the test of the &lt;code&gt;user&lt;/code&gt; row, the 30 seconds of waiting also produced several lines of &lt;code&gt;ERROR hiqlite::client::helpers: Error looking up DB metrics: …&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04 Configuration file basics&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05 RADIUS service and NAS clients&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;06 Dictionary and attributes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09 External databases and named queries&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;10 Writing policies in Lua&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;11 802.1X and EAP&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;12 TACACS+ device administration&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16 Clusters and high availability&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../18-operations/&#34; &gt;18 Day-to-day operations&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;19 Performance tuning and load testing&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../20-security/&#34; &gt;20 Security hardening&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>90 Appendix A: Configuration reference</title>
            <link>https://embark.systems/en/rradius/oss/90-config-reference/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/90-config-reference/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Look up the type, default, whether it is required and the meaning of every &lt;code&gt;rradiusd&lt;/code&gt; setting key&lt;/li&gt;&#xA;&lt;li&gt;Tell which keys take effect on reload and which need a restart&lt;/li&gt;&#xA;&lt;li&gt;Know what the server does when you leave out a whole section&lt;/li&gt;&#xA;&lt;li&gt;Recognize the keys and sections that the core does not support or that have no effect in the core&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: you have read &lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04 Configuration file basics&lt;/a&gt; and know how to use the configuration file, &lt;code&gt;include&lt;/code&gt; and &lt;code&gt;check&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#how-to-read-this-reference&#34; &gt;How to read this reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#overview-of-top-level-sections&#34; &gt;Overview of top-level sections&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#top-level-keys-dictionary-include&#34; &gt;Top-level keys: dictionary, include&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#lua&#34; &gt;lua&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#cluster&#34; &gt;cluster&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#metrics&#34; &gt;metrics&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#log&#34; &gt;log&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#runtime&#34; &gt;runtime&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#shutdown&#34; &gt;shutdown&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#accounts&#34; &gt;accounts&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#sessions&#34; &gt;sessions&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#auth&#34; &gt;auth&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#databases&#34; &gt;databases&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#queries&#34; &gt;queries&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#radius&#34; &gt;radius&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#tacacs&#34; &gt;tacacs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#settings-the-core-does-not-support-or-that-have-no-effect&#34; &gt;Settings the core does not support or that have no effect&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;how-to-read-this-reference&#34;&gt;How to read this reference&#xA;&lt;/h2&gt;&lt;p&gt;This appendix is built from &lt;code&gt;rradiusd schema --lang zh-TW&lt;/code&gt; (JSON Schema) and the output of &lt;code&gt;rradiusd config show&lt;/code&gt;, checked against &lt;code&gt;rradius-core/src/config.rs&lt;/code&gt; and &lt;code&gt;reload.rs&lt;/code&gt; to add the defaults and conditions that the schema does not state. After you update the program, trust these two commands on your version:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd schema --lang zh-TW &amp;gt; schema.json&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd config show --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# computed on this machine: radius.sockets &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 1, cluster.read_connections &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;28&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;config show&lt;/code&gt; prints the whole configuration with defaults filled in for the keys you did not write, and shows secrets as &lt;code&gt;&amp;lt;hidden&amp;gt;&lt;/code&gt;. The comment on the first line lists the values computed for this machine.&lt;/p&gt;&#xA;&lt;h3 id=&#34;how-key-names-are-written&#34;&gt;How key names are written&#xA;&lt;/h3&gt;&lt;p&gt;The first column of each table is the full path of the key:&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;Notation&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;Example&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;a.b&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Key &lt;code&gt;b&lt;/code&gt; in the table &lt;code&gt;[a]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.auth_port&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;a[].b&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Key &lt;code&gt;b&lt;/code&gt; in each item of the table array &lt;code&gt;[[a]]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.clients[].secret&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;a.&amp;lt;name&amp;gt;.b&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Key &lt;code&gt;b&lt;/code&gt; in the sub-table &lt;code&gt;[a.&amp;lt;name&amp;gt;]&lt;/code&gt; whose name you choose&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;databases.&amp;lt;name&amp;gt;.host&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;auth.handlers[ldap].b&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Key &lt;code&gt;b&lt;/code&gt; in the kind of &lt;code&gt;[[auth.handlers]]&lt;/code&gt; that has &lt;code&gt;type = &amp;quot;ldap&amp;quot;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;auth.handlers[ldap].urls&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;columns&#34;&gt;Columns&#xA;&lt;/h3&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Type:&lt;/strong&gt; string, integer, boolean, IP address, array, table. &amp;ldquo;Path&amp;rdquo; is a string; a relative path is always relative to the directory of this configuration file.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Default:&lt;/strong&gt; the value when you leave the key out. &amp;ldquo;—&amp;rdquo; means there is no default: leaving the key out means &amp;ldquo;this setting does not exist&amp;rdquo;, and the effect is written in the description.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Required:&lt;/strong&gt; &amp;ldquo;yes&amp;rdquo; means you must write it whenever this section is present; &amp;ldquo;conditional&amp;rdquo; means it is required only under the condition given in the description; blank means it can be left out.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;reload:&lt;/strong&gt; &amp;ldquo;yes&amp;rdquo; means it takes effect on a &lt;code&gt;SIGHUP&lt;/code&gt; reload; &amp;ldquo;restart&amp;rdquo; means reload does not apply it, the log lists these keys in &lt;code&gt;these need a restart to apply: …&lt;/code&gt;, and you must restart for it to take effect; &amp;ldquo;command&amp;rdquo; means only the management commands read it, each time you run the command, and reload has nothing to do with it.&lt;/li&gt;&#xA;&lt;li&gt;Integer units follow the key name: &lt;code&gt;_ms&lt;/code&gt; is milliseconds, &lt;code&gt;_seconds&lt;/code&gt; is seconds, &lt;code&gt;_bytes&lt;/code&gt; is bytes, &lt;code&gt;_mb&lt;/code&gt; is MiB, &lt;code&gt;_kib&lt;/code&gt; is KiB.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Under the heading of each section, the main chapter is named; detailed usage and examples are in that chapter.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;overview-of-top-level-sections&#34;&gt;Overview of top-level sections&#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;Section&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;When left out&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Main 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;code&gt;dictionary&lt;/code&gt;&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;Cannot be left out&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;06&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;include&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Only this one file is read&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;../04-configuration/&#34; &gt;04&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;[lua]&lt;/code&gt;&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;code&gt;check&lt;/code&gt; fails: &lt;code&gt;the [lua] section is required&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;yes (&lt;code&gt;max_memory_mb&lt;/code&gt; needs a restart)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#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;&lt;code&gt;[cluster]&lt;/code&gt;&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;code&gt;check&lt;/code&gt; fails: &lt;code&gt;the [cluster] section is required&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#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;&lt;code&gt;[metrics]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No HTTP port: no &lt;code&gt;/metrics&lt;/code&gt;, &lt;code&gt;/livez&lt;/code&gt;, &lt;code&gt;/readyz&lt;/code&gt;, and the &lt;code&gt;status&lt;/code&gt; command cannot read any data&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#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;&lt;code&gt;[log]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Level &lt;code&gt;info&lt;/code&gt;, format &lt;code&gt;text&lt;/code&gt;, auth records written&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart (&lt;code&gt;log.trace&lt;/code&gt; yes)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#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;&lt;code&gt;[runtime]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No CPU pinning&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../19-performance/&#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;&lt;code&gt;[shutdown]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A single node does not delay; drain waits at most 5000 ms&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;../04-configuration/&#34; &gt;04&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;[accounts]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The &lt;code&gt;user&lt;/code&gt; command cannot be used&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07&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;[sessions]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The &lt;code&gt;session&lt;/code&gt; command cannot be used&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#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;&lt;code&gt;[auth]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No auth chain; the script in &lt;code&gt;[lua]&lt;/code&gt; decides every login&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;../07-users-and-chains/&#34; &gt;07&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;[databases.&amp;lt;name&amp;gt;]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No external databases&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09&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;[queries.&amp;lt;name&amp;gt;]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No named queries&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09&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;[radius]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;at least one of this and &lt;code&gt;[tacacs]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RADIUS is not served&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;adding or removing the whole section needs a restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05&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;[tacacs]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;at least one of this and &lt;code&gt;[radius]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+ is not served&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;adding or removing the whole section needs a restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;12&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;If neither &lt;code&gt;[radius]&lt;/code&gt; nor &lt;code&gt;[tacacs]&lt;/code&gt; is present, &lt;code&gt;check&lt;/code&gt; fails: &lt;code&gt;at least one of [radius] or [tacacs] must be configured&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;No table accepts unknown keys. If you mistype a key, &lt;code&gt;check&lt;/code&gt; points to the line number and the keys you can use; see &lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-smallest-configuration&#34;&gt;The smallest configuration&#xA;&lt;/h3&gt;&lt;p&gt;Write only the required keys, use defaults for everything else, and &lt;code&gt;check&lt;/code&gt; passes:&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:#75715e&#34;&gt;# rradius.toml&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;dictionary&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;share/dictionary&amp;#34;&lt;/span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;# main dictionary file, relative to this file&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;lua&lt;/span&gt;]&#xA;&lt;/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;auth.lua&amp;#34;&lt;/span&gt;                  &lt;span style=&#34;color:#75715e&#34;&gt;# the file must exist and compile&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;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;data_dir&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;data&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_raft_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;raft.secret&amp;#34;&lt;/span&gt;     &lt;span style=&#34;color:#75715e&#34;&gt;# openssl rand -hex 32 &amp;gt; raft.secret&lt;/span&gt;&#xA;&lt;/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_api_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;api.secret&amp;#34;&lt;/span&gt;       &lt;span style=&#34;color:#75715e&#34;&gt;# openssl rand -hex 32 &amp;gt; api.secret&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;]&#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;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;127.0.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;localhost.secret&amp;#34;&lt;/span&gt;     &lt;span style=&#34;color:#75715e&#34;&gt;# openssl rand -hex 32 &amp;gt; localhost.secret&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This configuration listens on ports 1812 and 1813 on all addresses, has no &lt;code&gt;[metrics]&lt;/code&gt; (so no &lt;code&gt;/metrics&lt;/code&gt; and no &lt;code&gt;status&lt;/code&gt;), and has no &lt;code&gt;[auth]&lt;/code&gt; (so &lt;code&gt;auth.lua&lt;/code&gt; decides every login). &lt;code&gt;rradiusd config init --lang zh-TW&lt;/code&gt; produces a starting file with full comments and random secrets, which is easier than starting from here.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;top-level-keys-dictionary-include&#34;&gt;Top-level keys: dictionary, include&#xA;&lt;/h2&gt;&lt;p&gt;Main chapters: &lt;code&gt;dictionary&lt;/code&gt; is in &lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;06&lt;/a&gt;, &lt;code&gt;include&lt;/code&gt; is in &lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04&lt;/a&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The main file of the RADIUS dictionary, for example &lt;code&gt;/usr/share/rradius/dictionary&lt;/code&gt; installed by the package. A relative path is relative to the directory of 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;include&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;array (string)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Other configuration files to read together with this one, for example &lt;code&gt;[&amp;quot;conf.d/*.toml&amp;quot;]&lt;/code&gt;. Their content is treated as if it were appended to the main file.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Rules for &lt;code&gt;include&lt;/code&gt; (&lt;code&gt;config.rs&lt;/code&gt;):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The wildcards &lt;code&gt;*&lt;/code&gt; and &lt;code&gt;?&lt;/code&gt; can appear only in the last file name segment, for example &lt;code&gt;conf.d/*.toml&lt;/code&gt;; directory names cannot contain wildcards.&lt;/li&gt;&#xA;&lt;li&gt;One name expands in path order; a wildcard does not match file names that start with &lt;code&gt;.&lt;/code&gt;; the same file is read only once; the main file itself is skipped.&lt;/li&gt;&#xA;&lt;li&gt;At most 1000 files can be included, each at most 1048576 bytes (1 MiB).&lt;/li&gt;&#xA;&lt;li&gt;An included file must start with a table (&lt;code&gt;[section]&lt;/code&gt;) and cannot contain &lt;code&gt;include&lt;/code&gt; itself.&lt;/li&gt;&#xA;&lt;li&gt;If the main file already declares a table, an included file cannot declare it again, or you get &lt;code&gt;duplicate key&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;lua&#34;&gt;lua&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;10 Writing policies in Lua&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;lua-1&#34;&gt;&lt;code&gt;[lua]&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;The top-level script that runs for every request, and the resource limits for scripts. These limits also apply to the &lt;code&gt;lua&lt;/code&gt; handler in an auth chain.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;lua.script&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The top-level script that runs for every request. &lt;code&gt;check&lt;/code&gt; compiles 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;lua.query_timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;5000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Total time a script can wait for the database in one request, in milliseconds; must be greater than 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;lua.max_execution_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;How long a script can run in one request, in milliseconds; must be greater than 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;lua.max_memory_mb&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;256&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Memory limit for each Lua VM, in MiB; must be greater than 0.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;luahttp&#34;&gt;&lt;code&gt;[lua.http]&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;Only with this table can scripts call &lt;code&gt;http_request&lt;/code&gt; to reach HTTP APIs on the allow list. Without this table the function does not exist.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;lua.http.allowed_hosts&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;array (string)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Hosts that scripts can call, at least one: &lt;code&gt;host&lt;/code&gt;, &lt;code&gt;host:port&lt;/code&gt;, or &lt;code&gt;http://host&lt;/code&gt; to use plain HTTP for that host; all the others use HTTPS.&lt;/td&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.timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;2000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Time limit for one call from connecting to reading the whole response, in milliseconds; must be greater than 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;lua.http.max_response_bytes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1048576&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Upper limit for the response body accepted, in bytes; must be greater than 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;lua.http.max_concurrent&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;64&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Number of calls in progress at the same time for each host; must be greater than 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;lua.http.ca_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;CA certificates (PEM) to trust in addition to the system root certificates.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;cluster&#34;&gt;cluster&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16 Clusters and high availability&lt;/a&gt;. Any change to &lt;code&gt;[cluster]&lt;/code&gt; needs a restart.&lt;/p&gt;&#xA;&lt;h3 id=&#34;cluster-1&#34;&gt;&lt;code&gt;[cluster]&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;Node settings for the embedded database (hiqlite, Raft replication). A single server needs this section too: a single server is a cluster with one node.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;cluster.data_dir&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Data directory for the database and the Raft 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;cluster.node_id&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The id of this node, at least 1; it must appear in &lt;code&gt;nodes&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;cluster.secret_raft&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;conditional&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Shared secret of the Raft port, at least 16 characters. Set exactly one of this and &lt;code&gt;secret_raft_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;cluster.secret_raft_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;conditional&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;File that holds the Raft secret. Set exactly one of this and &lt;code&gt;secret_raft&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;cluster.secret_api&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;conditional&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Shared secret of the API port, at least 16 characters. Set exactly one of this and &lt;code&gt;secret_api_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;cluster.secret_api_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;conditional&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;File that holds the API secret. Set exactly one of this and &lt;code&gt;secret_api&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;cluster.listen&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;IP address&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;127.0.0.1&lt;/code&gt; without &lt;code&gt;nodes&lt;/code&gt;, &lt;code&gt;0.0.0.0&lt;/code&gt; with &lt;code&gt;nodes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Address on which the two cluster ports listen. If you have &lt;code&gt;nodes&lt;/code&gt; and do not set it, you get a warning; see &lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&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;cluster.nodes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;table array&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Every node of the cluster, including this one. The fields are in the next 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;&lt;code&gt;cluster.migrations_dir&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Directory of SQL files (migrations) applied in order at startup.&lt;/td&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.migrations_wait_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;60000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Time limit at startup for waiting for the cluster to be ready, applying migrations and catching up; the three steps are timed separately, in milliseconds; must be greater than 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;cluster.snapshot_every&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;100000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Number of Raft log entries between two snapshots; must be greater than 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;cluster.read_connections&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;twice the number of worker threads, at most 32 (depends on the machine)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Number of connections that read the local database, 1 to 128. The number of worker threads equals the number of CPUs.&lt;/td&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.stop_without_leader_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (always answers)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After this long without a leader, stop answering logins, in milliseconds; must be greater than 0.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;clusternodes&#34;&gt;&lt;code&gt;[[cluster.nodes]]&lt;/code&gt;&#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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;cluster.nodes[].id&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Node id, at least 1.&lt;/td&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.nodes[].raft&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;host:port&lt;/code&gt; of the Raft port of this 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;cluster.nodes[].api&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;host:port&lt;/code&gt; of the API port of this node.&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;raft&lt;/code&gt; and &lt;code&gt;api&lt;/code&gt; are ports used between nodes, not management interfaces.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;metrics&#34;&gt;metrics&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;metrics-1&#34;&gt;&lt;code&gt;[metrics]&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;The HTTP port that serves &lt;code&gt;/metrics&lt;/code&gt;, &lt;code&gt;/livez&lt;/code&gt; and &lt;code&gt;/readyz&lt;/code&gt; opens only if you write this table (even if it is empty); the &lt;code&gt;status&lt;/code&gt; command also reads this port.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;metrics.bind&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;IP address&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;127.0.0.1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Address on which the HTTP port listens.&lt;/td&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.port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;9812&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;HTTP port.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;log&#34;&gt;log&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;log-1&#34;&gt;&lt;code&gt;[log]&lt;/code&gt;&#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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;log.level&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;info&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Lowest level that is written: &lt;code&gt;error&lt;/code&gt;, &lt;code&gt;warn&lt;/code&gt;, &lt;code&gt;info&lt;/code&gt; or &lt;code&gt;debug&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;log.format&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;text&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Log format: &lt;code&gt;text&lt;/code&gt; or &lt;code&gt;json&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;log.auth&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;boolean&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Write one auth record for every authentication.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;logtrace&#34;&gt;&lt;code&gt;[log.trace]&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;For a limited time, write the full requests of some users or clients to the log. It is temporary: you must write &lt;code&gt;minutes&lt;/code&gt;, and it stops by itself when the time is up. It takes effect on reload, so you can start or end tracing without a restart.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;log.trace.users&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;array (string)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;conditional&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;code&gt;User-Name&lt;/code&gt; values to trace; only exact matches count. &lt;code&gt;users&lt;/code&gt; and &lt;code&gt;clients&lt;/code&gt; cannot both be empty.&lt;/td&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.clients&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;array (string)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;conditional&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;Names of RADIUS clients to trace; each must be a &lt;code&gt;name&lt;/code&gt; in &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;&lt;code&gt;log.trace.minutes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How long tracing lasts, 1 to 1440 minutes.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;runtime&#34;&gt;runtime&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;19 Performance tuning and load testing&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;runtime-1&#34;&gt;&lt;code&gt;[runtime]&lt;/code&gt;&#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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;runtime.pin_threads&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;boolean&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Pin each worker thread to its own CPU; works only on Linux.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;shutdown&#34;&gt;shutdown&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04 Configuration file basics&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;shutdown-1&#34;&gt;&lt;code&gt;[shutdown]&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;How the server stops after it receives &lt;code&gt;SIGTERM&lt;/code&gt; or &lt;code&gt;SIGINT&lt;/code&gt;. The configuration in effect at the moment stopping starts is the one that counts, so reload applies it.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;shutdown.ready_delay_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;0&lt;/code&gt; for a single node, &lt;code&gt;5000&lt;/code&gt; when &lt;code&gt;cluster.nodes&lt;/code&gt; has more than one&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;After the stop signal, the time during which &lt;code&gt;/readyz&lt;/code&gt; reports that the server is stopping while it still answers requests as usual, in milliseconds, at most 60000. It gives the load balancer time to move traffic away.&lt;/td&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;shutdown.drain_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;5000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;After the server stops accepting new requests, how long it waits at most for requests in progress, in milliseconds, at most 60000.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;accounts&#34;&gt;accounts&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;accounts-1&#34;&gt;&lt;code&gt;[accounts]&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;The SQL that the &lt;code&gt;rradiusd user …&lt;/code&gt; command runs. &lt;code&gt;?1&lt;/code&gt; is the account name and &lt;code&gt;?2&lt;/code&gt; is the password value to store. If you leave out a statement, the matching sub-command cannot be used.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;accounts.scheme&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;bcrypt&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How &lt;code&gt;user add&lt;/code&gt; and &lt;code&gt;user passwd&lt;/code&gt; store the password: &lt;code&gt;bcrypt&lt;/code&gt;, &lt;code&gt;sha512-crypt&lt;/code&gt;, &lt;code&gt;nthash&lt;/code&gt; or &lt;code&gt;clear&lt;/code&gt;. MS-CHAP and PEAP need &lt;code&gt;nthash&lt;/code&gt;; CHAP needs &lt;code&gt;clear&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;accounts.add&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SQL that &lt;code&gt;user add&lt;/code&gt; runs; &lt;code&gt;?1&lt;/code&gt; account name, &lt;code&gt;?2&lt;/code&gt; password 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;accounts.passwd&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SQL that &lt;code&gt;user passwd&lt;/code&gt; runs; &lt;code&gt;?1&lt;/code&gt; account name, &lt;code&gt;?2&lt;/code&gt; password 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;accounts.enable&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SQL that &lt;code&gt;user enable&lt;/code&gt; runs; &lt;code&gt;?1&lt;/code&gt; 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;&lt;code&gt;accounts.disable&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SQL that &lt;code&gt;user disable&lt;/code&gt; runs; &lt;code&gt;?1&lt;/code&gt; account name. It has an effect only together with a &lt;code&gt;user_query&lt;/code&gt; that skips disabled 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;accounts.delete&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SQL that &lt;code&gt;user delete&lt;/code&gt; runs; &lt;code&gt;?1&lt;/code&gt; 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;&lt;code&gt;accounts.show&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SQL that &lt;code&gt;user show&lt;/code&gt; runs and prints as it is; &lt;code&gt;?1&lt;/code&gt; account name. Do not select the password column.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;sessions&#34;&gt;sessions&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13 Accounting and sessions&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;sessions-1&#34;&gt;&lt;code&gt;[sessions]&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;SQL that the &lt;code&gt;rradiusd session …&lt;/code&gt; command runs and prints as it is. Both statements can only read: they must start with &lt;code&gt;SELECT&lt;/code&gt; or &lt;code&gt;WITH&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;sessions.list&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SQL for &lt;code&gt;session list&lt;/code&gt;: the sessions that are online now. No parameters.&lt;/td&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;sessions.show&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SQL for &lt;code&gt;session show&lt;/code&gt;: the sessions of one user; &lt;code&gt;?1&lt;/code&gt; is the user name.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;auth&#34;&gt;auth&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;; the &lt;code&gt;ldap&lt;/code&gt; and &lt;code&gt;netlogon&lt;/code&gt; handlers are in &lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;08 LDAP and Active Directory&lt;/a&gt;. All of &lt;code&gt;[auth]&lt;/code&gt; can be reloaded.&lt;/p&gt;&#xA;&lt;p&gt;When &lt;code&gt;[auth]&lt;/code&gt; is present, logins go to the auth chain: &lt;code&gt;[[auth.handlers]]&lt;/code&gt; is the default chain and &lt;code&gt;[auth.chains.&amp;lt;name&amp;gt;]&lt;/code&gt; is a named chain, which a client selects with &lt;code&gt;auth&lt;/code&gt;. &lt;code&gt;[auth]&lt;/code&gt; must have at least one handler or one named chain, or &lt;code&gt;check&lt;/code&gt; fails.&lt;/p&gt;&#xA;&lt;h3 id=&#34;auth-1&#34;&gt;&lt;code&gt;[auth]&lt;/code&gt;&#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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;auth.policy&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;first_match&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;How the default chain combines the results of its handlers: &lt;code&gt;first_match&lt;/code&gt; uses the first handler that has an answer; &lt;code&gt;all_accept&lt;/code&gt; runs every handler, rejects if any one rejects, and needs at least one 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;&lt;code&gt;auth.handlers&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;table array&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;conditional&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;Handlers of the default chain, tried in order. Required when there are no named chains. The fields depend on &lt;code&gt;type&lt;/code&gt;; see the tables for each handler 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;auth.allow_mschapv1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;boolean&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Whether the auth chain handles MS-CHAPv1 logins. When not written or &lt;code&gt;false&lt;/code&gt;, MS-CHAPv1 is rejected before any handler runs and does not count toward &lt;code&gt;auth.lockout&lt;/code&gt;; PAP, CHAP, MS-CHAPv2 and EAP are not affected.&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;auth.policy&lt;/code&gt; and &lt;code&gt;[auth.username]&lt;/code&gt; apply only to the default chain. If you write them without &lt;code&gt;[[auth.handlers]]&lt;/code&gt;, &lt;code&gt;check&lt;/code&gt; fails, for example &lt;code&gt;auth.username is set but the default chain has no [[auth.handlers]] entries&lt;/code&gt;; a named chain writes its own &lt;code&gt;policy&lt;/code&gt; and &lt;code&gt;username&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;authusername&#34;&gt;&lt;code&gt;[auth.username]&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;Normalization of the account name before the default chain gives it to the handlers. Without this table, the name is used as it was received.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;auth.username.strip_realm&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&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;&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;Which realm to remove: &lt;code&gt;none&lt;/code&gt;, &lt;code&gt;suffix&lt;/code&gt; (the part from the last &lt;code&gt;@&lt;/code&gt;), &lt;code&gt;prefix&lt;/code&gt; (the part up to the last backslash, for example &lt;code&gt;REALM\&lt;/code&gt;) or &lt;code&gt;both&lt;/code&gt; (prefix first, then suffix).&lt;/td&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.username.lowercase&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;boolean&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Convert the account name to lower case.&lt;/td&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.username.allowed&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;A regular expression that the whole normalized name must match; a name that does not match is rejected.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;authlockout&#34;&gt;&lt;code&gt;[auth.lockout]&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;Limits login failures. If the same key (account plus source device) fails &lt;code&gt;max_failures&lt;/code&gt; times within &lt;code&gt;window_seconds&lt;/code&gt;, requests are rejected directly for &lt;code&gt;lock_seconds&lt;/code&gt; without checking the password. Without this table, failures are not counted.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;auth.lockout.max_failures&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;10&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;How many failures within the window lock this key; must be greater than 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;auth.lockout.window_seconds&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;300&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;How long counting lasts from the first failure, in seconds; must be greater than 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;auth.lockout.lock_seconds&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;300&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;How long the lock lasts, in seconds; must be greater than 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;auth.lockout.max_entries&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;100000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Most keys each node remembers; must be greater than 0. When full, expired ones are dropped first, then the oldest unlocked ones; locked ones are not 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;&lt;code&gt;auth.lockout.account_max_failures&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (no total limit per account)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Total failures of one account from all sources; when reached, the account is locked for all sources. Must be greater than &lt;code&gt;max_failures&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;auth.lockout.max_in_flight&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;5 times &lt;code&gt;max_failures&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Most logins of the same key that can wait for a decision at the same time; more are rejected directly. Must be greater than 0. The total limit per account scales in proportion to &lt;code&gt;account_max_failures&lt;/code&gt;.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; If you set &lt;code&gt;account_max_failures&lt;/code&gt;, someone guessing passwords can lock other people&amp;rsquo;s accounts for all sources just by getting the password wrong on purpose.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;authpassword_limits&#34;&gt;&lt;code&gt;[auth.password_limits]&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;The most computation cost a stored password hash may demand in one comparison. A hash over the limit is not computed and is treated as a wrong password. Every key has a default, so the limits apply even if you do not write this table. Every value must be greater than 0.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;auth.password_limits.pbkdf2_iterations&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;5000000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Upper limit on iterations for PBKDF2 and X-PBKDF2 hashes.&lt;/td&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.password_limits.crypt_rounds&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1000000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Upper limit on rounds for &lt;code&gt;$5$&lt;/code&gt;, &lt;code&gt;$6$&lt;/code&gt;, &lt;code&gt;$sha1$&lt;/code&gt; and extended DES (starting with &lt;code&gt;_&lt;/code&gt;) crypt hashes.&lt;/td&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.password_limits.bcrypt_cost&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;15&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Upper limit on cost for bcrypt hashes; each +1 doubles the work.&lt;/td&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.password_limits.argon2_memory_kib&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;262144&lt;/code&gt; (256 MiB)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Upper limit on memory for argon2 hashes, in KiB. The number of comparisons in progress equals the number of CPUs, so the worst case is about this value times the number of CPUs.&lt;/td&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.password_limits.argon2_iterations&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;10&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Upper limit on iterations for argon2 hashes.&lt;/td&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.password_limits.argon2_lanes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;16&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Upper limit on parallelism for argon2 hashes.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;authhandlers-sql-handler&#34;&gt;&lt;code&gt;[[auth.handlers]]&lt;/code&gt;: sql handler&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;type = &amp;quot;sql&amp;quot;&lt;/code&gt;: looks up the account and password in the cluster database or in one of the &lt;code&gt;[databases.&amp;lt;name&amp;gt;]&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;auth.handlers[sql].type&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Always &lt;code&gt;sql&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;auth.handlers[sql].user_query&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SQL that looks up the user, with exactly one &lt;code&gt;?&lt;/code&gt; (the account name); the first column is the stored password.&lt;/td&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.handlers[sql].reply_query&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;SQL that gets the reply attributes, with exactly one &lt;code&gt;?&lt;/code&gt;, returning two columns &lt;code&gt;(attribute, value)&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;auth.handlers[sql].certificate_query&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Query used instead after an EAP-TLS certificate passes; if it finds a row, the login is accepted. When not set, &lt;code&gt;user_query&lt;/code&gt; is used.&lt;/td&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.handlers[sql].default_user&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;When the user is not found, check the password against this account instead; anyone who knows this password passes.&lt;/td&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.handlers[sql].database&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (the cluster database)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;In which &lt;code&gt;[databases.&amp;lt;name&amp;gt;]&lt;/code&gt; to run the queries; the placeholder is still &lt;code&gt;?&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;auth.handlers[sql].timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;5000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Time limit for one query, in milliseconds; must be greater than 0.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;authhandlers-lua-handler&#34;&gt;&lt;code&gt;[[auth.handlers]]&lt;/code&gt;: lua handler&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;type = &amp;quot;lua&amp;quot;&lt;/code&gt;: another Lua script decides.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;auth.handlers[lua].type&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Always &lt;code&gt;lua&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;auth.handlers[lua].script&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The script file for this 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;auth.handlers[lua].verifies_password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;boolean&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;The script checks the password itself. When &lt;code&gt;true&lt;/code&gt;, the chain can have only this handler, and its accept also counts as proof of the password inside EAP.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;authhandlers-ldap-handler&#34;&gt;&lt;code&gt;[[auth.handlers]]&lt;/code&gt;: ldap handler&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;type = &amp;quot;ldap&amp;quot;&lt;/code&gt;: finds the user in an LDAP directory and checks the password.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;auth.handlers[ldap].type&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Always &lt;code&gt;ldap&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;auth.handlers[ldap].urls&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;array (string)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Server addresses (&lt;code&gt;ldap://&lt;/code&gt; or &lt;code&gt;ldaps://&lt;/code&gt;), at least one, tried in order.&lt;/td&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.handlers[ldap].bind_dn&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The DN to bind as when searching for users.&lt;/td&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.handlers[ldap].bind_password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;conditional&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;Password of &lt;code&gt;bind_dn&lt;/code&gt;. Set exactly one of this and &lt;code&gt;bind_password_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;auth.handlers[ldap].bind_password_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;conditional&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;File that holds the password of &lt;code&gt;bind_dn&lt;/code&gt;. Set exactly one of this and &lt;code&gt;bind_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;auth.handlers[ldap].base_dn&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Where the user search starts.&lt;/td&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.handlers[ldap].filter&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Search filter that finds the user; &lt;code&gt;{user}&lt;/code&gt; is replaced with the escaped 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;&lt;code&gt;auth.handlers[ldap].certificate_filter&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Search filter used instead after an EAP-TLS certificate passes; if it finds an entry, the login is accepted.&lt;/td&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.handlers[ldap].password_check&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;bind&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;code&gt;bind&lt;/code&gt; checks the password by binding as the user; &lt;code&gt;attribute&lt;/code&gt; compares against the value of &lt;code&gt;password_attribute&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;auth.handlers[ldap].password_attribute&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;conditional&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;The attribute that holds the password when &lt;code&gt;password_check = &amp;quot;attribute&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;auth.handlers[ldap].reply_attributes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;table (string to string)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Key is the reply attribute name; value is the LDAP attribute of the user that provides the attribute value. Added in the order written.&lt;/td&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.handlers[ldap].ca_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;CA certificates trusted for &lt;code&gt;ldaps://&lt;/code&gt; and StartTLS.&lt;/td&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.handlers[ldap].allow_plaintext&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;boolean&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Allow &lt;code&gt;ldap://&lt;/code&gt; without StartTLS. The password is sent in clear 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;&lt;code&gt;auth.handlers[ldap].pool_size&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;4&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Number of server connections kept open; must be greater than 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;auth.handlers[ldap].timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;5000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Time limit for one LDAP query, in milliseconds; must be greater than 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;auth.handlers[ldap].required_groups&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;array (string)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (no group required)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;The user must belong to one of these groups to be accepted. If written, it needs at least 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;code&gt;auth.handlers[ldap].group_attribute&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;The user attribute that lists the groups the user belongs to, for example &lt;code&gt;memberOf&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;auth.handlers[ldap].group_base_dn&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Where the group search starts when you use &lt;code&gt;group_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;auth.handlers[ldap].group_filter&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Search filter that finds the groups the user belongs to; &lt;code&gt;{dn}&lt;/code&gt; is the DN of the user.&lt;/td&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.handlers[ldap].group_reply&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;table array&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Reply attributes to add when the user belongs to a group. The fields are in the next two rows.&lt;/td&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.handlers[ldap].group_reply[].group&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The group that gets these attributes added.&lt;/td&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.handlers[ldap].group_reply[].attributes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;table (string to string)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;The reply attributes to add, with the attribute name as key. At least one.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;authhandlers-netlogon-handler&#34;&gt;&lt;code&gt;[[auth.handlers]]&lt;/code&gt;: netlogon handler&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;type = &amp;quot;netlogon&amp;quot;&lt;/code&gt;: checks the login through the Netlogon service of an Active Directory domain controller. See &lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;08&lt;/a&gt; for which login methods are supported.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;auth.handlers[netlogon].type&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Always &lt;code&gt;netlogon&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;auth.handlers[netlogon].domain&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;NetBIOS name of the 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;&lt;code&gt;auth.handlers[netlogon].servers&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;array (string)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;DNS or NetBIOS names of the domain controllers, at least one, tried in order. IP addresses cannot be used: the logon request must carry the name of the DC.&lt;/td&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.handlers[netlogon].port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (ask the endpoint mapper on port 135 first)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Fixed Netlogon port of the domain controller; must be greater than 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;auth.handlers[netlogon].computer_name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The computer account of this node in the domain, without the trailing &lt;code&gt;$&lt;/code&gt;, at most 15 characters. Each node uses its own account: nodes that share an account break each other&amp;rsquo;s secure channel.&lt;/td&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.handlers[netlogon].machine_password_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;File that holds the password of the computer account; a trailing newline is removed.&lt;/td&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.handlers[netlogon].connections&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;4&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Most connections kept open to each domain controller; must be greater than 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;auth.handlers[netlogon].timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;2000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Time limit for one domain controller call, in milliseconds; must be greater than 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;auth.handlers[netlogon].required_groups&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;array (string)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (no group required)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;The user must belong to one of these groups to be accepted; groups are given as SIDs (&lt;code&gt;S-1-5-21-…&lt;/code&gt;). If written, it needs at least 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;code&gt;auth.handlers[netlogon].group_reply&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;table array&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Reply attributes to add when the user belongs to a 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;auth.handlers[netlogon].group_reply[].group&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The SID of the 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;auth.handlers[netlogon].group_reply[].attributes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;table (string to string)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;The reply attributes to add, with the attribute name as key. At least one.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;authchainsname&#34;&gt;&lt;code&gt;[auth.chains.&amp;lt;name&amp;gt;]&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;A named auth chain. You choose &lt;code&gt;&amp;lt;name&amp;gt;&lt;/code&gt;, and a client selects it with &lt;code&gt;auth = &amp;quot;&amp;lt;name&amp;gt;&amp;quot;&lt;/code&gt;. The fields are the same as the keys of the same name in &lt;code&gt;[auth]&lt;/code&gt;; every chain needs at least one handler.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;auth.chains.&amp;lt;name&amp;gt;.policy&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;first_match&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Same as &lt;code&gt;auth.policy&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;auth.chains.&amp;lt;name&amp;gt;.handlers&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;table array&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Handlers of this chain. The four kinds of handler and every key of theirs (including defaults) are exactly the same as &lt;code&gt;auth.handlers[sql]&lt;/code&gt;, &lt;code&gt;auth.handlers[lua]&lt;/code&gt;, &lt;code&gt;auth.handlers[ldap]&lt;/code&gt; and &lt;code&gt;auth.handlers[netlogon]&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;auth.chains.&amp;lt;name&amp;gt;.username&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;table&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Name normalization of this chain itself; the keys are in the next three rows. Without it, names are not normalized, and &lt;code&gt;[auth.username]&lt;/code&gt; is not inherited.&lt;/td&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.chains.&amp;lt;name&amp;gt;.username.strip_realm&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&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;&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;Same as &lt;code&gt;auth.username.strip_realm&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;auth.chains.&amp;lt;name&amp;gt;.username.lowercase&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;boolean&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Same as &lt;code&gt;auth.username.lowercase&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;auth.chains.&amp;lt;name&amp;gt;.username.allowed&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Same as &lt;code&gt;auth.username.allowed&lt;/code&gt;.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;databases&#34;&gt;databases&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09 External databases and named queries&lt;/a&gt;. Any change to &lt;code&gt;[databases]&lt;/code&gt; (including adding one) needs a restart.&lt;/p&gt;&#xA;&lt;h3 id=&#34;databasesname&#34;&gt;&lt;code&gt;[databases.&amp;lt;name&amp;gt;]&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;An external MySQL or PostgreSQL. You choose &lt;code&gt;&amp;lt;name&amp;gt;&lt;/code&gt;; the &lt;code&gt;database&lt;/code&gt; key of an sql handler and Lua scripts use the database by this name.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;databases.&amp;lt;name&amp;gt;.kind&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;mysql&lt;/code&gt; or &lt;code&gt;postgresql&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;databases.&amp;lt;name&amp;gt;.host&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Host name or address of the database server; with &lt;code&gt;tls = &amp;quot;verify&amp;quot;&lt;/code&gt;, the certificate must carry this 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;&lt;code&gt;databases.&amp;lt;name&amp;gt;.port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;3306&lt;/code&gt; for mysql, &lt;code&gt;5432&lt;/code&gt; for postgresql&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Port of the database server.&lt;/td&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;databases.&amp;lt;name&amp;gt;.database&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Name of the database to use.&lt;/td&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;databases.&amp;lt;name&amp;gt;.user&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Account used to log in to 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;databases.&amp;lt;name&amp;gt;.password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Password of &lt;code&gt;user&lt;/code&gt;; set at most one of this and &lt;code&gt;password_file&lt;/code&gt;. For MySQL with &lt;code&gt;tls = &amp;quot;off&amp;quot;&lt;/code&gt;, the account must use &lt;code&gt;mysql_native_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;databases.&amp;lt;name&amp;gt;.password_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;File that holds the password; set at most one of this and &lt;code&gt;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;databases.&amp;lt;name&amp;gt;.tls&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;verify&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;verify&lt;/code&gt;: encrypt and check the certificate chain and the host name; &lt;code&gt;off&lt;/code&gt;: no encryption, and a warning is logged when &lt;code&gt;host&lt;/code&gt; is not a loopback address.&lt;/td&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;databases.&amp;lt;name&amp;gt;.ca_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (system root certificates)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;CA certificates (PEM) trusted when &lt;code&gt;tls = &amp;quot;verify&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;databases.&amp;lt;name&amp;gt;.pool_size&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;8&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Most connections kept to this database, at least 1.&lt;/td&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;databases.&amp;lt;name&amp;gt;.connect_timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;5000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Time limit for opening one connection, in milliseconds; must be greater than 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;databases.&amp;lt;name&amp;gt;.required_for_ready&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;boolean&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Whether &lt;code&gt;/readyz&lt;/code&gt; returns 503 when this database cannot be reached. Every 5 seconds it runs &lt;code&gt;SELECT 1&lt;/code&gt; on a dedicated connection; two failures in a row count as unreachable, and one success recovers it.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;queries&#34;&gt;queries&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09 External databases and named queries&lt;/a&gt;. Any change to &lt;code&gt;[queries]&lt;/code&gt; needs a restart.&lt;/p&gt;&#xA;&lt;h3 id=&#34;queriesname&#34;&gt;&lt;code&gt;[queries.&amp;lt;name&amp;gt;]&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;Read-only SQL that every node runs periodically in the background; the result becomes samples of the metric &lt;code&gt;rradius_query_&amp;lt;name&amp;gt;&lt;/code&gt; (gauge). &lt;code&gt;rradiusd query &amp;lt;name&amp;gt;&lt;/code&gt; also runs it.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;queries.&amp;lt;name&amp;gt;.sql&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The SQL to run. Read-only (starts with &lt;code&gt;SELECT&lt;/code&gt; or &lt;code&gt;WITH&lt;/code&gt;), with no parameters.&lt;/td&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;queries.&amp;lt;name&amp;gt;.value&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;value&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The column that holds the sample value, integer or real; rows where this column is NULL are skipped.&lt;/td&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;queries.&amp;lt;name&amp;gt;.labels&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;array (string)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Columns whose values become sample labels; the label name is the column name. They cannot be numeric columns and cannot repeat.&lt;/td&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;queries.&amp;lt;name&amp;gt;.help&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;empty string (the output uses a text that contains the query name instead)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The HELP text of the metric.&lt;/td&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;queries.&amp;lt;name&amp;gt;.interval_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;30000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Interval from the start of one run to the start of the next, in milliseconds, at least 5000.&lt;/td&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;queries.&amp;lt;name&amp;gt;.timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;5000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Longest time for one run, in milliseconds, 1 to &lt;code&gt;interval_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;&lt;code&gt;queries.&amp;lt;name&amp;gt;.max_rows&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;200&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Most rows of one run that become samples, 1 to 10000; extra rows are dropped and counted.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;radius&#34;&gt;radius&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05 RADIUS service and NAS clients&lt;/a&gt;. Tuning of &lt;code&gt;sockets&lt;/code&gt;, &lt;code&gt;recv_buffer_bytes&lt;/code&gt; and &lt;code&gt;max_*_inflight&lt;/code&gt; is in &lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;19&lt;/a&gt;; the accounting spool and the accounting log are in &lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13&lt;/a&gt;; &lt;code&gt;[radius.eap]&lt;/code&gt; is in &lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;11&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;radius-1&#34;&gt;&lt;code&gt;[radius]&lt;/code&gt;&#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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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.bind&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;IP address, or array of IP addresses&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;0.0.0.0&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Address on which the RADIUS ports listen, one or a list; as an array it needs at least one. Every address opens both the authentication and the accounting port.&lt;/td&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.auth_port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1812&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Authentication port.&lt;/td&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.acct_port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1813&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting port.&lt;/td&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.sockets&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;equal to the number of worker threads on Linux, &lt;code&gt;1&lt;/code&gt; on other platforms (depends on the machine)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Number of receiving sockets for each address and port; must be greater than 0. Only Linux can spread packets over several sockets; on other platforms it can only be 1.&lt;/td&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.recv_buffer_bytes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (system default)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;SO_RCVBUF&lt;/code&gt; of each RADIUS socket, in bytes, 4096 to 1073741824.&lt;/td&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.max_auth_inflight&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;4096&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Number of authentication requests handled at the same time; extra requests are 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;&lt;code&gt;radius.max_acct_inflight&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;4096&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Number of accounting requests handled at the same time; extra requests are 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;&lt;code&gt;radius.status_server&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;boolean&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Answer Status-Server requests (RFC 5997).&lt;/td&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.require_message_authenticator&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;yes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Whether an Access-Request must have a Message-Authenticator: &lt;code&gt;yes&lt;/code&gt;, &lt;code&gt;no&lt;/code&gt;, or &lt;code&gt;auto&lt;/code&gt; (decided by the first Access-Request from this client after startup). A client can override 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;radius.limit_proxy_state&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;yes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Drop an Access-Request that has Proxy-State but no Message-Authenticator: &lt;code&gt;yes&lt;/code&gt;, &lt;code&gt;no&lt;/code&gt; or &lt;code&gt;auto&lt;/code&gt;. A client can override 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;radius.clients&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;table array&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;RADIUS clients (NAS) that are allowed to send requests. The fields are in the next section.&lt;/td&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_timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;strong&gt;No effect in the core&lt;/strong&gt;; see &lt;a class=&#34;link&#34; href=&#34;#settings-the-core-does-not-support-or-that-have-no-effect&#34; &gt;Settings the core does not support or that have no effect&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;radius.coa_attempts&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;3&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;strong&gt;No effect in the core&lt;/strong&gt;; same as above.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;radiusclients&#34;&gt;&lt;code&gt;[[radius.clients]]&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;NAS that are allowed to send requests. One item can be one address or one network range. A change to clients (including the shared secret) takes effect on reload.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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.clients[].address&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;IP address or CIDR range of the client, for example &lt;code&gt;10.0.0.0/24&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;radius.clients[].name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;the value of &lt;code&gt;address&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Name used in logs and metrics; &lt;code&gt;log.trace.clients&lt;/code&gt; uses it 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;&lt;code&gt;radius.clients[].secret&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;conditional&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;Shared secret. Set exactly one of this and &lt;code&gt;secret_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;radius.clients[].secret_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;conditional&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;File that holds the shared secret. Set exactly one of this and &lt;code&gt;secret&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;radius.clients[].auth&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (the default chain)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Which &lt;code&gt;[auth.chains.&amp;lt;name&amp;gt;]&lt;/code&gt; this client&amp;rsquo;s logins use instead.&lt;/td&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.clients[].require_message_authenticator&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;the value of &lt;code&gt;radius.require_message_authenticator&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Overrides the &lt;code&gt;[radius]&lt;/code&gt; setting: &lt;code&gt;yes&lt;/code&gt;, &lt;code&gt;no&lt;/code&gt; or &lt;code&gt;auto&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;radius.clients[].limit_proxy_state&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;the value of &lt;code&gt;radius.limit_proxy_state&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Overrides the &lt;code&gt;[radius]&lt;/code&gt; setting: &lt;code&gt;yes&lt;/code&gt;, &lt;code&gt;no&lt;/code&gt; or &lt;code&gt;auto&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;radius.clients[].eap_methods&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;array (string)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.eap.methods&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;conditional&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;EAP methods offered to this client, in order: &lt;code&gt;tls&lt;/code&gt;, &lt;code&gt;peap&lt;/code&gt;, &lt;code&gt;ttls&lt;/code&gt;. Needs &lt;code&gt;[radius.eap]&lt;/code&gt;. When &lt;code&gt;radius.eap.methods&lt;/code&gt; has two or more methods, every client must write it; a client that does not use EAP writes &lt;code&gt;[]&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;radius.clients[].authorize_group&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;strong&gt;For TACACS+ only&lt;/strong&gt;; &lt;code&gt;check&lt;/code&gt; fails when it is written on a RADIUS client.&lt;/td&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.clients[].tls_name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;strong&gt;No effect in the core&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;radius.clients[].coa_port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;3799&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;strong&gt;No effect in the core&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;radius.clients[].coa_sender&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;boolean&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Not supported by the core&lt;/strong&gt;; &lt;code&gt;check&lt;/code&gt; fails if you write 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;radius.clients[].max_radsec_connections&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Not supported by the core&lt;/strong&gt;; &lt;code&gt;check&lt;/code&gt; fails if you write 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;radius.clients[].mfa&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Not supported by the core&lt;/strong&gt;; &lt;code&gt;check&lt;/code&gt; fails if you write it.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;For the actual behavior and the error messages of the last five keys, see &lt;a class=&#34;link&#34; href=&#34;#settings-the-core-does-not-support-or-that-have-no-effect&#34; &gt;Settings the core does not support or that have no effect&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;radiusaccounting_spool&#34;&gt;&lt;code&gt;[radius.accounting_spool]&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;When the database cannot be written, accounting requests are first written to the accounting spool on disk (a temporary store that waits for replay) and replayed in order later. Without this table, when the cluster database is briefly unavailable you can only rely on the NAS to retransmit. A change to the whole table needs a restart.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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.accounting_spool.dir&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Directory of the temporary store.&lt;/td&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.max_bytes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1073741824&lt;/code&gt; (1 GiB)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Upper limit on the size of the store, in bytes; must be greater than 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;radius.accounting_spool.replay_interval_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;5000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After a replay fails, the wait before the next replay, in milliseconds; must be greater than 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;radius.accounting_spool.replay_window&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Number of entries replayed at the same time, 1 to 1024. The default is 1, strictly in order, because a script may expect the records of one session to arrive in order.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;radiusaccounting_log&#34;&gt;&lt;code&gt;[radius.accounting_log]&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;For every accounting request answered, append one line of JSON to a local file.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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.accounting_log.file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;File to append to; its directory must already exist, and if the file exists it must be appendable. The file is reopened on &lt;code&gt;SIGHUP&lt;/code&gt;, so it works with log rotation, and you can also reload to switch to another file 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;&lt;code&gt;radius.accounting_log.queue&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;65536&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Upper limit on entries waiting to be written, 1 to 16777216; extra entries are dropped and counted.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Adding or removing the whole &lt;code&gt;[radius.accounting_log]&lt;/code&gt; needs a restart.&lt;/p&gt;&#xA;&lt;h3 id=&#34;radiuseap&#34;&gt;&lt;code&gt;[radius.eap]&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;EAP for 802.1X: the server certificate, the methods offered and the limit on unfinished conversations. The whole table takes effect on reload.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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.eap.methods&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;array (string)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[&amp;quot;tls&amp;quot;]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;EAP methods offered; the first is the method proposed at the start: &lt;code&gt;tls&lt;/code&gt;, &lt;code&gt;peap&lt;/code&gt;, &lt;code&gt;ttls&lt;/code&gt;, at least one. With &lt;code&gt;peap&lt;/code&gt; or &lt;code&gt;ttls&lt;/code&gt; you need &lt;code&gt;[auth]&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;radius.eap.cert_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Server certificate chain (PEM).&lt;/td&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.key_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Private key of the server certificate (PEM).&lt;/td&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.client_ca_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;conditional&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;The CA that issues client certificates. Required when &lt;code&gt;methods&lt;/code&gt; has &lt;code&gt;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;radius.eap.crl_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;CRL (revocation list) for client certificates; used only for &lt;code&gt;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;radius.eap.match_identity&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;boolean&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;EAP-TLS: the certificate must correspond to the user in the EAP identity.&lt;/td&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.fragment_size&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Upper limit of an EAP fragment, 256 to 1400 bytes.&lt;/td&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.session_timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;30000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;How long an unfinished EAP conversation is kept, in milliseconds; must be greater than 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;radius.eap.max_sessions&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;4096&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Number of unfinished EAP conversations kept in total.&lt;/td&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.max_sessions_per_client&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1024&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Number of unfinished EAP conversations kept for each client.&lt;/td&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.max_sessions_per_device&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;4&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Number of unfinished EAP conversations kept for each device (&lt;code&gt;Calling-Station-Id&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;radius.eap.resumption_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Not supported by the core&lt;/strong&gt;; &lt;code&gt;check&lt;/code&gt; fails if you write 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;radius.eap.shared_tickets&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;boolean&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Not supported by the core&lt;/strong&gt;; &lt;code&gt;check&lt;/code&gt; fails if you write 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;radius.eap.ticket_seal_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Not supported by the core&lt;/strong&gt;; &lt;code&gt;check&lt;/code&gt; fails if you write 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;radius.eap.previous_ticket_seal_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Not supported by the core&lt;/strong&gt;; &lt;code&gt;check&lt;/code&gt; fails if you write it.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;tacacs&#34;&gt;tacacs&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;12 TACACS+ device administration&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;tacacs-1&#34;&gt;&lt;code&gt;[tacacs]&lt;/code&gt;&#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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;tacacs.bind&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;IP address&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;0.0.0.0&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Address on which the TACACS+ port listens.&lt;/td&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.port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;49&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+ port (TCP).&lt;/td&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.max_connections&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1024&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Number of connections open at the same time; extra connections are closed immediately.&lt;/td&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.max_connections_per_source&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;64&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Number of connections open at the same time from one source address; extra connections are closed immediately.&lt;/td&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.max_body_len&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;65536&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Upper limit on the packet body, in bytes; a larger one closes the connection. Must be greater than 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;tacacs.idle_timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;300000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;restart&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;If no complete packet arrives within this time, the connection is closed, in milliseconds.&lt;/td&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.enable&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;deny&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;How enable is checked: &lt;code&gt;deny&lt;/code&gt; always rejects and does not ask for a password; &lt;code&gt;login&lt;/code&gt; treats it as a login, decided by the auth chain or 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;tacacs.authorize_groups&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;table&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;&#x9;&#x9;&lt;td&gt;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Authorize groups: a name maps to a list of &lt;code&gt;permit&lt;/code&gt;/&lt;code&gt;deny&lt;/code&gt; rules, used to authorize commands and services. See the next section.&lt;/td&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.clients&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;table array&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;TACACS+ clients (devices) that are allowed to connect. The fields are below.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;tacacsauthorize_groups&#34;&gt;&lt;code&gt;[tacacs.authorize_groups]&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;Each key is the name of an authorize group, and the value is an array of rule strings, for 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:#75715e&#34;&gt;# conf.d/tacacs.toml&lt;/span&gt;&#xA;&lt;/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;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;ops&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;permit service=shell&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;address&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.0.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;   &lt;span style=&#34;color:#75715e&#34;&gt;# openssl rand -hex 32 &amp;gt; tacacs.secret&lt;/span&gt;&#xA;&lt;/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;ops&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 TACACS+ client selects a group with &lt;code&gt;authorize_group = &amp;quot;ops&amp;quot;&lt;/code&gt;. If &lt;code&gt;[tacacs]&lt;/code&gt; is present there must be at least one &lt;code&gt;[[tacacs.clients]]&lt;/code&gt;, or &lt;code&gt;check&lt;/code&gt; fails: &lt;code&gt;[tacacs] is enabled but has no [[tacacs.clients]] entries&lt;/code&gt;. If you write a group name that does not exist, &lt;code&gt;check&lt;/code&gt; fails. The syntax of the rules is in &lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;12&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;tacacsclients&#34;&gt;&lt;code&gt;[[tacacs.clients]]&lt;/code&gt;&#xA;&lt;/h3&gt;&lt;p&gt;The fields of a TACACS+ client share one definition with &lt;code&gt;[[radius.clients]]&lt;/code&gt;, so the schema lists the same 14 keys; but on a TACACS+ client only the first six are useful, and writing any of the others makes &lt;code&gt;check&lt;/code&gt; fail.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;reload&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;tacacs.clients[].address&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&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;yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;IP address or CIDR range of the 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;tacacs.clients[].name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;the value of &lt;code&gt;address&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Name used in logs and metrics.&lt;/td&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.clients[].secret&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;conditional&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;Shared secret. Set exactly one of this and &lt;code&gt;secret_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;tacacs.clients[].secret_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;path&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;conditional&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;File that holds the shared secret. Set exactly one of this and &lt;code&gt;secret&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.clients[].auth&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;— (the default chain)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Which &lt;code&gt;[auth.chains.&amp;lt;name&amp;gt;]&lt;/code&gt; this device&amp;rsquo;s logins use instead.&lt;/td&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.clients[].authorize_group&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&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;Which group in &lt;code&gt;tacacs.authorize_groups&lt;/code&gt; supplies the rules that authorize this 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;tacacs.clients[].require_message_authenticator&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;RADIUS only&lt;/strong&gt;: &lt;code&gt;check&lt;/code&gt; 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;tacacs.clients[].limit_proxy_state&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;RADIUS only&lt;/strong&gt;: &lt;code&gt;check&lt;/code&gt; 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;tacacs.clients[].eap_methods&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;array (string)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;RADIUS only&lt;/strong&gt;: &lt;code&gt;check&lt;/code&gt; 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;tacacs.clients[].coa_port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;RADIUS only&lt;/strong&gt;: &lt;code&gt;check&lt;/code&gt; 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;tacacs.clients[].coa_sender&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;boolean&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;RADIUS only&lt;/strong&gt;: &lt;code&gt;check&lt;/code&gt; 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;tacacs.clients[].max_radsec_connections&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;RADIUS only&lt;/strong&gt;: &lt;code&gt;check&lt;/code&gt; 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;tacacs.clients[].tls_name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Not supported by the core&lt;/strong&gt;: &lt;code&gt;check&lt;/code&gt; 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;tacacs.clients[].mfa&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;strong&gt;Not supported by the core&lt;/strong&gt;: &lt;code&gt;check&lt;/code&gt; fails.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;settings-the-core-does-not-support-or-that-have-no-effect&#34;&gt;Settings the core does not support or that have no effect&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;rradiusd&lt;/code&gt; and the enterprise edition share the same configuration reader, so some keys appear in the &lt;code&gt;schema&lt;/code&gt; of the core but are either rejected or have no effect in the core. The results below were measured one by one with &lt;code&gt;rradiusd check&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;keys-that-are-rejected-when-written&#34;&gt;Keys that are rejected when written&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;check&lt;/code&gt; exits with code 2 and the messages are as follows (&lt;code&gt;&amp;lt;file&amp;gt;&lt;/code&gt; is the path of the configuration file and &lt;code&gt;&amp;lt;name&amp;gt;&lt;/code&gt; is the client name):&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Message of &lt;code&gt;check&lt;/code&gt;&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.clients[].coa_sender&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;lt;file&amp;gt;: radius client &#39;&amp;lt;name&amp;gt;&#39;: coa_sender needs RadSec, which needs rradius-enterprise&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;radius.clients[].max_radsec_connections&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;lt;file&amp;gt;: radius client &#39;&amp;lt;name&amp;gt;&#39;: max_radsec_connections applies only to RadSec, which needs rradius-enterprise&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;radius.clients[].mfa&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;lt;file&amp;gt;: radius client &#39;&amp;lt;name&amp;gt;&#39;: mfa needs rradius-enterprise&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;radius.clients[].authorize_group&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;lt;file&amp;gt;: radius client &#39;&amp;lt;name&amp;gt;&#39;: authorize_group applies only to 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;&lt;code&gt;radius.eap.resumption_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;lt;file&amp;gt;: radius.eap.resumption_ms: not supported by this program (session resumption needs rradius-enterprise)&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;radius.eap.shared_tickets&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;lt;file&amp;gt;: radius.eap.shared_tickets: not supported by this program (session resumption needs rradius-enterprise)&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;radius.eap.ticket_seal_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;lt;file&amp;gt;: radius.eap.ticket_seal_file: not supported by this program (session resumption needs rradius-enterprise)&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;radius.eap.previous_ticket_seal_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;lt;file&amp;gt;: radius.eap.previous_ticket_seal_file: not supported by this program (session resumption needs rradius-enterprise)&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.clients[].tls_name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;lt;file&amp;gt;: tacacs client &#39;&amp;lt;name&amp;gt;&#39;: tls_name needs [tacacs.tls]&lt;/code&gt; (and &lt;code&gt;[tacacs.tls]&lt;/code&gt; is also rejected in the core, 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;&lt;code&gt;tacacs.clients[].mfa&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;lt;file&amp;gt;: tacacs client &#39;&amp;lt;name&amp;gt;&#39;: mfa needs rradius-enterprise&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.clients[].require_message_authenticator&lt;/code&gt;, &lt;code&gt;limit_proxy_state&lt;/code&gt;, &lt;code&gt;eap_methods&lt;/code&gt;, &lt;code&gt;coa_port&lt;/code&gt;, &lt;code&gt;coa_sender&lt;/code&gt;, &lt;code&gt;max_radsec_connections&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&amp;lt;file&amp;gt;: tacacs client &#39;&amp;lt;name&amp;gt;&#39;: &amp;lt;key&amp;gt; applies only to RADIUS clients&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;EAP methods are the same. When &lt;code&gt;radius.eap.methods&lt;/code&gt; contains &lt;code&gt;aka-prime&lt;/code&gt;, the message is &lt;code&gt;radius.eap.methods: aka-prime is not supported by this program (EAP-AKA&#39; needs rradius-enterprise)&lt;/code&gt;; when a client&amp;rsquo;s &lt;code&gt;eap_methods&lt;/code&gt; contains &lt;code&gt;aka-prime&lt;/code&gt;, it is &lt;code&gt;radius client &#39;&amp;lt;name&amp;gt;&#39;: eap_methods: aka-prime is not supported by this program (EAP-AKA&#39; needs rradius-enterprise)&lt;/code&gt;. When you write &lt;code&gt;sim&lt;/code&gt;, both places give &lt;code&gt;&#39;sim&#39; is not a method this server offers; it has tls, peap and ttls&lt;/code&gt; (the client one has &lt;code&gt;radius client &#39;&amp;lt;name&amp;gt;&#39;: eap_methods: &lt;/code&gt; in front in the same way).&lt;/p&gt;&#xA;&lt;h3 id=&#34;keys-that-are-accepted-but-have-no-effect&#34;&gt;Keys that are accepted but have no effect&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;check&lt;/code&gt; accepts these keys and gives no warning, but the core program never uses them. The core manual does not use them.&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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.clients[].tls_name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The name that the enterprise RadSec matches against the client certificate. The core has no RadSec. Written together with &lt;code&gt;address&lt;/code&gt; it is accepted but not used; written alone without &lt;code&gt;address&lt;/code&gt;, &lt;code&gt;check&lt;/code&gt; fails: &lt;code&gt;radius client &#39;&amp;lt;name&amp;gt;&#39; has no address, so it can only use RadSec, which needs rradius-enterprise&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;radius.clients[].coa_port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The port the enterprise edition uses when it sends CoA and Disconnect to this client (default 3799). The core does not send CoA.&lt;/td&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_timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How long the enterprise edition waits for a reply to each CoA or Disconnect (default 1000 ms).&lt;/td&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_attempts&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How many times the enterprise edition tries a CoA or Disconnect, including the first (default 3).&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;sections-rejected-by-the-core-not-in-the-core-schema&#34;&gt;Sections rejected by the core (not in the core schema)&#xA;&lt;/h3&gt;&lt;p&gt;These sections and keys are not in the output of &lt;code&gt;rradiusd schema&lt;/code&gt;; they belong to the enterprise edition. When the core reads them, &lt;code&gt;check&lt;/code&gt; exits with code 2, and the message has the form &lt;code&gt;&amp;lt;section&amp;gt;: not supported by this program (&amp;lt;feature&amp;gt; needs rradius-enterprise)&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;Section or key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description in parentheses&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;[proxy]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;proxying needs rradius-enterprise&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;[mfa]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;two-factor login needs rradius-enterprise&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;[diameter]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Diameter needs rradius-enterprise&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;[accounting_export]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accounting export needs rradius-enterprise&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;[cluster.backup]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;backups need rradius-enterprise&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;[radius.tls]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;RadSec needs rradius-enterprise&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;[radius.coa]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;CoA needs rradius-enterprise&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;[radius.dynamic_clients]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;dynamic clients need rradius-enterprise&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;[radius.dpsk]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;DPSK needs rradius-enterprise&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;[radius.eap.aka]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;EAP-AKA&#39; needs rradius-enterprise&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;[accounts.aka]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;EAP-AKA&#39; needs rradius-enterprise&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;[accounts.dpsk]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;DPSK needs rradius-enterprise&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;[accounts.clients]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;dynamic clients need rradius-enterprise&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.tls]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;TACACS+ over TLS needs rradius-enterprise&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;radius.eap.ocsp&lt;/code&gt;, &lt;code&gt;radius.eap.ocsp_url&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;OCSP needs rradius-enterprise&lt;/code&gt; (&lt;code&gt;methods&lt;/code&gt; must have &lt;code&gt;tls&lt;/code&gt;; without &lt;code&gt;tls&lt;/code&gt; you get &lt;code&gt;radius.eap.ocsp only applies to tls, which methods does not have&lt;/code&gt; first)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;An actual line looks like this:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: proxy: not supported by this program (proxying needs rradius-enterprise)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;A mistyped key name.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Symptom: &lt;code&gt;check&lt;/code&gt; exits with code 2, for example (in &lt;code&gt;[metrics]&lt;/code&gt;, &lt;code&gt;port&lt;/code&gt; mistyped as &lt;code&gt;prot&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: line 15: `prot`: unknown field `prot`, expected `bind` or `port`&#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;Cause: every table rejects unknown keys.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Fix: correct it using the line number and the key names in the message, and compare with the tables in this appendix.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;A value that is not an allowed option.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Symptom: for example &lt;code&gt;auth.policy = &amp;quot;any&amp;quot;&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius.toml: line 31: `policy`: unknown variant, expected `first_match` or `all_accept`&#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;Fix: change it to one of the values the message lists.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;An included file declares a table that the main file already has.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Symptom: &lt;code&gt;rradius.toml: line 413: duplicate key&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Cause: the file in &lt;code&gt;include&lt;/code&gt; is treated as appended to the main file, and the same table cannot be declared twice.&lt;/li&gt;&#xA;&lt;li&gt;Fix: move the settings into the table already in the main file, or delete that table from the main file and keep it only in the included file.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;A required section or secret is missing.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;the [lua] section is required&lt;/code&gt;, &lt;code&gt;the [cluster] section is required&lt;/code&gt;: add that section; see &lt;a class=&#34;link&#34; href=&#34;#lua&#34; &gt;lua&lt;/a&gt; and &lt;a class=&#34;link&#34; href=&#34;#cluster&#34; &gt;cluster&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;at least one of [radius] or [tacacs] must be configured&lt;/code&gt;: you need at least one of them.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;exactly one of cluster.secret_api or cluster.secret_api_file must be set&lt;/code&gt;: write exactly one of the two keys.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;radius client &#39;127.0.0.1&#39;: exactly one of secret or secret_file must be set&lt;/code&gt;: write exactly one of &lt;code&gt;secret&lt;/code&gt; and &lt;code&gt;secret_file&lt;/code&gt; on the client.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;radius client &#39;&#39;: address is required, or tls_name for a client without a fixed address&lt;/code&gt;: add &lt;code&gt;address&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;An EAP condition is not met.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;radius.eap.cert_file is required&lt;/code&gt;: &lt;code&gt;[radius.eap]&lt;/code&gt; must have &lt;code&gt;cert_file&lt;/code&gt; and &lt;code&gt;key_file&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;radius.eap.client_ca_file is required&lt;/code&gt;: when &lt;code&gt;methods&lt;/code&gt; has &lt;code&gt;tls&lt;/code&gt;, you need &lt;code&gt;client_ca_file&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;radius.eap.methods has a method whose password only a chain can check, and there is no [auth] section&lt;/code&gt;: with &lt;code&gt;peap&lt;/code&gt; or &lt;code&gt;ttls&lt;/code&gt; you need &lt;code&gt;[auth]&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;radius client &#39;example&#39;: eap_methods is required when radius.eap.methods has more than one method; [] for a client without EAP&lt;/code&gt;: write &lt;code&gt;eap_methods&lt;/code&gt; on every client.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;radius client &#39;example&#39;: eap_methods needs [radius.eap]&lt;/code&gt;: set up &lt;code&gt;[radius.eap]&lt;/code&gt; first.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;A warning that the cluster ports listen on all interfaces.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Symptom: &lt;code&gt;check&lt;/code&gt; and &lt;code&gt;serve&lt;/code&gt; print &lt;code&gt;WARN rradius_core::config: cluster.listen is not set, so the cluster&#39;s Raft and API ports are on all interfaces, with nothing but their shared secrets to protect them; …&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Cause: when you have &lt;code&gt;[[cluster.nodes]]&lt;/code&gt; and do not write &lt;code&gt;cluster.listen&lt;/code&gt;, it listens on &lt;code&gt;0.0.0.0&lt;/code&gt; by default.&lt;/li&gt;&#xA;&lt;li&gt;Fix: set &lt;code&gt;cluster.listen&lt;/code&gt; to a private address of this node; if you do want all interfaces, write &lt;code&gt;&amp;quot;0.0.0.0&amp;quot;&lt;/code&gt; and the warning goes away. See &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16&lt;/a&gt; and &lt;a class=&#34;link&#34; href=&#34;../20-security/&#34; &gt;20&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;You changed the configuration and it did not take effect after reload.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Symptom: the log has a message such as &lt;code&gt;configuration reloaded from …; these need a restart to apply: [cluster], radius.auth_port&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Cause: the listed keys have &amp;ldquo;restart&amp;rdquo; in the reload column of this appendix.&lt;/li&gt;&#xA;&lt;li&gt;Fix: schedule a restart. Until then these keys keep the values they had at startup, and every later reload lists them again.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Enterprise settings put into the core.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Symptom: &lt;code&gt;… not supported by this program (… needs rradius-enterprise)&lt;/code&gt;, exit code 2.&lt;/li&gt;&#xA;&lt;li&gt;Fix: see &lt;a class=&#34;link&#34; href=&#34;#settings-the-core-does-not-support-or-that-have-no-effect&#34; &gt;Settings the core does not support or that have no effect&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04 Configuration file basics&lt;/a&gt;: structure of the configuration file, &lt;code&gt;include&lt;/code&gt;, &lt;code&gt;check&lt;/code&gt;, &lt;code&gt;config show&lt;/code&gt;, &lt;code&gt;config diff&lt;/code&gt;, reload&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05 RADIUS service and NAS clients&lt;/a&gt;: &lt;code&gt;[radius]&lt;/code&gt; and &lt;code&gt;[[radius.clients]]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;06 Dictionary and attributes&lt;/a&gt;: &lt;code&gt;dictionary&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;: &lt;code&gt;[auth]&lt;/code&gt;, &lt;code&gt;[accounts]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;08 LDAP and Active Directory&lt;/a&gt;: ldap and netlogon handlers&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09 External databases and named queries&lt;/a&gt;: &lt;code&gt;[databases]&lt;/code&gt;, &lt;code&gt;[queries]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;10 Writing policies in Lua&lt;/a&gt;: &lt;code&gt;[lua]&lt;/code&gt;, &lt;code&gt;[lua.http]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;11 802.1X and EAP&lt;/a&gt;: &lt;code&gt;[radius.eap]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;12 TACACS+ device administration&lt;/a&gt;: &lt;code&gt;[tacacs]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13 Accounting and sessions&lt;/a&gt;: accounting spool, accounting log, &lt;code&gt;[sessions]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16 Clusters and high availability&lt;/a&gt;: &lt;code&gt;[cluster]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;: &lt;code&gt;[metrics]&lt;/code&gt;, &lt;code&gt;[log]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;19 Performance tuning and load testing&lt;/a&gt;: &lt;code&gt;[runtime]&lt;/code&gt;, &lt;code&gt;radius.sockets&lt;/code&gt; and so on&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../91-command-reference/&#34; &gt;91 Appendix B: Command reference&lt;/a&gt;: the &lt;code&gt;check&lt;/code&gt;, &lt;code&gt;config&lt;/code&gt;, &lt;code&gt;schema&lt;/code&gt; and other commands&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>91 Appendix B: Command reference</title>
            <link>https://embark.systems/en/rradius/oss/91-command-reference/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/91-command-reference/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Look up the syntax, flags, output and exit codes of every &lt;code&gt;rradiusd&lt;/code&gt; subcommand&lt;/li&gt;&#xA;&lt;li&gt;Look up every flag and default of &lt;code&gt;rradius-bench run&lt;/code&gt; and &lt;code&gt;calibrate&lt;/code&gt;, and every kind of &lt;code&gt;--load&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Judge the result by exit code in a script&lt;/li&gt;&#xA;&lt;li&gt;Recognize the commands that exist only in the enterprise edition, and know how the core reacts to them&lt;/li&gt;&#xA;&lt;li&gt;Compare this reference with the output of &lt;code&gt;help&lt;/code&gt; after the program is updated&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: you have read &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&gt; and can start the quick-start scenario.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#how-to-read-this-reference&#34; &gt;How to read this reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#environment-used-for-verification&#34; &gt;Environment used for verification&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#command-overview&#34; &gt;Command overview&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#exit-code-summary&#34; &gt;Exit code summary&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#serve&#34; &gt;serve&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#check&#34; &gt;check&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#help---version&#34; &gt;help, &amp;ndash;version&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#schema&#34; &gt;schema&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#config&#34; &gt;config&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#tuning&#34; &gt;tuning&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#status&#34; &gt;status&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#user&#34; &gt;user&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#session&#34; &gt;session&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#query&#34; &gt;query&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#cluster&#34; &gt;cluster&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#old-flag-syntax&#34; &gt;Old flag syntax&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#enterprise-only-commands&#34; &gt;Enterprise-only commands&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#rradius-bench-run&#34; &gt;rradius-bench run&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#--load-syntax&#34; &gt;&amp;ndash;load syntax&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#run-output-and-exit-codes&#34; &gt;run output and exit codes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#rradius-bench-calibrate&#34; &gt;rradius-bench calibrate&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#comparison-method&#34; &gt;Comparison method&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;how-to-read-this-reference&#34;&gt;How to read this reference&#xA;&lt;/h2&gt;&lt;p&gt;The content of this appendix comes from measured output of two executables, checked against the command-line parsing code:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;rradiusd&lt;/code&gt;: &lt;code&gt;rradius-core/src/cli.rs&lt;/code&gt;, and the &lt;code&gt;status.rs&lt;/code&gt;, &lt;code&gt;config_tools.rs&lt;/code&gt;, &lt;code&gt;tuning.rs&lt;/code&gt;, &lt;code&gt;accounts.rs&lt;/code&gt;, &lt;code&gt;sessions.rs&lt;/code&gt;, &lt;code&gt;query_command.rs&lt;/code&gt;, &lt;code&gt;cluster_commands.rs&lt;/code&gt; and &lt;code&gt;admin.rs&lt;/code&gt; of the subcommands&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;rradius-bench&lt;/code&gt;: &lt;code&gt;rradius-bench/src/cli.rs&lt;/code&gt;, &lt;code&gt;main.rs&lt;/code&gt;, &lt;code&gt;run.rs&lt;/code&gt;, &lt;code&gt;report.rs&lt;/code&gt;, &lt;code&gt;calibrate.rs&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Every command in this appendix was actually run. The output in the examples is copied as it was, except that machine-specific paths are shortened to &lt;code&gt;…&lt;/code&gt;. A few exit-code paths were checked only against the code; they are listed under the &lt;a class=&#34;link&#34; href=&#34;#exit-code-summary&#34; &gt;Exit code summary&lt;/a&gt;. Numbers such as rates and latencies differ from machine to machine; do not use them as performance references.&lt;/p&gt;&#xA;&lt;p&gt;Rules that all commands share:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;code&gt;--config &amp;lt;path&amp;gt;&lt;/code&gt;:&lt;/strong&gt; when it is not given, the command reads &lt;code&gt;/etc/rradius/rradius.toml&lt;/code&gt;. The actual default path is decided at build time; the second line of &lt;code&gt;rradiusd --version&lt;/code&gt; prints it. When the default configuration file cannot be read, the message has one more line, &lt;code&gt;(the default configuration; give --config &amp;lt;path&amp;gt; for another)&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Position of flags:&lt;/strong&gt; the flags of &lt;code&gt;status&lt;/code&gt;, &lt;code&gt;user&lt;/code&gt;, &lt;code&gt;session&lt;/code&gt; and &lt;code&gt;cluster&lt;/code&gt; can be placed anywhere after the subcommand; &lt;code&gt;user show --config a.toml dave&lt;/code&gt; and &lt;code&gt;user show dave --config a.toml&lt;/code&gt; are the same. The other commands need the order shown in the usage: for example &lt;code&gt;config --config a.toml show&lt;/code&gt; and &lt;code&gt;query --json list&lt;/code&gt; are usage errors. Giving the same flag twice is also a usage error.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Output:&lt;/strong&gt; results go to standard output; errors and usage text go to standard error. Administration commands write only &lt;code&gt;WARN&lt;/code&gt; and above of the log to standard error, so &lt;code&gt;check&lt;/code&gt; prints warnings such as secret file permissions.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Subcommands have no &lt;code&gt;--help&lt;/code&gt; of their own.&lt;/strong&gt; When the arguments are wrong, the command prints its own usage and exits with code 2; use &lt;code&gt;rradiusd help&lt;/code&gt; for the full usage list.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;environment-used-for-verification&#34;&gt;Environment used for verification&#xA;&lt;/h2&gt;&lt;p&gt;The examples were all run in a copy of the quick-start scenario. So that one configuration can exercise EAP, TACACS+ and named queries, the copy makes these changes beyond quick-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-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# rradius.toml (only the parts that differ from quick-start)&lt;/span&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;# … (other settings omitted)&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;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;data_dir&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;data&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_raft_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;raft.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;secret_api_file&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;api.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;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;listen&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;127.0.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;&#xA;&lt;/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;127.0.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;127.0.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;&#xA;&lt;/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;]&#xA;&lt;/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;127.0.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;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;status_server&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;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;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ttls&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;localhost&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;127.0.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;localhost.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;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ttls&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;]&#xA;&lt;/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;127.0.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;port&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;4949&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;localhost&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;127.0.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;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;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;metrics&lt;/span&gt;]&#xA;&lt;/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;127.0.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;port&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;9812&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;queries&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;enabled_users&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;help&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Accounts that can log 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;sql&lt;/span&gt; = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;SELECT enabled, COUNT(*) AS value FROM users GROUP BY enabled&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;labels&lt;/span&gt; = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;enabled&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;interval_ms&lt;/span&gt; = &lt;span style=&#34;color:#ae81ff&#34;&gt;60000&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;Ports use the defaults: RADIUS 1812 and 1813, metrics 9812, cluster 8100 and 8200. TACACS+ uses 4949, as in &lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;12 TACACS+ device administration&lt;/a&gt;, because the standard port 49 is below 1024 and an ordinary account cannot listen on it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;[accounts]&lt;/code&gt; is the same as the one added in &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The certificates were generated into this directory with the &lt;code&gt;setup.sh&lt;/code&gt; of the wifi-certs scenario: &lt;code&gt;sh &amp;lt;repo&amp;gt;/rradius-server/examples/scenarios/wifi-certs/setup.sh .&lt;/code&gt;. The name of the server certificate is &lt;code&gt;radius.corp.example.com&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;tacacs.secret&lt;/code&gt;, like the other &lt;code&gt;.secret&lt;/code&gt; files, was generated with &lt;code&gt;openssl rand -hex 32&lt;/code&gt; and has permissions 0600.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This configuration passes &lt;code&gt;check&lt;/code&gt;; for the meaning of each section, see &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;command-overview&#34;&gt;Command overview&#xA;&lt;/h2&gt;&lt;p&gt;The &lt;code&gt;rradiusd&lt;/code&gt; commands, in the order of &lt;code&gt;rradiusd help&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;Command&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What it does&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Server must be running&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Main 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;code&gt;serve&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Starts the server and runs until it receives a stop signal&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03&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;check&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Checks the configuration without opening any port&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;&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04&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;status&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reads the metrics port and condenses it into one page&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Yes (reads &lt;code&gt;[metrics]&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#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;&lt;code&gt;--version&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Prints the version and the default configuration path&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;This chapter&lt;/td&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;schema&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Prints the JSON Schema of the configuration file&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;&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04&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;config show&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Prints the full configuration with defaults filled in&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;&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04&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;config diff&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Compares two configurations&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;&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04&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;config init&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Generates a configuration draft&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;&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04&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;tuning&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Gives system tuning advice for this machine and configuration&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;&lt;a class=&#34;link&#34; href=&#34;../19-performance/&#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;&lt;code&gt;user add&lt;/code&gt;, &lt;code&gt;user passwd&lt;/code&gt;, &lt;code&gt;user enable&lt;/code&gt;, &lt;code&gt;user disable&lt;/code&gt;, &lt;code&gt;user delete&lt;/code&gt;, &lt;code&gt;user show&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Manages accounts with the SQL in &lt;code&gt;[accounts]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Yes (cluster API port)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07&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;session list&lt;/code&gt;, &lt;code&gt;session show&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Lists online sessions with the SQL in &lt;code&gt;[sessions]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Yes (cluster API port)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#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;&lt;code&gt;accounting find&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Looks up, from the accounting log file, who held a public address and port at a given time&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No (reads files only)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#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;&lt;code&gt;query list&lt;/code&gt;, &lt;code&gt;query &amp;lt;name&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Lists or runs &lt;code&gt;[queries.&amp;lt;name&amp;gt;]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;list&lt;/code&gt; no; running yes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09&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;cluster members&lt;/code&gt;, &lt;code&gt;remove&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Lists the cluster members, removes a node&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Yes (cluster API port)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#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;&lt;code&gt;help&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Prints the usage of all commands&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;This chapter&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;rradius-bench&lt;/code&gt; commands:&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;What it does&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Main 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;code&gt;run&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Sends load to a server and reports rate and latency; with &lt;code&gt;--requests 1&lt;/code&gt; it also works as a login test&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../19-performance/&#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;&lt;code&gt;calibrate&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Sends load to a responder inside its own process, to measure the limit of this tool on this machine&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../19-performance/&#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;&lt;code&gt;help&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Prints the command list, or the help of one command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;This chapter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;exit-code-summary&#34;&gt;Exit code summary&#xA;&lt;/h2&gt;&lt;p&gt;The convention of &lt;code&gt;rradiusd&lt;/code&gt; is: 0 for success, 2 for a usage or configuration error. Other values depend on the command:&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;0&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;1&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;2&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;3&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;serve&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Stopped normally after SIGTERM or SIGINT, including a stop requested during startup&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Cannot serve after starting: the RADIUS port cannot be listened on, a cluster error aborted a migration, there is no leader and &lt;code&gt;stop_without_leader_ms&lt;/code&gt; is set, the Raft core stopped&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Error in the configuration, dictionary or script, a migration file breaks the rules or its SQL fails, the cluster node cannot start (&lt;code&gt;cannot start cluster node …&lt;/code&gt;), wrong arguments&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;&lt;code&gt;check&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;configuration ok&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Error in the configuration&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;&lt;code&gt;help&lt;/code&gt;, &lt;code&gt;--version&lt;/code&gt;, no arguments&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Prints the result&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Unknown command&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;&lt;code&gt;schema&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Prints the schema&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Writing failed, for example the pipe was closed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wrong arguments&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;&lt;code&gt;config show&lt;/code&gt;, &lt;code&gt;init&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Prints the result&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wrong arguments or error in the configuration&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;&lt;code&gt;config diff&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No differences, or only node-specific differences&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;There are differences&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wrong arguments or error in a configuration&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;&lt;code&gt;tuning&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Prints the advice, including when the default configuration file cannot be read and when the platform has no advice&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wrong arguments, the file given to &lt;code&gt;--config&lt;/code&gt; cannot be read&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;&lt;code&gt;status&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Prints the result; &lt;code&gt;--watch&lt;/code&gt; ended by SIGINT or SIGTERM&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wrong arguments, no &lt;code&gt;[metrics]&lt;/code&gt;, the configuration cannot be read, the cluster members cannot be asked&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The metrics port cannot be read; with &lt;code&gt;--cluster&lt;/code&gt;, no member can be read&lt;/td&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;user&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Success&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No matching account, SQL failed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wrong arguments or error in the configuration, &lt;code&gt;[accounts]&lt;/code&gt; lacks this action, empty password or the two passwords differ&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The cluster cannot be reached, or did not answer within 30 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;session&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;There is data&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;There are no sessions&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wrong arguments or error in the configuration, &lt;code&gt;[sessions]&lt;/code&gt; lacks this action, SQL failed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same as &lt;code&gt;user&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;query&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Success, including no queries and no rows&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wrong arguments or error in the configuration, &lt;code&gt;queries.&amp;lt;name&amp;gt;&lt;/code&gt; is not set, SQL failed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same as &lt;code&gt;user&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;cluster&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Success&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;remove&lt;/code&gt;: the node is not in the cluster, the leader refused, the leader changed twice in a row&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wrong arguments or error in the configuration, wrong API secret, the node to remove still answers, only one or two voters would remain without &lt;code&gt;--force&lt;/code&gt;, the last voter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;No answer within 30 seconds; &lt;code&gt;remove&lt;/code&gt; got no response after it was sent&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Enterprise commands&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Always 2&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;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; these cells of the table were checked only against the code and not reproduced: the 0 of &lt;code&gt;serve&lt;/code&gt; stopped during startup; the 1 of &lt;code&gt;serve&lt;/code&gt; for a cluster error aborting a migration, &lt;code&gt;stop_without_leader_ms&lt;/code&gt; and the Raft core stopping; the 2 of &lt;code&gt;serve&lt;/code&gt; when the cluster node cannot start; the 0 of &lt;code&gt;tuning&lt;/code&gt; on a platform without advice; the 2 of &lt;code&gt;status --cluster&lt;/code&gt; when the members cannot be asked; the 2 of &lt;code&gt;query&lt;/code&gt; for an SQL failure and the 0 of &lt;code&gt;query list&lt;/code&gt; when there are no queries; the 2 of &lt;code&gt;user&lt;/code&gt; for two different passwords; and every cell of &lt;code&gt;cluster&lt;/code&gt; that needs several nodes (see &lt;a class=&#34;link&#34; href=&#34;#cluster&#34; &gt;cluster&lt;/a&gt;). All other cells were tested.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;code&gt;rradius-bench&lt;/code&gt; has a separate set, see &lt;a class=&#34;link&#34; href=&#34;#run-output-and-exit-codes&#34; &gt;run output and exit codes&lt;/a&gt;: 0 all Accept, 1 some Reject or Challenge, 2 some timeouts, invalid responses or socket errors, 3 wrong arguments or could not start.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; for the same &amp;ldquo;nothing found&amp;rdquo; case, the exit code of &lt;code&gt;session&lt;/code&gt; is 1 but that of &lt;code&gt;query&lt;/code&gt; is 0 (it prints &lt;code&gt;no rows&lt;/code&gt;). To tell in a script whether &lt;code&gt;query&lt;/code&gt; returned data, look at the output, not the exit code.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;serve&#34;&gt;serve&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd serve [--config &amp;lt;path&amp;gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Starts the server: reads the configuration, starts the cluster node, applies migrations, opens the RADIUS, TACACS+ and metrics ports, and then keeps running. For the startup sequence and the log, see &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;While it runs, you can send these signals:&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;Signal&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;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;SIGHUP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reloads the configuration. Log: &lt;code&gt;configuration reloaded from rradius.toml&lt;/code&gt;; keys that take effect only after a restart are listed with it. A SIGHUP received during startup is handled after the server starts serving&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SIGTERM, SIGINT (Ctrl+C)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Stops: &lt;code&gt;/readyz&lt;/code&gt; answers 503 first, no new requests are accepted, requests in progress are awaited for at most the time set in &lt;code&gt;[shutdown]&lt;/code&gt;, then the database is 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;Another SIGTERM or SIGINT during the stop&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Stops waiting for requests in progress&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd serve --config rradius.toml&#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;… INFO rradius_core::cli: Servers started. Press Ctrl+C to stop.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::radius: RADIUS Server listening on 127.0.0.1:1812 and 127.0.0.1:1813&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::metrics: Metrics listening on 127.0.0.1:9812&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::tacacs: TACACS+ Server listening on 127.0.0.1:4949&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Examples of exit codes (all tested):&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd serve --config bindfail.toml      &lt;span style=&#34;color:#75715e&#34;&gt;# the RADIUS port is held by another process&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;RADIUS server error: cannot listen on 127.0.0.1:1812: Address already in use (os error 48)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd serve --config badmig.toml        &lt;span style=&#34;color:#75715e&#34;&gt;# the SQL in a migration file is wrong&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;migration file &amp;#39;1_bad.sql&amp;#39; could not be applied: Sqlite: near &amp;#34;TABL&amp;#34;: syntax error in CREATE TABL oops (x);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; at offset 7&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd serve --config rradius.toml extra&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd serve [--config &amp;lt;path&amp;gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;When the port is in use, the cluster node has already started, and the server closes the database cleanly before it exits, so the exit code is 1, not 2. The number of the error code depends on the operating system.&lt;/li&gt;&#xA;&lt;li&gt;A normal stop has exit code 0 (tested: after sending SIGTERM, &lt;code&gt;wait&lt;/code&gt; returns 0).&lt;/li&gt;&#xA;&lt;li&gt;When the Raft core stops, the log says &lt;code&gt;its Raft core stopped (…); exiting so that a restart recovers it&lt;/code&gt; and the exit code is 1, leaving systemd or the container runtime to restart it. This case was not reproduced.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;check&#34;&gt;check&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd check [--config &amp;lt;path&amp;gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Does the checks that startup does, but opens no port, creates no data directory and connects to nothing: it reads the configuration file and the files named by &lt;code&gt;include&lt;/code&gt;, the dictionary, compiles the Lua script, checks the file names in the migrations directory, the auth chain, &lt;code&gt;[lua.http]&lt;/code&gt; and the accounting spool directory, and finally prints warnings such as a shared secret that is too short.&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;configuration ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd check --config ent.toml           &lt;span style=&#34;color:#75715e&#34;&gt;# has a [proxy] that the core does not support&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ent.toml: proxy: not supported by this program (proxying needs rradius-enterprise)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;On success it prints &lt;code&gt;configuration ok&lt;/code&gt; (standard output) and exits with 0; on an error it prints the reason (standard error) and exits with 2.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;check&lt;/code&gt; checks only the &lt;strong&gt;file names&lt;/strong&gt; of migration files; it does not run the SQL. The syntax error in &lt;code&gt;1_bad.sql&lt;/code&gt; in the previous section passes &lt;code&gt;check&lt;/code&gt;; only &lt;code&gt;serve&lt;/code&gt; finds it.&lt;/li&gt;&#xA;&lt;li&gt;An extra argument after &lt;code&gt;check&lt;/code&gt;, for example &lt;code&gt;check --config a.toml extra&lt;/code&gt;, prints &lt;code&gt;usage: rradiusd check [--config &amp;lt;path&amp;gt;]&lt;/code&gt; and exits with 2.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;help-version&#34;&gt;help, &amp;ndash;version&#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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd --version&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd 0.1.0 (community)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;default config: /etc/rradius/rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd help&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd serve [--config &amp;lt;path&amp;gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd check [--config &amp;lt;path&amp;gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd status [--config &amp;lt;path&amp;gt;] [--cluster] [--watch | --json | --tui]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd --version&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd schema [--lang en|zh-TW]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd config show [--config &amp;lt;path&amp;gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd config diff &amp;lt;a.toml&amp;gt; &amp;lt;b.toml&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd config init [--full] [--lang en|zh-TW]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd tuning [--config &amp;lt;path&amp;gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd user add|passwd|enable|disable|delete|show [--config &amp;lt;path&amp;gt;] &amp;lt;name&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  add and passwd read the password from standard input&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd session list [--config &amp;lt;path&amp;gt;] [--json]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd session show [--config &amp;lt;path&amp;gt;] [--json] &amp;lt;name&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd query list [--config &amp;lt;path&amp;gt;] [--json]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd query &amp;lt;name&amp;gt; [--config &amp;lt;path&amp;gt;] [--json]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd cluster members|remove [--config &amp;lt;path&amp;gt;] [--force] [&amp;lt;node_id&amp;gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  remove takes a node id, and --force to leave one or two voters&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;without --config, the configuration is /etc/rradius/rradius.toml&#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;help&lt;/code&gt;, &lt;code&gt;--help&lt;/code&gt;, &lt;code&gt;-h&lt;/code&gt; and no arguments at all all print this list (standard output) and exit with 0.&lt;/li&gt;&#xA;&lt;li&gt;An unknown command, for example &lt;code&gt;rradiusd bogus&lt;/code&gt;, prints the same list to standard error and exits with 2.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;--version&lt;/code&gt; can only be used alone.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;schema&#34;&gt;schema&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd schema [--lang en|zh-TW]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Prints the JSON Schema of the configuration file to standard output; the descriptions use the language given by &lt;code&gt;--lang&lt;/code&gt;, default &lt;code&gt;en&lt;/code&gt;. An editor can use it for completion and checking; Appendix A was also compiled from it.&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd schema --lang zh-TW &amp;gt; schema.json&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ python3 -c &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;import json; print(sorted(json.load(open(&amp;#34;schema.json&amp;#34;))[&amp;#34;properties&amp;#34;]))&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&amp;#39;accounts&amp;#39;, &amp;#39;auth&amp;#39;, &amp;#39;cluster&amp;#39;, &amp;#39;databases&amp;#39;, &amp;#39;dictionary&amp;#39;, &amp;#39;include&amp;#39;, &amp;#39;log&amp;#39;, &amp;#39;lua&amp;#39;, &amp;#39;metrics&amp;#39;, &amp;#39;queries&amp;#39;, &amp;#39;radius&amp;#39;, &amp;#39;runtime&amp;#39;, &amp;#39;sessions&amp;#39;, &amp;#39;shutdown&amp;#39;, &amp;#39;tacacs&amp;#39;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd schema --lang fr&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd schema [--lang en|zh-TW]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;An unknown language or an extra argument: exit code 2.&lt;/li&gt;&#xA;&lt;li&gt;When writing fails, it prints &lt;code&gt;schema: …&lt;/code&gt; and exits with 1. For example &lt;code&gt;rradiusd schema | head -1&lt;/code&gt; shows &lt;code&gt;schema: Broken pipe (os error 32)&lt;/code&gt; on standard error; this is caused by &lt;code&gt;head&lt;/code&gt; closing the pipe early, not by a problem with the schema.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;config&#34;&gt;config&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd config show [--config &amp;lt;path&amp;gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd config diff &amp;lt;a.toml&amp;gt; &amp;lt;b.toml&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd config init [--full] [--lang en|zh-TW]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Only &lt;code&gt;init&lt;/code&gt; accepts &lt;code&gt;--lang&lt;/code&gt;; giving &lt;code&gt;--lang&lt;/code&gt; to &lt;code&gt;show&lt;/code&gt; or &lt;code&gt;diff&lt;/code&gt; is a usage error. None of the three subcommands connects to the server. For details of use, see &lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04 Configuration file basics&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;config-show&#34;&gt;config show&#xA;&lt;/h3&gt;&lt;p&gt;Prints the configuration with all defaults filled in (including the files named by &lt;code&gt;include&lt;/code&gt;). Secrets are shown as &lt;code&gt;&amp;lt;hidden&amp;gt;&lt;/code&gt;; the comment on the first line lists the values computed for this machine.&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd config show --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# computed on this machine: radius.sockets &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 1, cluster.read_connections &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;28&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dictionary = &amp;#34;…/share/dictionary&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[lua]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;script = &amp;#34;accounting.lua&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;max_execution_ms = 1000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;max_memory_mb = 256&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;query_timeout_ms = 5000&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When the configuration has an error, &lt;code&gt;config show&lt;/code&gt; prints the same error as &lt;code&gt;check&lt;/code&gt; and exits with 2.&lt;/p&gt;&#xA;&lt;h3 id=&#34;config-diff&#34;&gt;config diff&#xA;&lt;/h3&gt;&lt;p&gt;Compares two configurations after the defaults are filled in, one key per line, in the format &lt;code&gt;&amp;lt;key&amp;gt;: &amp;lt;value in a&amp;gt; | &amp;lt;value in b&amp;gt;&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd config diff rradius.toml b.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;auth.policy: &amp;#34;first_match&amp;#34; | &amp;#34;all_accept&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;radius.auth_port: 1812 | 1822&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd config diff n2.toml n3.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cluster.secret_api: differs (hidden)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cluster.secret_api_file: &amp;#34;api.secret&amp;#34; | (absent)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node-specific:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  cluster.listen: &amp;#34;127.0.0.1&amp;#34; | &amp;#34;127.0.0.2&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd config diff rradius.toml rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;no differences&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;A key present on only one side is written &lt;code&gt;(absent)&lt;/code&gt;; a secret only says &lt;code&gt;differs (hidden)&lt;/code&gt; and the value is not printed.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;cluster.node_id&lt;/code&gt; and &lt;code&gt;cluster.listen&lt;/code&gt; are meant to differ on every node; they are placed at the end under &lt;code&gt;node-specific:&lt;/code&gt;, and these two keys do &lt;strong&gt;not&lt;/strong&gt; count as differences: when only these two keys differ, the exit code is 0.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;radius.clients&lt;/code&gt; and &lt;code&gt;tacacs.clients&lt;/code&gt; are matched by name (by address when there is no name); a different order is not a difference.&lt;/li&gt;&#xA;&lt;li&gt;Exit codes: 0 no differences, 1 there are differences, 2 wrong arguments or an error in either configuration.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;config-init&#34;&gt;config init&#xA;&lt;/h3&gt;&lt;p&gt;Prints a configuration draft to standard output. The cluster secrets and the shared secret of the example client are generated randomly (32 characters). The comments are in English by default; &lt;code&gt;--lang zh-TW&lt;/code&gt; makes them Traditional Chinese. For the contents of the draft and what to change next, see &lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd config init --lang zh-TW &amp;gt; rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ head -2 rradius.toml&#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;`&lt;/span&gt;config init&lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt; 產生的 rradius 設定檔。&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# 叢集的每個節點都要用相同的 secret_raft 與 secret_api；範例用戶端的 secret 也要設在 NAS 上。&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;tuning&#34;&gt;tuning&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd tuning [--config &amp;lt;path&amp;gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Reads the system settings of this machine and the UDP drop counters, then estimates the socket buffers and file counts needed, and prints suggested values, the reasons and the commands. &lt;code&gt;--config&lt;/code&gt; is optional: without it, the command reads the configuration file at the default path, and uses all defaults for the estimate if there is none; with it, the command checks against your settings (for example &lt;code&gt;recv_buffer_bytes&lt;/code&gt;, &lt;code&gt;sockets&lt;/code&gt;) whether the system limits are enough. The commands only read; they change nothing. Linux, macOS and FreeBSD have advice; other platforms print &lt;code&gt;rradius tuning: no advice for this platform (Linux, macOS and FreeBSD have it)&lt;/code&gt; and exit with 0. For the meaning of each item, see &lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;19 Performance tuning and load testing&lt;/a&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd tuning --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius tuning advice for macOS&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;UDP packets dropped because a receive buffer was full, since the system started: …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Raise the receive buffers below, then watch whether this count still grows.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Largest socket buffer (kern.ipc.maxsockbuf)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  current:   8388608&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  suggested: 33554432&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  why:       the receive buffer counts its bookkeeping against this limit too, so twice the buffer; raise it before recvspace&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  now:       sysctl -w kern.ipc.maxsockbuf=33554432&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  persist:   /etc/sysctl.conf: kern.ipc.maxsockbuf = 33554432&#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;These suggestions are unmeasured starting points: apply them, then confirm with the dropped packet counts above.&#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;tuning&lt;/code&gt; only prints advice; it changes no system setting.&lt;/li&gt;&#xA;&lt;li&gt;When &lt;code&gt;--config&lt;/code&gt; is not given and the default configuration file cannot be read, it prints one line with the reason and &lt;code&gt;the default settings are used&lt;/code&gt;, gives advice with the defaults, and the exit code is still 0. When &lt;code&gt;--config&lt;/code&gt; is given and cannot be read, the exit code is 2.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;status&#34;&gt;status&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd status [--config &amp;lt;path&amp;gt;] [--cluster] [--watch | --json | --tui]&#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;Flag&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;(none)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reads &lt;code&gt;/metrics&lt;/code&gt; of this node twice, one second apart, prints one page and ends&lt;/td&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;--watch&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Then reads once more every second and updates the screen until Ctrl+C; on a terminal it clears and redraws the screen&lt;/td&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;--json&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Prints JSON instead, one object 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;--cluster&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Asks the cluster for its members and reads the metrics port of each member, one line per 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;--tui&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Full-screen interactive view (a table of items plus a line chart of the last 60 seconds; up and down select an item, &lt;code&gt;[&lt;/code&gt; and &lt;code&gt;]&lt;/code&gt; select a member or all, &lt;code&gt;p&lt;/code&gt; pauses); cannot be combined with &lt;code&gt;--json&lt;/code&gt; or &lt;code&gt;--watch&lt;/code&gt;, and standard output must be a terminal, otherwise the exit code is 2&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;status&lt;/code&gt; reads the address in &lt;code&gt;[metrics]&lt;/code&gt; of the configuration file; when &lt;code&gt;bind&lt;/code&gt; is &lt;code&gt;0.0.0.0&lt;/code&gt; or &lt;code&gt;::&lt;/code&gt;, it connects to a local address instead. For the meaning of each section and line, see &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd status --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius status of 127.0.0.1:9812 over 1.0 s&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Node&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Ready                     ok&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Leader                    1&#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;$ rradiusd status --config rradius.toml --json&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&amp;#34;address&amp;#34;:&amp;#34;127.0.0.1:9812&amp;#34;,&amp;#34;counter_reset&amp;#34;:false,&amp;#34;interval_seconds&amp;#34;:1.002444875,&amp;#34;ready&amp;#34;:{&amp;#34;status&amp;#34;:200,&amp;#34;text&amp;#34;:&amp;#34;ok&amp;#34;},&amp;#34;sections&amp;#34;:[…]}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd status --config rradius.toml --cluster&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius cluster status over 1.0 s, members from the cluster&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node   role    ready  auth/s  acct/s  discarded/s  in progress  address&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1      leader  ok     0.0     0.0     0.0          0            127.0.0.1:9812&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;total          1/1    0.0     0.0     0.0          0&#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;code&gt;--watch --json&lt;/code&gt; prints one line of JSON every second, which suits feeding another program.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;--cluster&lt;/code&gt; asks the members with the cluster&amp;rsquo;s API secret, so &lt;code&gt;[cluster]&lt;/code&gt; in the configuration file must agree with the cluster. The metrics port of each member is the host of that member&amp;rsquo;s API address plus the port of &lt;code&gt;[metrics]&lt;/code&gt; in this configuration.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Errors:&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;Output&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Exit code&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;[metrics]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;status needs [metrics]: the command reads this node&#39;s /metrics. Add to …&lt;/code&gt;, followed by an example &lt;code&gt;[metrics]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;Nobody answers on the metrics port&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;cannot reach the metrics port at 127.0.0.1:9812: Connection refused (os error 61)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;3&lt;/td&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;, no member can be read&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The table is printed as usual, members that cannot be read are marked &lt;code&gt;unreachable&lt;/code&gt;, and the reasons are listed at the end&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;3&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wrong API secret&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;127.0.0.1:8200 refused the api secret: [cluster] secret_api differs from the cluster&#39;s&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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 same flag twice&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Usage&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;With &lt;code&gt;--watch&lt;/code&gt;, a metrics port that cannot be read does not end the command; it prints the error once a second and retries (this was checked only against the code).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;user&#34;&gt;user&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd user add|passwd|enable|disable|delete|show [--config &amp;lt;path&amp;gt;] &amp;lt;name&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Runs the SQL of the same name in &lt;code&gt;[accounts]&lt;/code&gt; and writes to or queries the table through the cluster API port, so the server must be running. &lt;code&gt;&amp;lt;name&amp;gt;&lt;/code&gt; is normalized as at login; for example the &lt;code&gt;username&lt;/code&gt; setting of the default auth chain removes the realm. For the account table and how to write &lt;code&gt;[accounts]&lt;/code&gt;, see &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&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;Action&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Key used&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Output on success&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;add&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accounts.add&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;added &amp;lt;name&amp;gt;&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;passwd&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accounts.passwd&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;password changed for &amp;lt;name&amp;gt;&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;enable&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accounts.enable&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;enabled &amp;lt;name&amp;gt;&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;disable&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accounts.disable&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;disabled &amp;lt;name&amp;gt;&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;delete&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accounts.delete&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;deleted &amp;lt;name&amp;gt;&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&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accounts.show&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One line per column, &lt;code&gt;column=value&lt;/code&gt;; a blank line between rows&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;code&gt;add&lt;/code&gt; and &lt;code&gt;passwd&lt;/code&gt; read the password from standard input: on a terminal they turn off echo and ask twice (&lt;code&gt;password: &lt;/code&gt;, &lt;code&gt;again: &lt;/code&gt;); from a pipe they read only the first line. The password is processed according to &lt;code&gt;accounts.scheme&lt;/code&gt; before it is stored in the table.&lt;/li&gt;&#xA;&lt;li&gt;Write actions judge by whether a row was changed: when no row was changed, they print &lt;code&gt;no account &amp;lt;name&amp;gt;&lt;/code&gt; and exit with 1.&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ printf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;dave-password\n&amp;#39;&lt;/span&gt; | rradiusd user add --config rradius.toml dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;added dave&#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;new-password\n&amp;#39;&lt;/span&gt; | rradiusd user passwd --config rradius.toml dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;password changed for dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd user show --config rradius.toml dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;username=dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;enabled=1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd user delete --config rradius.toml dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;deleted dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd user delete --config rradius.toml dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;no account dave&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Examples of errors:&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;Output&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Exit code&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;add&lt;/code&gt; when the account exists&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Connect: Error code 1555: constraint failed Some(&amp;quot;UNIQUE constraint failed: users.username&amp;quot;)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1&lt;/td&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 password is empty&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;the password is empty; nothing was changed&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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 two passwords differ on a terminal&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;the two passwords differ; nothing was changed&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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 name is missing&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;a name is required&lt;/code&gt;, followed by the usage&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;One argument too many&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;unexpected argument &#39;b&#39;&lt;/code&gt;, followed by the usage&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;--config&lt;/code&gt; has no value&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;--config needs a value&lt;/code&gt;, followed by the usage&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;[accounts]&lt;/code&gt; lacks this action&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accounts.add is not set in rradius.toml&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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 server is not running&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After 30 seconds, &lt;code&gt;the cluster did not answer within 30 s&lt;/code&gt;; while waiting, standard error shows &lt;code&gt;Error looking up DB metrics&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;3&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wrong API secret&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Immediately &lt;code&gt;127.0.0.1:8200 refused the api secret: [cluster] secret_api differs from the cluster&#39;s&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;&amp;ldquo;The two passwords differ&amp;rdquo; can happen only on a terminal; it was not tested and is written from the code.&lt;/p&gt;&#xA;&lt;h2 id=&#34;session&#34;&gt;session&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd session list [--config &amp;lt;path&amp;gt;] [--json]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd session show [--config &amp;lt;path&amp;gt;] [--json] &amp;lt;name&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Runs the &lt;code&gt;list&lt;/code&gt; or &lt;code&gt;show&lt;/code&gt; query of &lt;code&gt;[sessions]&lt;/code&gt; (the &lt;code&gt;?1&lt;/code&gt; of &lt;code&gt;show&lt;/code&gt; is the normalized name) and prints the result in the column order of the SELECT. The server itself has no session table; the definition of &amp;ldquo;online&amp;rdquo; is entirely in the SQL you write. For setup, see &lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13 Accounting and sessions&lt;/a&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd session list --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;username=alice&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nas=192.0.2.1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;session_id=11b8000000000000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;started=1795384834&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;updated=1795384834&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd session list --config rradius.toml --json&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[{&amp;#34;username&amp;#34;:&amp;#34;alice&amp;#34;,&amp;#34;nas&amp;#34;:&amp;#34;192.0.2.1&amp;#34;,&amp;#34;session_id&amp;#34;:&amp;#34;11b8000000000000&amp;#34;,&amp;#34;started&amp;#34;:1795384834,&amp;#34;updated&amp;#34;:1795384834}]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd session show --config rradius.toml nobody&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;no sessions for nobody&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd session show --config rradius.toml --json nobody&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;The text format has one line per column, &lt;code&gt;column=value&lt;/code&gt;, with a blank line between sessions; NULL is printed as an empty string and a BLOB as lowercase hexadecimal. &lt;code&gt;--json&lt;/code&gt; is an array of objects, and numbers stay numbers.&lt;/li&gt;&#xA;&lt;li&gt;With no data: the text format prints &lt;code&gt;no sessions&lt;/code&gt; or &lt;code&gt;no sessions for &amp;lt;name&amp;gt;&lt;/code&gt;, &lt;code&gt;--json&lt;/code&gt; prints &lt;code&gt;[]&lt;/code&gt;, and the exit code is 1 in both cases.&lt;/li&gt;&#xA;&lt;li&gt;When the SQL fails, it prints &lt;code&gt;the statement failed: …&lt;/code&gt; and the exit code is &lt;strong&gt;2&lt;/strong&gt; (for &lt;code&gt;user&lt;/code&gt;, an SQL failure is 1). Tested: &lt;code&gt;the statement failed: Sqlite: no such column: nosuchcol in SELECT nosuchcol, …&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;When &lt;code&gt;[sessions]&lt;/code&gt; has no &lt;code&gt;list&lt;/code&gt;, it prints &lt;code&gt;sessions.list is not set in …&lt;/code&gt; and exits with 2. When the cluster cannot be reached, it is the same as &lt;code&gt;user&lt;/code&gt;: exit code 3.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;accounting&#34;&gt;accounting&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd accounting find --ip &amp;lt;address&amp;gt; --port &amp;lt;port&amp;gt; --at &amp;lt;time&amp;gt; [--file &amp;lt;path&amp;gt;]... [--json]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Reads the accounting log file (&lt;code&gt;[radius.accounting_log]&lt;/code&gt;) and lists the &lt;code&gt;IP-Port-Range&lt;/code&gt; segments (RFC 8045) that held the public address &lt;code&gt;--ip&lt;/code&gt; and port &lt;code&gt;--port&lt;/code&gt; at the time &lt;code&gt;--at&lt;/code&gt;. It needs no configuration file and does not connect to the cluster. &lt;code&gt;--at&lt;/code&gt; is RFC 3339 and must have a time zone (&lt;code&gt;Z&lt;/code&gt; or &lt;code&gt;±HH:MM&lt;/code&gt;, fractional seconds allowed); &lt;code&gt;--file&lt;/code&gt; can be given several times, and &lt;code&gt;-&lt;/code&gt; or no &lt;code&gt;--file&lt;/code&gt; reads standard input; a &lt;code&gt;--file&lt;/code&gt; whose name ends in &lt;code&gt;.gz&lt;/code&gt; is decompressed automatically (it may be several gzip members joined together), standard input is not decompressed, so pipe it through &lt;code&gt;zcat&lt;/code&gt;; a damaged or truncated &lt;code&gt;.gz&lt;/code&gt; gives exit code 2 and names the 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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd accounting find --ip 198.51.100.7 --port &lt;span style=&#34;color:#ae81ff&#34;&gt;1500&lt;/span&gt; --at 2026-11-25T10:30:00Z --file accounting.jsonl&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;198.51.100.7:1024-2047 allocated 2026-11-25T10:00:00.120Z ended 2026-11-25T11:00:00Z ended_by release time_source received identity &amp;#34;Acct-Session-Id=s-1 client=bng1&amp;#34; client=bng1 User-Name=alice Acct-Session-Id=s-1 Framed-IP-Address=100.64.0.5&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd accounting find --ip 198.51.100.7 --port &lt;span style=&#34;color:#ae81ff&#34;&gt;1500&lt;/span&gt; --at 2026-11-25T11:30:00Z --file accounting.jsonl&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd accounting find --ip 198.51.100.7 --port &lt;span style=&#34;color:#ae81ff&#34;&gt;1500&lt;/span&gt; --file accounting.jsonl&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;--at is required&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;usage: rradiusd accounting find --ip &amp;lt;address&amp;gt; --port &amp;lt;port&amp;gt; --at &amp;lt;time&amp;gt; [--file &amp;lt;path&amp;gt;]... [--json]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  --file - or no --file reads standard input; --at is RFC 3339, such as 2026-11-25T10:00:00Z&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;Exit codes: 0 at least one holder was listed, 1 none, 2 wrong arguments, a file, or a line that is not a JSON object (the message names the file and line number).&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;--json&lt;/code&gt; is an array with the keys &lt;code&gt;ext_ip&lt;/code&gt;, &lt;code&gt;port_start&lt;/code&gt;, &lt;code&gt;port_end&lt;/code&gt;, &lt;code&gt;allocated&lt;/code&gt;, &lt;code&gt;released&lt;/code&gt; (&lt;code&gt;null&lt;/code&gt; if not ended yet), &lt;code&gt;ended_by&lt;/code&gt; (&lt;code&gt;release&lt;/code&gt;, &lt;code&gt;stop&lt;/code&gt; or &lt;code&gt;null&lt;/code&gt;), &lt;code&gt;time_source&lt;/code&gt;, &lt;code&gt;identity&lt;/code&gt; and &lt;code&gt;attributes&lt;/code&gt;; when there is no holder it is &lt;code&gt;[]&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;For the holding rules, the time basis and the known limits, see &amp;ldquo;Reverse lookup of public addresses and ports&amp;rdquo; in &lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13 Accounting and sessions&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;query&#34;&gt;query&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd query list [--config &amp;lt;path&amp;gt;] [--json]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd query &amp;lt;name&amp;gt; [--config &amp;lt;path&amp;gt;] [--json]&#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;query list&lt;/code&gt; only reads the configuration file and lists the name, &lt;code&gt;help&lt;/code&gt;, &lt;code&gt;interval_ms&lt;/code&gt; and &lt;code&gt;sql&lt;/code&gt; of every &lt;code&gt;[queries.&amp;lt;name&amp;gt;]&lt;/code&gt;; it does not connect to the cluster. When there are no queries it prints nothing and exits with 0.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;query &amp;lt;name&amp;gt;&lt;/code&gt; runs that SQL once on the cluster and prints it as a table. The name &lt;code&gt;list&lt;/code&gt; is reserved for listing and cannot be used as a query name.&lt;/li&gt;&#xA;&lt;li&gt;For how to write named queries and the metrics they map to, see &lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09 External databases and named queries&lt;/a&gt;.&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd query list --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;name=enabled_users&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;help=Accounts that can log in&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;interval_ms=60000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sql=SELECT enabled, COUNT(*) AS value FROM users GROUP BY enabled&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd query enabled_users --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;enabled  value&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0        1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1        2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd query enabled_users --config rradius.toml --json&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[{&amp;#34;enabled&amp;#34;:0,&amp;#34;value&amp;#34;:1},{&amp;#34;enabled&amp;#34;:1,&amp;#34;value&amp;#34;:2}]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd query nobody_here --config q2.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;no rows&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd query nope --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;queries.nope is not set in rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;NULL in a table is printed as &lt;code&gt;NULL&lt;/code&gt;; in &lt;code&gt;--json&lt;/code&gt; NULL is &lt;code&gt;null&lt;/code&gt;. &lt;code&gt;query list --json&lt;/code&gt; is one line with an array of objects.&lt;/li&gt;&#xA;&lt;li&gt;Multi-line SQL is written with &lt;code&gt;\n&lt;/code&gt; for the line breaks in the text format of &lt;code&gt;query list&lt;/code&gt;, so that one query stays on one line.&lt;/li&gt;&#xA;&lt;li&gt;Errors: a name that is not set 2; SQL failed 2 (same message as &lt;code&gt;session&lt;/code&gt;); cluster cannot be reached 3.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;cluster&#34;&gt;cluster&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd cluster members [--config &amp;lt;path&amp;gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradiusd cluster remove [--config &amp;lt;path&amp;gt;] [--force] &amp;lt;node_id&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Finds the leader through the API addresses in &lt;code&gt;[[cluster.nodes]]&lt;/code&gt; of the configuration file, then lists or changes the members. For the full member management procedure, see &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16 Clusters and high availability&lt;/a&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd cluster members --config rradius.toml&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;node 1  voter    leader  raft 127.0.0.1:8100  api 127.0.0.1:8200&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;members&lt;/code&gt; prints one line per member: node number, &lt;code&gt;voter&lt;/code&gt; or &lt;code&gt;learner&lt;/code&gt;, whether it is the &lt;code&gt;leader&lt;/code&gt;, and the Raft and API addresses. A member that is in the cluster but not listed in the configuration file gets &lt;code&gt;(not in this configuration)&lt;/code&gt; at the end of the line; a node listed in the configuration file but not in the cluster prints &lt;code&gt;node &amp;lt;id&amp;gt;  not in the cluster (listed in this configuration)&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;remove&lt;/code&gt; takes a node that has &lt;strong&gt;already stopped&lt;/strong&gt; out of the cluster:&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;Output&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Exit code&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;Success&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;removed node &amp;lt;id&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;The node still answers&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;node 1 still answers at 127.0.0.1:8200: stop it first, then remove it&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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 node is not in the cluster&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;no node 2 in the cluster&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1&lt;/td&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 number is not a positive integer&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;the node id must be a positive integer, not &#39;0&#39;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;No number given&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;a node id is required&lt;/code&gt;, followed by the usage&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;Only one voter would remain&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;removing node &amp;lt;id&amp;gt; leaves one voter, with nothing to take over when it stops; give --force to remove it anyway&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;Only two voters would remain&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;… leaves two voters, and the cluster stops writing when either stops; give --force to remove it anyway&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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 last voter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;node &amp;lt;id&amp;gt; is the last voter; the cluster cannot remove it&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;No response within 30 seconds after sending&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;the removal of node &amp;lt;id&amp;gt; may have been made, …; check with cluster members&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;3&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;code&gt;--force&lt;/code&gt; is used only with &lt;code&gt;remove&lt;/code&gt;, so that the &amp;ldquo;only one or two voters remain&amp;rdquo; cases above are removed anyway. &lt;code&gt;members --force&lt;/code&gt; is a usage error.&lt;/li&gt;&#xA;&lt;li&gt;Wrong API secret: &lt;code&gt;… refused the api secret: [cluster] secret_api differs from the cluster&#39;s&lt;/code&gt;, exit code 2, and it appears immediately (the same for &lt;code&gt;user&lt;/code&gt;, &lt;code&gt;session&lt;/code&gt;, &lt;code&gt;query&lt;/code&gt;, &lt;code&gt;client&lt;/code&gt;, &lt;code&gt;dpsk&lt;/code&gt;, &lt;code&gt;aka&lt;/code&gt;, and for &lt;code&gt;cluster&lt;/code&gt; and &lt;code&gt;status --cluster&lt;/code&gt;). The cluster does not answer at all: &lt;code&gt;the cluster did not answer within 30 s&lt;/code&gt;, exit code 3.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; the rows &amp;ldquo;Success&amp;rdquo;, &amp;ldquo;Only one or two voters would remain&amp;rdquo;, &amp;ldquo;The last voter&amp;rdquo; and &amp;ldquo;No response within 30 seconds after sending&amp;rdquo; in the table need a multi-node cluster, and were checked only against &lt;code&gt;cluster_commands.rs&lt;/code&gt; and its tests; the other rows were tested on a single node.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;old-flag-syntax&#34;&gt;Old flag syntax&#xA;&lt;/h2&gt;&lt;p&gt;Starting and checking used to be flags and are now subcommands. With the old syntax, &lt;code&gt;rradiusd&lt;/code&gt; does not start the server; it prints the full usage list with one more hint line at the end and exits with 2:&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;Old syntax&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Hint on the last line&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;rradiusd --config &amp;lt;path&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;to start the server: rradiusd serve --config &amp;lt;path&amp;gt;&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;--check&lt;/code&gt; anywhere, for example &lt;code&gt;rradiusd --check --config &amp;lt;path&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;to check a configuration: rradiusd check [--config &amp;lt;path&amp;gt;]&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;enterprise-only-commands&#34;&gt;Enterprise-only commands&#xA;&lt;/h2&gt;&lt;p&gt;The core &lt;code&gt;rradiusd&lt;/code&gt; knows the names of the enterprise commands but does not run them: before reading the configuration file it prints &lt;code&gt;&amp;lt;command&amp;gt;: not supported by this program (&amp;lt;feature&amp;gt; needs rradius-enterprise)&lt;/code&gt; and exits with 2. The arguments that follow do not change the result.&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;Message printed by the core&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;aka&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;aka: not supported by this program (EAP-AKA&#39; needs rradius-enterprise)&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;aka-seal&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;aka-seal: not supported by this program (EAP-AKA&#39; needs rradius-enterprise)&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;client&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;client: not supported by this program (dynamic clients need rradius-enterprise)&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;dpsk&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;dpsk: not supported by this program (DPSK needs rradius-enterprise)&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;dpsk-seal&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;dpsk-seal: not supported by this program (DPSK needs rradius-enterprise)&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;disconnect&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;disconnect: not supported by this program (CoA needs rradius-enterprise)&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;coa&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;coa: not supported by this program (CoA needs rradius-enterprise)&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;otp&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;otp: not supported by this program (two-factor login needs rradius-enterprise)&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 list is &lt;code&gt;COMMANDS_NEEDING_ENTERPRISE&lt;/code&gt; in &lt;code&gt;rradius-core/src/extension.rs&lt;/code&gt;, and all eight were tested. These commands are not in the list of &lt;code&gt;rradiusd help&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Enterprise edition:&lt;/strong&gt; the &lt;code&gt;help&lt;/code&gt; of the enterprise edition also lists these commands and their usage.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;rradius-bench-run&#34;&gt;rradius-bench run&#xA;&lt;/h2&gt;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;code&gt;rradius-bench&lt;/code&gt; is not in any package, archive or Docker image; build it from source, see &lt;a class=&#34;link&#34; href=&#34;../02-install/&#34; &gt;02 Installation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-bench run [OPTIONS] --server &amp;lt;SERVER&amp;gt; --secret &amp;lt;SECRET&amp;gt; --load &amp;lt;LOADS&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Sends load to a server and prints a report when it ends. &lt;code&gt;--server&lt;/code&gt;, &lt;code&gt;--secret&lt;/code&gt; and at least one &lt;code&gt;--load&lt;/code&gt; are required. All arguments are checked before any request is sent; on an error it exits with code 3 and sends nothing.&lt;/p&gt;&#xA;&lt;p&gt;Flags and defaults (&lt;code&gt;rradius-bench run --help&lt;/code&gt; is authoritative):&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;Flag&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&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;&lt;code&gt;--server &amp;lt;SERVER&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Required&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Name or address of the server&lt;/td&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 &amp;lt;SECRET&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Required&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Shared secret; TACACS+ loads also use it as the key. It shows up in the process list, so use only a test 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;--load &amp;lt;LOADS&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Required&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A load, syntax in the next section; can be given several times and runs at the same 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;--auth-port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1812&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Authentication port&lt;/td&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;--acct-port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1813&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting port&lt;/td&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;--bind &amp;lt;BIND&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Source address of the sockets&lt;/td&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;--user&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;bench&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;--password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;bench&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Password; for the &lt;code&gt;aka-prime&lt;/code&gt; load write &lt;code&gt;KI:OPC&lt;/code&gt;, 32 hexadecimal digits each&lt;/td&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;--users &amp;lt;N&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Uses &lt;code&gt;&amp;lt;user&amp;gt;0&lt;/code&gt; to &lt;code&gt;&amp;lt;user&amp;gt;N-1&lt;/code&gt; in turn&lt;/td&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-ip&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;192.0.2.1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;NAS-IP-Address&lt;/code&gt; of every request&lt;/td&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-identifier&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius-bench&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;NAS-Identifier&lt;/code&gt; of every request&lt;/td&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;--attr &amp;lt;TYPE=KIND:VALUE&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An attribute added to every request; &lt;code&gt;KIND&lt;/code&gt; is &lt;code&gt;int&lt;/code&gt;, &lt;code&gt;text&lt;/code&gt;, &lt;code&gt;hex&lt;/code&gt; or &lt;code&gt;ip&lt;/code&gt;; &lt;code&gt;TYPE&lt;/code&gt; is 1 to 255 and cannot be 80; can be given several times&lt;/td&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-message-authenticator&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Off&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Request carries 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;--timeout&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;5&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Seconds to wait for a response, then resend or give 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;&lt;code&gt;--retries&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;0&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Number of resends&lt;/td&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;--warmup&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;2&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Seconds to send before measuring starts&lt;/td&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;--duration&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;10&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Seconds to measure&lt;/td&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;--requests &amp;lt;N&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Each load stops after N requests are measured (&lt;code&gt;session&lt;/code&gt; counts flows), with no warmup; cannot be used together with &lt;code&gt;--warmup&lt;/code&gt; or &lt;code&gt;--duration&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;--metrics-url&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;http://host:port/metrics&lt;/code&gt; of the server; the report shows how the counters changed during the measurement; only &lt;code&gt;http://&lt;/code&gt; is accepted&lt;/td&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;--json&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Off&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The report is printed as JSON&lt;/td&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-version&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1.2&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TLS version of EAP loads, &lt;code&gt;1.2&lt;/code&gt; or &lt;code&gt;1.3&lt;/code&gt;; &lt;code&gt;1.3&lt;/code&gt; works only with &lt;code&gt;eap-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;--ca-file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;CA used to check the server&amp;rsquo;s EAP certificate; when not given, any certificate is accepted&lt;/td&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;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The value of &lt;code&gt;--server&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;With &lt;code&gt;--ca-file&lt;/code&gt;, the name the server certificate must 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;--cert-file&lt;/code&gt;, &lt;code&gt;--key-file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Certificate and private key for an &lt;code&gt;eap-tls&lt;/code&gt; login; also needed by &lt;code&gt;--transport 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;--eap-fragment&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1000&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Most bytes of TLS data one EAP-Response carries&lt;/td&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;--transport&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;udp&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;udp&lt;/code&gt;, or &lt;code&gt;tls&lt;/code&gt; (RadSec, RFC 6614, one TLS connection per socket)&lt;/td&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-port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;2083&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RadSec port, shared by authentication and accounting&lt;/td&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-port&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;49&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+ port for the &lt;code&gt;tacacs-*&lt;/code&gt; loads&lt;/td&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-connect&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;keep&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;keep&lt;/code&gt;: one connection per socket for the whole run; &lt;code&gt;per-request&lt;/code&gt;: a new connection for every request&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;These combinations are rejected before anything is sent (exit code 3; all messages were tested):&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;Combination&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Message&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;--transport dtls&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;--transport dtls: udp or 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;--transport tls&lt;/code&gt; without a certificate&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;--transport tls needs --cert-file and --key-file: RadSec servers ask for a client certificate&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;--transport tls --retries 1&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;--retries: nothing is sent again over TLS (RFC 6614), so --transport tls takes 0&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 TACACS+ load with &lt;code&gt;--transport tls&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;--transport tls: TACACS+ loads go over TCP, not 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;code&gt;--tacacs-connect sometimes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;--tacacs-connect sometimes: keep or per-request&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;An EAP load with &lt;code&gt;--no-message-authenticator&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;--no-message-authenticator: EAP loads always carry Message-Authenticator (RFC 3579)&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;peap&lt;/code&gt; with &lt;code&gt;--tls-version 1.3&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;--tls-version 1.3: only for eap-tls, not peap&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; without &lt;code&gt;--cert-file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;eap-tls needs --cert-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;aka-prime&lt;/code&gt; with a wrong &lt;code&gt;--password&lt;/code&gt; format&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;aka-prime needs --password KI:OPC, each 32 hex digits&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;--attr 80=hex:00&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;--attr 80=hex:00: type 80 is Message-Authenticator, which the tool handles&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;--metrics-url https://…&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;--metrics-url https://127.0.0.1/metrics: must start with 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;&lt;code&gt;--requests 0&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;--requests must be above 0&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;--requests&lt;/code&gt; together with &lt;code&gt;--duration&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The usage text of clap&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Name resolution fails&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;--server nonexistent.invalid: failed to lookup address information: …&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Not verified on real hardware:&lt;/strong&gt; &lt;code&gt;--transport tls&lt;/code&gt; needs a RadSec server, and the core &lt;code&gt;rradiusd&lt;/code&gt; has no RadSec, so only the argument checks in the table above were verified; it was never run against a server.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;load-syntax&#34;&gt;&amp;ndash;load syntax&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;--load KIND[,concurrency=N][,rate=N][,window=N][,threads=N][,alive=N]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;At least one of &lt;code&gt;concurrency&lt;/code&gt; and &lt;code&gt;rate&lt;/code&gt; is required, otherwise you get &lt;code&gt;--load pap: needs concurrency or rate&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&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;&lt;code&gt;concurrency&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;256 when &lt;code&gt;rate&lt;/code&gt; is given&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Number of requests in flight at the same time. Alone it is fixed-concurrency; together with &lt;code&gt;rate&lt;/code&gt; it is the upper limit. Must be above 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;rate&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How many to send per second, fixed-rate. Must be above 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;window&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RADIUS 64, TACACS+ 1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The most requests at the same time on one socket, 1 to 256. For TACACS+ it can only be 1&lt;/td&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;threads&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Fixed-concurrency 2, fixed-rate 1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How many threads this load uses; never more than the number of sockets&lt;/td&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;alive&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;0&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Used only by &lt;code&gt;session&lt;/code&gt;: how many Interim-Updates to send between Start and Stop&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The number of sockets is &lt;code&gt;concurrency ÷ window&lt;/code&gt;, rounded up. For example &lt;code&gt;pap,concurrency=4096&lt;/code&gt; uses 64 sockets, and &lt;code&gt;tacacs-pap,concurrency=32&lt;/code&gt; uses 32.&lt;/p&gt;&#xA;&lt;p&gt;All the kinds of &lt;code&gt;KIND&lt;/code&gt;. &lt;code&gt;--help&lt;/code&gt; does not list them; the list comes from &lt;code&gt;Step::name&lt;/code&gt; in &lt;code&gt;rradius-bench/src/packet.rs&lt;/code&gt; plus &lt;code&gt;session&lt;/code&gt;; the column &amp;ldquo;Tested against the core&amp;rdquo; is the result of sending each one once to this chapter&amp;rsquo;s verification environment:&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;Kind&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What it sends&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Tested against the core&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;pap&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Access-Request with &lt;code&gt;User-Password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;chap&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;CHAP-Password&lt;/code&gt; and &lt;code&gt;CHAP-Challenge&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;chap-authenticator&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;CHAP-Password&lt;/code&gt; with the Request Authenticator as the challenge, no &lt;code&gt;CHAP-Challenge&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;mschapv2&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;MS-CHAP-Challenge&lt;/code&gt; and &lt;code&gt;MS-CHAP2-Response&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;acct-start&lt;/code&gt;, &lt;code&gt;acct-alive&lt;/code&gt;, &lt;code&gt;acct-stop&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Accounting-Request with &lt;code&gt;Acct-Status-Type&lt;/code&gt; 1, 3, 2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;accounting&lt;/td&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;acct-on&lt;/code&gt;, &lt;code&gt;acct-off&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Acct-Status-Type&lt;/code&gt; 7, 8&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;accounting&lt;/td&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;status-auth&lt;/code&gt;, &lt;code&gt;status-acct&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Status-Server, sent to the authentication port or the accounting port&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;accept, accounting&lt;/td&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&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;With one session ID, in order: login (&lt;code&gt;pap&lt;/code&gt;), Start, &lt;code&gt;alive&lt;/code&gt; Interim-Updates, Stop; the next step is sent only when the previous one was answered; when the login is rejected, no accounting is sent&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Each step reported 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;&lt;code&gt;eap-tls&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An EAP-TLS conversation; needs &lt;code&gt;--cert-file&lt;/code&gt; and &lt;code&gt;--key-file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reject (the verification environment has no &lt;code&gt;certificate_query&lt;/code&gt;, log &lt;code&gt;not authorized&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;peap&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A PEAP conversation, inner MS-CHAPv2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;ttls&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An EAP-TTLS conversation, inner PAP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;ttls-mschapv2&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An EAP-TTLS conversation, inner MS-CHAPv2&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;aka-prime&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An EAP-AKA&amp;rsquo; conversation, &lt;code&gt;--password KI:OPC&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reject (the core does not offer this method, log &lt;code&gt;the peer asked only for methods this server does not offer&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-pap&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+ PAP authentication&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;tacacs-chap&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+ CHAP authentication (the server needs an auth chain that can compare the password, otherwise the server answers &lt;code&gt;RESTART&lt;/code&gt;, which counts as &lt;code&gt;invalid&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;accept (with such an auth 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;&lt;code&gt;tacacs-ascii&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+ ASCII login, the server asks for the account and password step by step (one login measured &lt;code&gt;rounds&lt;/code&gt; 3.0)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;tacacs-author&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+ authorization&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reject (the verification environment has no authorization rules)&lt;/td&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-acct&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+ accounting&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;accounting&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;For EAP loads, &lt;code&gt;concurrency&lt;/code&gt;, &lt;code&gt;rate&lt;/code&gt; and &lt;code&gt;--requests&lt;/code&gt; count &amp;ldquo;conversations&amp;rdquo;; for &lt;code&gt;tacacs-ascii&lt;/code&gt; they count &amp;ldquo;logins&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --auth-port &lt;span style=&#34;color:#ae81ff&#34;&gt;1812&lt;/span&gt; --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --password alice-password --load peap,concurrency=1 --requests 1 \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --ca-file certs/ca.pem --tls-name radius.corp.example.com&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;measured 0.003 s after 0.000 s of warmup&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;peap (fixed-concurrency): concurrency 1, 1 threads, 1 sockets, busiest worker 15%&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  peap: 382/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    rounds per finished conversation: 10.0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    latency us: p50 2578.4, p90 2578.4, p99 2578.4, p99.9 2578.4, max 2578.4&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --tacacs-port &lt;span style=&#34;color:#ae81ff&#34;&gt;4949&lt;/span&gt; --secret &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 tacacs.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --password alice-password --load tacacs-ascii,concurrency=1 --requests 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;measured 0.000 s after 0.000 s of warmup&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;tacacs-ascii (fixed-concurrency): concurrency 1, 1 threads, 1 sockets over tcp, busiest worker 12%&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  tacacs-ascii: 2542/s, sent 1, accept 1, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    rounds per finished conversation: 3.0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    latency us: p50 391.2, p90 391.2, p99 391.2, p99.9 391.2, max 391.2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;run-output-and-exit-codes&#34;&gt;run output and exit codes&#xA;&lt;/h2&gt;&lt;p&gt;Structure of the text report:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The first line is &lt;code&gt;measured &amp;lt;seconds&amp;gt; s after &amp;lt;seconds&amp;gt; s of warmup&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;One section per load: kind, mode (&lt;code&gt;fixed-concurrency&lt;/code&gt; or &lt;code&gt;fixed-rate&lt;/code&gt;), &lt;code&gt;concurrency&lt;/code&gt;, &lt;code&gt;rate&lt;/code&gt;, number of threads and sockets; for non-UDP, &lt;code&gt;over tcp&lt;/code&gt; or &lt;code&gt;over tls&lt;/code&gt; is added; fixed-concurrency shows &lt;code&gt;busiest worker&lt;/code&gt;, fixed-rate shows &lt;code&gt;send lag p99&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;One line of counts per step: &lt;code&gt;sent&lt;/code&gt;, &lt;code&gt;accept&lt;/code&gt;, &lt;code&gt;reject&lt;/code&gt;, &lt;code&gt;challenge&lt;/code&gt;, &lt;code&gt;accounting&lt;/code&gt;, &lt;code&gt;timeouts&lt;/code&gt;, &lt;code&gt;invalid&lt;/code&gt;, &lt;code&gt;late&lt;/code&gt;, &lt;code&gt;socket errors&lt;/code&gt;, &lt;code&gt;retransmits&lt;/code&gt;, then one line of latency (microseconds) with p50, p90, p99, p99.9 and max. EAP and &lt;code&gt;tacacs-ascii&lt;/code&gt; have one more line, &lt;code&gt;rounds per finished conversation&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;With &lt;code&gt;--metrics-url&lt;/code&gt; there is one more section, &lt;code&gt;server counters: …&lt;/code&gt;, and when there are warnings, one more section, &lt;code&gt;warnings:&lt;/code&gt;.&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --auth-port &lt;span style=&#34;color:#ae81ff&#34;&gt;1812&lt;/span&gt; --secret &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 localhost.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:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --user alice --password alice-password --load pap,rate=50 --warmup 0.5 --duration 1 \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    --metrics-url http://127.0.0.1:9812/metrics&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;measured 1.000 s after 0.500 s of warmup&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pap (fixed-rate): concurrency 256, rate 50/s, 1 threads, 4 sockets, send lag p99 89.0 us&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  pap: 50/s, sent 50, accept 50, reject 0, challenge 0, accounting 0, timeouts 0, invalid 0, late 0, socket errors 0, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    latency us: p50 383.7, p90 561.7, p99 604.2, p99.9 604.2, max 604.2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;server counters: auth 49, acct 0, duplicates 0, discarded overload 0, unknown_client 0, invalid 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;--json&lt;/code&gt; prints a JSON document instead: the top level has &lt;code&gt;schema&lt;/code&gt; (currently 1), &lt;code&gt;warmup_s&lt;/code&gt;, &lt;code&gt;duration_s&lt;/code&gt;, &lt;code&gt;trustworthy&lt;/code&gt;, &lt;code&gt;loads&lt;/code&gt;, &lt;code&gt;server_metrics&lt;/code&gt; and &lt;code&gt;warnings&lt;/code&gt;; each load has &lt;code&gt;kind&lt;/code&gt;, &lt;code&gt;mode&lt;/code&gt;, &lt;code&gt;transport&lt;/code&gt;, &lt;code&gt;concurrency&lt;/code&gt;, &lt;code&gt;rate&lt;/code&gt;, &lt;code&gt;threads&lt;/code&gt;, &lt;code&gt;sockets&lt;/code&gt;, &lt;code&gt;reconnects&lt;/code&gt;, &lt;code&gt;send_lag_us&lt;/code&gt;, &lt;code&gt;worker_busy_max&lt;/code&gt; and &lt;code&gt;steps&lt;/code&gt;; each step has &lt;code&gt;step&lt;/code&gt;, &lt;code&gt;sent&lt;/code&gt;, &lt;code&gt;responses&lt;/code&gt; (&lt;code&gt;accept&lt;/code&gt;, &lt;code&gt;reject&lt;/code&gt;, &lt;code&gt;challenge&lt;/code&gt;, &lt;code&gt;accounting&lt;/code&gt;), &lt;code&gt;timeouts&lt;/code&gt;, &lt;code&gt;invalid&lt;/code&gt;, &lt;code&gt;late&lt;/code&gt;, &lt;code&gt;socket_errors&lt;/code&gt;, &lt;code&gt;retransmits&lt;/code&gt;, &lt;code&gt;throughput_per_s&lt;/code&gt;, &lt;code&gt;rounds&lt;/code&gt; and &lt;code&gt;latency_us&lt;/code&gt; (&lt;code&gt;p50&lt;/code&gt;, &lt;code&gt;p90&lt;/code&gt;, &lt;code&gt;p99&lt;/code&gt;, &lt;code&gt;p999&lt;/code&gt;, &lt;code&gt;max&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Warning codes:&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;Code&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;When it appears&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;tool_saturated&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A worker thread of a fixed-concurrency load was busy for at least 90% of the measurement: what was measured is the limit of the tool&lt;/td&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;rate_not_met&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A fixed-rate load sent less than 99% of the schedule, or the p99 of &lt;code&gt;send_lag_us&lt;/code&gt; is above 1000&lt;/td&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;duplicate_path&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;With &lt;code&gt;--retries 0&lt;/code&gt;, the server&amp;rsquo;s duplicate request counter increased&lt;/td&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;server_discarded_&amp;lt;reason&amp;gt;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The server&amp;rsquo;s counter of discarded packets increased, for example &lt;code&gt;server_discarded_overload&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;metrics_unavailable&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;--metrics-url&lt;/code&gt; could not be read; the measurement completed as usual&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The three codes &lt;code&gt;tool_saturated&lt;/code&gt;, &lt;code&gt;rate_not_met&lt;/code&gt; and &lt;code&gt;duplicate_path&lt;/code&gt; make &lt;code&gt;trustworthy&lt;/code&gt; false, and the text report ends with &lt;code&gt;these numbers do not describe the server alone: see the warnings&lt;/code&gt;. Warnings and &lt;code&gt;late&lt;/code&gt; do not affect the exit code.&lt;/p&gt;&#xA;&lt;p&gt;Exit codes:&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;Exit code&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;0&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;All measured requests were Accept, or all accounting requests were answered&lt;/td&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;There were Reject or Challenge, with no timeouts or errors&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&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;There were timeouts, invalid responses or socket errors&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;3&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wrong arguments or could not start (for example name resolution failed), no result; an unknown command or a missing required flag also gives 3&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench run --server 127.0.0.1 --auth-port &lt;span style=&#34;color:#ae81ff&#34;&gt;1899&lt;/span&gt; --secret x --load pap,concurrency&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --requests &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; --timeout 0.5&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;measured 0.503 s after 0.000 s of warmup&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pap (fixed-concurrency): concurrency 1, 1 threads, 1 sockets, busiest worker 0%&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  pap: 0/s, sent 1, accept 0, reject 0, challenge 0, accounting 0, timeouts 1, invalid 0, late 0, socket errors 1, retransmits 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    latency us: p50 0.0, p90 0.0, p99 0.0, p99.9 0.0, max 0.0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This example deliberately uses port 1899, where nobody is listening. The exit code of &lt;code&gt;rradius-bench --help&lt;/code&gt;, &lt;code&gt;-h&lt;/code&gt;, &lt;code&gt;--version&lt;/code&gt; and &lt;code&gt;-V&lt;/code&gt; is 0; with no arguments it prints the command list and exits with 3.&lt;/p&gt;&#xA;&lt;h2 id=&#34;rradius-bench-calibrate&#34;&gt;rradius-bench calibrate&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius-bench calibrate [--duration &amp;lt;seconds&amp;gt;] [--json]&#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;Flag&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&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;&lt;code&gt;--duration&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;3&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Seconds to measure each combination; must be above 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;--json&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Off&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Prints JSON instead: &lt;code&gt;schema&lt;/code&gt; 1 and four &lt;code&gt;results&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;It sends load to a responder inside the tool&amp;rsquo;s own process that signs its responses correctly, using the same code as &lt;code&gt;run&lt;/code&gt;. It measures four combinations: 1 thread with window 1 and concurrency 1; and 1, 2 and 4 threads with window 64. The result is how fast this tool can send on this machine; when &lt;code&gt;run&lt;/code&gt; measures close to this number, the bottleneck may be the tool.&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradius-bench calibrate --duration 0.5&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;what this tool can do here, against responders that do no other work:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  1 threads, window 1, concurrency 1: …/s, p50 … us, p99 … us, busiest worker …%, timeouts 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  1 threads, window 64, concurrency 64: …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  2 threads, window 64, concurrency 128: …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  4 threads, window 64, concurrency 256: …&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The numbers differ from machine to machine and are omitted here. The exit code is 0; &lt;code&gt;--duration 0&lt;/code&gt; prints &lt;code&gt;rradius-bench: --duration must be above 0&lt;/code&gt; and exits with 3.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;comparison-method&#34;&gt;Comparison method&#xA;&lt;/h2&gt;&lt;p&gt;After the program is updated, use the following method to confirm that this reference has not missed or added any commands or flags. Result of running it against this appendix on 2026-11-23: every difference was 0.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;1. Commands and flags of &lt;code&gt;rradiusd&lt;/code&gt;.&lt;/strong&gt; The output of &lt;code&gt;help&lt;/code&gt; already contains the usage of every subcommand; take out the &amp;ldquo;command subcommand&amp;rdquo; pairs and the flags, and check one by one that they appear in this appendix:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rradiusd help &amp;gt; help.txt&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ grep -oE -- &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;--[a-z]+(-[a-z]+)*&amp;#39;&lt;/span&gt; help.txt | sort -u &amp;gt; flags-help.txt&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ grep -oE -- &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;--[a-z]+(-[a-z]+)*&amp;#39;&lt;/span&gt; 91-command-reference.md | sort -u &amp;gt; flags-book.txt&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ comm -23 flags-help.txt flags-book.txt          &lt;span style=&#34;color:#75715e&#34;&gt;# in help, not in the book: must be empty&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ sed -n &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;s/^usage: rradiusd \([a-z-]*\) \([a-z|]*\).*/\1 \2/p&amp;#39;&lt;/span&gt; help.txt &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;    | awk &amp;#39;{n=split($2,a,&amp;#34;|&amp;#34;); for(i=1;i&amp;lt;=n;i++) print $1&amp;#34; &amp;#34;a[i]}&amp;#39; \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    | grep -v &amp;#39; $&amp;#39; \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    | while read c; do grep -qF &amp;#34;\`$c&amp;#34; 91-command-reference.md || echo &amp;#34;missing: $c&amp;#34;; done&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The second part produces pairs such as &lt;code&gt;config show&lt;/code&gt;, &lt;code&gt;user add&lt;/code&gt; and &lt;code&gt;cluster remove&lt;/code&gt;; it passes only if it prints nothing.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;2. Flags that the book has in excess.&lt;/strong&gt; &lt;code&gt;comm -13 flags-help.txt flags-book.txt&lt;/code&gt; lists the flags that are in the book but not in &lt;code&gt;rradiusd help&lt;/code&gt;. They should all come from the &lt;code&gt;--help&lt;/code&gt; of &lt;code&gt;rradius-bench&lt;/code&gt;, from the old flag &lt;code&gt;--check&lt;/code&gt;, and from &lt;code&gt;--help&lt;/code&gt;. Add the flags of &lt;code&gt;rradius-bench --help&lt;/code&gt;, &lt;code&gt;rradius-bench run --help&lt;/code&gt; and &lt;code&gt;rradius-bench calibrate --help&lt;/code&gt; to &lt;code&gt;flags-help.txt&lt;/code&gt; and compare again; what remains can only be &lt;code&gt;--check&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;3. Flags and defaults of &lt;code&gt;rradius-bench&lt;/code&gt;.&lt;/strong&gt; Every flag of &lt;code&gt;rradius-bench run --help&lt;/code&gt; must be in the table of &lt;a class=&#34;link&#34; href=&#34;#rradius-bench-run&#34; &gt;rradius-bench run&lt;/a&gt;, and &lt;code&gt;[default: …]&lt;/code&gt; must agree with the &amp;ldquo;Default&amp;rdquo; column of the table; the same goes for &lt;code&gt;calibrate --help&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;4. The kinds of &lt;code&gt;--load&lt;/code&gt;.&lt;/strong&gt; &lt;code&gt;--help&lt;/code&gt; does not list the kinds; take them from the source:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ sed -n &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;/pub fn name/,/^    }/p&amp;#39;&lt;/span&gt; rradius-bench/src/packet.rs | grep -oE &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;#34;[a-z0-9-]+&amp;#34;&amp;#39;&lt;/span&gt; | tr -d &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;#34;&amp;#39;&lt;/span&gt; &amp;gt; kinds.txt&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo session &amp;gt;&amp;gt; kinds.txt&#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;while&lt;/span&gt; read k; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; grep -qF &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;\`&lt;/span&gt;$k&lt;span style=&#34;color:#e6db74&#34;&gt;\`&amp;#34;&lt;/span&gt; 91-command-reference.md &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;missing: &lt;/span&gt;$k&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; &amp;lt; kinds.txt&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;There are 20 kinds at the moment.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;5. Enterprise commands.&lt;/strong&gt; Take the names from &lt;code&gt;COMMANDS_NEEDING_ENTERPRISE&lt;/code&gt; in &lt;code&gt;extension.rs&lt;/code&gt; and run each against the core; every one must give &lt;code&gt;not supported by this program&lt;/code&gt; and exit code 2, and must appear in the table of &lt;a class=&#34;link&#34; href=&#34;#enterprise-only-commands&#34; &gt;Enterprise-only commands&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Exit codes are not in &lt;code&gt;help&lt;/code&gt;; compare them against the source of each subcommand (&lt;code&gt;return&lt;/code&gt;, &lt;code&gt;exit_code&lt;/code&gt;, the &lt;code&gt;STATUS_*&lt;/code&gt; constants).&lt;/p&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; adding &lt;code&gt;--help&lt;/code&gt; after a subcommand, for example &lt;code&gt;rradiusd user --help&lt;/code&gt;, prints the usage and exits with 2.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; subcommands have no &lt;code&gt;--help&lt;/code&gt;; &lt;code&gt;--help&lt;/code&gt; is treated as an unknown argument.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; use &lt;code&gt;rradiusd help&lt;/code&gt; to see all usage; the usage text itself is not an error.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;rradiusd --config rradius.toml&lt;/code&gt; does not start and prints the whole usage and &lt;code&gt;to start the server: …&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; old syntax; starting is now a subcommand.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; write &lt;code&gt;rradiusd serve --config rradius.toml&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;rradiusd config show --config a.toml --lang zh-TW&lt;/code&gt; prints the usage of &lt;code&gt;config&lt;/code&gt; and exits with 2.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; only &lt;code&gt;config init&lt;/code&gt; accepts &lt;code&gt;--lang&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; do not add &lt;code&gt;--lang&lt;/code&gt; to &lt;code&gt;config show&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; a script uses the exit code of &lt;code&gt;query &amp;lt;name&amp;gt;&lt;/code&gt; to tell whether there is data, and it is always 0.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; when there are no rows, &lt;code&gt;query&lt;/code&gt; prints &lt;code&gt;no rows&lt;/code&gt; and the exit code is still 0.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; judge by the output, or use &lt;code&gt;--json&lt;/code&gt; and check whether it is &lt;code&gt;[]&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;user&lt;/code&gt;, &lt;code&gt;session&lt;/code&gt; or &lt;code&gt;cluster&lt;/code&gt; stops for 30 seconds and then prints &lt;code&gt;the cluster did not answer within 30 s&lt;/code&gt;, exit code 3.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; the server is not running, the API address in &lt;code&gt;[[cluster.nodes]]&lt;/code&gt; is wrong, or the API secret does not agree with the cluster. When the secret does not agree, the command says &lt;code&gt;refused the api secret&lt;/code&gt; directly with exit code 2 and does not wait for the timeout; it waits 30 seconds only when it cannot connect or gets no answer.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; make sure the server is running and that the command uses the same configuration file as the server.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; every result of &lt;code&gt;rradius-bench&lt;/code&gt; is &lt;code&gt;timeouts&lt;/code&gt;, and the server log has &lt;code&gt;discarded 1 Access-Requests lacking a Message-Authenticator&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;--no-message-authenticator&lt;/code&gt; was used, and the server by default requires Access-Request to carry Message-Authenticator.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; remove this flag; to test a NAS that does not send it, first read &lt;code&gt;radius.clients[].require_message_authenticator&lt;/code&gt; in &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;rradius-bench run … --requests 1 --duration 3&lt;/code&gt; prints the usage of clap and exits with 3.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;--requests&lt;/code&gt; cannot be used together with &lt;code&gt;--warmup&lt;/code&gt; or &lt;code&gt;--duration&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; choose one.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; the &lt;code&gt;eap-tls&lt;/code&gt; load gets &lt;code&gt;reject 1&lt;/code&gt;, and the server log says &lt;code&gt;the EAP Identity does not fit the certificate&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; the EAP Identity sent by &lt;code&gt;--user&lt;/code&gt; does not match the name of the client certificate.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; write &lt;code&gt;--user&lt;/code&gt; as the name on the certificate, for example &lt;code&gt;laptop-001.corp.example.com&lt;/code&gt; of the wifi-certs scenario.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&gt;: first use of &lt;code&gt;serve&lt;/code&gt;, &lt;code&gt;user&lt;/code&gt;, &lt;code&gt;session&lt;/code&gt; and &lt;code&gt;status&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04 Configuration file basics&lt;/a&gt;: &lt;code&gt;check&lt;/code&gt;, &lt;code&gt;config&lt;/code&gt;, &lt;code&gt;schema&lt;/code&gt;, reload&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;: &lt;code&gt;user&lt;/code&gt; and &lt;code&gt;[accounts]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09 External databases and named queries&lt;/a&gt;: &lt;code&gt;query&lt;/code&gt; and &lt;code&gt;[queries]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13 Accounting and sessions&lt;/a&gt;: &lt;code&gt;session&lt;/code&gt; and &lt;code&gt;[sessions]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16 Clusters and high availability&lt;/a&gt;: &lt;code&gt;cluster members&lt;/code&gt;, &lt;code&gt;cluster remove&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;: &lt;code&gt;status&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;19 Performance tuning and load testing&lt;/a&gt;: &lt;code&gt;tuning&lt;/code&gt;, &lt;code&gt;rradius-bench&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../94-glossary/&#34; &gt;Appendix E: Glossary and RFC cross-reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>92 Appendix C: Metrics reference</title>
            <link>https://embark.systems/en/rradius/oss/92-metrics-reference/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/92-metrics-reference/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Look up every metric that &lt;code&gt;rradiusd&lt;/code&gt; writes to &lt;code&gt;/metrics&lt;/code&gt;: its type, its labels and what it means&lt;/li&gt;&#xA;&lt;li&gt;Tell which metrics are always present and which appear only with the matching configuration&lt;/li&gt;&#xA;&lt;li&gt;Find the alert rule in &lt;code&gt;deploy/monitoring/rradius.rules.yml&lt;/code&gt; that uses a metric&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: you have read &amp;ldquo;Reading /metrics&amp;rdquo; in &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/#reading-metrics&#34; &gt;Chapter 17&lt;/a&gt;. You know the difference between a counter, a gauge and a histogram, and how to fetch &lt;code&gt;/metrics&lt;/code&gt; with &lt;code&gt;curl&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#how-to-read-this-reference&#34; &gt;How to read this reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#where-this-list-comes-from&#34; &gt;Where this list comes from&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#overview&#34; &gt;Overview&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#radius&#34; &gt;RADIUS&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#tacacs&#34; &gt;TACACS+&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#eap&#34; &gt;EAP&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#cluster-and-cluster-database&#34; &gt;Cluster and cluster database&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#accounting-spool-and-accounting-log-file&#34; &gt;Accounting spool and accounting log file&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#login-lockout-and-password-checks&#34; &gt;Login lockout and password checks&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#netlogon&#34; &gt;Netlogon&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#external-databases&#34; &gt;External databases&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#named-queries&#34; &gt;Named queries&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#http-calls-from-scripts&#34; &gt;HTTP calls from scripts&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#reload-version-and-log&#34; &gt;Reload, version and log&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;how-to-read-this-reference&#34;&gt;How to read this reference&#xA;&lt;/h2&gt;&lt;p&gt;Each metric has its own section. The title is the name of the metric family, and the first line below it says:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Type:&lt;/strong&gt; &lt;code&gt;counter&lt;/code&gt; (only goes up), &lt;code&gt;gauge&lt;/code&gt; (the value right now) or &lt;code&gt;histogram&lt;/code&gt; (a distribution).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Labels:&lt;/strong&gt; the name of each label and the values it can take. When the values are a fixed set, all of them are listed. When the values come from the configuration (for example client names), the source is given.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Present when:&lt;/strong&gt; &amp;ldquo;always&amp;rdquo; means every configuration writes it. For the others, the setting that is needed is named.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Alert:&lt;/strong&gt; the rules in &lt;code&gt;deploy/monitoring/rradius.rules.yml&lt;/code&gt; that use it, or &amp;ldquo;—&amp;rdquo; if there are none.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Rules that apply to all metrics:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Every metric is kept &lt;strong&gt;per node&lt;/strong&gt;, counted from the start of the process. A reload does not reset it. Only a restart does.&lt;/li&gt;&#xA;&lt;li&gt;Once a metric family appears, all of its label combinations are present from the start with the value 0. A query never under-counts because a combination &amp;ldquo;appeared for the first time&amp;rdquo;.&lt;/li&gt;&#xA;&lt;li&gt;The sample names of a histogram are &lt;code&gt;&amp;lt;name&amp;gt;_bucket{…,le=&amp;quot;…&amp;quot;}&lt;/code&gt;, &lt;code&gt;&amp;lt;name&amp;gt;_sum&lt;/code&gt; and &lt;code&gt;&amp;lt;name&amp;gt;_count&lt;/code&gt;. The upper bounds of the buckets (in seconds) are always &lt;code&gt;0.00005&lt;/code&gt;, &lt;code&gt;0.0001&lt;/code&gt;, &lt;code&gt;0.00025&lt;/code&gt;, &lt;code&gt;0.0005&lt;/code&gt;, &lt;code&gt;0.001&lt;/code&gt;, &lt;code&gt;0.0025&lt;/code&gt;, &lt;code&gt;0.005&lt;/code&gt;, &lt;code&gt;0.01&lt;/code&gt;, &lt;code&gt;0.025&lt;/code&gt;, &lt;code&gt;0.05&lt;/code&gt;, &lt;code&gt;0.1&lt;/code&gt;, &lt;code&gt;0.25&lt;/code&gt;, &lt;code&gt;0.5&lt;/code&gt;, &lt;code&gt;1&lt;/code&gt;, &lt;code&gt;2.5&lt;/code&gt;, &lt;code&gt;5&lt;/code&gt;, &lt;code&gt;10&lt;/code&gt; and &lt;code&gt;+Inf&lt;/code&gt;. &lt;code&gt;_sum&lt;/code&gt; is in seconds, and &lt;code&gt;_count&lt;/code&gt; equals the &lt;code&gt;+Inf&lt;/code&gt; bucket.&lt;/li&gt;&#xA;&lt;li&gt;Each metric has an English &lt;code&gt;# HELP&lt;/code&gt; line in &lt;code&gt;/metrics&lt;/code&gt;. This reference describes it in its own words and does not translate that line word for word.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;where-this-list-comes-from&#34;&gt;Where this list comes from&#xA;&lt;/h2&gt;&lt;p&gt;Part of the metric names are built by the program (for example &lt;code&gt;rradius_query_&amp;lt;name&amp;gt;&lt;/code&gt; for named queries). So this list was not copied from the source code. It was produced from a running &lt;code&gt;/metrics&lt;/code&gt; and then cross-checked against the source code.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Real output:&lt;/strong&gt; &lt;code&gt;rradiusd 0.1.0&lt;/code&gt;, built from the core repo commit of 2026-11-23, was run with four configurations. &lt;code&gt;/metrics&lt;/code&gt; was fetched once for each:&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;Configuration&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;Metric families&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;Minimal&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;the quick-start scenario (&lt;code&gt;[radius]&lt;/code&gt;, the sql handler, the accounting script), &lt;code&gt;log.auth = false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;39&lt;/td&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+ only&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;rradius-server/benchmarks/tacacs.toml&lt;/code&gt; (no &lt;code&gt;[radius]&lt;/code&gt;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;37&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Full&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Minimal, plus &lt;code&gt;[tacacs]&lt;/code&gt;, &lt;code&gt;[auth.lockout]&lt;/code&gt;, &lt;code&gt;[radius.accounting_log]&lt;/code&gt; and one &lt;code&gt;[queries.*]&lt;/code&gt;&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;External database&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Full, plus one &lt;code&gt;[databases.*]&lt;/code&gt; with &lt;code&gt;required_for_ready = true&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;53&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;From each output, the names and types on the &lt;code&gt;# TYPE&lt;/code&gt; lines were taken, and the label names and values from the sample lines. The union of the four is 53 metric families (the gauge of a named query counts as one).&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl -s http://127.0.0.1:9812/metrics | grep &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;^# TYPE&amp;#39;&lt;/span&gt; | wc -l&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Source code:&lt;/strong&gt; In every file under &lt;code&gt;rradius-core/src/&lt;/code&gt; (without the &lt;code&gt;#[cfg(test)]&lt;/code&gt; test modules), the names passed to &lt;code&gt;write_family&lt;/code&gt; and &lt;code&gt;write_histograms&lt;/code&gt;, and the &lt;code&gt;# HELP&lt;/code&gt; lines written directly, were collected. There are 53, and &lt;code&gt;rradius_query_{name}&lt;/code&gt; among them is the dynamic name of a named query. The extensions built into the core are empty (&lt;code&gt;rradius-core/src/extensions/mod.rs&lt;/code&gt;), so extensions add no metrics.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Result:&lt;/strong&gt; The two sets are identical, with 0 differences. Every metric family the code writes appeared in the real output, and every metric family in the real output can be found in the code. The section titles of this appendix were compared with the same set as well. The type, the label names and the fixed label values in each section were checked one by one against the real output, again with 0 differences. Labels that come from the configuration (the names of clients, databases and queries, and the label columns of a named query) have no fixed values listed. Only their source is given.&lt;/p&gt;&#xA;&lt;p&gt;The 39 metric families of the minimal configuration become 43 sample names once the &lt;code&gt;_bucket&lt;/code&gt;, &lt;code&gt;_sum&lt;/code&gt; and &lt;code&gt;_count&lt;/code&gt; of the histograms are expanded.&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Enterprise edition:&lt;/strong&gt; The enterprise edition&amp;rsquo;s &lt;code&gt;/metrics&lt;/code&gt; has more metrics after these, for its own features.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;overview&#34;&gt;Overview&#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;Metric family&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Present when&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Main 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;code&gt;rradius_radius_packets_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&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_responses_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&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_client_responses_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&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_status_server_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&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;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&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&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&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_response_seconds&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;histogram&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&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_requests_in_progress&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;with &lt;code&gt;[radius]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17, 19&lt;/td&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_requests_limit&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;with &lt;code&gt;[radius]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17, 19&lt;/td&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_tacacs_connections_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&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_tacacs_connections_open&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&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_tacacs_requests_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&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_tacacs_responses_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&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_traffic_bytes_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&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_tacacs_malformed_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&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_tacacs_response_seconds&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;histogram&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&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_open&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&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&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&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;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;16&lt;/td&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_is_leader&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;16&lt;/td&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_applied_index&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;16&lt;/td&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_seconds_without_leader&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;16&lt;/td&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_caught_up&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;16&lt;/td&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_db_batched_writes_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;16&lt;/td&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_db_split_batches_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;16&lt;/td&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_written_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;rradius_acct_spool_replayed_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;rradius_acct_spool_rejected_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;rradius_acct_spool_full_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;rradius_acct_spool_corrupt_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;rradius_acct_spool_bytes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;rradius_accounting_log_written_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;with &lt;code&gt;[radius.accounting_log]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;rradius_accounting_log_dropped_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;with &lt;code&gt;[radius.accounting_log]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;rradius_accounting_log_failures_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;with &lt;code&gt;[radius.accounting_log]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;rradius_auth_lockout_rejected_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;with &lt;code&gt;[auth.lockout]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;07&lt;/td&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_auth_lockouts_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;with &lt;code&gt;[auth.lockout]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;07&lt;/td&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_auth_lockout_untracked_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;with &lt;code&gt;[auth.lockout]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;07&lt;/td&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_password_checks_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;07&lt;/td&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_netlogon_logons_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;08&lt;/td&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_netlogon_channel_setups_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;08&lt;/td&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_netlogon_open_connections&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;08&lt;/td&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_external_db_failures_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;with &lt;code&gt;[databases.*]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;09&lt;/td&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_external_db_connections&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;with &lt;code&gt;[databases.*]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;09&lt;/td&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_external_db_connections_max&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;with &lt;code&gt;[databases.*]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;09&lt;/td&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_external_db_reachable&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;with a &lt;code&gt;[databases.*]&lt;/code&gt; that has &lt;code&gt;required_for_ready = true&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;09&lt;/td&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_query_{name}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;one for each &lt;code&gt;[queries.&amp;lt;name&amp;gt;]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;09&lt;/td&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_query_failures_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;with &lt;code&gt;[queries.*]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;09&lt;/td&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_query_dropped_rows_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;with &lt;code&gt;[queries.*]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;09&lt;/td&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_query_last_success_timestamp_seconds&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;with &lt;code&gt;[queries.*]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;09&lt;/td&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&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;rradius_reload_total&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&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_last_success_timestamp_seconds&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&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_build_info&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&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_start_time_seconds&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;gauge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&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;counter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;always&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;17&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;&amp;ldquo;Always&amp;rdquo; includes configurations that do not use the feature. For example, without &lt;code&gt;[tacacs]&lt;/code&gt; the TACACS+ metrics are still written, all with the value 0. The same is true of the Netlogon metrics when there is no netlogon handler.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;radius&#34;&gt;RADIUS&#xA;&lt;/h2&gt;&lt;p&gt;The RADIUS metrics cover both UDP and RadSec. Main chapter: &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;Chapter 17&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_radius_packets_total&#34;&gt;&lt;code&gt;rradius_radius_packets_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: &lt;code&gt;kind&lt;/code&gt; (&lt;code&gt;auth&lt;/code&gt;, &lt;code&gt;acct&lt;/code&gt;). Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The number of RADIUS requests that passed the checks and the retransmission detection and actually went into processing, split into authentication and accounting. Discarded packets, retransmissions and Status-Server do not count here. In a test that sent 6 Access-Requests, 1 request with a wrong shared secret and 1 Status-Server, &lt;code&gt;kind=&amp;quot;auth&amp;quot;&lt;/code&gt; was 6.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_radius_responses_total&#34;&gt;&lt;code&gt;rradius_radius_responses_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: &lt;code&gt;code&lt;/code&gt; (&lt;code&gt;access_accept&lt;/code&gt;, &lt;code&gt;access_reject&lt;/code&gt;, &lt;code&gt;access_challenge&lt;/code&gt;, &lt;code&gt;accounting_response&lt;/code&gt;). Present when: always. Alert: &lt;code&gt;RradiusManyRejects&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The responses that were sent, split by response type. A response that is sent again from the retransmission cache and a response to Status-Server do not count.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_radius_client_responses_total&#34;&gt;&lt;code&gt;rradius_radius_client_responses_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: &lt;code&gt;client&lt;/code&gt; (the &lt;code&gt;name&lt;/code&gt; of a &lt;code&gt;[[radius.clients]]&lt;/code&gt;), &lt;code&gt;code&lt;/code&gt; (&lt;code&gt;access_accept&lt;/code&gt;, &lt;code&gt;access_reject&lt;/code&gt;, &lt;code&gt;access_challenge&lt;/code&gt;, &lt;code&gt;accounting_response&lt;/code&gt;). Present when: always. Each client in the configuration has four samples. With no clients, this family has only the two lines &lt;code&gt;# HELP&lt;/code&gt; and &lt;code&gt;# TYPE&lt;/code&gt;. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The number of responses sent to each client. Client names come only from the configuration and do not grow with traffic. A client added by a reload starts at 0, and the samples of a removed client disappear. The &amp;ldquo;Busiest RADIUS clients&amp;rdquo; list of &lt;code&gt;status&lt;/code&gt; is calculated from this.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_radius_status_server_total&#34;&gt;&lt;code&gt;rradius_radius_status_server_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: none. Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The number of Status-Server packets that were answered.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_radius_duplicates_total&#34;&gt;&lt;code&gt;rradius_radius_duplicates_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: none. Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;Requests that the NAS sent again: they were answered directly from the retransmission cache, or dropped because the original was still being processed. If this value grows during a load test with &lt;code&gt;rradius-bench&lt;/code&gt;, the test requests are being treated as retransmissions, and what you measure is not the normal path.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_radius_discarded_total&#34;&gt;&lt;code&gt;rradius_radius_discarded_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: &lt;code&gt;reason&lt;/code&gt; (&lt;code&gt;overload&lt;/code&gt;, &lt;code&gt;unknown_client&lt;/code&gt;, &lt;code&gt;invalid&lt;/code&gt;, &lt;code&gt;database&lt;/code&gt;, &lt;code&gt;no_leader&lt;/code&gt;). Present when: always. Alert: &lt;code&gt;RradiusOverload&lt;/code&gt; (&lt;code&gt;overload&lt;/code&gt;), &lt;code&gt;RradiusDiscardingForTheDatabase&lt;/code&gt; (&lt;code&gt;database&lt;/code&gt;, &lt;code&gt;no_leader&lt;/code&gt;), &lt;code&gt;RradiusInvalidPackets&lt;/code&gt; (&lt;code&gt;invalid&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Packets that were received but not answered:&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;reason&lt;/code&gt;&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;&lt;code&gt;overload&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The requests in progress have reached &lt;code&gt;max_auth_inflight&lt;/code&gt; or &lt;code&gt;max_acct_inflight&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;unknown_client&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The source does not belong to any client&lt;/td&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;invalid&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Malformed, the authenticator or Message-Authenticator does not verify, or it does not fit the policy. The most common cause is a shared secret that does 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;database&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The cluster database is unavailable, so an Access-Request gets no 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;no_leader&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;cluster.stop_without_leader_ms&lt;/code&gt; has taken effect&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h4 id=&#34;rradius_radius_response_seconds&#34;&gt;&lt;code&gt;rradius_radius_response_seconds&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: histogram. Labels: &lt;code&gt;kind&lt;/code&gt; (&lt;code&gt;auth&lt;/code&gt;, &lt;code&gt;acct&lt;/code&gt;). Present when: always. Alert: &lt;code&gt;RradiusSlowLogins&lt;/code&gt; (p99 of &lt;code&gt;kind=&amp;quot;auth&amp;quot;&lt;/code&gt; above 1 second).&lt;/p&gt;&#xA;&lt;p&gt;The time a RADIUS request takes from passing the retransmission check to sending the response. Requests that get no response do not count. The p50 and p99 in &lt;code&gt;status&lt;/code&gt; are interpolated from this.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_radius_requests_in_progress&#34;&gt;&lt;code&gt;rradius_radius_requests_in_progress&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: gauge. Labels: &lt;code&gt;kind&lt;/code&gt; (&lt;code&gt;auth&lt;/code&gt;, &lt;code&gt;acct&lt;/code&gt;). Present when: the server has &lt;code&gt;[radius]&lt;/code&gt;. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The number of RADIUS requests being processed right now. When it gets close to &lt;code&gt;rradius_radius_requests_limit&lt;/code&gt;, further requests are dropped with &lt;code&gt;overload&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_radius_requests_limit&#34;&gt;&lt;code&gt;rradius_radius_requests_limit&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: gauge. Labels: &lt;code&gt;kind&lt;/code&gt; (&lt;code&gt;auth&lt;/code&gt;, &lt;code&gt;acct&lt;/code&gt;). Present when: the server has &lt;code&gt;[radius]&lt;/code&gt;. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The number of requests that can be processed at the same time. This is the value of &lt;code&gt;radius.max_auth_inflight&lt;/code&gt; and &lt;code&gt;radius.max_acct_inflight&lt;/code&gt; (both default to 4096). For how to adjust them, see &lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;Chapter 19&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;tacacs&#34;&gt;TACACS+&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;Chapter 17&lt;/a&gt;. For TACACS+ itself, see &lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;Chapter 12&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_tacacs_connections_total&#34;&gt;&lt;code&gt;rradius_tacacs_connections_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: &lt;code&gt;result&lt;/code&gt; (&lt;code&gt;accepted&lt;/code&gt;, &lt;code&gt;refused&lt;/code&gt;). Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The outcome of TACACS+ connections. &lt;code&gt;refused&lt;/code&gt; is a connection that was closed before any data was read: the source does not belong to any &lt;code&gt;[[tacacs.clients]]&lt;/code&gt;, or it went over &lt;code&gt;tacacs.max_connections_per_source&lt;/code&gt; or &lt;code&gt;max_connections&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_tacacs_connections_open&#34;&gt;&lt;code&gt;rradius_tacacs_connections_open&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: gauge. Labels: none. Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The number of TACACS+ connections that are open right now.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_tacacs_requests_total&#34;&gt;&lt;code&gt;rradius_tacacs_requests_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: &lt;code&gt;type&lt;/code&gt; (&lt;code&gt;authen&lt;/code&gt;, &lt;code&gt;author&lt;/code&gt;, &lt;code&gt;acct&lt;/code&gt;). Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The number of TACACS+ requests, split into authentication, authorization and accounting. One login counts as one request, however many packets an ASCII login uses back and forth.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_tacacs_responses_total&#34;&gt;&lt;code&gt;rradius_tacacs_responses_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: &lt;code&gt;type&lt;/code&gt; (&lt;code&gt;authen&lt;/code&gt;, &lt;code&gt;author&lt;/code&gt;, &lt;code&gt;acct&lt;/code&gt;), &lt;code&gt;status&lt;/code&gt;. Present when: always (every label combination is 0 at startup). Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The number of TACACS+ replies written to clients, split by the status in the reply. For authentication the statuses are &lt;code&gt;pass&lt;/code&gt;, &lt;code&gt;fail&lt;/code&gt;, &lt;code&gt;getdata&lt;/code&gt;, &lt;code&gt;getuser&lt;/code&gt;, &lt;code&gt;getpass&lt;/code&gt;, &lt;code&gt;restart&lt;/code&gt; and &lt;code&gt;error&lt;/code&gt;. For authorization they are &lt;code&gt;pass&lt;/code&gt;, &lt;code&gt;fail&lt;/code&gt; and &lt;code&gt;error&lt;/code&gt;. For accounting they are &lt;code&gt;success&lt;/code&gt; and &lt;code&gt;error&lt;/code&gt;. Only replies that have actually been written are counted. The TACACS+ section of &lt;code&gt;status&lt;/code&gt; adds them up into the &lt;code&gt;Replies&lt;/code&gt; line.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_traffic_bytes_total&#34;&gt;&lt;code&gt;rradius_traffic_bytes_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: &lt;code&gt;protocol&lt;/code&gt; (&lt;code&gt;radius&lt;/code&gt;, &lt;code&gt;tacacs&lt;/code&gt;), &lt;code&gt;direction&lt;/code&gt; (&lt;code&gt;in&lt;/code&gt;, &lt;code&gt;out&lt;/code&gt;). Present when: always (all four label combinations are 0 at startup). Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The bytes of protocol packets that the server received and wrote. For &lt;code&gt;radius&lt;/code&gt;, this is the length of the RADIUS packets received on the UDP ports and of the responses written back. For &lt;code&gt;tacacs&lt;/code&gt;, it is the length of the TACACS+ packets read (the 12-byte header plus the body) and of the replies written, both for plain TCP and for TACACS+ over TLS. &lt;code&gt;in&lt;/code&gt; is added when a complete packet is received, even if it is dropped afterwards. &lt;code&gt;out&lt;/code&gt; is added only after the write succeeds.&lt;/p&gt;&#xA;&lt;p&gt;These are the bytes of the protocol packets. They do not include the IP, UDP, TCP and TLS headers or the record overhead, so they are lower than what a network interface sees (for example, 28 bytes less per RADIUS packet over IPv4). RadSec, proxy upstreams, CoA sent by the server, and cluster and database traffic are not included. The RADIUS and TACACS+ sections of &lt;code&gt;status&lt;/code&gt; show this as &lt;code&gt;In bytes&lt;/code&gt; and &lt;code&gt;Out bytes&lt;/code&gt;, switched automatically to KiB, MiB and so on (powers of 1024). &lt;code&gt;--json&lt;/code&gt; and &lt;code&gt;/metrics&lt;/code&gt; still give bytes.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_tacacs_malformed_total&#34;&gt;&lt;code&gt;rradius_tacacs_malformed_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: none. Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;Requests whose content does not make sense after decryption. The most common cause is a shared secret that does not match.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_tacacs_response_seconds&#34;&gt;&lt;code&gt;rradius_tacacs_response_seconds&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: histogram. Labels: &lt;code&gt;type&lt;/code&gt; (&lt;code&gt;authen&lt;/code&gt;, &lt;code&gt;author&lt;/code&gt;, &lt;code&gt;acct&lt;/code&gt;). Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The time from reading a packet to writing the response. For authentication, each packet is counted once.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;eap&#34;&gt;EAP&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;Chapter 17&lt;/a&gt;. For EAP itself, see &lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;Chapter 11&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_eap_sessions_open&#34;&gt;&lt;code&gt;rradius_eap_sessions_open&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: gauge. Labels: none. Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The number of EAP conversations in progress right now.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_eap_sessions_total&#34;&gt;&lt;code&gt;rradius_eap_sessions_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: &lt;code&gt;method&lt;/code&gt; (&lt;code&gt;tls&lt;/code&gt;, &lt;code&gt;peap&lt;/code&gt;, &lt;code&gt;ttls&lt;/code&gt;), &lt;code&gt;result&lt;/code&gt; (&lt;code&gt;accept&lt;/code&gt;, &lt;code&gt;reject&lt;/code&gt;, &lt;code&gt;timeout&lt;/code&gt;, &lt;code&gt;overload&lt;/code&gt;, &lt;code&gt;replaced&lt;/code&gt;, &lt;code&gt;evicted&lt;/code&gt;). Present when: always. Alert: &lt;code&gt;RradiusEapSessionsLost&lt;/code&gt; (&lt;code&gt;evicted&lt;/code&gt;, &lt;code&gt;overload&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;How EAP conversations end:&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;result&lt;/code&gt;&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;&lt;code&gt;accept&lt;/code&gt;, &lt;code&gt;reject&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The conversation finished, accepted or rejected&lt;/td&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;timeout&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The conversation went too long without a next step and was cleaned 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;&lt;code&gt;overload&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Refused because of a limit or load, for example the device already has the maximum number of conversations&lt;/td&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;replaced&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The same device started again after stopping at the Identity step, and the old conversation was replaced&lt;/td&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;evicted&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The total number of conversations, or the number for one client, is full, and the one that had been idle longest was pushed out&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;cluster-and-cluster-database&#34;&gt;Cluster and cluster database&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;Chapter 16&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_cluster_leader&#34;&gt;&lt;code&gt;rradius_cluster_leader&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: gauge. Labels: none. Present when: always. Alert: &lt;code&gt;RradiusNoLeader&lt;/code&gt; (equal to 0 for 1 minute).&lt;/p&gt;&#xA;&lt;p&gt;1 when this node has a leader it can write to, otherwise 0. A single node is also 1.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_cluster_is_leader&#34;&gt;&lt;code&gt;rradius_cluster_is_leader&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: gauge. Labels: none. Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;1 when this node is the leader.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_cluster_applied_index&#34;&gt;&lt;code&gt;rradius_cluster_applied_index&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: gauge. Labels: none. Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The number of the last Raft log entry that the local copy applied. If the values on the nodes are close to each other, replication is keeping up.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_cluster_seconds_without_leader&#34;&gt;&lt;code&gt;rradius_cluster_seconds_without_leader&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: gauge. Labels: none. Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;For how many seconds there has been no leader. It is 0 when there is a leader. When it goes over &lt;code&gt;cluster.stop_without_leader_ms&lt;/code&gt;, &lt;code&gt;/readyz&lt;/code&gt; returns 503 &lt;code&gt;no leader&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_cluster_caught_up&#34;&gt;&lt;code&gt;rradius_cluster_caught_up&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: gauge. Labels: none. Present when: always. Alert: &lt;code&gt;RradiusNotCaughtUp&lt;/code&gt; (equal to 0 for 5 minutes).&lt;/p&gt;&#xA;&lt;p&gt;1 when, after the node started, the local copy has caught up with the cluster. Before that it is 0, because the data in use may be behind.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_db_batched_writes_total&#34;&gt;&lt;code&gt;rradius_db_batched_writes_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: none. Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The number of script writes that were committed in the same transaction together with other writes.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_db_split_batches_total&#34;&gt;&lt;code&gt;rradius_db_split_batches_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: none. Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;How many times a merged transaction failed and was split up to find out which write failed.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;accounting-spool-and-accounting-log-file&#34;&gt;Accounting spool and accounting log file&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;Chapter 13&lt;/a&gt;. The accounting spool holds accounting requests on disk, to be replayed when the database is back.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_acct_spool_written_total&#34;&gt;&lt;code&gt;rradius_acct_spool_written_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: none. Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The number of accounting requests written to the spool.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_acct_spool_replayed_total&#34;&gt;&lt;code&gt;rradius_acct_spool_replayed_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: none. Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The number of accounting requests replayed from the spool and accepted by the script.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_acct_spool_rejected_total&#34;&gt;&lt;code&gt;rradius_acct_spool_rejected_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: none. Present when: always. Alert: &lt;code&gt;RradiusAccountingSpoolLoss&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The number of accounting requests that were rejected during replay and moved to &lt;code&gt;rejected.log&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_acct_spool_full_total&#34;&gt;&lt;code&gt;rradius_acct_spool_full_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: none. Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The number of accounting requests that were not written to the spool because the spool was full or the disk had an error.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_acct_spool_corrupt_total&#34;&gt;&lt;code&gt;rradius_acct_spool_corrupt_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: none. Present when: always. Alert: &lt;code&gt;RradiusAccountingSpoolLoss&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The number of spool files that were damaged and moved aside.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_acct_spool_bytes&#34;&gt;&lt;code&gt;rradius_acct_spool_bytes&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: gauge. Labels: none. Present when: always. Alert: &lt;code&gt;RradiusAccountingSpoolBacklog&lt;/code&gt; (above 0 for 15 minutes).&lt;/p&gt;&#xA;&lt;p&gt;The bytes in the spool that are waiting to be replayed.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_accounting_log_written_total&#34;&gt;&lt;code&gt;rradius_accounting_log_written_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: none. Present when: with &lt;code&gt;[radius.accounting_log]&lt;/code&gt;. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The number of accounting requests written to the accounting log file.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_accounting_log_dropped_total&#34;&gt;&lt;code&gt;rradius_accounting_log_dropped_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: none. Present when: with &lt;code&gt;[radius.accounting_log]&lt;/code&gt;. Alert: &lt;code&gt;RradiusAccountingLogDropping&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The number of accounting requests that were not written because the queue of the accounting log file was full.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_accounting_log_failures_total&#34;&gt;&lt;code&gt;rradius_accounting_log_failures_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: &lt;code&gt;stage&lt;/code&gt; (&lt;code&gt;open&lt;/code&gt;, &lt;code&gt;write&lt;/code&gt;). Present when: with &lt;code&gt;[radius.accounting_log]&lt;/code&gt;. Alert: &lt;code&gt;RradiusAccountingLogDropping&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;How many times opening the accounting log file failed and how many times writing to it failed.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;login-lockout-and-password-checks&#34;&gt;Login lockout and password checks&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;Chapter 07&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_auth_lockout_rejected_total&#34;&gt;&lt;code&gt;rradius_auth_lockout_rejected_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: none. Present when: with &lt;code&gt;[auth.lockout]&lt;/code&gt;. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The number of logins that were rejected directly because the account plus source, or the whole account, is locked, or because too many logins are waiting for a decision at the same time.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_auth_lockouts_total&#34;&gt;&lt;code&gt;rradius_auth_lockouts_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: none. Present when: with &lt;code&gt;[auth.lockout]&lt;/code&gt;. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;How many times a lockout started.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_auth_lockout_untracked_total&#34;&gt;&lt;code&gt;rradius_auth_lockout_untracked_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: none. Present when: with &lt;code&gt;[auth.lockout]&lt;/code&gt;. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The number of failures that were not counted because the lockout table was full of entries that are currently locked.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_password_checks_total&#34;&gt;&lt;code&gt;rradius_password_checks_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: &lt;code&gt;scheme&lt;/code&gt; (&lt;code&gt;clear&lt;/code&gt;, &lt;code&gt;none&lt;/code&gt;, &lt;code&gt;crypt&lt;/code&gt;, &lt;code&gt;md5&lt;/code&gt;, &lt;code&gt;smd5&lt;/code&gt;, &lt;code&gt;sha&lt;/code&gt;, &lt;code&gt;ssha&lt;/code&gt;, &lt;code&gt;sha224&lt;/code&gt;, &lt;code&gt;ssha224&lt;/code&gt;, &lt;code&gt;sha256&lt;/code&gt;, &lt;code&gt;ssha256&lt;/code&gt;, &lt;code&gt;sha384&lt;/code&gt;, &lt;code&gt;ssha384&lt;/code&gt;, &lt;code&gt;sha512&lt;/code&gt;, &lt;code&gt;ssha512&lt;/code&gt;, &lt;code&gt;pbkdf2-sha1&lt;/code&gt;, &lt;code&gt;pbkdf2-sha256&lt;/code&gt;, &lt;code&gt;pbkdf2-sha512&lt;/code&gt;, &lt;code&gt;x-pbkdf2&lt;/code&gt;, &lt;code&gt;ns-mta-md5&lt;/code&gt;, &lt;code&gt;nthash&lt;/code&gt;, &lt;code&gt;argon2&lt;/code&gt;, &lt;code&gt;unknown&lt;/code&gt;), &lt;code&gt;result&lt;/code&gt; (&lt;code&gt;failed&lt;/code&gt;, &lt;code&gt;ok&lt;/code&gt;). Present when: always, 23 × 2 samples. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;How many times a login password was compared with the stored password, split by the format of the stored value and by the result. &lt;code&gt;none&lt;/code&gt; is a value with no format prefix. &lt;code&gt;unknown&lt;/code&gt; is a prefix that is not recognized. &lt;code&gt;pbkdf2-sha1&lt;/code&gt; covers both of its spellings. In a test with the quick-start scenario, &lt;code&gt;alice&lt;/code&gt; (plain text) was counted under &lt;code&gt;none&lt;/code&gt; and &lt;code&gt;bob&lt;/code&gt; (a bcrypt hash) under &lt;code&gt;crypt&lt;/code&gt;. Use it to find out which old password formats are still in the table.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;netlogon&#34;&gt;Netlogon&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;Chapter 08&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_netlogon_logons_total&#34;&gt;&lt;code&gt;rradius_netlogon_logons_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: &lt;code&gt;result&lt;/code&gt; (&lt;code&gt;accept&lt;/code&gt;, &lt;code&gt;reject&lt;/code&gt;, &lt;code&gt;no_such_user&lt;/code&gt;, &lt;code&gt;unavailable&lt;/code&gt;). Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The MS-CHAPv2 logins that the netlogon handler asked a domain controller about, split by result. &lt;code&gt;unavailable&lt;/code&gt; means no domain controller could answer.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_netlogon_channel_setups_total&#34;&gt;&lt;code&gt;rradius_netlogon_channel_setups_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: &lt;code&gt;result&lt;/code&gt; (&lt;code&gt;ok&lt;/code&gt;, &lt;code&gt;failed&lt;/code&gt;). Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;How many times a Netlogon secure channel was set up with a domain controller, split by result.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_netlogon_open_connections&#34;&gt;&lt;code&gt;rradius_netlogon_open_connections&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: gauge. Labels: none. Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The number of Netlogon connections that are open and encrypted right now.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;external-databases&#34;&gt;External databases&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;Chapter 09&lt;/a&gt;. The &lt;code&gt;database&lt;/code&gt; label is the name of a &lt;code&gt;[databases.&amp;lt;name&amp;gt;]&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_external_db_failures_total&#34;&gt;&lt;code&gt;rradius_external_db_failures_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: &lt;code&gt;database&lt;/code&gt; (the name in the configuration), &lt;code&gt;reason&lt;/code&gt; (&lt;code&gt;unavailable&lt;/code&gt;, &lt;code&gt;mistake&lt;/code&gt;, &lt;code&gt;unknown&lt;/code&gt;). Present when: with &lt;code&gt;[databases.*]&lt;/code&gt;. Alert: &lt;code&gt;RradiusExternalDatabaseFailing&lt;/code&gt; (&lt;code&gt;unavailable&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;How many calls to each external database failed. &lt;code&gt;unavailable&lt;/code&gt; means it could not be reached or timed out, &lt;code&gt;mistake&lt;/code&gt; means the SQL or a parameter is wrong, and &lt;code&gt;unknown&lt;/code&gt; means anything else.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_external_db_connections&#34;&gt;&lt;code&gt;rradius_external_db_connections&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: gauge. Labels: &lt;code&gt;database&lt;/code&gt; (the name in the configuration), &lt;code&gt;state&lt;/code&gt; (&lt;code&gt;in_use&lt;/code&gt;, &lt;code&gt;idle&lt;/code&gt;). Present when: with &lt;code&gt;[databases.*]&lt;/code&gt;. Alert: &lt;code&gt;RradiusExternalDatabasePoolFull&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The number of connections in the connection pool. &lt;code&gt;in_use&lt;/code&gt; are those handed to a caller or being created, and &lt;code&gt;idle&lt;/code&gt; are those that are open and idle.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_external_db_connections_max&#34;&gt;&lt;code&gt;rradius_external_db_connections_max&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: gauge. Labels: &lt;code&gt;database&lt;/code&gt; (the name in the configuration). Present when: with &lt;code&gt;[databases.*]&lt;/code&gt;. Alert: &lt;code&gt;RradiusExternalDatabasePoolFull&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The most connections the pool keeps, which is &lt;code&gt;pool_size&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_external_db_reachable&#34;&gt;&lt;code&gt;rradius_external_db_reachable&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: gauge. Labels: &lt;code&gt;database&lt;/code&gt; (the name in the configuration). Present when: a database has &lt;code&gt;required_for_ready = true&lt;/code&gt;. Only those databases are listed. Alert: &lt;code&gt;RradiusExternalDatabaseUnreachable&lt;/code&gt; (equal to 0 for 2 minutes).&lt;/p&gt;&#xA;&lt;p&gt;1 when the readiness check can reach this database, otherwise 0. When it is 0, &lt;code&gt;/readyz&lt;/code&gt; returns 503 &lt;code&gt;database &amp;lt;name&amp;gt; unreachable&lt;/code&gt;. Measured:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_external_db_reachable{database=&amp;#34;billing&amp;#34;} 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;&#xA;&lt;h2 id=&#34;named-queries&#34;&gt;Named queries&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;Chapter 09&lt;/a&gt;. The &lt;code&gt;query&lt;/code&gt; label is the name of a &lt;code&gt;[queries.&amp;lt;name&amp;gt;]&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_query_name&#34;&gt;&lt;code&gt;rradius_query_{name}&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: gauge. Labels: the columns listed in &lt;code&gt;[queries.&amp;lt;name&amp;gt;] labels&lt;/code&gt;. The label name is the column name. Present when: one for each &lt;code&gt;[queries.&amp;lt;name&amp;gt;]&lt;/code&gt;. The name is &lt;code&gt;rradius_query_&lt;/code&gt; plus the name of the query. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The result of each row of a named query. The value is taken from the &lt;code&gt;value&lt;/code&gt; column. &lt;code&gt;# HELP&lt;/code&gt; is the &lt;code&gt;help&lt;/code&gt; from the configuration, or a text with the name of the query if none is set. Before the query has ever succeeded, there are only the two lines &lt;code&gt;# HELP&lt;/code&gt; and &lt;code&gt;# TYPE&lt;/code&gt;, and no samples. Measured:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# HELP rradius_query_accounts_by_state Accounts in the users table, by state.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;# TYPE rradius_query_accounts_by_state gauge&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_query_accounts_by_state{state=&amp;#34;disabled&amp;#34;} 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rradius_query_accounts_by_state{state=&amp;#34;enabled&amp;#34;} 2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;rradius_query_failures_total&#34;&gt;&lt;code&gt;rradius_query_failures_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: &lt;code&gt;query&lt;/code&gt; (the name of the query), &lt;code&gt;reason&lt;/code&gt; (&lt;code&gt;timeout&lt;/code&gt;, &lt;code&gt;error&lt;/code&gt;, &lt;code&gt;shape&lt;/code&gt;). Present when: with &lt;code&gt;[queries.*]&lt;/code&gt;. Alert: &lt;code&gt;RradiusNamedQueryFailing&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;How many times each named query failed. &lt;code&gt;timeout&lt;/code&gt; means there was no result in time. &lt;code&gt;error&lt;/code&gt; means the database rejected the SQL or could not be reached. &lt;code&gt;shape&lt;/code&gt; means the result is missing a column or a value has the wrong type.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_query_dropped_rows_total&#34;&gt;&lt;code&gt;rradius_query_dropped_rows_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: &lt;code&gt;query&lt;/code&gt; (the name of the query), &lt;code&gt;reason&lt;/code&gt; (&lt;code&gt;null_value&lt;/code&gt;, &lt;code&gt;over_limit&lt;/code&gt;). Present when: with &lt;code&gt;[queries.*]&lt;/code&gt;. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The number of rows from a successful query that did not become samples. &lt;code&gt;null_value&lt;/code&gt; means the value column is NULL, and &lt;code&gt;over_limit&lt;/code&gt; means the rows went over &lt;code&gt;max_rows&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_query_last_success_timestamp_seconds&#34;&gt;&lt;code&gt;rradius_query_last_success_timestamp_seconds&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: gauge. Labels: &lt;code&gt;query&lt;/code&gt; (the name of the query). Present when: with &lt;code&gt;[queries.*]&lt;/code&gt;. Alert: &lt;code&gt;RradiusNamedQueryStale&lt;/code&gt; (no success for more than 120 seconds).&lt;/p&gt;&#xA;&lt;p&gt;The Unix time of the last success of each named query. It is 0 if the query has never succeeded.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;http-calls-from-scripts&#34;&gt;HTTP calls from scripts&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;Chapter 10&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_script_http_requests_total&#34;&gt;&lt;code&gt;rradius_script_http_requests_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: &lt;code&gt;result&lt;/code&gt; (&lt;code&gt;ok&lt;/code&gt;, &lt;code&gt;timeout&lt;/code&gt;, &lt;code&gt;error&lt;/code&gt;, &lt;code&gt;denied&lt;/code&gt;, &lt;code&gt;too_large&lt;/code&gt;, &lt;code&gt;busy&lt;/code&gt;). Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The results of script calls to &lt;code&gt;http_request&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;result&lt;/code&gt;&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;&lt;code&gt;ok&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A response was received&lt;/td&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;timeout&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The time limit was exceeded&lt;/td&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;error&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The connection or the request failed&lt;/td&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;denied&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The host is not in &lt;code&gt;lua.http.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;too_large&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The response went over the size 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;busy&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The waiting requests to the same host have reached the limit&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;reload-version-and-log&#34;&gt;Reload, version and log&#xA;&lt;/h2&gt;&lt;p&gt;Main chapter: &lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;Chapter 17&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_reload_total&#34;&gt;&lt;code&gt;rradius_reload_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: &lt;code&gt;result&lt;/code&gt; (&lt;code&gt;ok&lt;/code&gt;, &lt;code&gt;error&lt;/code&gt;). Present when: always. Alert: &lt;code&gt;RradiusReloadFailed&lt;/code&gt; (&lt;code&gt;error&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;The number of reloads, split by result. When one fails, the server keeps using its previous configuration and the log says &lt;code&gt;reload failed, keeping the running configuration: …&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_reload_last_success_timestamp_seconds&#34;&gt;&lt;code&gt;rradius_reload_last_success_timestamp_seconds&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: gauge. Labels: none. Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The Unix time of the last successful reload. It is 0 if there has been no reload.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_build_info&#34;&gt;&lt;code&gt;rradius_build_info&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: gauge. Labels: &lt;code&gt;version&lt;/code&gt; (the version of the program, for example &lt;code&gt;0.1.0&lt;/code&gt;). Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The value is always 1, and the version is in the label. Use it to see whether all the nodes in a cluster run the same version.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_start_time_seconds&#34;&gt;&lt;code&gt;rradius_start_time_seconds&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: gauge. Labels: none. Present when: always. Alert: —.&lt;/p&gt;&#xA;&lt;p&gt;The Unix time the process started. &lt;code&gt;time() - rradius_start_time_seconds&lt;/code&gt; is how long it has been running. If this value changes, the process was restarted, and all counters start again from 0.&lt;/p&gt;&#xA;&lt;h4 id=&#34;rradius_log_dropped_lines_total&#34;&gt;&lt;code&gt;rradius_log_dropped_lines_total&lt;/code&gt;&#xA;&lt;/h4&gt;&lt;p&gt;Type: counter. Labels: none. Present when: always. Alert: &lt;code&gt;RradiusLogLinesDropped&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The number of log lines that were dropped because the output could not keep up, or that failed to be written.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; A metric has &amp;ldquo;disappeared&amp;rdquo; from a Grafana chart.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; It appears only with the matching configuration. For example, after you remove &lt;code&gt;[auth.lockout]&lt;/code&gt; and restart, the &lt;code&gt;rradius_auth_lockout_*&lt;/code&gt; metrics are no longer written. After a named query is renamed, the gauge with the old name is gone too.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Check the &amp;ldquo;Present when&amp;rdquo; column in the &lt;a class=&#34;link&#34; href=&#34;#overview&#34; &gt;Overview&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; A counter suddenly falls back to a small number, and &lt;code&gt;rate()&lt;/code&gt; shows a spike or a gap.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; The node was restarted and the counters started from 0. &lt;code&gt;rradius_start_time_seconds&lt;/code&gt; changes with it.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Always query with &lt;code&gt;rate()&lt;/code&gt; and &lt;code&gt;increase()&lt;/code&gt;, which handle the reset. In this case &lt;code&gt;status&lt;/code&gt; prints &lt;code&gt;counters reset since the previous sample: the server restarted&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;rradius_radius_packets_total&lt;/code&gt; differs a lot between the three nodes of a cluster.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; Metrics are counted per node. The numbers show which node the NAS sent its requests to.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; For the total, use &lt;code&gt;sum without (instance) (…)&lt;/code&gt;, or &lt;code&gt;status --cluster&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; A client is missing from &lt;code&gt;rradius_radius_client_responses_total&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; A reload removed it from the configuration, and its samples were removed with it.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; Check that the &lt;code&gt;name&lt;/code&gt; of this client is still in the configuration.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;08 LDAP and Active Directory&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09 External databases and named queries&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;10 Writing policies in Lua&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;11 802.1X and EAP&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;12 TACACS+ device administration&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13 Accounting and sessions&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16 Clusters and high availability&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17 Monitoring, status and logs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../19-performance/&#34; &gt;19 Performance tuning and load testing&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>93 Appendix D: Lua API reference</title>
            <link>https://embark.systems/en/rradius/oss/93-lua-reference/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/93-lua-reference/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Look up the signature, return value, errors and limits of every global variable and function in a script&lt;/li&gt;&#xA;&lt;li&gt;Know which Lua type an attribute or database value becomes&lt;/li&gt;&#xA;&lt;li&gt;Know which built-in Lua libraries a script can use and which were removed&lt;/li&gt;&#xA;&lt;li&gt;Check this list against the code yourself&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: you have read &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;chapter 10&lt;/a&gt;. This appendix lists the API only. How to write a policy, and why, is in chapter 10.&lt;/p&gt;&#xA;&lt;p&gt;The contents of this appendix come from where the script environment is registered in &lt;code&gt;rradius-core/src/lua_engine.rs&lt;/code&gt; (the &lt;code&gt;BINDER&lt;/code&gt; constant and &lt;code&gt;make_binder&lt;/code&gt;) and from &lt;code&gt;rradius-core/src/script_http.rs&lt;/code&gt;. The error messages were produced on the quick-start and are copied as they appear.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#the-script-environment&#34; &gt;The script environment&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#global-variables&#34; &gt;Global variables&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#request-attributes&#34; &gt;Request attributes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#cluster-database&#34; &gt;Cluster database&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#external-databases&#34; &gt;External databases&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#http&#34; &gt;HTTP&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#logging-and-utilities&#34; &gt;Logging and utilities&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#coa-and-disconnect&#34; &gt;CoA and Disconnect&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#built-in-libraries&#34; &gt;Built-in libraries&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#form-of-errors&#34; &gt;Form of errors&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#limits&#34; &gt;Limits&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#how-to-compare&#34; &gt;How to compare&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;the-script-environment&#34;&gt;The script environment&#xA;&lt;/h2&gt;&lt;p&gt;Scripts are Luau (an extension of Lua 5.1). Each request has its own global table: the names listed in this appendix are bound to that request, and any other name is looked up in the read-only built-in libraries.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Global variables do not survive to the next request. Tested: a script writes &lt;code&gt;seen = true&lt;/code&gt;, and the next request reads &lt;code&gt;seen&lt;/code&gt; as &lt;code&gt;nil&lt;/code&gt;. To remember something, write it to the cluster database.&lt;/li&gt;&#xA;&lt;li&gt;The built-in libraries are read-only. Tested: &lt;code&gt;string.upper = nil&lt;/code&gt; gives &lt;code&gt;attempt to modify a readonly table&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The value the script &lt;code&gt;return&lt;/code&gt;s at the end decides the result:&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;Return value&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;&lt;code&gt;&#39;accept&#39;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&lt;code&gt;&#39;reject&#39;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;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;&#39;ignore&#39;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Only meaningful in the &lt;code&gt;lua&lt;/code&gt; handler of an auth chain: pass to the next handler. A top-level script that returns it is 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;&#39;challenge&#39;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Only valid for a RADIUS login (&lt;code&gt;protocol == &#39;radius&#39;&lt;/code&gt; and &lt;code&gt;phase == &#39;authentication&#39;&lt;/code&gt;): send an Access-Challenge. Anywhere else it is a 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;Any other value, no return, or an error&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reject&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Only the exact same lower-case string counts; &lt;code&gt;&#39;ACCEPT&#39;&lt;/code&gt; is a reject. For an accounting request, &amp;ldquo;reject&amp;rdquo; means no response, and the log says &lt;code&gt;Lua script did not accept accounting (radius, client localhost)&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;global-variables&#34;&gt;Global variables&#xA;&lt;/h2&gt;&lt;p&gt;Global variables are set before the script starts and do not change during the request.&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;Variable&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;When it has a 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;&lt;code&gt;protocol&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Always&lt;/td&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;phase&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Always&lt;/td&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;client&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Always&lt;/td&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_user&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string or &lt;code&gt;nil&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The &lt;code&gt;lua&lt;/code&gt; handler in an auth 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;&lt;code&gt;replayed&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;boolean&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Always&lt;/td&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_method&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string or &lt;code&gt;nil&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP logins&lt;/td&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_subject&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string or &lt;code&gt;nil&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After an EAP-TLS certificate passes&lt;/td&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_subject_attrs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;table or &lt;code&gt;nil&lt;/code&gt;&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;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;protocol&#34;&gt;protocol&#xA;&lt;/h3&gt;&lt;p&gt;The protocol of the request: &lt;code&gt;&#39;radius&#39;&lt;/code&gt; or &lt;code&gt;&#39;tacacs&#39;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;phase&#34;&gt;phase&#xA;&lt;/h3&gt;&lt;p&gt;The phase of the request:&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;protocol&lt;/code&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Values of &lt;code&gt;phase&lt;/code&gt;&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;&#39;radius&#39;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&#39;authentication&#39;&lt;/code&gt; (Access-Request), &lt;code&gt;&#39;accounting&#39;&lt;/code&gt; (Accounting-Request)&lt;/td&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;&#39;tacacs&#39;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&#39;authentication&#39;&lt;/code&gt;, &lt;code&gt;&#39;authorization&#39;&lt;/code&gt;, &lt;code&gt;&#39;accounting&#39;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;client&#34;&gt;client&#xA;&lt;/h3&gt;&lt;p&gt;Which client the request came from: the &lt;code&gt;name&lt;/code&gt; of the &lt;code&gt;[[radius.clients]]&lt;/code&gt; or &lt;code&gt;[[tacacs.clients]]&lt;/code&gt; entry in the configuration. The quick-start client is called &lt;code&gt;localhost&lt;/code&gt;, so the value is &lt;code&gt;&#39;localhost&#39;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;auth_user&#34;&gt;auth_user&#xA;&lt;/h3&gt;&lt;p&gt;The account name after the auth chain has normalized it. For example, when &lt;code&gt;[auth.username]&lt;/code&gt; sets &lt;code&gt;lowercase = true&lt;/code&gt;, a login as &lt;code&gt;Alice&lt;/code&gt; sees &lt;code&gt;&#39;alice&#39;&lt;/code&gt;, while &lt;code&gt;get_attr(&#39;User-Name&#39;)&lt;/code&gt; is still the original &lt;code&gt;&#39;Alice&#39;&lt;/code&gt; from the request (tested). Only the &lt;code&gt;lua&lt;/code&gt; handler in an auth chain gets it; in a top-level script it is always &lt;code&gt;nil&lt;/code&gt;, so use &lt;code&gt;get_attr(&#39;User-Name&#39;)&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;replayed&#34;&gt;replayed&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;true&lt;/code&gt; means this accounting request was replayed from the accounting spool (a temporary store on disk where requests wait to be sent again); every other request is &lt;code&gt;false&lt;/code&gt;. When replayed, &lt;code&gt;Acct-Delay-Time&lt;/code&gt; is increased by the number of seconds the request waited in the spool.&lt;/p&gt;&#xA;&lt;h3 id=&#34;eap_method&#34;&gt;eap_method&#xA;&lt;/h3&gt;&lt;p&gt;The EAP method that authenticates this request:&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;Value&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;When&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;&#39;tls&#39;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;After the EAP-TLS certificate passes, when the auth chain or the top-level script is asked whether this name may log in&lt;/td&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;&#39;peap&#39;&lt;/code&gt;, &lt;code&gt;&#39;ttls&#39;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The inner login inside a PEAP or TTLS tunnel (goes through the auth chain only)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;For a request that is not EAP, it is &lt;code&gt;nil&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;tls_subject&#34;&gt;tls_subject&#xA;&lt;/h3&gt;&lt;p&gt;The subject of the EAP-TLS certificate, as a string, for example &lt;code&gt;&#39;CN=laptop-001&#39;&lt;/code&gt;. For other requests it is &lt;code&gt;nil&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;tls_subject_attrs&#34;&gt;tls_subject_attrs&#xA;&lt;/h3&gt;&lt;p&gt;The subject of the same certificate split into a table: each attribute name maps to an array, because a name can repeat, for example &lt;code&gt;{ CN = { &#39;laptop-001&#39; } }&lt;/code&gt;. The values have their escape characters removed. For other requests it is &lt;code&gt;nil&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-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;-- policy.lua (excerpt)&lt;/span&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; ou &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; tls_subject_attrs &lt;span style=&#34;color:#f92672&#34;&gt;and&lt;/span&gt; tls_subject_attrs.OU &lt;span style=&#34;color:#f92672&#34;&gt;and&lt;/span&gt; tls_subject_attrs.OU[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;request-attributes&#34;&gt;Request attributes&#xA;&lt;/h2&gt;&lt;h3 id=&#34;get_attr&#34;&gt;get_attr&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;get_attr(name) -&amp;gt; value or nil&#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;Parameters:&lt;/strong&gt; &lt;code&gt;name&lt;/code&gt;, the attribute name (a string). For RADIUS, use the name in the dictionary, with the same capitalization; for TACACS+, see the table below.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Returns:&lt;/strong&gt; the value of the first attribute with this name in the request; &lt;code&gt;nil&lt;/code&gt; if there is none. A name that does not exist is not an error and also gives &lt;code&gt;nil&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Phases:&lt;/strong&gt; all.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;get_attrs&#34;&gt;get_attrs&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;get_attrs(name) -&amp;gt; array&#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;Parameters:&lt;/strong&gt; same as &lt;code&gt;get_attr&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Returns:&lt;/strong&gt; the values of all attributes with this name, in packet order; an empty table &lt;code&gt;{}&lt;/code&gt; if there are none.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Phases:&lt;/strong&gt; all.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;set_attr&#34;&gt;set_attr&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;set_attr(name, value)&#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;Parameters:&lt;/strong&gt; &lt;code&gt;name&lt;/code&gt;, the attribute name; &lt;code&gt;value&lt;/code&gt;, a string or a number. For an enumeration you can write the value name from the dictionary or the number; a tagged attribute is written as &lt;code&gt;name:tag&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Returns:&lt;/strong&gt; nothing.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Effect:&lt;/strong&gt; adds an attribute to the reply, in call order; calling it twice with the same name gives two attributes. Only an accept and a challenge are sent; an Accounting-Response never carries attributes.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Phases:&lt;/strong&gt; all. For a RADIUS login, the name and value are checked against the dictionary at the moment of the call. In TACACS+ authorization it becomes an AV pair of the reply (&lt;code&gt;name=value&lt;/code&gt;); the name &lt;code&gt;server_msg&lt;/code&gt; is a special case and becomes a message shown to the user.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Errors:&lt;/strong&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;Case&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Error message&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 value is a boolean, a table or &lt;code&gt;nil&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;attribute value must be a string or number, got boolean&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 dictionary has no such name&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;attribute &#39;No-Such-Attribute&#39; has an unsupported number&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 enumeration has no such value&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&#39;Nonsense&#39; is not a value of &#39;Service-Type&#39;&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;An Access-Challenge can carry only &lt;code&gt;Reply-Message&lt;/code&gt;, &lt;code&gt;State&lt;/code&gt; (at most one), &lt;code&gt;Idle-Timeout&lt;/code&gt;, &lt;code&gt;Session-Timeout&lt;/code&gt; and vendor-specific attributes. Other attributes are checked just before sending, so &lt;code&gt;set_attr&lt;/code&gt; does not fail; instead the whole challenge becomes a reject, and the log says &lt;code&gt;RADIUS Access-Challenge for client localhost not sent: &#39;Filter-Id&#39; is not allowed in an Access-Challenge&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In TACACS+ authorization, one AV pair (&lt;code&gt;name=value&lt;/code&gt;) can be at most 255 octets: a longer one makes &lt;code&gt;set_attr&lt;/code&gt; fail at the call (&lt;code&gt;AV pair &#39;name&#39; is longer than 255 octets&lt;/code&gt;) and the request is rejected. A reply holds at most 255 AV pairs: more than that returns ERROR, and the log says &lt;code&gt;TACACS+ authorization for client … has … AV pairs, more than the 255 a reply holds&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;types-of-radius-attribute-values&#34;&gt;Types of RADIUS attribute values&#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;Dictionary type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What &lt;code&gt;get_attr&lt;/code&gt; returns&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What &lt;code&gt;set_attr&lt;/code&gt; accepts&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;integer&lt;/code&gt;, &lt;code&gt;date&lt;/code&gt;, &lt;code&gt;byte&lt;/code&gt;, &lt;code&gt;short&lt;/code&gt;, &lt;code&gt;signed&lt;/code&gt;, &lt;code&gt;integer64&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A number; an enumeration is also a number&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A number, or the value name of an enumeration&lt;/td&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;ipaddr&lt;/code&gt;, &lt;code&gt;ipv6addr&lt;/code&gt;, &lt;code&gt;ipv6prefix&lt;/code&gt;, &lt;code&gt;ipv4prefix&lt;/code&gt;, &lt;code&gt;ether&lt;/code&gt;, &lt;code&gt;ifid&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A string in text form, for example &lt;code&gt;&#39;192.0.2.1&#39;&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A string in text form&lt;/td&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;string&lt;/code&gt;, &lt;code&gt;octets&lt;/code&gt; and others&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A string of raw bytes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Tested: &lt;code&gt;User-Name&lt;/code&gt; is &lt;code&gt;&#39;bob&#39;&lt;/code&gt;, &lt;code&gt;NAS-IP-Address&lt;/code&gt; is &lt;code&gt;&#39;192.0.2.1&#39;&lt;/code&gt;, and &lt;code&gt;NAS-Port&lt;/code&gt; is the number &lt;code&gt;7&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;User-Password&lt;/code&gt; is the decrypted plain text, and only PAP requests have it.&lt;/p&gt;&#xA;&lt;h3 id=&#34;names-of-tacacs-attributes&#34;&gt;Names of TACACS+ attributes&#xA;&lt;/h3&gt;&lt;p&gt;TACACS+ has no dictionary. The names are the packet fields and the AV pair names:&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;Name&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Type&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Which phase&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Content&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;user&lt;/code&gt;, &lt;code&gt;port&lt;/code&gt;, &lt;code&gt;rem_addr&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;all&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;User name, the port on the device, the remote address&lt;/td&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;data&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;authentication&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The data field of the START 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;&lt;code&gt;authen_type&lt;/code&gt;, &lt;code&gt;priv_lvl&lt;/code&gt;, &lt;code&gt;authen_service&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;number&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;all&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Field values from RFC 8907&lt;/td&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;authen_method&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;number&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;authorization, accounting&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How the user originally logged in&lt;/td&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 of AV pairs, for example &lt;code&gt;service&lt;/code&gt;, &lt;code&gt;cmd&lt;/code&gt;, &lt;code&gt;cmd-arg&lt;/code&gt;, &lt;code&gt;task_id&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;authorization, accounting&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Each &lt;code&gt;key=value&lt;/code&gt; or &lt;code&gt;key*value&lt;/code&gt; argument, with the key as the name&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;For AV pairs with the same name (for example several &lt;code&gt;cmd-arg&lt;/code&gt;), use &lt;code&gt;get_attrs&lt;/code&gt; to get all of them.&lt;/p&gt;&#xA;&lt;h2 id=&#34;cluster-database&#34;&gt;Cluster database&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;sql_query&lt;/code&gt; and &lt;code&gt;sql_execute&lt;/code&gt; use the database built into the cluster (hiqlite, a SQLite with one copy per node, replicated with Raft). For usage and cautions, see chapter 10.&lt;/p&gt;&#xA;&lt;h3 id=&#34;sql_query&#34;&gt;sql_query&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sql_query(sql, params) -&amp;gt; array of rows&#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;Parameters:&lt;/strong&gt; &lt;code&gt;sql&lt;/code&gt;, one SQL statement; &lt;code&gt;params&lt;/code&gt;, optional, an array of values matched to the &lt;code&gt;?&lt;/code&gt; in order.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Returns:&lt;/strong&gt; an array with one table per row, with the column names as keys; an empty table if there is no result.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Effect:&lt;/strong&gt; reads the local copy of the database, read-only.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Phases:&lt;/strong&gt; all.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Errors:&lt;/strong&gt; see &lt;a class=&#34;link&#34; href=&#34;#parameters&#34; &gt;Parameters&lt;/a&gt; below and this table:&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;Case&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Error message&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 write&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Sqlite: attempt to write a readonly database&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 syntax error&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Sqlite: near &amp;quot;SELEC&amp;quot;: syntax error in SELEC 1 at offset 0&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;No such table&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Sqlite: Error code 1: SQL logic error Some(&amp;quot;no such table: nosuch&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;The database time of this request is used up&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;sql_query timed out: the database calls of one request have 5000 ms together&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;sql_execute&#34;&gt;sql_execute&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sql_execute(sql, params) -&amp;gt; number&#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;Parameters:&lt;/strong&gt; same as &lt;code&gt;sql_query&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Returns:&lt;/strong&gt; the number of rows affected. Tested: an &lt;code&gt;INSERT&lt;/code&gt; of one row returns &lt;code&gt;1&lt;/code&gt;; &lt;code&gt;CREATE TABLE&lt;/code&gt; can also be run.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Effect:&lt;/strong&gt; sent to the cluster leader, and returns after it is replicated to the nodes.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Phases:&lt;/strong&gt; all.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Errors:&lt;/strong&gt; besides the errors under &lt;a class=&#34;link&#34; href=&#34;#parameters&#34; &gt;Parameters&lt;/a&gt;, SQL that uses a function or keyword that each node would compute differently is refused before it is sent:&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;Case&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Error message&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;Uses one of the functions &lt;code&gt;date&lt;/code&gt;, &lt;code&gt;datetime&lt;/code&gt;, &lt;code&gt;julianday&lt;/code&gt;, &lt;code&gt;now&lt;/code&gt;, &lt;code&gt;random&lt;/code&gt;, &lt;code&gt;randomblob&lt;/code&gt;, &lt;code&gt;strftime&lt;/code&gt;, &lt;code&gt;time&lt;/code&gt;, &lt;code&gt;timediff&lt;/code&gt;, &lt;code&gt;unixepoch&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;sql_execute: non-deterministic `strftime` is not allowed in writes; pass time values from now_unix() instead&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;Uses one of the keywords &lt;code&gt;current_timestamp&lt;/code&gt;, &lt;code&gt;current_date&lt;/code&gt;, &lt;code&gt;current_time&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Same as above, with &lt;code&gt;`current_timestamp`&lt;/code&gt; between the backticks&lt;/td&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 database time of this request is used up&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;sql_execute timed out: the database calls of one request have 5000 ms together&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;parameters&#34;&gt;Parameters&#xA;&lt;/h3&gt;&lt;p&gt;The parameter rules are the same for &lt;code&gt;sql_query&lt;/code&gt;, &lt;code&gt;sql_execute&lt;/code&gt;, &lt;code&gt;db_query&lt;/code&gt; and &lt;code&gt;db_execute&lt;/code&gt;. The function name appears at the start of the message:&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;Case&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Error message (using &lt;code&gt;sql_query&lt;/code&gt; as the example)&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 number of &lt;code&gt;?&lt;/code&gt; and the number of values differ&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;sql_query: 1 placeholder, 0 values&lt;/code&gt;, &lt;code&gt;sql_query: 0 placeholders, 1 value&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;Uses forms such as &lt;code&gt;?1&lt;/code&gt; or &lt;code&gt;:name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;sql_query: only plain ? placeholders are supported, found ?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;The second argument is not a table&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;sql_query: parameters must be an array, not string&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 array has a hole (a &lt;code&gt;nil&lt;/code&gt; in the middle)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;sql_query: parameters must be an array without holes&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 value has an unsupported type&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;sql_query: parameter 1 has unsupported type table&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 number is infinite or NaN&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;sql_query: parameter 1 is not a finite number&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;How values are mapped:&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;Lua value&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Sent to the database&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;String&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TEXT; BLOB if it is not UTF-8&lt;/td&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 number with an integer value&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;INTEGER&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Other numbers&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;REAL&lt;/td&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;true&lt;/code&gt;/&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;1&lt;/code&gt;/&lt;code&gt;0&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;A &lt;code&gt;?&lt;/code&gt; inside an SQL string literal is not a parameter. Tested: &lt;code&gt;sql_query(&amp;quot;SELECT &#39;?&#39; AS q&amp;quot;)&lt;/code&gt; needs no parameters and returns one row where &lt;code&gt;q&lt;/code&gt; is &lt;code&gt;&#39;?&#39;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;types-of-results&#34;&gt;Types of results&#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;Database value&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Lua&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;INTEGER&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Number (integer)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;REAL&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Number&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TEXT&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;String&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;BLOB&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;String of raw bytes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;NULL&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;nil&lt;/code&gt;, so the table for that row has no such key&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;external-databases&#34;&gt;External databases&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;db_query&lt;/code&gt; and &lt;code&gt;db_execute&lt;/code&gt; use the PostgreSQL or MySQL database configured in &lt;code&gt;[databases.&amp;lt;name&amp;gt;]&lt;/code&gt;. For the configuration, see &lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;chapter 09&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;db_query&#34;&gt;db_query&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;db_query(name, sql, params) -&amp;gt; array of rows&#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;Parameters:&lt;/strong&gt; &lt;code&gt;name&lt;/code&gt;, the name in &lt;code&gt;[databases.&amp;lt;name&amp;gt;]&lt;/code&gt;; &lt;code&gt;sql&lt;/code&gt;; &lt;code&gt;params&lt;/code&gt;, optional, rules in &lt;a class=&#34;link&#34; href=&#34;#parameters&#34; &gt;Parameters&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Returns:&lt;/strong&gt; same as &lt;code&gt;sql_query&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Effect:&lt;/strong&gt; sent through the connection pool of that database. Always write &lt;code&gt;?&lt;/code&gt; in the SQL; for PostgreSQL, rradius rewrites it to &lt;code&gt;$1&lt;/code&gt;, &lt;code&gt;$2&lt;/code&gt;, &amp;hellip;, and for MySQL it is sent as it is.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Phases:&lt;/strong&gt; all.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Errors:&lt;/strong&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;Case&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Error message&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 such name&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;db_query: there is no database &#39;billing&#39; in [databases]&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;Cannot connect, or the pool cannot get a connection&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Messages like &lt;code&gt;db_query: database billing: pool timed out while waiting for an open connection&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 column type that cannot be read&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;db_query: database billing: column x has a type that cannot be read; CAST it to text in the SQL&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 MySQL unsigned integer larger than a script number can hold&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;db_query: database billing: column x holds …, more than a script number can hold; CAST it to text in the SQL&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 database time of this request is used up&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;db_query timed out: the database calls of one request have 5000 ms together&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;Types of results: integers and floating-point numbers are numbers, a boolean is &lt;code&gt;1&lt;/code&gt;/&lt;code&gt;0&lt;/code&gt;, text is a string, binary is a byte string, and NULL is &lt;code&gt;nil&lt;/code&gt;. PostgreSQL &lt;code&gt;NUMERIC&lt;/code&gt; and MySQL &lt;code&gt;DECIMAL&lt;/code&gt; (the usual result of &lt;code&gt;SUM&lt;/code&gt; and &lt;code&gt;AVG&lt;/code&gt;) are decimal strings and are not rounded.&lt;/p&gt;&#xA;&lt;p&gt;Tested (PostgreSQL 17, MySQL 8.4):&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;Query&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;PostgreSQL &lt;code&gt;WHERE username = ? OR username = ?&lt;/code&gt; with parameters &lt;code&gt;{&#39;alice&#39;, &#39;bob&#39;}&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Two rows (the &lt;code&gt;?&lt;/code&gt; are rewritten to &lt;code&gt;$1&lt;/code&gt;, &lt;code&gt;$2&lt;/code&gt; in order)&lt;/td&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;SELECT &#39;?&#39; AS mark …&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;mark&lt;/code&gt; is &lt;code&gt;&#39;?&#39;&lt;/code&gt;; a &lt;code&gt;?&lt;/code&gt; in a string literal is not a parameter&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PostgreSQL &lt;code&gt;NUMERIC(8,2)&lt;/code&gt; and its &lt;code&gt;SUM&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&#39;12.50&#39;&lt;/code&gt; (a string)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PostgreSQL &lt;code&gt;BOOLEAN&lt;/code&gt; &lt;code&gt;true&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;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;PostgreSQL &lt;code&gt;BIGINT&lt;/code&gt; &lt;code&gt;9007199254740993&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;9007199254740992&lt;/code&gt;: an integer above 2^53 loses precision, so &lt;code&gt;CAST&lt;/code&gt; it to 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;MySQL &lt;code&gt;DECIMAL(8,2)&lt;/code&gt;, &lt;code&gt;TINYINT(1)&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&#39;12.50&#39;&lt;/code&gt;, &lt;code&gt;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;PostgreSQL and MySQL &lt;code&gt;DATE&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;db_query: database billing: column created has a type that cannot be read; CAST it to text in the SQL&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;MySQL &lt;code&gt;BIGINT UNSIGNED&lt;/code&gt; &lt;code&gt;18446744073709551615&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;db_query: database legacy: column u_big holds 18446744073709551615, more than a script number can hold; CAST it to text in the SQL&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 column that does not exist (PostgreSQL)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;db_query: database billing: error returned from database: column &amp;quot;nosuch&amp;quot; does not exist …&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 database&amp;rsquo;s own error message follows &lt;code&gt;error returned from database:&lt;/code&gt; and is passed to the script as it is.&lt;/p&gt;&#xA;&lt;h3 id=&#34;db_execute&#34;&gt;db_execute&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;db_execute(name, sql, params) -&amp;gt; number&#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;Parameters:&lt;/strong&gt; same as &lt;code&gt;db_query&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Returns:&lt;/strong&gt; the number of rows affected.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Effect:&lt;/strong&gt; an external database has no cluster replication problem, so non-deterministic functions are not checked, and functions such as &lt;code&gt;now()&lt;/code&gt; can be used.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Phases:&lt;/strong&gt; all.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Errors:&lt;/strong&gt; same as &lt;code&gt;db_query&lt;/code&gt;, with the message starting with &lt;code&gt;db_execute:&lt;/code&gt;. Tested: without permission, the message is &lt;code&gt;db_execute: database legacy: error returned from database: 1142 (42000): UPDATE command denied to user …&lt;/code&gt; (MySQL) or &lt;code&gt;… permission denied for table radcheck …&lt;/code&gt; (PostgreSQL).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;http&#34;&gt;HTTP&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;http_request&lt;/code&gt; and &lt;code&gt;url_encode&lt;/code&gt; exist only when the configuration has &lt;code&gt;[lua.http]&lt;/code&gt;; without it they are &lt;code&gt;nil&lt;/code&gt;, and calling them gives &lt;code&gt;attempt to call a nil value&lt;/code&gt;. For the configuration, see &lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A&lt;/a&gt;; for usage, see chapter 10.&lt;/p&gt;&#xA;&lt;h3 id=&#34;http_request&#34;&gt;http_request&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;http_request{ url = …, method = …, headers = …, body = … } -&amp;gt; response, nil&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                                                           -&amp;gt; nil, reason&#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;Parameters:&lt;/strong&gt; one table:&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;Key&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Required&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Description&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;url&lt;/code&gt;&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;The full URL. The host, port and http/https must be in &lt;code&gt;lua.http.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;method&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;&#39;GET&#39;&lt;/code&gt; (default), &lt;code&gt;&#39;POST&#39;&lt;/code&gt;, &lt;code&gt;&#39;PUT&#39;&lt;/code&gt;, &lt;code&gt;&#39;DELETE&#39;&lt;/code&gt;, &lt;code&gt;&#39;PATCH&#39;&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;headers&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A table, header names mapped to string 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;&lt;code&gt;body&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A string&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;Returns:&lt;/strong&gt; on success, a table and &lt;code&gt;nil&lt;/code&gt;: &lt;code&gt;status&lt;/code&gt; (a number), &lt;code&gt;body&lt;/code&gt; (a string), &lt;code&gt;headers&lt;/code&gt; (a table with lower-case names, for example &lt;code&gt;r.headers[&#39;content-type&#39;]&lt;/code&gt;). Redirects are not followed automatically: a 302 is returned as a 302, and &lt;code&gt;headers.location&lt;/code&gt; is the redirect target. On failure, &lt;code&gt;nil&lt;/code&gt; and a reason string.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Phases:&lt;/strong&gt; all. An accounting script gives up its accounting slot while it waits for the response.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Two kinds of failure:&lt;/strong&gt; an option that is written wrongly is a script bug and raises an error; a URL that is not allowed, a connection that fails, or a timeout is a runtime condition, reported to the script as a return value so that the script decides what to do.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Errors for wrongly written options:&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;Case&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Error message&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 argument is not a table&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;http_request: takes a table of options&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;No &lt;code&gt;url&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;http_request: url is required&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;url&lt;/code&gt;, &lt;code&gt;method&lt;/code&gt; or &lt;code&gt;body&lt;/code&gt; is not a string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;http_request: url must be a string&lt;/code&gt; (by key 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;An unsupported method&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;http_request: method must be GET, POST, PUT, DELETE or PATCH&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;headers&lt;/code&gt; is not a table&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;http_request: headers must be a table&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 header name or value is not valid&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;http_request: a header name or value is not valid&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;Sets &lt;code&gt;Host&lt;/code&gt;, &lt;code&gt;Content-Length&lt;/code&gt;, &lt;code&gt;Transfer-Encoding&lt;/code&gt;, &lt;code&gt;Connection&lt;/code&gt;, &lt;code&gt;Upgrade&lt;/code&gt; or &lt;code&gt;TE&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;http_request: the Host header cannot be set&lt;/code&gt; (by name)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Failure reasons that are returned:&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;Reason&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;When&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;http://127.0.0.1 is not in lua.http.allowed_hosts&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The host, port or http/https is not exactly the same as in the allow list&lt;/td&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;not an http or https URL&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Another scheme&lt;/td&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;not a valid URL&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The URL cannot be parsed&lt;/td&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 URL with a user name is not allowed&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The URL has a user name or password&lt;/td&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 URL with . or .. in its path is not allowed&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The path has &lt;code&gt;.&lt;/code&gt; or &lt;code&gt;..&lt;/code&gt; (including when encoded as &lt;code&gt;%2e&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;a URL with a tab or a line break is not allowed&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The URL has a tab or a line break&lt;/td&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 URL with a space or a control character at either end is not allowed&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The URL has a space at the start or end&lt;/td&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 requests at once&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The calls in progress to this host have reached &lt;code&gt;lua.http.max_concurrent&lt;/code&gt;; there is no queue, the call fails 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;&lt;code&gt;timed out after 2s&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Over &lt;code&gt;lua.http.timeout_ms&lt;/code&gt; (the message shows the actual 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 response is over 1048576 octets&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The response body is over &lt;code&gt;lua.http.max_response_bytes&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 connection was refused&lt;/code&gt;, &lt;code&gt;the connection failed&lt;/code&gt;, &lt;code&gt;the name lookup failed&lt;/code&gt;, &lt;code&gt;the server&#39;s certificate was not accepted&lt;/code&gt;, &lt;code&gt;the request failed&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Connection and TLS failures&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The reason contains only the host, not the rest of the URL, because the path and query string often carry keys or user names. Every failure writes one WARN line, for example &lt;code&gt;script http_request refused: …&lt;/code&gt;, &lt;code&gt;script http_request to 127.0.0.1: the connection was refused&lt;/code&gt;; when the number of calls in progress is used up, it is &lt;code&gt;script http_request to 127.0.0.1: 64 already waiting&lt;/code&gt;. The result is recorded in the &lt;code&gt;result&lt;/code&gt; label of the metric &lt;code&gt;rradius_script_http_requests_total&lt;/code&gt; (&lt;code&gt;ok&lt;/code&gt;, &lt;code&gt;timeout&lt;/code&gt;, &lt;code&gt;error&lt;/code&gt;, &lt;code&gt;denied&lt;/code&gt;, &lt;code&gt;too_large&lt;/code&gt;, &lt;code&gt;busy&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Login and accounting calls count their calls in progress separately, so no amount of accounting takes a slot from logins.&lt;/p&gt;&#xA;&lt;h3 id=&#34;url_encode&#34;&gt;url_encode&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;url_encode(text) -&amp;gt; string&#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;Parameters:&lt;/strong&gt; &lt;code&gt;text&lt;/code&gt;, a string.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Returns:&lt;/strong&gt; every byte except English letters, digits and &lt;code&gt;-&lt;/code&gt;, &lt;code&gt;.&lt;/code&gt;, &lt;code&gt;_&lt;/code&gt;, &lt;code&gt;~&lt;/code&gt; is encoded as &lt;code&gt;%XX&lt;/code&gt;, so the result is always just one piece of a URL. Tested: &lt;code&gt;url_encode(&amp;quot;o&#39;brien@corp é&amp;quot;)&lt;/code&gt; is &lt;code&gt;o%27brien%40corp%20%C3%A9&lt;/code&gt;, and &lt;code&gt;url_encode(&#39;a b/c&#39;)&lt;/code&gt; is &lt;code&gt;a%20b%2Fc&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Errors:&lt;/strong&gt; an empty string, &lt;code&gt;.&lt;/code&gt; and &lt;code&gt;..&lt;/code&gt; are treated as a step of the path when the URL is parsed, however they are encoded, so they raise an error: &lt;code&gt;url_encode: &#39;..&#39; cannot be one piece of a URL&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;logging-and-utilities&#34;&gt;Logging and utilities&#xA;&lt;/h2&gt;&lt;h3 id=&#34;log&#34;&gt;log&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;log(...)&#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;Parameters:&lt;/strong&gt; any number of values of any type.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Effect:&lt;/strong&gt; writes one INFO log line: &lt;code&gt;script &amp;lt;file name&amp;gt; (&amp;lt;protocol&amp;gt;/&amp;lt;phase&amp;gt;, client &amp;lt;client&amp;gt;): &amp;lt;message&amp;gt;&lt;/code&gt;. The arguments are converted to text and joined with spaces; &lt;code&gt;nil&lt;/code&gt;, booleans and numbers are written as Lua writes them, a table is written as &lt;code&gt;table: 0x…&lt;/code&gt;; line breaks become spaces; anything over 4096 bytes is cut off.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Phases:&lt;/strong&gt; all.&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… INFO rradius_core::lua_engine: script policy.lua (radius/authentication, client localhost): refused bob&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;now_unix&#34;&gt;now_unix&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;now_unix() -&amp;gt; number&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The current Unix time in seconds, as an integer value. For any time you write to the cluster database, compute it with this and pass it as a parameter.&lt;/p&gt;&#xA;&lt;h3 id=&#34;random_token&#34;&gt;random_token&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;random_token() -&amp;gt; string&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;16 random bytes, written as 32 lower-case hexadecimal characters, for example to use as the &lt;code&gt;State&lt;/code&gt; of an Access-Challenge.&lt;/p&gt;&#xA;&lt;h3 id=&#34;totp_verify&#34;&gt;totp_verify&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;totp_verify(secret, code) -&amp;gt; number or nil&#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;Parameters:&lt;/strong&gt; &lt;code&gt;secret&lt;/code&gt;, the Base32 TOTP secret (upper or lower case is accepted, and the trailing &lt;code&gt;=&lt;/code&gt; can be left out); &lt;code&gt;code&lt;/code&gt;, the code the user typed. Use a string, because a leading &lt;code&gt;0&lt;/code&gt; is lost in a number.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Rules:&lt;/strong&gt; RFC 6238, SHA-1, 6 digits, 30-second steps, one step before and after the current one is accepted.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Returns:&lt;/strong&gt; if the code is right, the number of that step (the Unix time divided by 30, as an integer); if it is wrong, &lt;code&gt;nil&lt;/code&gt;. Record the steps that have been used, so that the same code cannot be used a second time.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Errors:&lt;/strong&gt; the secret is not Base32 or is empty: &lt;code&gt;totp_verify: the secret is not valid Base32&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;wpa_pmk&#34;&gt;wpa_pmk&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;wpa_pmk(passphrase, ssid) -&amp;gt; string&#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;Parameters:&lt;/strong&gt; &lt;code&gt;passphrase&lt;/code&gt;, a passphrase of 8 to 63 printable ASCII characters, or a PSK of 64 hexadecimal characters; &lt;code&gt;ssid&lt;/code&gt;, 1 to 32 bytes.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Returns:&lt;/strong&gt; the WPA2 PMK, 64 lower-case hexadecimal characters. Tested: &lt;code&gt;wpa_pmk(&#39;password&#39;, &#39;IEEE&#39;)&lt;/code&gt; is &lt;code&gt;f42c6fc52df0ebef9ebb4b90b38a5f902e83fe1b135a70e23aed762e9710a12e&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Note:&lt;/strong&gt; each call computes 4096 rounds of PBKDF2, which uses a few milliseconds of execution time.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Errors:&lt;/strong&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;Case&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Error message&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 passphrase has the wrong length or characters&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;wpa_pmk: the passphrase must be 8 to 63 printable ASCII characters, or the PSK 64 hex digits&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 SSID has the wrong length&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;wpa_pmk: the SSID must be 1 to 32 octets&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;Not UTF-8 text&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;wpa_pmk: the passphrase is not text&lt;/code&gt;, &lt;code&gt;wpa_pmk: the SSID is not text&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;password_verify&#34;&gt;password_verify&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;password_verify(stored, given) -&amp;gt; boolean&#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;Parameters:&lt;/strong&gt; &lt;code&gt;stored&lt;/code&gt;, the stored password, in the same format as the password column of the sql handler (a &lt;code&gt;{crypt}&lt;/code&gt; or &lt;code&gt;{clear}&lt;/code&gt; prefix, or a hash without a prefix; see chapter 07); &lt;code&gt;given&lt;/code&gt;, the password the user typed.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Returns:&lt;/strong&gt; &lt;code&gt;true&lt;/code&gt; if they match. If either is &lt;code&gt;nil&lt;/code&gt;, the result is &lt;code&gt;false&lt;/code&gt;; a format that is not recognized is also &lt;code&gt;false&lt;/code&gt;, not an error.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Note:&lt;/strong&gt; it does not count failures, so &lt;code&gt;[auth.lockout]&lt;/code&gt; has no control over it. When a script compares passwords itself, it must limit the number of guesses itself.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;coa-and-disconnect&#34;&gt;CoA and Disconnect&#xA;&lt;/h2&gt;&lt;p&gt;The core has these two names, but calling them always fails.&lt;/p&gt;&#xA;&lt;h3 id=&#34;send_disconnect&#34;&gt;send_disconnect&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;send_disconnect(target, attributes)&#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;Parameters:&lt;/strong&gt; &lt;code&gt;target&lt;/code&gt;, a string; &lt;code&gt;attributes&lt;/code&gt;, a table mapping attribute names to a value or an array of values.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Behavior in the core:&lt;/strong&gt; the call always fails: &lt;code&gt;send_disconnect: not supported by this program (CoA needs rradius-enterprise)&lt;/code&gt;. If the second argument is not a table, you first get an argument conversion error, for example &lt;code&gt;bad argument #2: error converting Lua string to table&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;send_coa&#34;&gt;send_coa&#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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;send_coa(target, attributes)&#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;Parameters:&lt;/strong&gt; same as &lt;code&gt;send_disconnect&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Behavior in the core:&lt;/strong&gt; the call always fails: &lt;code&gt;send_coa: not supported by this program (CoA needs rradius-enterprise)&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Enterprise edition:&lt;/strong&gt; these two functions send a Disconnect-Request and a CoA-Request, and return &lt;code&gt;&#39;ack&#39;&lt;/code&gt;, &lt;code&gt;&#39;nak&#39;&lt;/code&gt; or &lt;code&gt;&#39;timeout&#39;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;built-in-libraries&#34;&gt;Built-in libraries&#xA;&lt;/h2&gt;&lt;p&gt;The Luau built-in names a script can see (tested by listing every key of &lt;code&gt;_G&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;_G _VERSION assert bit32 buffer collectgarbage coroutine debug error gcinfo&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;getmetatable integer ipairs math newproxy next os pairs pcall print rawequal&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rawget rawlen rawset select setmetatable string table tonumber tostring type&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;typeof unpack utf8 vector xpcall&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Removed:&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;Name&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;State&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;require&lt;/code&gt;, &lt;code&gt;loadstring&lt;/code&gt;, &lt;code&gt;getfenv&lt;/code&gt;, &lt;code&gt;setfenv&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Do not exist; they are &lt;code&gt;nil&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;io&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Does not exist; a script cannot read or write files&lt;/td&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;os.execute&lt;/code&gt; and similar&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Do not exist; &lt;code&gt;os.time()&lt;/code&gt; and &lt;code&gt;os.clock()&lt;/code&gt; can be used&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;code&gt;print&lt;/code&gt; exists, but it writes to the program&amp;rsquo;s standard output, not to the log, and under systemd or in a container you usually cannot see it. Always use &lt;code&gt;log&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;_G&lt;/code&gt; is the table of the built-in libraries, not the request&amp;rsquo;s global table. The names in this appendix are not in &lt;code&gt;_G&lt;/code&gt;, and &lt;code&gt;_G.get_attr&lt;/code&gt; is &lt;code&gt;nil&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;form-of-errors&#34;&gt;Form of errors&#xA;&lt;/h2&gt;&lt;p&gt;When a function fails, the error that is thrown is a string. It starts with &lt;code&gt;runtime error: &lt;/code&gt;, followed by the message, then &lt;code&gt;stack traceback:&lt;/code&gt; and the call locations. If the script does not catch it, the request is rejected and the log gets one ERROR line:&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… ERROR rradius_core::lua_engine: Lua script error (radius/authentication): runtime error: probe.lua:40: something went wrong&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;stack traceback:&#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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A script can catch the error with &lt;code&gt;pcall&lt;/code&gt; and decide the result itself:&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;-- policy.lua (excerpt)&lt;/span&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; ok, err &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; pcall(send_coa, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;localhost&amp;#39;&lt;/span&gt;, { [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;User-Name&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;alice&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;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;not&lt;/span&gt; ok &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;coa failed&amp;#39;&lt;/span&gt;, err)&#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;p&gt;In two cases, catching the error with &lt;code&gt;pcall&lt;/code&gt; does not change the result:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The execution time is exceeded: every later step raises the same error, so the result is always a failure.&lt;/li&gt;&#xA;&lt;li&gt;The database cannot be reached or times out: even if you catch it, the login gets no response (the log says &lt;code&gt;Discarded: database&lt;/code&gt;), and TACACS+ returns ERROR, so that the NAS asks another server.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;limits&#34;&gt;Limits&#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;Limit&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Setting&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Default&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;When exceeded&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 script&amp;rsquo;s own execution time&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;lua.max_execution_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;1000&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;script exceeded the execution limit of 1000 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;Memory per VM&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;lua.max_memory_mb&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;256&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;memory error: not enough memory&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 total time of all database calls in one request&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;lua.query_timeout_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;5000&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;sql_query timed out: the database calls of one request have 5000 ms together&lt;/code&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;The execution time does not include time spent waiting for the database, for HTTP or for an accounting slot.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;lua.query_timeout_ms&lt;/code&gt; is shared by &lt;code&gt;sql_query&lt;/code&gt;, &lt;code&gt;sql_execute&lt;/code&gt;, &lt;code&gt;db_query&lt;/code&gt; and &lt;code&gt;db_execute&lt;/code&gt;; &lt;code&gt;http_request&lt;/code&gt; has its own &lt;code&gt;lua.http.timeout_ms&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;A change to &lt;code&gt;lua.max_memory_mb&lt;/code&gt; needs a restart; the others take effect on reload.&lt;/li&gt;&#xA;&lt;li&gt;The number of VMs equals the number of CPUs the program can use. Accounting scripts run at most &amp;ldquo;number of VMs minus 2, at least 1&amp;rdquo; at the same time, and they give up their slot while they wait for the database or HTTP.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;how-to-compare&#34;&gt;How to compare&#xA;&lt;/h2&gt;&lt;p&gt;The names listed in this appendix must match the names the code registers. The comparison has two steps, run in the root directory of the core repo.&lt;/p&gt;&#xA;&lt;p&gt;Step one: extract the names from the code mechanically. The keys of &lt;code&gt;setmetatable({ … }, meta)&lt;/code&gt; in the &lt;code&gt;BINDER&lt;/code&gt; constant, plus the names set by &lt;code&gt;env.&amp;lt;name&amp;gt; =&lt;/code&gt;, are all the names in the script environment:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ python3 -I - rradius-core/src/lua_engine.rs &amp;lt;&amp;lt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;EOF&amp;#39;&lt;/span&gt; &amp;gt; /tmp/source.txt&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;import re, sys&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;src = open(sys.argv[1]).read()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;binder = re.search(r&amp;#39;const BINDER: &amp;amp;str = r#&amp;#34;(.*?)&amp;#34;#;&amp;#39;, src, re.S).group(1)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;table = re.search(r&amp;#39;setmetatable\(\{(.*?)\}, meta\)&amp;#39;, binder, re.S).group(1)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;names = set(re.findall(r&amp;#39;^\s*([a-z_]+)\s*=&amp;#39;, table, re.M))&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;names |= set(re.findall(r&amp;#39;env\.([a-z_]+)\s*=&amp;#39;, binder))&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(&amp;#39;\n&amp;#39;.join(sorted(names)))&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;EOF&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ wc -l &amp;lt; /tmp/source.txt&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      27&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Of the 27 names, &lt;code&gt;radsec_subject&lt;/code&gt; and &lt;code&gt;radsec_subject_attrs&lt;/code&gt; are the certificate information of a RadSec connection. The core has no RadSec, so they are always &lt;code&gt;nil&lt;/code&gt;; this appendix does not list them, and the comparison leaves them out explicitly:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ grep -v -x -e radsec_subject -e radsec_subject_attrs /tmp/source.txt &amp;gt; /tmp/expected.txt&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ grep -E &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;^### [a-z_]+$&amp;#39;&lt;/span&gt; docs/manual/93-lua-reference.md | cut -c5- | sort &amp;gt; /tmp/book.txt&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ diff /tmp/expected.txt /tmp/book.txt &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; echo same&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;same&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In this appendix, only the API names are all-lower-case English headings, so the &lt;code&gt;grep&lt;/code&gt; on the second line picks up the list in the book.&lt;/p&gt;&#xA;&lt;p&gt;Step two: confirm at run time. Generate a script from the list in the book that records the type of each name, put it in the quick-start (change &lt;code&gt;script&lt;/code&gt; in &lt;code&gt;[lua]&lt;/code&gt; to it, remove &lt;code&gt;[auth]&lt;/code&gt;, add &lt;code&gt;[lua.http]&lt;/code&gt;), and log in once:&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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ awk &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;{printf &amp;#34;log(\&amp;#34;%s\&amp;#34;, type(%s))\n&amp;#34;, $1, $1} END {print &amp;#34;return \&amp;#34;accept\&amp;#34;&amp;#34;}&amp;#39;&lt;/span&gt; /tmp/book.txt &amp;gt; names.lua&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The log from the test (excerpted format, 25 lines in all):&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-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… script names.lua (radius/authentication, client localhost): auth_user nil&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… script names.lua (radius/authentication, client localhost): client string&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;… script names.lua (radius/authentication, client localhost): db_execute function&#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;… script names.lua (radius/authentication, client localhost): wpa_pmk function&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;All 17 functions are &lt;code&gt;function&lt;/code&gt;; &lt;code&gt;protocol&lt;/code&gt;, &lt;code&gt;phase&lt;/code&gt; and &lt;code&gt;client&lt;/code&gt; are &lt;code&gt;string&lt;/code&gt;, and &lt;code&gt;replayed&lt;/code&gt; is &lt;code&gt;boolean&lt;/code&gt;; &lt;code&gt;auth_user&lt;/code&gt;, &lt;code&gt;eap_method&lt;/code&gt;, &lt;code&gt;tls_subject&lt;/code&gt; and &lt;code&gt;tls_subject_attrs&lt;/code&gt; are &lt;code&gt;nil&lt;/code&gt; in a PAP login to a top-level script. For when they have a value, see &lt;a class=&#34;link&#34; href=&#34;#global-variables&#34; &gt;Global variables&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;When the code adds or removes a name, the &lt;code&gt;diff&lt;/code&gt; in step one shows a difference.&lt;/p&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; calling &lt;code&gt;http_request&lt;/code&gt; or &lt;code&gt;url_encode&lt;/code&gt; gives &lt;code&gt;attempt to call a nil value&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; the configuration has no &lt;code&gt;[lua.http]&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; add &lt;code&gt;[lua.http]&lt;/code&gt; and &lt;code&gt;allowed_hosts&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;auth_user&lt;/code&gt; is always &lt;code&gt;nil&lt;/code&gt; in a top-level script.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; only the &lt;code&gt;lua&lt;/code&gt; handler in an auth chain gets it.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; in a top-level script, use &lt;code&gt;get_attr(&#39;User-Name&#39;)&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;get_attr(&#39;Service-Type&#39;) == &#39;Framed-User&#39;&lt;/code&gt; is never true.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; an enumeration is returned as a number.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; write &lt;code&gt;== 2&lt;/code&gt;. Only &lt;code&gt;set_attr&lt;/code&gt; accepts the value name.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;totp_verify&lt;/code&gt; returns &lt;code&gt;nil&lt;/code&gt; for the user&amp;rsquo;s input &lt;code&gt;012345&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; the code was converted to a number, and the leading &lt;code&gt;0&lt;/code&gt; was lost.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; pass the string from &lt;code&gt;get_attr&lt;/code&gt; as it is; do not use &lt;code&gt;tonumber&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; the log has &lt;code&gt;sql_query: parameters must be an array, not string&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; the second argument was a plain value, for example &lt;code&gt;sql_query(sql, user)&lt;/code&gt;.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; wrap it in an array: &lt;code&gt;sql_query(sql, {user})&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; the log has &lt;code&gt;db_query: there is no database &#39;billing&#39; in [databases]&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; the name does not match &lt;code&gt;[databases.&amp;lt;name&amp;gt;]&lt;/code&gt;, or the configuration has no such section.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; compare it with the name in the configuration; after changing &lt;code&gt;[databases]&lt;/code&gt;, restart.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Symptom:&lt;/strong&gt; &lt;code&gt;_G.get_attr&lt;/code&gt; is &lt;code&gt;nil&lt;/code&gt;.&#xA;&lt;strong&gt;Cause:&lt;/strong&gt; &lt;code&gt;_G&lt;/code&gt; is the built-in libraries, not the request&amp;rsquo;s global table.&#xA;&lt;strong&gt;Fix:&lt;/strong&gt; write &lt;code&gt;get_attr&lt;/code&gt; directly.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../03-quick-start/&#34; &gt;03 First start and first login&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../09-external-databases/&#34; &gt;09 External databases and named queries&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;10 Writing policies in Lua&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;12 TACACS+ device administration&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item><item>
            <title>94 Appendix E: Glossary and RFC cross-reference</title>
            <link>https://embark.systems/en/rradius/oss/94-glossary/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://embark.systems/en/rradius/oss/94-glossary/</guid>
            <description>&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;After this chapter you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Look up how every term in this manual is written, what it means, and which setting key or command it maps to&lt;/li&gt;&#xA;&lt;li&gt;Tell apart terms that are easy to confuse, such as client and user, or authorize group and LDAP group&lt;/li&gt;&#xA;&lt;li&gt;Find which RFCs and standards the core implements, and which feature uses each one&lt;/li&gt;&#xA;&lt;li&gt;Recognize RFCs that the code mentions but the core does not implement&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;p&gt;Prerequisites: none. You can look things up in this appendix on its own.&lt;/p&gt;&#xA;&lt;p&gt;In this chapter:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#how-to-read-this-cross-reference&#34; &gt;How to read this cross-reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#basic-terms&#34; &gt;Basic terms&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#authentication-and-accounts&#34; &gt;Authentication and accounts&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#accounting-and-sessions&#34; &gt;Accounting and sessions&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#clusters&#34; &gt;Clusters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#operations-and-monitoring&#34; &gt;Operations and monitoring&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#certificates-and-security&#34; &gt;Certificates and security&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#terms-for-features-the-core-does-not-support&#34; &gt;Terms for features the core does not support&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#rfcs-implemented-by-the-core&#34; &gt;RFCs implemented by the core&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#other-standards&#34; &gt;Other standards&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#rfcs-mentioned-in-the-code-but-not-implemented-by-the-core&#34; &gt;RFCs mentioned in the code but not implemented by the core&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#rfcs-used-by-rradius-bench&#34; &gt;RFCs used by rradius-bench&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#official-rfc-titles&#34; &gt;Official RFC titles&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#how-to-regenerate-the-rfc-list&#34; &gt;How to regenerate the RFC list&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#common-mistakes&#34; &gt;Common mistakes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;#related-chapters&#34; &gt;Related chapters&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;how-to-read-this-cross-reference&#34;&gt;How to read this cross-reference&#xA;&lt;/h2&gt;&lt;p&gt;The whole manual uses one set of wordings. The &amp;ldquo;Used in this manual&amp;rdquo; column is the wording used in the text. Setting keys, commands, attribute names and RFC names always stay as they are. Terms marked &amp;ldquo;not translated&amp;rdquo; are written in English in the manual, for example realm, session and leader.&lt;/p&gt;&#xA;&lt;p&gt;The &amp;ldquo;Maps to&amp;rdquo; column shows what the term looks like in a configuration file or a command. For details, see the &amp;ldquo;Main chapter&amp;rdquo;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;basic-terms&#34;&gt;Basic 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;Used in this manual&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;Maps to&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Main 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;NAS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;NAS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The device that sends RADIUS requests to the server, for example an AP controller, a switch, a BNG or a VPN gateway. On first use, write it as &amp;ldquo;NAS (network access server, for example an AP controller, a switch, a BNG or a VPN gateway)&amp;rdquo;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05&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;client&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;client&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One &lt;code&gt;[[radius.clients]]&lt;/code&gt; or &lt;code&gt;[[tacacs.clients]]&lt;/code&gt; entry in the configuration, that is, a NAS that is allowed to send requests. One entry can cover a whole network range, so one client is not always one device&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.clients&lt;/code&gt;, &lt;code&gt;tacacs.clients&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05&lt;/a&gt;, &lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#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;user&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;user&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The person or device that logs in&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;User-Name&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07&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;account&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;account&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The row in a table that stands for one user&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;user&lt;/code&gt; command, &lt;code&gt;[accounts]&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07&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;shared secret&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;shared secret&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The same password configured on both the client and the server, used to sign packets and to hide password fields&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;secret&lt;/code&gt;, &lt;code&gt;secret_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05&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;authentication／authorization／accounting&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;authentication/authorization/accounting&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Confirm who you are/decide what you can do/record how much you used. Together they are called AAA&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;—&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../01-overview/&#34; &gt;01&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;realm&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;realm&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The part of an account name after the &lt;code&gt;@&lt;/code&gt;, for example &lt;code&gt;@example.com&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;auth.username.strip_realm&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07&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;dictionary&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;dictionary&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The file that maps attribute names to numbers and types&lt;/td&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;&lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;06&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;vendor-specific attribute&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;vendor-specific attribute (VSA)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An attribute whose number is defined by a vendor, carried inside &lt;code&gt;Vendor-Specific&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;VENDOR&lt;/code&gt; in the dictionary&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;06&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;reply attribute&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reply attribute&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An attribute that Access-Accept carries back to the NAS, for example &lt;code&gt;Session-Timeout&lt;/code&gt; or &lt;code&gt;Filter-Id&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;reply_query&lt;/code&gt; of the sql handler, &lt;code&gt;set_attr&lt;/code&gt; in Lua&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07&lt;/a&gt;, &lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#34; &gt;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;authentication-and-accounts&#34;&gt;Authentication and accounts&#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;Used in this manual&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;Maps to&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Main 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;auth chain&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;auth chain&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A series of handlers that are asked in order to decide whether to accept or reject one login&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[auth]&lt;/code&gt;, &lt;code&gt;auth.chains&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07&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;handler&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;handler&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One step in an auth chain, for example the sql handler or the ldap handler&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;auth.handlers&lt;/code&gt;, &lt;code&gt;type&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07&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;policy&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;first_match&lt;/code&gt;, &lt;code&gt;all_accept&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;How an auth chain combines the results of its handlers; written as in the source&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;auth.policy&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07&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;lockout&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;lockout&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Temporarily rejecting an account after too many wrong passwords&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;auth.lockout&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07&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;script&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;script&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A policy written in Lua&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;lua.script&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#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;phase&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;phase&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;What the script is being called to handle this time: &lt;code&gt;authentication&lt;/code&gt;, &lt;code&gt;authorization&lt;/code&gt; or &lt;code&gt;accounting&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;phase&lt;/code&gt; in Lua&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#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;enable (TACACS+)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;enable&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The step on a TACACS+ device that raises privilege; written as in the source&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;tacacs.enable&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#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;authorize group&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;authorize group&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A set of TACACS+ authorization rules in &lt;code&gt;authorize_groups&lt;/code&gt;, grouped by &lt;strong&gt;device&lt;/strong&gt;, not an LDAP group&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;tacacs.authorize_groups&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;12&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;accounting-and-sessions&#34;&gt;Accounting and sessions&#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;Used in this manual&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;Maps to&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Main 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;session&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;session&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One connection of a user from going online to going offline; it starts with Accounting Start and ends with Stop&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;[sessions]&lt;/code&gt;, &lt;code&gt;session&lt;/code&gt; command&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#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;accounting spool&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;accounting spool&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A temporary store on disk where accounting requests wait to be replayed while the database cannot be written to. Explain it this way on first use&lt;/td&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;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#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;replay&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;replay (a NAS retransmit is a different thing)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Handing a request in the accounting spool to the script once more&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;replay_interval_ms&lt;/code&gt;, &lt;code&gt;replay_window&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13&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;clusters&#34;&gt;Clusters&#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;Used in this manual&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;Maps to&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Main 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;cluster&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;cluster&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A group of rradius nodes that share one database; a single machine is also a cluster of one node&lt;/td&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;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#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;node&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;node&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;One rradius process in a cluster&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;cluster.node_id&lt;/code&gt;, &lt;code&gt;cluster.nodes&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#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;leader／follower&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;leader/follower&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The node that does the writing, and the other nodes that copy its data. Not translated&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;Leader&lt;/code&gt; in &lt;code&gt;status&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#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;voter／learner&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;voter/learner&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;A member that takes part in voting for the leader, and a member that only copies data and does not vote. Not translated&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;output of &lt;code&gt;cluster members&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#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;snapshot&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;snapshot&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The cluster saves the whole database state; later log entries continue from there&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;cluster.snapshot_every&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#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;migration&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;migration&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The SQL files in &lt;code&gt;migrations_dir&lt;/code&gt;, applied in numbered order to create and change tables&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;cluster.migrations_dir&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;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;operations-and-monitoring&#34;&gt;Operations and monitoring&#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;Used in this manual&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;Maps to&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Main 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;reload&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;reload&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Reading the configuration again without stopping the server; triggered by sending SIGHUP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;SIGHUP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04&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;drain&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;drain&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;On shutdown, stop accepting new requests and wait for requests in progress to finish&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;shutdown.drain_ms&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../04-configuration/&#34; &gt;04&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;metrics&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;metrics&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Values in Prometheus format served by &lt;code&gt;/metrics&lt;/code&gt;&lt;/td&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;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#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;readiness／liveness&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;readiness/liveness&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Can handle requests/the process is still alive; they map to &lt;code&gt;/readyz&lt;/code&gt; and &lt;code&gt;/livez&lt;/code&gt;&lt;/td&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;&lt;a class=&#34;link&#34; href=&#34;../17-monitoring/&#34; &gt;17&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;certificates-and-security&#34;&gt;Certificates and security&#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;Used in this manual&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;Maps to&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Main 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;certificate&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;certificate&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;An X.509 certificate&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.eap.cert_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#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;CA&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;CA&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The authority that issues certificates; the server uses it to check client certificates&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.eap.client_ca_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#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;CRL&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;CRL (certificate revocation list)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The list of revoked certificates that a CA publishes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.eap.crl_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#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;revocation&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;revocation&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Making a certificate invalid before it expires&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.eap.crl_file&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;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;terms-for-features-the-core-does-not-support&#34;&gt;Terms for features the core does not support&#xA;&lt;/h2&gt;&lt;p&gt;These terms appear in the core&amp;rsquo;s error messages or in the configuration reference, but the feature itself exists only in the enterprise edition. The core manual uses them only when it says &amp;ldquo;not supported by the core&amp;rdquo;:&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;Term&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Used in this manual&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What the core does when it meets 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;RadSec&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RadSec&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.tls: not supported by this program (RadSec needs rradius-enterprise)&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;CoA, Disconnect-Request&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;CoA, Disconnect-Request&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.coa: not supported by this program (CoA needs rradius-enterprise)&lt;/code&gt;; the Lua calls &lt;code&gt;send_disconnect&lt;/code&gt; and &lt;code&gt;send_coa&lt;/code&gt; raise an error when called&lt;/td&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;OCSP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.eap.ocsp: not supported by this program (OCSP needs rradius-enterprise)&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;proxy&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;proxy&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;proxy: not supported by this program (proxying needs rradius-enterprise)&lt;/code&gt;; &amp;ldquo;proxy server&amp;rdquo; is used only when talking about upstream servers&lt;/td&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&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;upstream server&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;second factor／MFA&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;second factor&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;mfa: not supported by this program (two-factor login needs rradius-enterprise)&lt;/code&gt;; the setting key &lt;code&gt;mfa&lt;/code&gt; stays as it is&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;sealed key／seal&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;sealed&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Encrypted with another master key before it is written to the database; for example &lt;code&gt;aka-seal&lt;/code&gt; means &amp;ldquo;produce a sealed value&amp;rdquo;. The core has no setting or command that uses sealing, and &lt;code&gt;aka-seal&lt;/code&gt; gets &lt;code&gt;not supported by this program&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;rfcs-implemented-by-the-core&#34;&gt;RFCs implemented by the core&#xA;&lt;/h2&gt;&lt;p&gt;This list takes the RFC numbers from the code comments in &lt;code&gt;rradius-core/src&lt;/code&gt;, then opens the code each comment is in and keeps only the RFCs that the core really implements. &amp;ldquo;What the code uses it for&amp;rdquo; follows the content of the comment, not the official RFC title.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;RADIUS itself&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;RFC&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What the code uses it for&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Source&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Main 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;RFC 2865&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RADIUS authentication: hiding and unhiding &lt;code&gt;User-Password&lt;/code&gt;; Access-Challenge does not carry the reply attributes from earlier handlers, because most attributes cannot go in an Access-Challenge&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.rs&lt;/code&gt;, &lt;code&gt;auth_chain.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05&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;RFC 2866&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RADIUS accounting: the Request Authenticator of Accounting-Request&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#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;RFC 2868&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The tag of tunnel attributes, and the salt encryption of &lt;code&gt;Tunnel-Password&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;06&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;RFC 3162&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;IPv6 attributes: the bytes after the prefix can be omitted&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;06&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;RFC 6929&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Extended and long-extended attributes and Extended-Vendor-Specific; an invalid attribute is skipped as a whole&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;06&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;RFC 5080&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Retransmit detection: how long an answered request stays in the duplicate cache, and how a retransmit is recognized&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05&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;RFC 5997&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Status-Server: answered without running a script and without entering the duplicate cache&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05&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;RFC 3579&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RADIUS carrying EAP, and the Message-Authenticator check&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;radius.rs&lt;/code&gt;, &lt;code&gt;eap.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05&lt;/a&gt;, &lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;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;EAP&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;RFC&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What the code uses it for&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Source&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Main 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;RFC 3748&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP itself, for example a stale response is dropped&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;eap.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#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;RFC 5216&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP-TLS: key derivation for TLS 1.2, the length field in the first fragment&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;eap.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#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;RFC 9190&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Key derivation and the way EAP-TLS ends when it uses TLS 1.3&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;eap.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#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;RFC 5281&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP-TTLS: AVPs inside the tunnel, key derivation&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;eap.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#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;RFC 4514&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Escaping rules when the subject (DN) of a client certificate is written as a string&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;eap.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;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;Passwords and challenge-response authentication&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;RFC&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What the code uses it for&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Source&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Main 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;RFC 2759&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The MS-CHAPv2 response and authenticator response, also used inside PEAP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;mschap.rs&lt;/code&gt;, &lt;code&gt;eap.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07&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;RFC 2433&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The NT-Response check of MS-CHAPv1&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;mschap.rs&lt;/code&gt;, &lt;code&gt;ldap_handler.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07&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;RFC 2548&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Microsoft vendor attributes: the MS-CHAP request and the reply attributes for MPPE keys&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;mschap.rs&lt;/code&gt;, &lt;code&gt;auth_chain.rs&lt;/code&gt;, &lt;code&gt;reload.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07&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;RFC 3079&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Session key derivation for MPPE&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;mschap.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07&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;TACACS+, LDAP and Lua functions&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;RFC&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What the code uses it for&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Source&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Main 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;RFC 8907&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TACACS+: the packet format, the arguments of authorization rules, the warning when a shared secret is too short&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;tacacs.rs&lt;/code&gt;, &lt;code&gt;tacacs_rules.rs&lt;/code&gt;, &lt;code&gt;reload.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#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;RFC 4513&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;LDAP bind: an empty password becomes an unauthenticated bind that always succeeds, so only a non-empty PAP password is used to bind&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;ldap_handler.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;08&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;RFC 4515&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Escaping of &lt;code&gt;{user}&lt;/code&gt; in LDAP filter strings&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;ldap_handler.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;08&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;RFC 6238&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TOTP, the Lua function &lt;code&gt;totp_verify&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;totp.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#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;RFC 4226&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;HOTP, the basis of the TOTP calculation&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;totp.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#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;RFC 4648&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Base32, the encoding of the TOTP secret&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;totp.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#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;RFC 3986&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Which characters the Lua function &lt;code&gt;url_encode&lt;/code&gt; leaves unencoded&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;script_http.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../10-lua-policies/&#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;RFC 3339&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The time format of the accounting log (UTC, to the millisecond)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;accounting_log.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13&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;other-standards&#34;&gt;Other standards&#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;Standard&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What the code uses it for&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Source&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Main 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;MS-NRPC&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Netlogon for AD: setting up the secure channel, the &lt;code&gt;NetrLogonSamLogonEx&lt;/code&gt; network logon&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;netlogon/&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;08&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;PEAPv0&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;PEAP, with inner EAP-MSCHAPv2. The code does not cite a standard number&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;eap.rs&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;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;The core code does not cite any 3GPP TS.&lt;/p&gt;&#xA;&lt;h2 id=&#34;rfcs-mentioned-in-the-code-but-not-implemented-by-the-core&#34;&gt;RFCs mentioned in the code but not implemented by the core&#xA;&lt;/h2&gt;&lt;p&gt;These numbers appear in the core source or in &lt;code&gt;docs/spectra/specs/&lt;/code&gt;, but the feature exists only in the enterprise edition. The core rejects the setting or raises an error when called:&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;RFC&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Topic&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;What the core does&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;RFC 6614, RFC 6613&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RadSec (RADIUS over TLS/TCP)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;common/framing.rs&lt;/code&gt; and &lt;code&gt;clients.rs&lt;/code&gt; have shared code, but &lt;code&gt;radius.tls&lt;/code&gt; is rejected&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 5176&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;CoA and Disconnect&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;dynamic_authorization.rs&lt;/code&gt; is the hook; &lt;code&gt;radius.coa&lt;/code&gt; is rejected, and &lt;code&gt;send_disconnect&lt;/code&gt; and &lt;code&gt;send_coa&lt;/code&gt; raise errors&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 9887&lt;/td&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;&lt;code&gt;tacacs_transport.rs&lt;/code&gt; is the hook; &lt;code&gt;tacacs.tls&lt;/code&gt; is rejected&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 6960&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;OCSP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Only in specs; &lt;code&gt;radius.eap.ocsp&lt;/code&gt; is rejected&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 4186&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP-SIM&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Only in specs; &lt;code&gt;eap_methods = [&amp;quot;sim&amp;quot;]&lt;/code&gt; gets &lt;code&gt;&#39;sim&#39; is not a method this server offers&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;RFC 9048&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;Only in specs and the load-test tool; &lt;code&gt;eap_methods = [&amp;quot;aka-prime&amp;quot;]&lt;/code&gt; gets &lt;code&gt;aka-prime is not supported by this program (EAP-AKA&#39; needs rradius-enterprise)&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;RFC 5448&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The first version of EAP-AKA&amp;rsquo; (RFC 9048 updates it)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Only in specs&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 6733, RFC 3539&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Diameter, and the AAA transport profile (the watchdog is defined here)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Only in specs; &lt;code&gt;[diameter]&lt;/code&gt; is rejected&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 7585&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Finding the RadSec servers of a realm through DNS&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Only in specs; &lt;code&gt;[proxy]&lt;/code&gt; is rejected&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The 3GPP TS documents in &lt;code&gt;docs/spectra/specs/&lt;/code&gt; (29.273, 33.402, 35.205, 35.206, 35.208) also belong to EAP-AKA&amp;rsquo; and Diameter in the enterprise edition.&lt;/p&gt;&#xA;&lt;p&gt;Also, &lt;code&gt;passwords.rs&lt;/code&gt; cites RFC 7914 only because it publishes a set of PBKDF2-HMAC-SHA-256 test vectors; the core does not implement the subject of that RFC.&lt;/p&gt;&#xA;&lt;h2 id=&#34;rfcs-used-by-rradius-bench&#34;&gt;RFCs used by rradius-bench&#xA;&lt;/h2&gt;&lt;p&gt;The load-test tool is a RADIUS and TACACS+ client, and its code cites RFC 2865, 2866, 2548, 2759, 3579, 3748, 5216, 5281, 9190 and 8907, the same as the server side. Three more depend only on whether the server under test has the feature:&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;RFC&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Use in the tool&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;For the core&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;RFC 6614&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;--transport tls&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The core has no RadSec&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 4187, RFC 9048&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;aka-prime&lt;/code&gt; load&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The core replies with Reject&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;official-rfc-titles&#34;&gt;Official RFC titles&#xA;&lt;/h2&gt;&lt;p&gt;The official title of every RFC mentioned in this appendix, checked on 2026-11-23 against the public data at rfc-editor.org. The &amp;ldquo;Topic&amp;rdquo; and &amp;ldquo;What the code uses it for&amp;rdquo; columns in the tables above are this manual&amp;rsquo;s own explanations, not titles.&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;RFC&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Official title&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;RFC 2433&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Microsoft PPP CHAP Extensions&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 2548&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Microsoft Vendor-specific RADIUS Attributes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 2759&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Microsoft PPP CHAP Extensions, Version 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;RFC 2865&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Remote Authentication Dial In User Service (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;RFC 2866&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RADIUS Accounting&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 2868&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RADIUS Attributes for Tunnel Protocol Support&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 3079&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Deriving Keys for use with Microsoft Point-to-Point Encryption (MPPE)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 3162&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RADIUS and IPv6&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 3339&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Date and Time on the Internet: Timestamps&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 3539&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Authentication, Authorization and Accounting (AAA) Transport Profile&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 3579&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RADIUS (Remote Authentication Dial In User Service) Support For Extensible Authentication Protocol (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;RFC 3748&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Extensible Authentication Protocol (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;RFC 3986&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Uniform Resource Identifier (URI): Generic Syntax&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 4186&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Extensible Authentication Protocol Method for Global System for Mobile Communications (GSM) Subscriber Identity Modules (EAP-SIM)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 4187&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Extensible Authentication Protocol Method for 3rd Generation Authentication and Key Agreement (EAP-AKA)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 4226&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;HOTP: An HMAC-Based One-Time Password Algorithm&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 4513&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Lightweight Directory Access Protocol (LDAP): Authentication Methods and Security Mechanisms&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 4514&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Lightweight Directory Access Protocol (LDAP): String Representation of Distinguished 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;RFC 4515&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Lightweight Directory Access Protocol (LDAP): String Representation of Search Filters&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 4648&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The Base16, Base32, and Base64 Data Encodings&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 5080&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Common Remote Authentication Dial In User Service (RADIUS) Implementation Issues and Suggested Fixes&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 5176&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Dynamic Authorization Extensions to Remote Authentication Dial In User Service (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;RFC 5216&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The EAP-TLS Authentication Protocol&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 5281&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Extensible Authentication Protocol Tunneled Transport Layer Security Authenticated Protocol Version 0 (EAP-TTLSv0)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 5448&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Improved Extensible Authentication Protocol Method for 3rd Generation Authentication and Key Agreement (EAP-AKA&#39;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 5997&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Use of Status-Server Packets in the Remote Authentication Dial In User Service (RADIUS) Protocol&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 6238&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;TOTP: Time-Based One-Time Password Algorithm&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 6613&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RADIUS over TCP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 6614&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Transport Layer Security (TLS) Encryption 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;RFC 6733&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Diameter Base Protocol&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 6929&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Remote Authentication Dial In User Service (RADIUS) Protocol Extensions&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 6960&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;X.509 Internet Public Key Infrastructure Online Certificate Status Protocol - OCSP&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 7585&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Dynamic Peer Discovery for RADIUS/TLS and RADIUS/DTLS Based on the Network Access Identifier (NAI)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 7914&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The scrypt Password-Based Key Derivation Function&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 8907&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;The Terminal Access Controller Access-Control System Plus (TACACS+) Protocol&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 9048&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Improved Extensible Authentication Protocol Method for 3GPP Mobile Network Authentication and Key Agreement (EAP-AKA&#39;)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 9190&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;EAP-TLS 1.3: Using the Extensible Authentication Protocol with TLS 1.3&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;RFC 9887&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Terminal Access Controller Access-Control System Plus (TACACS+) over TLS 1.3&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-to-regenerate-the-rfc-list&#34;&gt;How to regenerate the RFC 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-console&#34; data-lang=&#34;console&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ grep -rhoE &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;RFC ?[0-9]{3,5}&amp;#39;&lt;/span&gt; rradius-core/src | sed &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;s/RFC */RFC /&amp;#39;&lt;/span&gt; | sort -u&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ grep -rhoE &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;RFC ?[0-9]{3,5}&amp;#39;&lt;/span&gt; docs/spectra/specs | sed &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;s/RFC */RFC /&amp;#39;&lt;/span&gt; | sort -u&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Result on 2026-11-23: the first command prints 31 lines. One of them, &lt;code&gt;RFC 822&lt;/code&gt;, is picked up by accident from the certificate field name &lt;code&gt;RFC822Name&lt;/code&gt; and is not a citation of an RFC, so there are 30 numbers. The second command prints 29 numbers. Every number from both is already placed in one of the tables in this appendix. For each new number, open the code that holds the comment and confirm that the core really implements it before you add it to &lt;a class=&#34;link&#34; href=&#34;#rfcs-implemented-by-the-core&#34; &gt;RFCs implemented by the core&lt;/a&gt;; a number that is only a hook or is rejected goes into &lt;a class=&#34;link&#34; href=&#34;#rfcs-mentioned-in-the-code-but-not-implemented-by-the-core&#34; &gt;RFCs mentioned in the code but not implemented by the core&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;common-mistakes&#34;&gt;Common mistakes&#xA;&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Mixing up client and user.&lt;/strong&gt; A client is a NAS, written in &lt;code&gt;[[radius.clients]]&lt;/code&gt;; a user is the person who logs in, written in the account table. For &amp;ldquo;client rejected&amp;rdquo;, look at &lt;code&gt;Discarded: unknown client&lt;/code&gt; in &lt;code&gt;status&lt;/code&gt;; for &amp;ldquo;user rejected&amp;rdquo;, look at &lt;code&gt;decision=&amp;quot;reject&amp;quot;&lt;/code&gt; in the authentication log.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Treating an authorize group as an LDAP group.&lt;/strong&gt; &lt;code&gt;tacacs.authorize_groups&lt;/code&gt; groups by TACACS+ device. Deciding permissions by the user&amp;rsquo;s LDAP groups is the job of the ldap handler; see &lt;a class=&#34;link&#34; href=&#34;../08-ldap-and-ad/&#34; &gt;08&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Mixing up the accounting spool and the accounting log.&lt;/strong&gt; The accounting spool (&lt;code&gt;radius.accounting_spool&lt;/code&gt;) is temporary storage for when the database cannot be written to, and it is replayed later; the accounting log (&lt;code&gt;radius.accounting_log&lt;/code&gt;) is a log file with one line per accounting request, and it is never replayed. Both are in &lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;related-chapters&#34;&gt;Related chapters&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../01-overview/&#34; &gt;01 Getting to know rradius&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../05-radius-clients/&#34; &gt;05 RADIUS service and NAS clients&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../06-dictionary/&#34; &gt;06 Dictionary and attributes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../07-users-and-chains/&#34; &gt;07 User accounts and auth chains&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../11-eap/&#34; &gt;11 802.1X and EAP&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../12-tacacs/&#34; &gt;12 TACACS+ device administration&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../13-accounting/&#34; &gt;13 Accounting and sessions&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../16-cluster/&#34; &gt;16 Clusters and high availability&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../90-config-reference/&#34; &gt;Appendix A: Configuration reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;../91-command-reference/&#34; &gt;Appendix B: Command reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item></channel>
</rss>
