Is it possible to create new certificate with certbot
if I accidentally lost the one I just created?
I was testing certbot with docker and created certificate on my test server. Then I wanted to make sure that running same command for creating certificate, will exit normally. But instead it would get stuck on (which is problematic when running ansible as it would just stuck without any output at all):
Saving debug log to /var/log/letsencrypt/letsencrypt.log
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/myhost.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Certificate not yet due for renewal
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
The following certificates are not due for renewal yet:
/etc/letsencrypt/live/myhost/fullchain.pem expires on 2023-02-28 (skipped)
No renewals were attempted.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
^CERROR: 130
So I decided to just delete certificate and private key and create new certificate (should have made a backup..). But now I always get this:
docker-compose run --rm -p 80:80 certbot certonly --register-unsafely-without-email --agree-tos --standalone --preferred-challenge http -d myhost
Creating app_certbot_run ... done
Saving debug log to /var/log/letsencrypt/letsencrypt.log
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
No renewals were attempted.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
^CERROR: 130
So as I understand letsencrypt knows there is valid certificate registered by them and refuses to create new one. Is there a way to create new one instead of waiting till it expires?..:)
My mistake. I forgot that I added this in docker compose for certbot as entrypoint..
"/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
So it would try to renew and be stuck.