Skip to content

TLS authentication ignored by nginx ingress #1573

@christian-roggia

Description

@christian-roggia

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/.): No

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.): verify-client, auth-tls-secret, auth-tls


Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT

NGINX Ingress controller version: 0.9.0-beta.15 (with RBAC)

Kubernetes version (use kubectl version):
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.1", GitCommit:"f38e43b221d08850172a9a4ea785a86a3ffa3b3a", GitTreeState:"clean", BuildDate:"2017-10-11T23:27:35Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.1", GitCommit:"f38e43b221d08850172a9a4ea785a86a3ffa3b3a", GitTreeState:"clean", BuildDate:"2017-10-11T23:16:41Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}

Environment:

  • Cloud provider or hardware configuration: Bare metal (kubeadm + Flannel)
  • OS (e.g. from /etc/os-release): Ubuntu 16.04
  • Kernel (e.g. uname -a): Linux 4.4.0-81-generic

What happened:
Kubernetes dashboard and Grafana dashboard are accessible from everywhere without a valid CA.

What you expected to happen:
I expected an error message because I did not have a valid CA configured in Chrome.
I expected an error message 503 if my configuration was not correct.

How to reproduce it (as minimally and precisely as possible):
Follow the example provided by the docs:
https://github.com/kubernetes/ingress-nginx/blob/master/docs/examples/auth/client-certs/nginx-tls-auth.yaml

Anything else we need to know:
I generated the CA and TLS secrets by following the guide provided by the docs:
https://github.com/kubernetes/ingress-nginx/blob/master/docs/examples/PREREQUISITES.md
I only changed the name and namespace.

NOTE: Basic-auth works correctly with my kubernetes and nginx ingress configuration.
NOTE: If I try to invalidate the configuration of the TLS auth by setting an invalid CA the error page 503 is displayed as expected.


I am currently using the following yaml configuration to deploy my ingress (same config for kubernetes' dashboard):

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: "nginx"
    ingress.kubernetes.io/auth-tls-secret: "kube-system/dashboard-ca-ingress"
    ingress.kubernetes.io/auth-tls-verify-depth: "3"
    ingress.kubernetes.io/auth-tls-verify-client: "on"
    ingress.kubernetes.io/force-ssl-redirect: "true"
  name: grafana-ingress
  namespace: kube-system
spec:
  tls:
  - hosts:
    - <host goes here>
    secretName: nginx-tls-secret
  rules:
  - host: <host goes here>
    http:
      paths:
      - path: /
        backend:
          serviceName: monitoring-grafana
          servicePort: 80

dashboard-ca-ingress secret:

apiVersion: v1
data:
  ca.crt: <data goes here>
kind: Secret
metadata:
  name: dashboard-ca-ingress
  namespace: kube-system
type: Opaque

nginx-tls-secret secret:

apiVersion: v1
data:
  tls.crt: <data goes here>
  tls.key: <data goes here>
kind: Secret
metadata:
  name: nginx-tls-secret
  namespace: kube-system
type: kubernetes.io/tls

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions