dashy icon indicating copy to clipboard operation
dashy copied to clipboard

[BUG] does not listen on IPv6

Open mbunkus opened this issue 3 years ago • 15 comments

Environment

Self-Hosted (Docker)

System

any

Version

2.1.1

Describe the problem

dashy's web server only listens on IPv4, even if the Docker container has IPv6 enabled, making it unusable in IPv6-only setups. It can be run in dual-stack containers, of course.

Example (actual global IPv6 obscured):

[0 root@durnik ~] docker container inspect dashy | rg 'IPAddress|GlobalIPv6Address' | tail -n 2
                    "IPAddress": "172.18.3.2",
                    "GlobalIPv6Address": "2a01:4f8:262:xxxx::x:y:z",
[0 root@durnik ~] telnet 172.18.3.2 80
Trying 172.18.3.2...
Connected to 172.18.3.2.
Escape character is '^]'.
HTTP/1.1 400 Bad Request
Connection: close

Connection closed by foreign host.
[1 root@durnik ~] telnet 2a01:4f8:262:xxxx::x:y:z 80
Trying 2a01:4f8:262:xxxx::x:y:z...
telnet: Unable to connect to remote host: Connection refused

Additional info

No response

Please tick the boxes

mbunkus avatar Nov 20 '22 00:11 mbunkus

If you're enjoying Dashy, consider dropping us a ⭐
🤖 I'm a bot, and this message was automated

liss-bot avatar Nov 20 '22 00:11 liss-bot

This issue has gone 6 weeks without an update. To keep the ticket open, please indicate that it is still relevant in a comment below. Otherwise it will be closed in 5 working days.

liss-bot avatar Dec 20 '22 01:12 liss-bot

The issue is very much still there.

mbunkus avatar Dec 20 '22 08:12 mbunkus

This issue has gone 6 weeks without an update. To keep the ticket open, please indicate that it is still relevant in a comment below. Otherwise it will be closed in 5 working days.

liss-bot avatar Jan 20 '23 01:01 liss-bot

Still relevant

mbunkus avatar Jan 20 '23 08:01 mbunkus

This issue has gone 6 weeks without an update. To keep the ticket open, please indicate that it is still relevant in a comment below. Otherwise it will be closed in 5 working days.

liss-bot avatar Feb 20 '23 01:02 liss-bot

Still relevant

mbunkus avatar Feb 20 '23 08:02 mbunkus

This issue has gone 6 weeks without an update. To keep the ticket open, please indicate that it is still relevant in a comment below. Otherwise it will be closed in 5 working days.

liss-bot avatar Apr 06 '23 01:04 liss-bot

Still relevant

mbunkus avatar Apr 06 '23 07:04 mbunkus

Same here

GuodongQi avatar Apr 27 '23 12:04 GuodongQi

I sovled this by set the environment HOST with "HOST=::".

Now, It works!

GuodongQi avatar Apr 27 '23 12:04 GuodongQi

Heya @mbunkus Does @GuodongQi's solution work for you? If not, I can look into making some changes to the container - if you've got suggestions about what would need to be modified to get this working, that'd also be helpful :)

Lissy93 avatar Apr 28 '23 17:04 Lissy93

Yes, that works. Thanks.

if you've got suggestions about what would need to be modified to get this working, that'd also be helpful :)

Well, you could make the behavior triggered by HOST=:: the default. I would very much welcome such a change as I'm a firm believer in having the most useful default settings (as in, it's nice that this is configurable, but users shouldn't have to configure it in the first place).

On Linux listening on the IPv6 wildcard address :: will also listen on the corresponding IPv4 wildcard address, 0.0.0.0:

[0 root@durnik ~] docker exec -ti dashy-dashy-1 /bin/sh
/app # apk add curl
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
(1/5) Installing ca-certificates (20220614-r0)
(2/5) Installing brotli-libs (1.0.9-r5)
(3/5) Installing nghttp2-libs (1.46.0-r0)
(4/5) Installing libcurl (8.0.1-r0)
(5/5) Installing curl (8.0.1-r0)
Executing busybox-1.34.1-r3.trigger
Executing ca-certificates-20220614-r0.trigger
OK: 13 MiB in 23 packages
/app # curl -s http://127.0.0.1/ | head -c 20                                                                                                                                                                                                                                                                                <!DOCTYPE html><html/app #                                                                                                                                                                                                                                                                                                   /app # curl -s 'http://[::]/' | head -c 20                                                                                                                                                                                                                                                                                   <!DOCTYPE html><html/app #                                                                                                                                                                                                                                                                                                   /app #

I cannot really tell you how to do that as I have no experience whatsoever with node.js.

Here's a more expansive answer I wrote in a similar bug report I filed on a different project (Yacht):

Anyway, in the case of Yacht "proper IPv6" support would probably mean nothing more than making the daemon listen on IPv6, too. In terms of sockets this means listening on :: instead of 0.0.0.0, or if the port number is part of the listen spec, on [::]:8000 instead of 0.0.0.0:8000. The reason is that at least on Linux listening on the IPv6 wildcard address will automatically listen on IPv4, too.

If you're worried about that, you can also try listening on both [::]:8000 and 0.0.0.0:8000, in that order, and ignore failures if exactly one of those fails:

  • if listening on [::]:8000 succeeds & turns on listening on IPv4 as well, then 0.0.0.0:8000 will fail; the daemon will now listen on both IPv6 & IPv4
  • if listening on [::]:8000 succeeds & but doesn't turn on listening on IPv4 as well, then 0.0.0.0:8000 will also succeed, and the daemon will now listen on both IPv6 & IPv4
  • if listening on [::]:8000 fails due to IPv6 being completely turned off on the host but listening on 0.0.0.0:8000 succeeds, then the daemon will only listen on IPv4, and that'd be OK for those hosts

As a last resort one might make the address/port number to listen on configurable via environment variables. Other images go that route.

As an example for Docker images that support listening on IPv6 out of the box (or where I could configure it via an environment variable): Authentik; Wekan; PowerDNS Admin; Docker Registry; Portainer.

mbunkus avatar Apr 28 '23 17:04 mbunkus

Thanks @mbunkus - that's really helpful! I've set this ticket to 'keep open', and will update you here once complete, or within an update

Lissy93 avatar Apr 28 '23 19:04 Lissy93

I too would like to see this work with IPV6. Running this in a pure IPV6 environment causes failures to start.

pshempel avatar Nov 16 '23 13:11 pshempel