lego: Race Condition?

Welcome

  • Yes, I’m using a binary release within 2 latest releases.
  • Yes, I’ve searched similar issues on GitHub and didn’t find any.
  • Yes, I’ve included all information below (version, config, etc).

What did you expect to see?

I’m using this command using lego version 4.23.1 windows/amd64:

$domains = Get-Content ..\domains.txt;
$joined = $domains -join ",";
.\lego.exe --accept-tos --server "https://acme.enterprise.sectigo.com" --domains "$joined" --eab --kid "REDACTED" --hmac "REDACTED" --email "REDACTED" --key-type rsa2048 --overall-request-limit 2147483646 --cert.timeout 300 --http run

It however fails when the domains.txt contains more than 20ish domains. I say 20ish because sometimes it works fine, which leads me to believe there is some sort of race condition happening. Currently there are 42 domains. As I reduce the number of domains towards 0 I get a better success rate. 12 seems to always work, 20ish seems to be 50/50. This is why I feel it is race-conditiony.

I thought at first it was the ACME implementation on the Sectigo was bespoke, but I’ve managed to issue the cert using:

certbot on Debian 10

$domains = Get-Content .\domains.txt;
$joined = $domains -join ",";
certbot certonly --standalone --non-interactive --agree-tos --email "REDACTED" --server https://acme.enterprise.sectigo.com/ --eab-kid "REDACTED" --eab-hmac-key "REDACTED" --domain "$joined" --cert-name DVcert --rsa-key-size 2048 --key-type rsa --config-dir ./ --work-dir ./ --logs-dir ./

And then:

Posh-ACME on the same machine as lego (Windows Server 2022 20348.3453)

Set-PAServer -DirectoryUrl "https://acme.enterprise.sectigo.com";
New-PAAccount -ExtAcctKID 'REDACTED' -ExtAcctHMACKey 'REDACTED' -Contact 'REDACTED' -AcceptTOS;
New-PACertificate @(Get-Content ..\domains.txt) -AcceptTOS -Contact 'REDACTED';

I’ve run it with LEGO_DEBUG_ACME_HTTP_CLIENT and attached the debug.log. I’ve had to redacted the actual domain names, sorry.

Cheers, Indy

What did you see instead?

How do you use lego?

Binary

Reproduction steps

see above

Effective version of lego

lego version 4.23.1 windows/amd64

Logs

debug.log

Go environment (if applicable)

NA

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (12 by maintainers)

Most upvoted comments

Note, that some ACME servers only work with --overall-request-limit equal to or lower than 7.

So try with 7, and 5, etc.

--overall-request-limit must be a small number. The larger this number, the more likely the rate limit will be reached.

This is why I asked you to use 10.

It cannot be disabled because it should not be disabled.

I think we already have the information: the problem is related to 503 (Service Unavailable) from the ACME server.

I don’t know why the 503s are not a problem for other clients: maybe it’s because the server doesn’t produce 503 like I already explained, maybe it’s a bug (but I don’t think so).

The logs already contain all the possible debug information a client can get: calls and answers.

FYI, there a very few elements that run concurrently inside lego (Authorizations, and HTTP/TLS server), so I still think this is not a concurrency issue inside the client, and 503 (from the ACME server) is leading to another direction.

Can you try --overall-request-limit? By default, it’s 18, so I think you can try 10.