-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: Enable custom port / IP binding #29540
Comments
Am I missing something or is it already possible to do what you want by calling |
In my opinion the whole autocert package is about convenience and providing easy HTTPS implementation. |
Copy of @bradfitz comment in Gerrit:
|
I'm not really happy with the name, too. Here are my thoughts why I ended up with My first thougt was to make My 2nd idea was to call the function So I went with the 3rd option I thought about a 4th option that maybe work well with @bradfitz proposal
If somebody really wants to bind to a specific address on a port different from 443 he needs to build this on his own outside of autocert. I'm not sure if it is a good idea to sacrifice flexibility for better function naming but the described case will be rarely needed so I'm fine with it. |
I'd argue the
and we deprecate |
@FiloSottile I support your proposal. I think it's more straightforward to use and returning errors is a huge improvement. The changes should be fairly easy to do but I have two questions regarding the workflow:
|
@x1ddos, does #29540 (comment) look good to you? |
This issue requires no code changes imho:
The above sounds like a non-issue to me: m := &autocert.Manager{
Cache: autocert.DirCache("secret-dir"),
Prompt: autocert.AcceptTOS,
HostPolicy: autocert.HostWhitelist("example.org", "www.example.org"),
}
s := &http.Server{
Addr: "127.0.0.1:8443",
TLSConfig: m.TLSConfig(),
}
s.ListenAndServeTLS("", "") Listener has a different purpose:
It even says so later:
(from https://godoc.org/golang.org/x/crypto/acme/autocert#NewListener) |
Talked to @bradfitz about this (we designed this package). It seems odd to have both Listen and Listener (maybe Listener should have been named Listen from the start but oh well). For >99% of use cases Listener is doing the right thing. We could imagine adding a field Addr string to Manager, defaulting to ":443", but then what if you want to change the keepalives that listener does? As it is, listener (the unexported type) is a very small wrapper around Manager itself. It probably makes sense to just copy it out. All you really need access to is m.TLSConf(), which you have. |
Based on the discussion above, this seems like a likely decline. |
No change in consensus, so declined. |
It is mandatory to be reachable on port 443 from the public internet for autocert to work but it is completely fine to run a service on a different port internally and use e. g. NAT on a router to fulfill this requirement.
Additionally there are setups where I don't want to listen on all my local IP addresses.
This can be implemented through a new function
ListenerCustomAddress(address)
that works likeListener()
but accepts a custom address.PR: golang/crypto#69
Gerrit: https://go-review.googlesource.com/c/crypto/+/155744
The text was updated successfully, but these errors were encountered: