forked from TrueCloudLab/lego
commit
357f5de272
5 changed files with 9 additions and 9 deletions
|
@ -585,7 +585,7 @@ func (c *Client) requestCertificate(authz []authorizationResource, bundle bool)
|
||||||
case 202:
|
case 202:
|
||||||
case 201:
|
case 201:
|
||||||
|
|
||||||
cert, err := ioutil.ReadAll(limitReader(resp.Body, 1024 * 1024))
|
cert, err := ioutil.ReadAll(limitReader(resp.Body, 1024*1024))
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return CertificateResource{}, err
|
return CertificateResource{}, err
|
||||||
|
@ -658,7 +658,7 @@ func (c *Client) getIssuerCertificate(url string) ([]byte, error) {
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
issuerBytes, err := ioutil.ReadAll(limitReader(resp.Body, 1024 * 1024))
|
issuerBytes, err := ioutil.ReadAll(limitReader(resp.Body, 1024*1024))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ func GetOCSPForCert(bundle []byte) ([]byte, int, error) {
|
||||||
return nil, OCSPUnknown, err
|
return nil, OCSPUnknown, err
|
||||||
}
|
}
|
||||||
defer req.Body.Close()
|
defer req.Body.Close()
|
||||||
|
|
||||||
ocspResBytes, err := ioutil.ReadAll(limitReader(req.Body, 1024*1024))
|
ocspResBytes, err := ioutil.ReadAll(limitReader(req.Body, 1024*1024))
|
||||||
ocspRes, err := ocsp.ParseResponse(ocspResBytes, issuerCert)
|
ocspRes, err := ocsp.ParseResponse(ocspResBytes, issuerCert)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -43,8 +43,8 @@ func (c challengeError) Error() string {
|
||||||
|
|
||||||
var errStr string
|
var errStr string
|
||||||
for _, validation := range c.records {
|
for _, validation := range c.records {
|
||||||
errStr = errStr + fmt.Sprintf("\tValidation for %s:%s\n\tResolved to:\n\t\t%s\n\tUsed: %s\n\n",
|
errStr = errStr + fmt.Sprintf("\tValidation for %s:%s\n\tResolved to:\n\t\t%s\n\tUsed: %s\n\n",
|
||||||
validation.Hostname, validation.Port, strings.Join(validation.ResolvedAddresses, "\n\t\t"), validation.UsedAddress)
|
validation.Hostname, validation.Port, strings.Join(validation.ResolvedAddresses, "\n\t\t"), validation.UsedAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf("%s\nError Detail:\n%s", c.RemoteError.Error(), errStr)
|
return fmt.Sprintf("%s\nError Detail:\n%s", c.RemoteError.Error(), errStr)
|
||||||
|
|
2
cli.go
2
cli.go
|
@ -49,7 +49,7 @@ func main() {
|
||||||
Action: renew,
|
Action: renew,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
cli.IntFlag{
|
cli.IntFlag{
|
||||||
Name: "days",
|
Name: "days",
|
||||||
Value: 0,
|
Value: 0,
|
||||||
Usage: "The number of days left on a certificate to renew it.",
|
Usage: "The number of days left on a certificate to renew it.",
|
||||||
},
|
},
|
||||||
|
|
|
@ -172,11 +172,11 @@ func revoke(c *cli.Context) {
|
||||||
|
|
||||||
func renew(c *cli.Context) {
|
func renew(c *cli.Context) {
|
||||||
conf, _, client := setup(c)
|
conf, _, client := setup(c)
|
||||||
|
|
||||||
if len(c.GlobalStringSlice("domains")) <= 0 {
|
if len(c.GlobalStringSlice("domains")) <= 0 {
|
||||||
logger().Fatal("Please specify at least one domain.")
|
logger().Fatal("Please specify at least one domain.")
|
||||||
}
|
}
|
||||||
|
|
||||||
domain := c.GlobalStringSlice("domains")[0]
|
domain := c.GlobalStringSlice("domains")[0]
|
||||||
|
|
||||||
// load the cert resource from files.
|
// load the cert resource from files.
|
||||||
|
@ -197,7 +197,7 @@ func renew(c *cli.Context) {
|
||||||
logger().Printf("Could not get Certification expiration for domain %s", domain)
|
logger().Printf("Could not get Certification expiration for domain %s", domain)
|
||||||
}
|
}
|
||||||
|
|
||||||
if int(expTime.Sub(time.Now()).Hours() / 24.0) > c.Int("days") {
|
if int(expTime.Sub(time.Now()).Hours()/24.0) > c.Int("days") {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue