Fix UAM challenge race by issuing challenges in the main daemon#609
Merged
Conversation
Contributor
Author
|
After a week of activity on an instance, with over 6000 connections, there are no more errors. @sevan : Do you see anything problematic with this PR ? |
Member
|
Meged, thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Parallel
chilliredirworkers could each generate a different UAM challenge while the main daemon still haduamtime == 0(or before state was synchronized). The HTTP response seen by the client could then disagree with the challengestoredin chilli, leading to valid credentials but RADIUS Access-Reject (especially with CHAP). A retry often worked because a single code path then owned the session.In my case, this represents approximately 5 to 10% of login attempts that result in an "Access-Reject".
The behavior seems to be related to the type of device being used; it is consistently reproducible with a Google Pixel 7a but not with an iPad, for example.
Solution
Challenge creation / refresh for the affected UAM paths is moved to the main chilli daemon, which already handles UAM IPC in a single-threaded way for each accepted connection. The redir side uses a new Unix-socket RPC (same pattern as
REDIR_MSG_STATUS_TYPE/redir_conn_t reply): message types 1001–1004 encode the same policy as the previousredir_memcopy(REDIR_CHALLENGE)sites (prelogin/splash, status,challengetimeout2, and “always” on reject whenchallengetimeoutis set).Random bytes are read in the daemon via a small helper
uam_random_challenge()inutil.c(shared with the former redir-side/dev/urandomlogic).