Skip to content

net/freeradius: simultaneous-use verify query must select by user, not group - #5708

Open
sudo-pad wants to merge 1 commit into
opnsense:masterfrom
sudo-pad:freeradius-simul-verify-username
Open

sudo-pad wants to merge 1 commit into
opnsense:masterfrom
sudo-pad:freeradius-simul-verify-username

Conversation

@sudo-pad

Copy link
Copy Markdown

Important notices

Before you submit a pull request, we ask you kindly to acknowledge the following:

If AI was used, please disclose:

  • Model used: Claude Fable 5.1 (Anthropic, via Claude Code)
  • Extent of AI involvement: helped diagnose the fault with radiusd -X, proposed the one-line change, and drafted this text. The change and every measurement below were reviewed and reproduced by the author.

Describe the problem

simul_verify_query in net/freeradius/src/opnsense/service/templates/OPNsense/Freeradius/queries.conf filters radacct on %{${group_attribute}}, which renders as %{SQL-Group}. That attribute is empty on an Access-Request, so the verify step finds no live session and Simultaneous-Use never rejects: every extra login is accepted even when the sessions are sitting in radacct with no stop time. The count query directly above it already uses %{SQL-User-Name}, and so does the stock FreeRADIUS 3.2 sqlite dialect, so the count says N and the verify says 0, and the verify wins.

Measured on OPNsense 26.7.3_11, plugin 1.10.2, the captive portal as the RADIUS client over 127.0.0.1, sqlite store and the session limit both on, a user with Simultaneous-Use := 2, two open rows in radacct, radiusd -X running: the verify query expands to WHERE username = '' and the request gets Access-Accept.


Describe the proposed solution

One line: use %{SQL-User-Name} in simul_verify_query, as the count query and the stock dialect do. After the change the same request expands to WHERE username = '<the user>', returns both rows, and gets Multiple logins (max 2) and Access-Reject. Confirmed end to end through the captive portal from three real devices: the first two sign in, the third is refused before it connects. Template only; no version bump.


Related issue

None opened; the fix is a single substitution.

…t group

simul_verify_query filters radacct on %{SQL-Group}, which is empty on an
Access-Request, so the verify step finds no live session and Simultaneous-Use
never rejects: every extra login is accepted even with the sessions in radacct.
The count query beside it already uses %{SQL-User-Name}, and so does the stock
FreeRADIUS sqlite dialect. Use the same here.

Measured on 26.7.3 with the captive portal as the client, radiusd -X: with two
open rows and Simultaneous-Use := 2, before this change Access-Accept; after it,
"Multiple logins (max 2)" and Access-Reject.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant