Inject reverse DNS info when accepting socket connection #540
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.
Currently, when accepting a socket connection, the server is only able to verify the IP Address of the client. The IP Address that it can verify is the physical interface address used by the client, which may not be present in the certificate SANs. We could instead check if the client hostname is present in SANs.
This PR uses a
HostnameResolver
to execute a reverse DNS lookup. Since reverse DNS is unsupported in Kubernetes, it uses the local hostname and the predefined formula for Pod hostnames in a StatefulSet to find the mapping of IP Address to Pod Hostname.We then use reflection to inject this hostname into the InetAddress object returned by the
Socket
.