-
Notifications
You must be signed in to change notification settings - Fork 18k
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
x/crypto/acme/autocert: implement HTTP-01 challenge responses #20049
Comments
If you're doing to do something custom and wire up a weird contraption, the https://godoc.org/golang.org/x/crypto/acme package has HTTP-01 support already. Have you got that working first? autocert is supposed to be magic for a common config. Maybe your use case will also become a common config, but it's not clear it is already. FWIW, I also run a bunch of autocert sites on GKE, but it's just using Google's TCP proxy, so I still do the SNI+HTTPS, without HTTP proxies or TLS in front of me. You can implement the autocert cache interface and put the certs on GCS or something. In any case, what API do you have in mind? I'd say make it work first and then propose the least invasive API change possible. |
The API change I had in mind is adding this exported field to autocert.Manager:
Usage would then look something like:
This could be done just using the In any case, I'll try and get it working first then report back. Thanks for the feedback! |
The concrete type And instead of naming the field type Manager struct {
// Foo optionally specifies a Handler to ...
// If nil, ...
Foo http.Handler Also, that one minute polling loop is kinda gross. Any polling is gross: it's either too fast or too slow. You want to have no TLS for a minute while you wait to install the cert? Any API needs to work instantly and not involve loops with sleeps. |
Wouldn't it be even simpler to just have Manager implement m := &autocert.Manager{Prompt: autocert.AcceptTOS}
http.Handle("/.well-known/acme-challenge/", m)
http.ListenAndServe(":80", nil) Manager would still need to know which challenge type is preferred, tls-sni or http-01, but this feels less intrusive towards existing API. |
That seems like too big of a cut through the abstractions. I'd rather not add a ServeHTTP method and make users know or think about the ACME protocol. That sends the wrong message about how Manager is supposed to be used. |
RE: Polling - yes, it's ugly, the client could just poll once every RE: ServeMux/Handler. I don't understand how one can add a Handler for a path (e.g. Given this would expose details of the ACME protocol to users of autocert.Manager, and that's not desirable, I think I'll just use the |
Presently only the TLS-SNI-02 & TLS-SNI-01 Challenges are supported:
https://github.com/golang/crypto/blob/12c985a/acme/autocert/autocert.go#L455..L463
Adding support for the HTTP-01 challenge would be helpful for servers that sit behind a TLS-terminating proxy (such as Google Cloud HTTP(S) Load Balancer), and therefore cannot receive TLS-SNI requests directly. My intended use case is to have a server running on GKE behind such a load balancer (Kube Ingress) provision/update certs and then use the Kube API to update TLS secrets for the load balancer to serve.
Would you be open to a change that adds this support? Probably by way of adding an optional *http.ServeMux to the autocert.Manager struct, and updating the function linked above?
/cc @x1ddos @bradfitz
The text was updated successfully, but these errors were encountered: