-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Normalize ipv6 addresses for HostNameVerification in OkHostNameVerifier #5885
Comments
Agree 100%. Looks like the correct thing to do https://tools.ietf.org/html/rfc2818#section-3.1
https://tools.ietf.org/html/rfc2459#section-4.2.1.7
|
|
@yschimke Thanks for the comment. Certificate contains ip in 16 octets as per spec. There is no issue with the certificate. The issue is whether to consider "FD::001" is exact match to "FD00:0:0:0:0:0:0:1" for the purpose of hostname verification. Ipv6 address spec allows both representation, though 16 octet form is preferred. Refer section 2.2.2 from https://tools.ietf.org/html/rfc4291
|
HttpUrl canonicalises the host automatically (::1), so I've gone the other direction and am doing the same to the certificate (0:0:0:0:0:1 -> ::1) since it's a more controlled change. I can't assume it's always the case since javax.net.ssl.HostnameVerifier is a public API taking a String hostname |
In our k8 environment,
KUBERNETES_SERVICE_HOST is set to ipv6 address in compact form. Ex: FD::0001
In certificate subject alternative name, the same ip is set in normalized form. Ex FD00:0:0:0:0:0:0:1
Due to above different formats, hostname verification is failed even though both are same address.
It will be good, if OkHostNameVerifier normalize the hostname and sans before comparing them.
Reference Implementation from https://github.com/apache/cxf/blob/master/rt/transports/http/src/main/java/org/apache/cxf/transport/https/httpclient/DefaultHostnameVerifier.java
The text was updated successfully, but these errors were encountered: