mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-23 22:27:38 -05:00
letsencrypt: Ensure no prompt if user is not there
Also only set custom address if alternate port is specified (rather than using a blank address; just cleaner this way)
This commit is contained in:
parent
8a6c778c8d
commit
c7d4d051cb
1 changed files with 12 additions and 8 deletions
|
@ -342,9 +342,11 @@ func newClientPort(leEmail, port string) (*acme.Client, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
client.SetHTTPAddress(":" + port)
|
if port != "" {
|
||||||
client.SetTLSAddress(":" + port)
|
client.SetHTTPAddress(":" + port)
|
||||||
client.ExcludeChallenges([]string{"tls-sni-01", "dns-01"}) // We can only guarantee http-01 at this time
|
client.SetTLSAddress(":" + port)
|
||||||
|
}
|
||||||
|
client.ExcludeChallenges([]string{"tls-sni-01", "dns-01"}) // We can only guarantee http-01 at this time, but tls-01 should work if port is not custom!
|
||||||
|
|
||||||
// If not registered, the user must register an account with the CA
|
// If not registered, the user must register an account with the CA
|
||||||
// and agree to terms
|
// and agree to terms
|
||||||
|
@ -355,11 +357,13 @@ func newClientPort(leEmail, port string) (*acme.Client, error) {
|
||||||
}
|
}
|
||||||
leUser.Registration = reg
|
leUser.Registration = reg
|
||||||
|
|
||||||
if !Agreed && reg.TosURL == "" {
|
if port == "" { // can't prompt a user who isn't there
|
||||||
Agreed = promptUserAgreement(saURL, false) // TODO - latest URL
|
if !Agreed && reg.TosURL == "" {
|
||||||
}
|
Agreed = promptUserAgreement(saURL, false) // TODO - latest URL
|
||||||
if !Agreed && reg.TosURL == "" {
|
}
|
||||||
return nil, errors.New("user must agree to terms")
|
if !Agreed && reg.TosURL == "" {
|
||||||
|
return nil, errors.New("user must agree to terms")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = client.AgreeToTOS()
|
err = client.AgreeToTOS()
|
||||||
|
|
Loading…
Reference in a new issue