Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use curl to test availability of ACME server, which tries all resolved IPs #3647

Merged

Conversation

merlinran
Copy link
Contributor

Fixes #3639

Tested in my gateway container.

docker compose exec -ti gateway /bin/sh
...
/app # nc -z localhost 80; echo $?
1
/app # nc -z 127.0.0.1 80; echo $?
0
/app # nc -z ::1 80; echo $?
1
/app # curl -sSf http://localhost > /dev/null; echo $?
0

Even with this fix, it may still fail to get the certificate, if the host has only IPv6 address, because this line listens only on IPv4 somehow.

ACME_WEBSERVER_PID=$(cd $ACME_WEBSERVER_ROOT; python -m http.server 80 > /dev/null 2>&1 & echo $!)

Even though the Python3 doc says

By default, the server binds itself to all interfaces. The option -b/--bind specifies a specific address to which it should bind. Both IPv4 and IPv6 addresses are supported.

@merlinran merlinran requested a review from a team as a code owner March 25, 2024 15:04
nc just checks the first resolved IP, while curl tries all resolved IPs
@gustavosbarreto gustavosbarreto merged commit f758e77 into shellhub-io:master Mar 25, 2024
9 checks passed
@gustavosbarreto
Copy link
Member

Merged! Thanks @merlinran

@merlinran merlinran deleted the curl_check_acme_server branch March 25, 2024 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The gateway container keeps timing out waiting for the ACME server on first start
2 participants