Kubernetes/Ingress/TLS - block access with IP Address in URL

5/5/2021

A pod is accessible via nginx-ingress and https://FQDN. That works well with the configured public certificates. But if someone uses https://IP_ADDRESS - he will get a certificate error because of the default "Kubernetes Fake Certificate". Is it possible to block access completely using the IP_ADDRESS url?

-- Mark
kubernetes
ssl

1 Answer

5/5/2021

I think you would first need the TLS handshake to complete, before Nginx could deny the access.

On the other hand, HAproxy may be able to close the connection while checking the ServerName. Say setting some ACL in your https frontend, routing applications to their backends. Though I'm not sure this would be doable unless mounting a custom HAproxy configuration template into your ingress controller.

-- SYN
Source: StackOverflow