-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Description
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/Linux -
Install 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:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx-ext
labels:
allRelated: service
name: ing-test
spec:
rules:
- host: x.hello.com
http:
paths:
- backend:
serviceName: service
servicePort: 80
tls:
- hosts:
- x.hello.com
secretName: y.goodbye.com
This created nginx config of..
## start server x.hello.com
server {
server_name x.hello.com;
listen 80;
listen [::]:80;
set $proxy_upstream_name "-";
location / {
....
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?)