Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: The SNI match should be case-insensitive #5047

Closed
tokers opened this issue Sep 13, 2021 · 1 comment · Fixed by #5074
Closed

bug: The SNI match should be case-insensitive #5047

tokers opened this issue Sep 13, 2021 · 1 comment · Fixed by #5074
Labels
bug Something isn't working

Comments

@tokers
Copy link
Contributor

tokers commented Sep 13, 2021

Issue description

Refer from RFC6066:

"HostName" contains the fully qualified DNS hostname of the server,
as understood by the client. The hostname is represented as a byte
string using ASCII encoding without a trailing dot. This allows the
support of internationalized domain names through the use of A-labels
defined in [RFC5890]. DNS hostnames are case-insensitive. The
algorithm to compare hostnames is described in [RFC5890], Section
2.3.2.4.

The SNI should be case-insensitive, While if the snis field in the SSL object contains some uppercase letters, APISIX doesn't convert them into lowercase, as a result, when SNI sent from the client is all in lowercase, the SNI matching will fail and the SSL handshaking will be aborted.

PS: apisix-dashboard sniffs the snis from the SAN and CN fields from the certificate, it doesn't convert them into lowercase too.

Environment

  • apisix version (cmd: apisix version): master
  • OS (cmd: uname -a): N/A
  • OpenResty / Nginx version (cmd: nginx -V or openresty -V): N/A
  • etcd version, if have (cmd: run curl http://127.0.0.1:9090/v1/server_info to get the info from server-info API):
  • apisix-dashboard version, if have: N/A
  • luarocks version, if the issue is about installation (cmd: luarocks --version): N/A

Steps to reproduce

N/A

Actual result

N/A

Error log

N/A

Expected result

No response

@leslie-tsang
Copy link
Member

leslie-tsang commented Sep 13, 2021

The SNI should be case-insensitive, While if the snis field in the SSL object contains some uppercase letters, APISIX doesn't convert them into lowercase, as a result, when SNI sent from the client is all in lowercase, the SNI matching will fail and the SSL handshaking will be aborted.

Can't agree more, string.lower seems to be a feasible method

@spacewander spacewander added the bug Something isn't working label Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants