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

Add handling for a default TLS certificate #410

Closed
mattalberts opened this issue May 25, 2018 · 15 comments
Closed

Add handling for a default TLS certificate #410

mattalberts opened this issue May 25, 2018 · 15 comments
Assignees
Labels
blocked/needs-design Categorizes the issue or PR as blocked because it needs a design document. kind/feature Categorizes issue or PR as related to a new feature. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Milestone

Comments

@mattalberts
Copy link

Feature Request: Add handling for a default TLS certificate

  • Search Terms: "is:issue is:open TLS"

Add handling to allow use of a default TLS certificate, following these guidelines

  • The certificate is specified as a <namespace>/<name> reference to a secret.
  • The default secret is applied to Ingress specs that specify tls without providing spec.tls.secretName
  • Existing matching rules against spec.tls.hosts are still satisfied.
  • An Ingress spec.tls.secretName overrides the default secret.
  • The default secret does not apply to the default host "*"

Hopefully the guidelines don't sound to dogmatic. 😄

All I'm try to capture is a loosening of validTLSSpecforVhost to only reject a TLS spec if both the default secret and spec.tls.secretName are not set.

Example Depolyment|Container Definition

        - name: contour
          image: gcr.io/heptio-images/contour:latest
          imagePullPolicy: Always
          command: ["contour"]
          args:
            - serve
            - --incluster
            - --ingress-class-name=contour
            - --default-tls-secret=$(POD_NAMESPACE)/contour-ingress
          env:
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace

Example Ingress Definition

---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: contour-echo
  labels:
    ingress: contour
  annotations:
    kubernetes.io/ingress.class: contour
spec:
  tls:
  - hosts:
    - echo.127.0.0.1.xip.io
  rules:
  - host: echo.127.0.0.1.xip.io
    http:
      paths:
      - path: /
        backend:
          serviceName: echo
          servicePort: 80
---
  • we specify tls with a host but leave the secretName empty to use the default secret.
  • the behavior is similar to both the nginx and haproxy ingress controllers.
@davecheney
Copy link
Contributor

davecheney commented May 26, 2018 via email

@davecheney davecheney added the kind/feature Categorizes issue or PR as related to a new feature. label May 28, 2018
@mattalberts
Copy link
Author

@davecheney

I was curious about that too, especially given that the cross-section of istio, nginx, and haproxy ingress controllers are not all consistent (istio is the outlier, both nginx and haproxy provide a --default-ssl-certificate option).

// IngressTLS describes the transport layer security associated with an Ingress.
type IngressTLS struct {
	// Hosts are a list of hosts included in the TLS certificate. The values in
	// this list must match the name/s used in the tlsSecret. Defaults to the
	// wildcard host setting for the loadbalancer controller fulfilling this
	// Ingress, if left unspecified.
	// +optional
	Hosts []string `json:"hosts,omitempty" protobuf:"bytes,1,rep,name=hosts"`
	// SecretName is the name of the secret used to terminate SSL traffic on 443.
	// Field is left optional to allow SSL routing based on SNI hostname alone.
	// If the SNI host in a listener conflicts with the "Host" header field used
	// by an IngressRule, the SNI host is used for termination and value of the
	// Host header is used for routing.
	// +optional
	SecretName string `json:"secretName,omitempty" protobuf:"bytes,2,opt,name=secretName"`
	// TODO: Consider specifying different modes of termination, protocols etc.
}
  • Given the wording, I wasn't certain if this constituted a violation ... or expected behavior.. Feels like it falls into the final portion of the wording for SecretName (the qualification around it being optional).
  • GitHub Spec Reference

Spec aside (😄 cause I'm sure you're more familiar than I am 😄 ), let's talk use-case. I'll try to set the stage a little.

Assumptions,

  • a kubernetes 1.10.x cluster with ~100 namespaces (its early, the number will grow).
  • namespaces are used to develop restful apis and other socket/grpc services
  • 1 or more ingresses per-namespace (all needing tls support)
  • most ingresses want exposure of the form {{{service-name}}].example.com
  • a least one wildcard signed certificate

I'm aiming for an environment where TSL setup/management is so easy its free (from a development/operational cost perspective), without removing the ability to self-manage certs where needed (for customization & control).

To get there now, I see a few choices (you might see more 😄).

  1. add default handling (controller default with ingress spec override)
  2. use Cert Managert
  3. reliably replicate the secret into all namespaces

Cert Manager is ear-marked as not ready, which is fine because I'm not ready for it either 😄.

The replication option is workable. It would be fairly easy to write a list-watch to ensure the secret is present (or replicate it if not present). My small cluster would see ~100 copies of the certificate (again, the number will grow). It also leads to exposure of the certificate key. Namespaces are expect to have additional secrets, locking it down via rbac wouldn't be an option (I could explore web-hook options for restrictions, but it starts to feel a little rube goldberg-esch).

@davecheney
Copy link
Contributor

a least one wildcard signed certificate

I think this is the key requirement here, it's come up before with respect to applying the ingress notion of a default ingress to tls. IMO this case was not well thought out in the ingress spec so I want to tread very carefully because any behaviour we adopt now (it's been prohibited since 0.3) will be irreversible once adopted.

Duplicating a secret across multiple namespaces sounds like a pain operationally and will give your security folks hives.

My recommendation is:

a. use cert-manager and lets encrypt, this problem is exactly their target market. AFAIK JetStack consider ready for production. /cc @munnerz
b. wait for the ingress route crd to land. No ETA yet and TBH we haven't thought about how to accomodate wildcard explicitly either, so in that respect we're no better than the current ingress spec.

@mattalberts
Copy link
Author

Even vocalizing the suggestion would trigger hives (its truly a voldemort of phrases 😄).

Sadly lets encrypt is also a non-option. The diagram shows integration with vault; vault is a workable option. My light reading suggests cert-manager will produce signed certificates as CRDs. That hints at requiring additional processing to translate those CRDs into Secrets within the namespace for use by Ingress definitions? /cc @munnerz.

I'm likely stuck with a modified option b. for a period of time. The modification being, run with an patched version of contour while I wait for the ingress route crd to land.

Its the least risky of all the options 😄.

@munnerz
Copy link

munnerz commented Sep 10, 2018

I'm just crunching through my GitHub notifications and have spotted these questions - sorry for not getting back sooner!

@mattalberts cert-manager uses the Certificate CRD to define what a Certificate should look like. It ultimately stores the signed keypair as a Secret resource in the API server (as named by spec.secretName.

Happy to discuss with you further if you are still exploring this. We support Vault now, and would love to hear any feedback on the integration (especially with the sort of setup you have, with many namespaces and many things TLS'd! 😄)

@mauilion
Copy link

bumping this issue again. There are a number of folks that are unable to adopt contour until this feature lands.

@floriankoch
Copy link

any progress here? i have the same situation / requirement as @mattalberts , we use nginx-ingress atm, but want to switch to contour to use the ingress route

@jcrowthe
Copy link

Likewise, similar situation here. In a multi-tenant cluster environment with a wildcard certificate, placing the cert as a secret in every namespace is horrific. Cert-manager can be adopted by some, but not all, and lack of support in Contour is a hindrance to its adoption.

IngressRoute doesn't appear to be well suited to a multi tenant team with a wildcard cert, as you need to delegate each and every fqdn before tenants get access. Most multi-tenant models attempt to be as self-service as possible, making the requirement to of delegation a large road block.

Can we revisit this issue?

@davecheney
Copy link
Contributor

davecheney commented Nov 17, 2018 via email

@jcrowthe
Copy link

@davecheney Thanks, it's good to know this is on the radar.

If a dev on my team happened to have some spare cycles, would you accept a PR for this feature? If so, we'd like to implement it right, which means we'd need a spec to build toward.

@davecheney
Copy link
Contributor

If a dev on my team happened to have some spare cycles, would you accept a PR for this feature?

Of course, all help gratefully received, but please before sending any code discuss and agree on a design in this issue, or in a spec PT to the design/ or docs/ directory.

@jcrowthe
Copy link

@davecheney Thanks, sounds good. I'm also seeing that an attempt was already made at this feature in PR #411. Would you comment further on why it was rejected initially? Would it be possible to revive that PR? Thanks!

@davecheney
Copy link
Contributor

The contribution process for this repo is to agree on a design, then code. #411 did it the other way around.

@davecheney davecheney modified the milestones: 0.9.1, 0.10.0 Feb 6, 2019
@davecheney davecheney added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Feb 6, 2019
@davecheney davecheney self-assigned this Feb 8, 2019
@davecheney davecheney added priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. blocked/needs-design Categorizes the issue or PR as blocked because it needs a design document. and removed priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Feb 8, 2019
@davecheney davecheney added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. labels Feb 18, 2019
davecheney added a commit to davecheney/contour that referenced this issue Feb 18, 2019
Updates projectcontour#410

Subdomain delegation is an alternative to TLS Certificate Delegation (projectcontour#889).
Subdomain delegation introduces the notion of a "root" IngressRoute
object which holds the top level domain definition, ie, .mycompany.com,
along with a TLS stanza block that applies to all delegated subdomains
unless specifically overridden.

Signed-off-by: Dave Cheney <dave@cheney.net>
davecheney added a commit to davecheney/contour that referenced this issue Feb 18, 2019
Updates projectcontour#410

Subdomain delegation is an alternative to TLS Certificate Delegation (projectcontour#889).
Subdomain delegation introduces the notion of a "root" IngressRoute
object which holds the top level domain definition, ie, .mycompany.com,
along with a TLS stanza block that applies to all delegated subdomains
unless specifically overridden.

Signed-off-by: Dave Cheney <dave@cheney.net>
davecheney added a commit to davecheney/contour that referenced this issue Feb 18, 2019
Updates projectcontour#410

Subdomain delegation is an alternative to TLS Certificate Delegation (projectcontour#889).
Subdomain delegation introduces the notion of a "root" IngressRoute
object which holds the top level domain definition, ie, .mycompany.com,
along with a TLS stanza block that applies to all delegated subdomains
unless specifically overridden.

Signed-off-by: Dave Cheney <dave@cheney.net>
davecheney added a commit to davecheney/contour that referenced this issue Feb 27, 2019
Updates projectcontour#410
Updates projectcontour#905

Signed-off-by: Dave Cheney <dave@cheney.net>
davecheney added a commit to davecheney/contour that referenced this issue Feb 27, 2019
Updates projectcontour#410
Updates projectcontour#905

Signed-off-by: Dave Cheney <dave@cheney.net>
davecheney added a commit to davecheney/contour that referenced this issue Feb 27, 2019
Updates projectcontour#410
Updates projectcontour#905

Signed-off-by: Dave Cheney <dave@cheney.net>
davecheney added a commit that referenced this issue Feb 28, 2019
Updates #410

Watch TLSCertificateDelegation entries.

Also adjust the group name from contour.vmware.com to contour.heptio.com
to solve registration problems.

Adjust RBAC and CRD definitions to match

Signed-off-by: Dave Cheney <dave@cheney.net>
davecheney added a commit to davecheney/contour that referenced this issue Mar 4, 2019
Fixes projectcontour#905
Updates projectcontour#410

This PR implements TLS Certificate Delegation for ingress (untested) and
ingressroute objects. See projectcontour#889 for design.

Signed-off-by: Dave Cheney <dave@cheney.net>
davecheney added a commit to davecheney/contour that referenced this issue Mar 4, 2019
Fixes projectcontour#905
Updates projectcontour#410

This PR implements TLS Certificate Delegation for ingress (untested) and
ingressroute objects. See projectcontour#889 for design.

Signed-off-by: Dave Cheney <dave@cheney.net>
davecheney added a commit to davecheney/contour that referenced this issue Mar 4, 2019
Fixes projectcontour#905
Updates projectcontour#410

This PR implements TLS Certificate Delegation for ingress (untested) and
ingressroute objects. See projectcontour#889 for design.

Signed-off-by: Dave Cheney <dave@cheney.net>
davecheney added a commit to davecheney/contour that referenced this issue Mar 4, 2019
Fixes projectcontour#905
Updates projectcontour#410

This PR implements TLS Certificate Delegation for ingress (untested) and
ingressroute objects. See projectcontour#889 for design.

Signed-off-by: Dave Cheney <dave@cheney.net>
davecheney added a commit to davecheney/contour that referenced this issue Mar 4, 2019
Fixes projectcontour#905
Updates projectcontour#410

This PR implements TLS Certificate Delegation for ingress (untested) and
ingressroute objects. See projectcontour#889 for design.

Signed-off-by: Dave Cheney <dave@cheney.net>
@davecheney davecheney modified the milestones: 0.10.0, 0.11.0 Mar 8, 2019
@davecheney
Copy link
Contributor

I'm closing this issue as we shipped TLS Certificate Delegation in 0.10. Additions or improvements should be handled in a new issue.

@mattalberts
Copy link
Author

I saw that! Thanks for the update. Certificate Delegation looks to be a very flexible resolution (reading about it right now).

sunjayBhatia pushed a commit that referenced this issue Jan 30, 2023
Moves these three packages up one level, from under
internal/operator/ to directly under internal/. This
simplifies the package hierarchy.

Signed-off-by: Steve Kriss <krisss@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked/needs-design Categorizes the issue or PR as blocked because it needs a design document. kind/feature Categorizes issue or PR as related to a new feature. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
None yet
Development

No branches or pull requests

6 participants