foomo / simplecert

golang autocert library for letsencrypt
MIT License
212 stars 34 forks source link

Creating new certificate all the time application start #19

Closed yaseenyahya closed 3 years ago

yaseenyahya commented 3 years ago

Is this possible to use old certificate while app starts check if its expire then renew. Renewing all the time make the letsencrypt cross thier rate limit.

dreadl0ck commented 3 years ago

Are you running inside a container?

Probably you did not mount the CacheDir into it, so every time your application starts up, no cert is found and a new one will be obtained.

Check the simplecert log file, it will tell you whether a cert was found or not.

yaseenyahya commented 3 years ago
2021/02/06 22:25:08 [ERROR] len(cert.DNSNames): [mep.api.axonmobilepk.com] != len(c.Domains): [mep.api.axonmobilepk.com mep.api.axonmobilepk.com]
2021/02/06 22:25:08 [INFO] domains have changed. Obtaining a new certificate...
2021/02/06 22:25:09 [INFO] simplecert: client creation complete
2021/02/06 22:25:09 [INFO] simplecert: set HTTP challenge
2021/02/06 22:25:09 [INFO] simplecert: set TLS challenge
2021/02/06 22:25:09 simplecert init failed: simplecert: failed to obtain cert: acme: error: 429 :: POST :: https://acme-v02.api.letsencrypt.org/acme/new-order :: urn:ietf:params:acme:error:rateLimited :: Error creating new order :: too many certificates already issued for exact set of domains: mep.api.axonmobilepk.com: see https://letsencrypt.org/docs/rate-limits/, url: 
2021/02/06 22:28:27 [ERROR] len(cert.DNSNames): [mep.api.axonmobilepk.com] != len(c.Domains): [mep.api.axonmobilepk.com mep.api.axonmobilepk.com]
2021/02/06 22:28:27 [INFO] domains have changed. Obtaining a new certificate...
2021/02/06 22:28:29 [INFO] simplecert: client creation complete
2021/02/06 22:28:29 [INFO] simplecert: set HTTP challenge
2021/02/06 22:28:29 [INFO] simplecert: set TLS challenge
2021/02/06 22:28:29 simplecert init failed: simplecert: failed to obtain cert: acme: error: 429 :: POST :: https://acme-v02.api.letsencrypt.org/acme/new-order :: urn:ietf:params:acme:error:rateLimited :: Error creating new order :: too many certificates already issued for exact set of domains: mep.api.axonmobilepk.com: see https://letsencrypt.org/docs/rate-limits/, url: 
2021/02/06 22:28:32 [ERROR] len(cert.DNSNames): [mep.api.axonmobilepk.com] != len(c.Domains): [mep.api.axonmobilepk.com mep.api.axonmobilepk.com]
2021/02/06 22:28:32 [INFO] domains have changed. Obtaining a new certificate...
2021/02/06 22:28:33 [INFO] simplecert: client creation complete
2021/02/06 22:28:33 [INFO] simplecert: set HTTP challenge
2021/02/06 22:28:33 [INFO] simplecert: set TLS challenge
2021/02/06 22:28:33 simplecert init failed: simplecert: failed to obtain cert: acme: error: 429 :: POST :: https://acme-v02.api.letsencrypt.org/acme/new-order :: urn:ietf:params:acme:error:rateLimited :: Error creating new order :: too many certificates already issued for exact set of domains: mep.api.axonmobilepk.com: see https://letsencrypt.org/docs/rate-limits/, url: 

thsi my log can you guide me.

yaseenyahya commented 3 years ago

problem solved my blunder mistake cfg.Domains = []string{"mep.api.axonmobilepk.com", "mep.api.axonmobilepk.com"} wrote same domain multiple times