Skip to content
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

Where is DefaultSSLCertificate used? #163

Closed
rikatz opened this issue Jan 23, 2017 · 5 comments
Closed

Where is DefaultSSLCertificate used? #163

rikatz opened this issue Jan 23, 2017 · 5 comments

Comments

@rikatz
Copy link
Contributor

rikatz commented Jan 23, 2017

I'm configuring a new NGINX Ingress Controller here, and have the following startup command:

./nginx-ingress-controller --update-status=false --apiserver-host=https://10.200.83.12 --configmap=sistema/nginx-load-balancer-conf --default-ssl-certificate=sistema/tlspadrao --default-backend-service=sistema/default-backend --kubeconfig=/etc/kubernetes/kubeconfig.yaml

The ingress controller is able to configure the default ssl certificate (as the following):

ls -l /ingress-controller/ssl/sistema-tlspadrao.pem 
-rw-------. 1 root root 5420 Jan 23 16:35 /ingress-controller/ssl/sistema-tlspadrao.pem

But this file is not referenced anywhere on nginx configuration. Even on the default virtualhost (server_name _) there is no config of this default TLS certificate.

Also, I though this was necessary for vhosts that specify a 'tls' entry but no secret (as the following, using the default TLS certificate to this vhost):

user@homer:~/kubernetes/ingress/ssl$ kubectl get ingress teste --namespace=katz1 -o yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    ingress.kubernetes.io/limit-connections: "2"
    ingress.kubernetes.io/ssl-redirect: "true"
    ingress.kubernetes.io/whitelist-source-range: 10.0.0.0/8,127.0.0.1/32
  creationTimestamp: 2017-01-03T12:37:34Z
  generation: 5
  name: teste
  namespace: katz1
  resourceVersion: "16320214"
  selfLink: /apis/extensions/v1beta1/namespaces/katz1/ingresses/teste
  uid: 66c40a07-d1b1-11e6-8a4c-00505683ef23
spec:
  rules:
  - host: teste.vhost.com
    http:
      paths:
      - backend:
          serviceName: nginx
          servicePort: 80
        path: /
  tls:
  - hosts:
    - teste.vhost.com

So, what am I missing? Trying to see where in the code I can change this also :)

Thanks

@aledbf
Copy link
Member

aledbf commented Jan 23, 2017

@rikatz please check the generated nginx.conf file searching the default server. The file you see in the ssl certificate is the default certificate to use

@rikatz
Copy link
Contributor Author

rikatz commented Jan 23, 2017 via email

@rikatz
Copy link
Contributor Author

rikatz commented Jan 24, 2017

@aledbf This is the part of nginx.conf file that should have a '442' listen port:

    server {
        server_name _;
        listen [::]:80 ipv6only=off default_server reuseport backlog=511;
        vhost_traffic_status_filter_by_set_key $geoip_country_code country::$server_name;

I don't know if the used schema inside NGINX (listening as a stream on 443 port, and then directing it to a vhost) allows us to have a Default SSL Vhost.

@rikatz
Copy link
Contributor Author

rikatz commented Jan 24, 2017

@aledbf here: https://github.com/kubernetes/ingress/blob/master/core/pkg/ingress/controller/controller.go#L821

I think there's something missing.

I'm trying to do as follow:

        defaultCertificate, exists := ic.sslCertTracker.Get(ic.cfg.DefaultSSLCertificate)
        if exists {
                cert := defaultCertificate.(*ingress.SSLCert)
                servers[defServerName].SSLCertificate = cert.PemFileName
                servers[defServerName].SSLPemChecksum = cert.PemSHA
        } else {
                glog.Warningf("Default SSL Certificate %v does not exists", ic.cfg.DefaultSSLCertificate)
        }

I'm not being able to read the secret correctly (don't know why, but will keep trying), but I think this solves part of the problem, as Default Server is going to have a certificate for itself.

The post step is to change also the template, but I'm not being able, by now, to read the Default SSL Certificate and transform it into something usable by the Default Server.

@rikatz
Copy link
Contributor Author

rikatz commented Jan 26, 2017

Solved in #179

@rikatz rikatz closed this as completed Jan 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants