Certification renewal error (only dry run sometimes works)

I've been using Certbot to manage my SSL/TLS certificates for my website, and everything was working fine until May 17th.

My certificates were automatically renewed every three months without any issues.

However, now I'm encountering a "Redirect Loop Detected" error, and my attempts to renew the certificate are failing.
Also

  1. Using '--dry-run': Sometimes it works, and sometimes it doesn't, even if I run it again shortly after a successful attempt.
  2. Actual Renewal: It consistently fails, never successfully renewing the certificates.

How can I resolve this issue?

My domain is: mics.snu.ac.kr

I ran this command: sudo /usr/local/bin/certbot-auto renew --no-self-upgrade

It produced this output:

IMPORTANT NOTES:

  • The following errors were reported by the server:

    Domain: mics.snu.ac.kr
    Type: connection
    Detail: xxx.xx.xxx.xxx: Fetching
    http://mics.snu.ac.kr/.well-known/acme-challenge/cd_33BVxiAT3KezmJjp-XMeuu-jQGT2n94BxwPaVKlI:
    Redirect loop detected

    To fix these errors, please make sure that your domain name was
    entered correctly and the DNS A/AAAA record(s) for that domain
    contain(s) the right IP address. Additionally, please check that
    your computer has a publicly routable IP address and that no
    firewalls are preventing the server from communicating with the
    client. If you're using the webroot plugin, you should also verify
    that you are serving files from the webroot path you provided.

The operating system my web server runs on is (include version): Ubuntu 12.04, apache2.2.22

Have you looked into that error message?

3 Likes

Yes, I have verified that the DNS and IP addresses are correctly configured, and during the DRY-run, the renewal success was confirmed. However, when attempting the actual renewal, an error occurs, preventing the update. I researched the "redirect loop detected" error on the LE forum and followed the suggested configuration file modifications, but they did not provide any helpful information for our situation. The most puzzling aspect is the failure of the actual renewal after the success of the DRY-run, which I thought was a renewal simulation. Could you provide assistance on what adjustments might be needed?

That application hasn't been supported for years.

Neither have those.

Ubuntu 12.04 LTS was end of life over seven years ago! Apache 2.2 also went end of life the same year at version 2.2.34.

Such ancient and unmaintained software should not be expected to work and definitely is not safe to connect to the internet. You really need to move your workloads to current and supported versions of software.

5 Likes

It looks like some sort of firewall is interfering with access

We have seen this before but I don't remember the exact product that causes this problem.

But, I can demonstrate what is happening.

In words, the first attempt from a "new" IP to your domain gets an odd set of redirects which LE detects as a redirect loop. But, repeated attempts from the same origin IP work. This is why you sometimes see this work and other times not. You are getting lucky that the same LE Auth Server IP is used on later attempt. These change often.

This is also why browsers won't see this as a problem because they will try redirects many many times before issuing a "redirect loop" error.

You should disable the firewall feature when seeing requests that include /.well-known/acme-challenge

Here are HTTP requests that show this

# A request to your domain gets redirected to a URL with a number added
curl -i http://mics.snu.ac.kr
HTTP/1.0 302 Found
Location: http://mics.snu.ac.kr/002705864258/

# Following that location gets redirected back to the original URL
# The Let's Encrypt server detects this as a "redirect loop"
curl -i http://mics.snu.ac.kr/002705864258/
HTTP/1.0 302 Found
Location: http://mics.snu.ac.kr/

# If someone (like a browser) would try this redirect anyway it works
curl -i http://mics.snu.ac.kr/
HTTP/1.1 301 Moved Permanently
Date: Mon, 29 Jul 2024 13:32:03 GMT
Server: Apache/2.2.22 (Ubuntu)
Location: https://mics.snu.ac.kr/

If I repeat this request rapidly I get good responses. If I wait a bit (like 5 minutes) the sequence above starts over. It is as if it remembers my IP for a short while.

5 Likes

If I repeatedly enter the following command in a short period of time, does it increase the likelihood of success? certbot-auto renew --no-self-upgrade

Based on my experience, running certbot-auto renew --dry-run multiple times in a row often results in success. However, when attempting the actual renewal, there's a limitation where if it fails more than five times, renewal is blocked for an hour, preventing continuous attempts as with the dry run. If attempting consecutively does indeed increase the chances of success, is there a way to remove this five-attempt failure limit?

No.
That is there to prevent abuse/misuse.

You should correct the problem.
So that it can work on every attempt.

4 Likes

As you note, it does not increase the odds of success with the production system.

If you can't resolve your (likely) firewall related problem you could consider the DNS Challenge. Although, with your DNS provider you may need to use a manual method unless you can work out a hook for automated API updates to it.

You should ask your ISP or network team about this problem.

Another option is to use a different ACME Certificate Authority. It is possible one of those will not reject this peculiar set of redirects in the same way. I do not know which would work for sure. BuyPass is the easiest to try as it does not require EAB setup.

3 Likes

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