-
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
nginx: support wildcard TLS names #195
Comments
@colemickens can you post an example please? |
https://github.com/kubernetes/test-infra/blob/master/prow/cluster/ingress.yaml I also had to remove the |
@colemickens the issue here is that
The only solution for this cases is to create a mapping of special cases but this requires changes in both ingress controllers (which makes no sense) @bprashanth what can we do to avoid this issues? |
I think I understand why the treatment of But what about the TLS cert? I don't see why the nginx template generation couldn't do the same logic that the GCE controller does... |
You are right, in the absence of hosts in the TLS section we should use the information available on the certificate and generate a server. |
@bprashanth how we should handle this case? (empty hosts in the TLS section). |
Hmm, figuring out the hostname from a cert should be relatively straightforward I think. func main() {
var k, c bytes.Buffer
if err := generateRSACerts("foo.bar.com", true, &k, &c); err != nil {
log.Fatal(err)
}
log.Printf("Hostname %v", getHostnameOrDie(c.Bytes()))
}
func getHostnameOrDie(cert []byte) string {
block, _ := pem.Decode(cert)
if block == nil {
log.Fatalf("Failed to decode cert")
}
parsed, err := x509.ParseCertificate(block.Bytes)
if err != nil {
log.Fatalf("%v", err)
}
return strings.Join(parsed.DNSNames, ",")
} So maybe try and figure out the hostname before failing? |
@bprashanth that's easy ^^. |
It should create a server per hostname in the rules section, and use the cert from the secret for each. If there are no hostnames in the rules section, and no hostname in the tls section, we can do 1 of 3 things:
I'm fine doing 1 adding a doc, filing a bug for 2 and waiting for people to complain. |
Can someone clarify for me to make sure I understand how this will change. If someone has a certificate that has the hostnames foo.example and bar.example the controller will automatically add them to
and if a user has a certificate with a wildcard cert with no hosts specified (e.g., *.example) they can manually add the hosts they want to use that certificate. Is that correct? The current ingress controller I'm trying (gcr.io/google_containers/nginx-ingress-controller:0.9.0-beta.11) doesn't appear to be friendly with wildcard certs. I receive a notice in the logs |
@aledbf We've just completed testing Our ingress:
Log from ingress controller:
I've changed the subdomain and top level domain for privacy reasons. But the domain depth is identical to what we're actually using. The certificate has a common name of |
@keyosk thank you for the log and example. Let me reproduce this. |
@aledbf That's correct. The cert only contains a common name for |
@aledbf If it helps, in this certificate there is a |
I also wanted to follow up an this. I tried with 0.173 yesterday (didn't get a chance to test 0.174 today) but I saw the same behavior still. |
Just tested |
@aledbf @keyosk well i tried |
@gurvindersingh IIRC *.world.com is not valid for sub-sub domains, like test.example.world.com but only one-level sub domains like example.world.com |
@SaaldjorMike yup that seems to be the case :) |
@aledbf just tested with |
@schulzp please update to the latest version quay.io/kubernetes-ingress-controller/nginx-amd64:0.9.0 |
@aledbf do you mean https://quay.io/repository/kubernetes-ingress-controller/nginx-amd64 tag 0.30? If I use that none of my ingresses work at all, I always end up on 'Welcome to nginx'. |
@schulzp quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.9.0 |
@schulzp apologies, I sent the wrong image in the first link |
@aledbf, thanks! However, now I'm getting:
But that's expected, as explained by @SaaldjorMike |
same issue: |
@Oleksii-Terekhov *.whatever is valid for this.whatever, not this.that.whatever. |
-_- ok... but why apache/nginx/firefox/IE/chome and other soft use my "not valid" cert without troubles? |
Apache/nginx will serve whatever it's told to. Firefox/IE/Chrome will warn if invalid cert is served. It's Ingress that rejects the certificate - and therefore, won't pass to nginx.
|
any answer??? |
I'm running into this exact same issue with our wildcard certificate. Would really appreciate some kind of workaround or fix on this one.. |
Having the same issue... created a new question about it: #7349 |
Right now nginx-ingress-controller doesn't do anything if the domain names are omitted from the Ingress rules (with the intention of the "wildcard" TLS cert being used).
As a result, there are Ingress resources that work on GCE, but not Nginx (just using standard Ingress fields too... it's not like there's a proprietary annotation being used).
Fixing this bug would increase the number of ingress yamls in the wild that work with Nginx. As-is... the UX is pretty bad. I had to manually debug in order to figure out that the SSL rules simply weren't being written into my
nginx.conf
.The text was updated successfully, but these errors were encountered: