Documented restricting $ssl_server_name in certificate file names - #304
Draft
VadimZhestikov wants to merge 1 commit into
Draft
Documented restricting $ssl_server_name in certificate file names#304VadimZhestikov wants to merge 1 commit into
VadimZhestikov wants to merge 1 commit into
Conversation
pluknet
reviewed
Aug 7, 2026
When a variable such as $ssl_server_name -- which holds the unvalidated name requested by the client -- is used directly in the ssl_certificate or ssl_certificate_key file name, the client can influence which file is loaded, for example via a name containing a path separator or "../". Added a note recommending that the value be restricted to an expected set of names, for example with the map directive.
VadimZhestikov
force-pushed
the
docs-ssl-certificate-variable-warning
branch
from
August 7, 2026 14:25
404886c to
4fefaa5
Compare
Contributor
Author
|
Thanks, reworked as suggested: dropped the repeated
-- followed by the |
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.
Problem
The documentation for
ssl_certificatepresents$ssl_server_nameused directlyin the certificate file name as a straightforward SNI-based selection pattern,
with only a performance caveat.
$ssl_server_nameholds the server namerequested by the client and is not validated, so using it directly in the file
name lets a client influence which file is loaded -- for example, by sending an
SNI value containing a path separator or
../.The behavior is by design (the variable intentionally reflects the raw SNI; see
fd97b2a80), so this is a documentation gap rather than a code defect, but the
example currently leads administrators toward an unsafe configuration.
Solution
Added a note to the
ssl_certificatevariables section explaining that$ssl_server_nameis client-controlled and not validated, and recommending thatthe value be restricted to an expected set of names, for example with a
mapallowlist. English and Russian.
Testing
xmllint --noout --validagainstdtd/passes for both files.