Letsencrypt Renewal issue for multiple domains

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. crt.sh | example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is: test.planetbeyondapps.com

I ran this command: certbot renew --cert-name test.pla.com -v

It produced this output: Saving debug log to /var/log/letsencrypt/letsencrypt.log


Processing /etc/letsencrypt/renewal/test.pla.com.conf


Certificate not yet due for renewal


The following certificates are not due for renewal yet:
/etc/letsencrypt/live/test.pla.com/fullchain.pem expires on 2024-10-22 (skipped)
No renewals were attempted.


[root@nginx-rh8-dmz-235 ~]# certbot renew --cert-name test.pla.com -v
Saving debug log to /var/log/letsencrypt/letsencrypt.log


Processing /etc/letsencrypt/renewal/test.pla.com.conf


Certificate is due for renewal, auto-renewing...
Plugins selected: Authenticator nginx, Installer nginx
Renewing an existing certificate for test.pla.com
Performing the following challenges:
http-01 challenge for test.pla.com
Waiting for verification...
Challenge failed for domain test.pla.com
http-01 challenge for test.pla.com

Certbot failed to authenticate some domains (authenticator: nginx). The Certificate Authority reported these problems:
Domain: test.pla.com
Type: unauthorized
Detail: 117.20.23.229: Invalid response from https://test.pla.com/.well-known/acme-challenge/G-EF_WuwuxdhVvl_qXVTJFS7nuTW2WhR-jfQop1naf0: 404

Hint: The Certificate Authority failed to verify the temporary nginx configuration changes made by Certbot. Ensure the listed domains point to this nginx server and that it is accessible from the internet.

Cleaning up challenges
Failed to renew certificate test.pla.com with error: Some challenges have failed.


All renewals failed. The following certificates could not be renewed:
/etc/letsencrypt/live/test.pla.com/fullchain.pem (failure)


1 renew failure(s), 0 parse failure(s)
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.

My web server is (include version): Nginx version 1.22.0. Compiled from source.

The operating system my web server runs on is (include version): Red Hat Enterprise Linux release 8.9 (Ootpa)

My hosting provider, if applicable, is: NA

I can login to a root shell on my machine (yes or no, or I don't know): Yes

I'm using a control panel to manage my site (no, or provide the name and version of the control panel): No

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): certbot 1.22.0

My domain config is as below
cat /etc/nginx/conf.d/test.pla.com.conf

server {
    server_name  test.pla.com;

   access_log    /var/log/nginx/test.pla.com.access.log  main;
   include include/error.conf;

###### For LEtsencrypt Certificates ########

   location /.well-known/acme-challenge {
        alias /var/www/html/.well-known/acme-challenge;
        try_files $uri =404;
        default_type text/plain;  # Ensure files are served as plain text
    }
    
###########################################

    location / {
      proxy_pass    http://192.168.0.244:9001/;
      include include/proxy.conf;
   }

   
}

It think that challenge files is not being written on /var/www/html/.well-known/acme-challenge/ or may be any thing else. Because when i run the certbot renew --cert-name demo.highersummit.com it did not create any file in acme-challenge directory as monitored by below command.

watch -n 1 ls -lh /var/www/html/.well-known/acme-challenge/

Also check no permission issue. directory is with 755 and nginx:nginx ownership. Verified from below command.

sudo -u nginx touch /var/www/html/.well-known/acme-challenge/testfile

echo "test-acme" | sudo tee /var/www/html/.well-known/acme-challenge/testfile

I am able to access it browser with the required URL

https://demo.highersummit.com/.well-known/acme-challenge/testfile (accessible - can be verified)

Even i manually place the file mentioned in the error "G-EF_WuwuxdhVvl_qXVTJFS7nuTW2WhR-jfQop1naf0" can be accessible on https://demo.highersummit.com/.well-known/acme-challenge/G-EF_WuwuxdhVvl_qXVTJFS7nuTW2WhR-jfQop1naf0.

Dont know why letsencrypt is unbale to validating the challenge for my domain. I have multiple domains and facing same issue.

Please looking for support. Thank you.

1 Like

The --nginx option you use does not create a file in that folder. Instead, it modifies your nginx config using a "return" statement for the correct value. It then removes that statement when the cert request is complete.

It is unusual for that to fail with a "404" error. There is either something very unusual with your nginx config or maybe your DNS no longer has the correct IP for this server.

Let us review your nginx config first. Please show the entire output of this

sudo nginx -T

An uppercase T is essential

If easier, redirect that to a file and upload that file here like this

sudo nginx -T >config.txt

Or, upload the entire /var/log/letsencrypt/letsencrypt.log file for a failed run. This shows the modifications made to your nginx and often we can see the problem from that. There may be more than one log file so upload one from a 404 failure

5 Likes

letsencrypt.txt (34.8 KB)

This is my /var/log/letsencrypt/letsencrypt.log file. Thanks for your support.

1 Like

Thanks. Can you try this command? Your nginx config is larger with some extra packages. It may need more than 1 second of wait time before trying the challenge

certbot renew --cert-name demo.highersummit.com --dry-run --nginx-sleep-seconds 5

From the Certbot docs:

--nginx-sleep-seconds NGINX_SLEEP_SECONDS
Number of seconds to wait for nginx configuration changes to apply when reloading. (default: 1)

2 Likes

certbot renew --cert-name demo.highersummit.com --dry-run --nginx-sleep-seconds 5
Saving debug log to /var/log/letsencrypt/letsencrypt.log


Processing /etc/letsencrypt/renewal/demo.highersummit.com.conf


Simulating renewal of an existing certificate for demo.highersummit.com


Congratulations, all simulated renewals succeeded:
/etc/letsencrypt/live/demo.highersummit.com/fullchain.pem (success)

Going to add nginx-sleep-seconds = 5 in vim /etc/letsencrypt/cli.ini for global configuration. I hope it will fix the issue.

Good. Now try it again without the --dry-run and it should renew.

Once that works show the renewal config file so we can confirm it has the new option

/etc/letsencrypt/renewal/demo.highersummit.com.conf

That might work too. I am not sure and it is difficult for me to test that method.

3 Likes

certbot renew --cert-name demo.highersummit.com --nginx-sleep-seconds 5
Saving debug log to /var/log/letsencrypt/letsencrypt.log


Processing /etc/letsencrypt/renewal/demo.highersummit.com.conf


Renewing an existing certificate for demo.highersummit.com
Reloading nginx server after certificate renewal


Congratulations, all renewals succeeded:
/etc/letsencrypt/live/demo.highersummit.com/fullchain.pem (success)


[1]+ Killed certbot renew --dry-run

It has renewed. Thanks for support.

nginx-sleep-seconds = 5 in vim /etc/letsencrypt/cli.ini is not working.

1 Like
/etc/letsencrypt/renewal/demo.highersummit.com.conf

did not have any nginx_sleep_seconds parameters. I tried to add in it nginx_sleep_seconds = 5 but still not works. 

Would you show contents of that file? We need to reissue the original command then but adding the nginx-sleep-seconds

3 Likes

Just verified with another domain. after running certbot renew --cert-name aaaaa.highersummit.com --nginx-sleep-seconds 5

the below parameter is automatically added in /etc/letsencrypt/live/aaaaa.highersummit.com.conf
nginx_sleep_seconds = 5

Thanks for your support.

1 Like

nginx-sleep-seconds = 5 was also there in it. Could we set certbot renew --nginx-sleep-seconds 5 in cron for all domains? or it should be run only first time ?

When you put that in cli.ini did you use the same exact format as you see in those renewal config files? Specifically using underscores rather than dashes? I think that cli.ini should work so maybe it was just this formatting issue

2 Likes

In /etc/letsencrypt/renewal/demo.highersummit.com.conf it is nginx_sleep_seconds = 5 and in /etc/letsencrypt/cli.ini added the nginx-sleep-seconds = 5

1 Like

That looks like it should have worked. I guess you are stuck doing each renewal profile separately. Or you could try asking on the Github for Certbot and see what the developers say

2 Likes

Thank you so much for your support. I will check it.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.