Conversation
backend_tls_ctx_reload_crl() decides whether PEM_read_bio_X509_CRL()
hit end of file by looking at ERR_peek_error(), which returns the
OLDEST error on the thread's OpenSSL error queue, and it never clears
the queue before reading. If anything earlier in the handshake left an
error queued (seen with OpenSSL 3.5: an EVP "unsupported" error from
the same handshake), a clean EOF after the last CRL is misclassified:
the M_WARN "cannot read CRL from file" fires, crypto_msg() prints the
unrelated queued errors as if they came from the CRL file, and the
CRLs that were already parsed are installed anyway ("loaded 1 CRLs").
Observed on every first handshake after the CRL file changed (mtime or
size), never at daemon start where the queue is empty. The verdict is
unaffected; the warning is a false positive that operators alerting on
that string for a fail-closed crl-verify deployment will page on.
Clear the error queue before the read loop so only errors raised by
PEM_read_bio_X509_CRL() are visible, test the last error rather than
the first, and clear the queue on the EOF path instead of popping one
entry.
Signed-off-by: Drew Blokzyl <drew@linuxkids.com>
Author
|
Patch sent to openvpn-devel on 2026-09-10 as |
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.
Fixes #1103.
backend_tls_ctx_reload_crl()tests for end of file withERR_peek_error(), which returns the oldest error on the thread's OpenSSL error queue, and never clears the queue first. Any error left queued earlier in the handshake makes a clean EOF after the last CRL look like a read failure: theM_WARN"CRL: cannot read CRL from file" fires with the unrelated queued errors printed under it, and the CRLs already parsed are installed anyway ("loaded 1 CRLs"). Seen on every first handshake after the CRL file changes, with OpenSSL 3.5.5 leaving an EVP "unsupported" error queued.This change clears the queue before the read loop, tests
ERR_peek_last_error(), and clears the queue on the EOF path instead of popping one entry.Validated on aarch64 / OpenSSL 3.5.5 / DCO with two builds of master
28ec0f90run as a server withcrl-verify <file>, the file atomically replaced three times with a client re-handshake after each, then once with a file containing no CRL:loaded 0 CRLs,VERIFY ERROR: CRL not loadedloaded 0 CRLs,VERIFY ERROR: CRL not loaded, prints only the PEM errorOpened for review per CONTRIBUTING; the patch will go to openvpn-devel once ACKed.
clang-format --dry-run -Werroris clean on the file.