-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Ingress doesn't listen on 443 if TLS cert not Valid #1873
Comments
Please post the logs from the nginx controller pod |
Just a small snippet - Thanks @aledbf
|
@markfermor the log is clear, you have a secret with a SSL certificate for |
Thanks @aledbf, and yes I understand that, however as I explained in the initial post, this is a valid situation that can occur when using AWS Cloudfront. It's valid to serve the domain with a different certificate to that of the originating requested Host header/domain. As described at the bottom of this doc (https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-https-cloudfront-to-custom-origin.html).
We have configured cloudfront to forward all headers, but technically speaking it's still valid for me to use a different certificate on the origin (Nginx Ingress) to terminate requests, to that of the certificate that cloudfront is using (why might i want to do this? - I can save costs of buying lots of SSL certs. I have lots of AWS ACM free SSL certs, but they have to stay within AWS and you can't export/take the certificate with you). However it's also valid with Cloudfront to just need the origin certificate to match the origin configured domain in cloudfront and not have to match the Host/domain of the request sent to CloudFront (thus technically we use this feature so we only need a single certificate external to cloudfront in order to validly serve requests) The message also states "W0104 15:03:24.264064 8 controller.go:1063] Validating certificate against DNS names. This will be deprecated in a future version." Does that mean the verification is getting removed so that the usecase I'm trying to employ here will work? |
No. It means your certificate is not going to be valid. Using CN if SAN extension present is deprecated. |
This is not related to any external setup butto your local Ingress rule and secret containing the SSL certificate. Please check your secret contains a SSL certificate for the host defined in the ingress |
I'm not sure if you've fully understood what I'm trying to explain? |
@markfermor did you ever find a workaround for this issue? I'm running into a simiar situation. I want to associate a certificate with an Ingress but I don't need the hosts to match at this moment. I've been looking through the nginx ingress controller annotations hoping that there is a "turn of certificate / host verification" option, but I'm not finding one. |
@john-mcgowan-wowza sort of yes. It's not ideal but it was a workable solution at the time. I configured the main server name to be something that was valid, and then added https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md#server-alias a list of server-aliases that didn't match the certificate but would still be answered by the particular ingress resource, it was a space separated list of domain names (you can and we do add quite a few, but expect to have to tweak some of the Nginx memory settings if you are adding a large quantity of domains into the list). It worked like a charm |
#1873 (comment) no longer works. In 0.18.0 it worked like a charm, however just been working on upgrade to 0.25.0 and it doesn't work anymore. It's to do with moving SSL into LUA rather than Nginx handling it in the server blocks like it used to (for good intentions/reasons I might add!). To get around this we used |
Needed to use this issue at one point, but to clarify this: these rules only apply to web browsers, and not anything else that uses the internet. CAB guidelines are between CAs and Browsers -- if you deal with private CAs anything goes. There are definitely use cases that have not moved to SANs out there and the ingress controller should have a way to turn this bogus check off -- the browser will reject it if you use a malformed SAN-less cert anyway.
|
Indeed, especially in the banking industry where using private CAs to issue certs that browsers/default root CA stores see as "invalid" is a required practice. Even though we use I love ingress-nginx and am grateful to its authors. It saves me tons of time and headaches in managing our infrastructure. So thanks! I'll keep using it wherever it works for us. That said, I too wish this validation check could be disabled so I could use it even more. |
Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see https://kubernetes.io/docs/tasks/debug-application-cluster/troubleshooting/.):
What keywords did you search in NGINX Ingress controller issues before filing this one? (If you have found any duplicates, you should instead reply there.):
TLS verify host ssl
Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT or FEATURE REQUEST
NGINX Ingress controller version: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.9.0
Kubernetes version (use
kubectl version
):Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.4", GitCommit:"9befc2b8928a9426501d3bf62f72849d5cbcd5a3", GitTreeState:"clean", BuildDate:"2017-11-20T05:28:34Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"8+", GitVersion:"v1.8.4-gke.1", GitCommit:"04502ae78d522a3d410de3710e1550cfb16dad4a", GitTreeState:"clean", BuildDate:"2017-12-08T17:24:53Z", GoVersion:"go1.8.3b4", Compiler:"gc", Platform:"linux/amd64"}
Environment: testing
Cloud provider or hardware configuration: GKE
OS (e.g. from /etc/os-release):
BUILD_ID=10032.50.0
PRETTY_NAME="Container-Optimized OS from Google"
VERSION=63
Kernel (e.g.
uname -a
): Linux NODENAME 4.4.86+ Basic structure #1 SMP Tue Nov 21 22:05:47 PST 2017 x86_64 Intel(R) Xeon(R) CPU @ 2.20GHz GenuineIntel GNU/LinuxInstall tools: GKE
Others:
What happened:
Just tried setting up an nginx ingress (controller and Nginx running on K8s) which is also behind AWS cloudfront (for reasons I won't go into). So the layout looks something like this..
client (Requests x.hello.com) -> Cloudfront - terminates https (configured to send/forward to origin of y.goodbye.com and re-encrypt) -> K8s Nginx ingress - terminates https and has TLS for y.goodbye.com
When using this set-up there's different TLS Certificates involved one at Cloudfront level and another on the backend origin for Nginx. Problem is that Cloudfront doesn't re-write the Host/domain header of the request, so the request reaches the backend Nginx pods with host header of "x.hello.com" and Cloudfront is happy as long as the TLS cert served matches the origin of "y.goodbye.com".
However in order to get Nginx to answer with the right cert for a request coming into it of "x.hello.com" I configured the yaml as follows:
This created nginx config of..
Which only listens on port 80 and not port 443. My guess is there's possibly some verification of the SSL which although is normally valid, in this case actually isn't valid.
What you expected to happen:
I expected the nginx config to listen on port 80 but also to listen on port 443 which is what does happen when the certificate is correctly matching the hosts array in tls config. I understand this is technically odd, but my hands are tied by Cloudfront and I needed Nginx to answer the SSL cert that Cloudfront is expecting to see.
How to reproduce it (as minimally and precisely as possible):
As described I suppose
Anything else we need to know:
I have a potential work around in that using the service-alias annotation possibly is enough to get the job done. However then it becomes more difficult I imagine (based on the layout of the nginx config and a hutch - i'm yet to test this theory), if I wanted to have multiple of the same server name to split traffic to different services based on request path, this wouldn't be possible. 1. I can't use it as a main server name again because i'm needing to use it as an alias to get around this problem. 2. Being part of an alias, i imagine if I make it part of an alias in another server {} definition else where that one will still gain priority over the other. Looks very similar to #1573 and this comment in particular #1573 (comment) - however in this case I need the wrong certificate to be returned (it's the correct certificate as far as Cloudfront is concerned but it's also technically the wrong certificate for the host - however I feel this is a perfectly valid use case?)
The text was updated successfully, but these errors were encountered: