I'm attempting to test simple Java client app with acme4j library locally with latest Pebble Docker image. The account creation part is completed successfully, but the HTTP-01 validation stage fails with various status codes, depending on default IPv4 settings for challtestsrv.
For testing, I run a simple Python HTTP server which contains only .well-known/acme-challenge/<TOKEN>
file. The command for it: python -m http.server 5002
(Python Version 3.10.1). To ensure that file is accessible, I used curl localhost:5002/.well-known/acme-challenge/<REQUIRED_NAME>
, which returned the correct content.
When using the default docker-compose.yml
, I receive the following error during this challenge:
The key authorization file from the server did not match this challenge \"ZxZaPZD5LtpTD6TBnTysD4jOWzsQvws-sCoWUxNkeZ0.yeKaorVdAYaqeyJcRI3KzwQwTDf6plJwZMkNvTS9K-k\" != \"\"","status":403
I tried to debug it with Wireshark and found, that the request is sent to 10.30.50.3:5002:
Frame 117: 294 bytes on wire (2352 bits), 294 bytes captured (2352 bits) on interface vethf215e22, id 1
Ethernet II, Src: 02:42:0a:1e:32:02 (02:42:0a:1e:32:02), Dst: 02:42:0a:1e:32:03 (02:42:0a:1e:32:03)
Internet Protocol Version 4, Src: 10.30.50.2, Dst: 10.30.50.3
Transmission Control Protocol, Src Port: 48652, Dst Port: 5002, Seq: 1, Ack: 1, Len: 228
Source Port: 48652
Destination Port: 5002
[Stream index: 3]
[Conversation completeness: Complete, WITH_DATA (31)]
[TCP Segment Len: 228]
Sequence Number: 1 (relative sequence number)
Sequence Number (raw): 106143684
[Next Sequence Number: 229 (relative sequence number)]
Acknowledgment Number: 1 (relative ack number)
Acknowledgment number (raw): 2934519440
1000 .... = Header Length: 32 bytes (8)
Flags: 0x018 (PSH, ACK)
Window: 502
[Calculated window size: 64256]
[Window size scaling factor: 128]
Checksum: 0x794b [unverified]
[Checksum Status: Unverified]
Urgent Pointer: 0
Options: (12 bytes), No-Operation (NOP), No-Operation (NOP), Timestamps
[Timestamps]
[Time since first frame in this TCP stream: 0.000563568 seconds]
[Time since previous frame in this TCP stream: 0.000420927 seconds]
[SEQ/ACK analysis]
[iRTT: 0.000142641 seconds]
[Bytes in flight: 228]
[Bytes sent since last PSH flag: 228]
TCP payload (228 bytes)
Hypertext Transfer Protocol
GET /.well-known/acme-challenge/ZxZaPZD5LtpTD6TBnTysD4jOWzsQvws-sCoWUxNkeZ0 HTTP/1.1\r\n
[Expert Info (Chat/Sequence): GET /.well-known/acme-challenge/ZxZaPZD5LtpTD6TBnTysD4jOWzsQvws-sCoWUxNkeZ0 HTTP/1.1\r\n]
Request Method: GET
Request URI: /.well-known/acme-challenge/ZxZaPZD5LtpTD6TBnTysD4jOWzsQvws-sCoWUxNkeZ0
Request Version: HTTP/1.1
Host: test.mypythonserver.gg:5002\r\n
User-Agent: LetsEncrypt-Pebble-VA (linux; amd64)\r\n
Accept: */*\r\n
Accept-Encoding: gzip\r\n
Connection: close\r\n
\r\n
[Full request URI: http://test.mypythonserver.gg:5002/.well-known/acme-challenge/ZxZaPZD5LtpTD6TBnTysD4jOWzsQvws-sCoWUxNkeZ0]
[HTTP request 1/1]
[Response in frame: 120]
After that, I've stopped the Docker images and started again, but set the default IPv4 address for DNS challenges, as said in Pebble's README:
curl -d '{"ip":"127.0.0.1"}' http://localhost:8055/set-default-ipv4
The error has changed:
Get http://test.mypythonserver.gg:5002/.well-known/acme-challenge/P0VJP2GvXyvzLZTw0_qy5FJqVh6N_VadqDLIR9NQr1U: dial tcp 127.0.0.1:5002: connect: connection refused","status":400
Furthermore, there were no HTTP requests captured in Wireshark.
I'm not familiar with Docker, but I thought, that the Docker attempts to call his local IP address, not the address of my original server. So, I've attempted to setup it in bridge network, which subnet was 127.17.0.1/16 (received via docker network inspect bridge
), the resulting server setup was python -m http.server 5002 --bind 127.17.0.1
and before that I made curl -d '{"ip":"127.17.0.1"}' http://localhost:8055/set-default-ipv4
. The error was the same as in previous case, no HTTP requests captured too.
In each of the following attempts, the server had not received any requests and, obviously, the challenge status was set to invalid.
The other interesting thing I found is that curl 10.30.50.3:5002
successfully connects and returns empty string. Perhaps, I need to somehow add the route for HTTP-01 challenge file in this address?
To sum up, I'm not sure, where do i need to locate my test server or how should i modify the default configuration. I guess, this is not a Java client's issue, because the account is created and the challenge is triggered successfully, but the desired server cannot be located.
OS: Arch Linux x86_64
Kernel: 5.15.13-arch1-1
Wireshark (QT) version: 3.6.1