Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: support ACME challenges for unknown virtual hosts#2602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
buchdag merged 2 commits intonginx-proxy:mainfromp12tic:acme-unknown-virtual-host
May 19, 2025

Conversation

@p12tic
Copy link
Contributor

Currently any ACME challenge for unknown virtual host returns 503. This is inconvenient because if the user does not use wildcard certificates, then the user must match the configuration of certificate renewal script to what virtual hosts are enabled at the time.

This must be done automatically, because due to short certificate lifetime the renewal script runs automatically. Additionally, enabling a previously disabled virtual host forces certificate renewal. Under certain circumstances this may lead to rate limiting from Let's Encrypt, because only 5 certificates for exact same set of domains can be issued per week.

Accordingly, it's worthwhile supporting unknown virtual hosts for the purposes of passing ACME challenges.

@p12ticp12ticforce-pushed theacme-unknown-virtual-host branch from3928efb to19c67d3CompareMarch 14, 2025 14:33
@buchdag
Copy link
Member

Hi@p12tic

Additionally, enabling a previously disabled virtual host forces certificate renewal. Under certain circumstances this may lead to rate limiting from Let's Encrypt, because only 5 certificates for exact same set of domains can be issued per week

This sounds like an issue with the ACME automation you're using rather than something caused by nginx-proxy itself. A properly designed automation should be able to re-use a previously issued certificate if the set of domains match and the certificate is still valid, instead of issuing a new one. That's what acme-companion does.

Anyway I agree thatoptionally passing ACME challenge for unknown virtual host might be a nice to have feature, but not to make it default.

p12tic reacted with thumbs up emoji

@p12tic
Copy link
ContributorAuthor

@buchdag Do you think it makes sense to add another option toACME_HTTP_CHALLENGE_LOCATION or creating separate environment variable, likeACME_HTTP_CHALLENGE_ACCEPT_UNKNOWN? Former seems to be better because accepting unknown domains seems like a strongertrue value.

@p12tic
Copy link
ContributorAuthor

This sounds like an issue with the ACME automation you're using rather than something caused by nginx-proxy itself. A properly designed automation should be able to re-use a previously issued certificate if the set of domains match and the certificate is still valid, instead of issuing a new one. That's what acme-companion does.

I agree, I used incorrect argument to make my point stronger. I did hit this limit in the past, but this was in a slightly different set of circumstances.

The main issue is the requirement to refresh certificates each time a container is started because there exists possibility that the container was shut down while certificates were refreshed the last time.

The perfect workflow would be to just give the list of all domains I could possible use to certbot and forget about it. It's not possible now, because validation may fail if a container is shut down.

@p12ticp12ticforce-pushed theacme-unknown-virtual-host branch from19c67d3 to0d195b1CompareApril 9, 2025 00:30
@p12tic
Copy link
ContributorAuthor

@buchdag I've updated the PR to use separateACME_HTTP_CHALLENGE_ACCEPT_UNKNOWN variable to control acceptance of unknown hosts. This made the logic way simpler and the PR better, thanks for the suggestion.

This PR should be good to go.

@p12ticp12ticforce-pushed theacme-unknown-virtual-host branch from0d195b1 to48df2c7CompareApril 11, 2025 16:10
@p12tic
Copy link
ContributorAuthor

@buchdag Just a friendly ping.. :)

@buchdag
Copy link
Member

@p12tic this look good to me save maybe for the name of the environment variable :

ACME_HTTP_CHALLENGE_ACCEPT_UNKNOWN ->ACME_HTTP_CHALLENGE_ACCEPT_UNKNOWN_HOST

What do you think ?

@buchdagbuchdag added the type/featPR for a new feature labelMay 8, 2025
@p12ticp12ticforce-pushed theacme-unknown-virtual-host branch from48df2c7 to4319a56CompareMay 18, 2025 21:54
@p12tic
Copy link
ContributorAuthor

@buchdag Thanks for review. I agree with all your comments and have applied fixes.

Currently any ACME challenge for unknown virtual host returns 503. Thisis inconvenient because if the user does not use wildcard certificates,then the user must match the configuration of certificate renewal scriptto what virtual hosts are enabled at the time.This must be done automatically, because due to short certificatelifetime the renewal script runs automatically. Additionally, enabling apreviously disabled virtual host forces certificate renewal.Accordingly, it's worthwhile supporting unknown virtual hosts for thepurposes of passing ACME challenges. This is done by introducing aglobal ACME_HTTP_CHALLENGE_ACCEPT_UNKNOWN_HOST variable to control this.
@buchdagbuchdagforce-pushed theacme-unknown-virtual-host branch from4319a56 to4c8f22eCompareMay 19, 2025 18:10
@buchdagbuchdag changed the titleSupport ACME challenges for unknown virtual hostsfeat: support ACME challenges for unknown virtual hostsMay 19, 2025
@buchdagbuchdag merged commit554689c intonginx-proxy:mainMay 19, 2025
2 checks passed
@p12ticp12tic deleted the acme-unknown-virtual-host branchSeptember 14, 2025 18:46
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@buchdagbuchdagbuchdag approved these changes

Assignees

No one assigned

Labels

type/featPR for a new feature

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@p12tic@buchdag

[8]ページ先頭

©2009-2025 Movatter.jp