forked from TrueCloudLab/lego
feat: use colon instead a arrow. (#1090)
This commit is contained in:
parent
6bc93456ad
commit
f3e067df49
12 changed files with 22 additions and 22 deletions
|
@ -118,7 +118,7 @@ func (a *Core) retrievablePost(uri string, content []byte, response interface{})
|
||||||
func (a *Core) signedPost(uri string, content []byte, response interface{}) (*http.Response, error) {
|
func (a *Core) signedPost(uri string, content []byte, response interface{}) (*http.Response, error) {
|
||||||
signedContent, err := a.jws.SignContent(uri, content)
|
signedContent, err := a.jws.SignContent(uri, content)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to post JWS message -> failed to sign content -> %w", err)
|
return nil, fmt.Errorf("failed to post JWS message: failed to sign content: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
signedBody := bytes.NewBuffer([]byte(signedContent.FullSerialize()))
|
signedBody := bytes.NewBuffer([]byte(signedContent.FullSerialize()))
|
||||||
|
|
|
@ -57,7 +57,7 @@ func (n *Manager) Nonce() (string, error) {
|
||||||
func (n *Manager) getNonce() (string, error) {
|
func (n *Manager) getNonce() (string, error) {
|
||||||
resp, err := n.do.Head(n.nonceURL)
|
resp, err := n.do.Head(n.nonceURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("failed to get nonce from HTTP HEAD -> %w", err)
|
return "", fmt.Errorf("failed to get nonce from HTTP HEAD: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetFromResponse(resp)
|
return GetFromResponse(resp)
|
||||||
|
|
|
@ -65,12 +65,12 @@ func (j *JWS) SignContent(url string, content []byte) (*jose.JSONWebSignature, e
|
||||||
|
|
||||||
signer, err := jose.NewSigner(signKey, &options)
|
signer, err := jose.NewSigner(signKey, &options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to create jose signer -> %w", err)
|
return nil, fmt.Errorf("failed to create jose signer: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
signed, err := signer.Sign(content)
|
signed, err := signer.Sign(content)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to sign content -> %w", err)
|
return nil, fmt.Errorf("failed to sign content: %w", err)
|
||||||
}
|
}
|
||||||
return signed, nil
|
return signed, nil
|
||||||
}
|
}
|
||||||
|
@ -94,12 +94,12 @@ func (j *JWS) SignEABContent(url, kid string, hmac []byte) (*jose.JSONWebSignatu
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to create External Account Binding jose signer -> %w", err)
|
return nil, fmt.Errorf("failed to create External Account Binding jose signer: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
signed, err := signer.Sign(jwkJSON)
|
signed, err := signer.Sign(jwkJSON)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to External Account Binding sign content -> %w", err)
|
return nil, fmt.Errorf("failed to External Account Binding sign content: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return signed, nil
|
return signed, nil
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
type obtainError map[string]error
|
type obtainError map[string]error
|
||||||
|
|
||||||
func (e obtainError) Error() string {
|
func (e obtainError) Error() string {
|
||||||
buffer := bytes.NewBufferString("acme: Error -> One or more domains had a problem:\n")
|
buffer := bytes.NewBufferString("error: one or more domains had a problem:\n")
|
||||||
|
|
||||||
var domains []string
|
var domains []string
|
||||||
for domain := range e {
|
for domain := range e {
|
||||||
|
|
|
@ -37,7 +37,7 @@ func (s *ProviderServer) Present(domain, token, keyAuth string) error {
|
||||||
var err error
|
var err error
|
||||||
s.listener, err = net.Listen("tcp", s.GetAddress())
|
s.listener, err = net.Listen("tcp", s.GetAddress())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not start HTTP server for challenge -> %w", err)
|
return fmt.Errorf("could not start HTTP server for challenge: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
s.done = make(chan bool)
|
s.done = make(chan bool)
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
type obtainError map[string]error
|
type obtainError map[string]error
|
||||||
|
|
||||||
func (e obtainError) Error() string {
|
func (e obtainError) Error() string {
|
||||||
buffer := bytes.NewBufferString("acme: Error -> One or more domains had a problem:\n")
|
buffer := bytes.NewBufferString("error: one or more domains had a problem:\n")
|
||||||
|
|
||||||
var domains []string
|
var domains []string
|
||||||
for domain := range e {
|
for domain := range e {
|
||||||
|
|
|
@ -66,7 +66,7 @@ func TestProber_Solve(t *testing.T) {
|
||||||
createStubAuthorizationHTTP01("lego.wtf", acme.StatusProcessing),
|
createStubAuthorizationHTTP01("lego.wtf", acme.StatusProcessing),
|
||||||
createStubAuthorizationHTTP01("mydomain.wtf", acme.StatusProcessing),
|
createStubAuthorizationHTTP01("mydomain.wtf", acme.StatusProcessing),
|
||||||
},
|
},
|
||||||
expectedError: `acme: Error -> One or more domains had a problem:
|
expectedError: `error: one or more domains had a problem:
|
||||||
[acme.wtf] preSolve error acme.wtf
|
[acme.wtf] preSolve error acme.wtf
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
|
@ -91,7 +91,7 @@ func TestProber_Solve(t *testing.T) {
|
||||||
createStubAuthorizationHTTP01("lego.wtf", acme.StatusProcessing),
|
createStubAuthorizationHTTP01("lego.wtf", acme.StatusProcessing),
|
||||||
createStubAuthorizationHTTP01("mydomain.wtf", acme.StatusProcessing),
|
createStubAuthorizationHTTP01("mydomain.wtf", acme.StatusProcessing),
|
||||||
},
|
},
|
||||||
expectedError: `acme: Error -> One or more domains had a problem:
|
expectedError: `error: one or more domains had a problem:
|
||||||
[acme.wtf] preSolve error acme.wtf
|
[acme.wtf] preSolve error acme.wtf
|
||||||
[lego.wtf] solve error lego.wtf
|
[lego.wtf] solve error lego.wtf
|
||||||
`,
|
`,
|
||||||
|
|
|
@ -66,7 +66,7 @@ func (s *ProviderServer) Present(domain, token, keyAuth string) error {
|
||||||
// Create the listener with the created tls.Config.
|
// Create the listener with the created tls.Config.
|
||||||
s.listener, err = tls.Listen("tcp", s.GetAddress(), tlsConf)
|
s.listener, err = tls.Listen("tcp", s.GetAddress(), tlsConf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not start HTTPS server for challenge -> %w", err)
|
return fmt.Errorf("could not start HTTPS server for challenge: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shut the server down when we're finished.
|
// Shut the server down when we're finished.
|
||||||
|
|
|
@ -128,13 +128,13 @@ func (s *AccountsStorage) Save(account *Account) error {
|
||||||
func (s *AccountsStorage) LoadAccount(privateKey crypto.PrivateKey) *Account {
|
func (s *AccountsStorage) LoadAccount(privateKey crypto.PrivateKey) *Account {
|
||||||
fileBytes, err := ioutil.ReadFile(s.accountFilePath)
|
fileBytes, err := ioutil.ReadFile(s.accountFilePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Could not load file for account %s -> %v", s.userID, err)
|
log.Fatalf("Could not load file for account %s: %v", s.userID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var account Account
|
var account Account
|
||||||
err = json.Unmarshal(fileBytes, &account)
|
err = json.Unmarshal(fileBytes, &account)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Could not parse file for account %s -> %v", s.userID, err)
|
log.Fatalf("Could not parse file for account %s: %v", s.userID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
account.key = privateKey
|
account.key = privateKey
|
||||||
|
@ -142,13 +142,13 @@ func (s *AccountsStorage) LoadAccount(privateKey crypto.PrivateKey) *Account {
|
||||||
if account.Registration == nil || account.Registration.Body.Status == "" {
|
if account.Registration == nil || account.Registration.Body.Status == "" {
|
||||||
reg, err := tryRecoverRegistration(s.ctx, privateKey)
|
reg, err := tryRecoverRegistration(s.ctx, privateKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Could not load account for %s. Registration is nil -> %#v", s.userID, err)
|
log.Fatalf("Could not load account for %s. Registration is nil: %#v", s.userID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
account.Registration = reg
|
account.Registration = reg
|
||||||
err = s.Save(&account)
|
err = s.Save(&account)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Could not save account for %s. Registration is nil -> %#v", s.userID, err)
|
log.Fatalf("Could not save account for %s. Registration is nil: %#v", s.userID, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ func (d *DNSProvider) sendRequest(method, uri string, body io.Reader) (json.RawM
|
||||||
|
|
||||||
resp, err := d.config.HTTPClient.Do(req)
|
resp, err := d.config.HTTPClient.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error talking to PDNS API -> %w", err)
|
return nil, fmt.Errorf("error talking to PDNS API: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
@ -188,7 +188,7 @@ func (d *DNSProvider) sendRequest(method, uri string, body io.Reader) (json.RawM
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if errInfo.ShortMsg != "" {
|
if errInfo.ShortMsg != "" {
|
||||||
return nil, fmt.Errorf("error talking to PDNS API -> %w", errInfo)
|
return nil, fmt.Errorf("error talking to PDNS API: %w", errInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return msg, nil
|
return msg, nil
|
||||||
|
|
|
@ -48,7 +48,7 @@ func (w *HTTPProvider) Present(domain, token, keyAuth string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(errs) == len(w.hosts) {
|
if len(errs) == len(w.hosts) {
|
||||||
return fmt.Errorf("unable to store key in any of the memcache hosts -> %v", errs)
|
return fmt.Errorf("unable to store key in any of the memcache hosts: %v", errs)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -32,12 +32,12 @@ func (w *HTTPProvider) Present(domain, token, keyAuth string) error {
|
||||||
challengeFilePath := filepath.Join(w.path, http01.ChallengePath(token))
|
challengeFilePath := filepath.Join(w.path, http01.ChallengePath(token))
|
||||||
err = os.MkdirAll(filepath.Dir(challengeFilePath), 0755)
|
err = os.MkdirAll(filepath.Dir(challengeFilePath), 0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not create required directories in webroot for HTTP challenge -> %w", err)
|
return fmt.Errorf("could not create required directories in webroot for HTTP challenge: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ioutil.WriteFile(challengeFilePath, []byte(keyAuth), 0644)
|
err = ioutil.WriteFile(challengeFilePath, []byte(keyAuth), 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not write file in webroot for HTTP challenge -> %w", err)
|
return fmt.Errorf("could not write file in webroot for HTTP challenge: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -47,7 +47,7 @@ func (w *HTTPProvider) Present(domain, token, keyAuth string) error {
|
||||||
func (w *HTTPProvider) CleanUp(domain, token, keyAuth string) error {
|
func (w *HTTPProvider) CleanUp(domain, token, keyAuth string) error {
|
||||||
err := os.Remove(filepath.Join(w.path, http01.ChallengePath(token)))
|
err := os.Remove(filepath.Join(w.path, http01.ChallengePath(token)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not remove file in webroot after HTTP challenge -> %w", err)
|
return fmt.Errorf("could not remove file in webroot after HTTP challenge: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue