Shutdown ssl connection with client if radius request packet validation fails#122
Merged
fmauchle merged 1 commit intoradsecproxy:masterfrom Apr 28, 2023
Merged
Conversation
fmauchle
added a commit
that referenced
this pull request
Apr 28, 2023
fmauchle
added a commit
that referenced
this pull request
May 2, 2023
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.
On upgrading radsecproxy from 1.9.1 to 1.9.2, we started seeing an issue where tls clients were reporting a socket timeout on sending a malformed radius packet (with wrong secret) instead of radsecproxy closing the SSL connection (which was the behaviour in 1.9.1). Debugging this, we found an issue in radsecproxy whereby some threads were not exiting (namely
tlsserverwr) leading to this.When
radsrvreturns 0 because of radius packet validation failure,tlsserverrddoes not set any state to indicate totlsserverwrthread that SSL connection with client is closed. It only callspthread_cond_signal(&client->replyq->cond);.tlsserverwrthread on receiving the thread conditional signal moves ahead and checks whether SSL is shutdown usingSSL_get_shutdown(client->ssl)but since this returns false, it again starts waiting for the thread conditional signal and therefore never exits. At this time,tlsserverrdis also waiting for thetlsserverwrthread to end. Below logs indicate this scenarioThis fix is to shutdown the SSL connection with the client if
radsrvreturns 0 so thattlsserverwrthread can also exit successfully. This leads totlsservernewthread exiting which frees the SSL connection with the client along with closing the socket. Below logs demonstrate the fix.