]> git.proxmox.com Git - proxmox-acme.git/commit
fix #3390: standalone: explicitly bind to '::'
authorStoiko Ivanov <s.ivanov@proxmox.com>
Wed, 12 May 2021 19:04:52 +0000 (21:04 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 21 Jun 2021 07:35:39 +0000 (09:35 +0200)
commita4ac1b6ee21ce049b428de1df56b57546cb42408
treee24f96f9874d50d50ea18022c5b42a54e42655f0
parent085b9535c4cbd581a277d93e2af0bc84fc2c8bac
fix #3390: standalone: explicitly bind to '::'

This patch follows 2f8be3bfda203065b22e60862e5f98d831a46921 from
pve-common:
Instead of not specifying a listen address, we first try to bind on
'::', which usually accepts connections for both ipv4 and ipv6,
and fall back to '0.0.0.0' if this fails (if ipv6 is disabled via
kernel commandline).

The arguments are the same for HTTP::Daemon as for IO::Socket::IP,
since the former has IO::Socket::IP as base.

Additionally, by setting 'V6Only' explicitly to '0', the listening
socket will also accept ipv4 connections, even if the sysctl
'net.ipv6.bindv6only' is set to 1 - the sysctl provides a default
value, which can be overridden by a socket-option (see ipv6(7) -
IPV6_ONLY).

setting this option results in the following setsockopt-call being
added:
setsockopt(3, SOL_IPV6, IPV6_V6ONLY, [0], 4) = 0

AFAICT the socket option is available and overridable on Linux > 2.4
see [0] for an explanation of why this might not be wanted

Overriding the default setting set by an admin might be debateable,
but considering that the http-listener for the ACME challenge is
rather short-lived I think this is justified. The only other option
would be to create 2 listening sockets and binding on both - which
would mean reorganizing our perl-deamons to deal with multiple listen
sockets.

quickly tested on a publicly reachable test-machine of mine with:
* ipv6.domain.test (only AAAA record)
* ip46.domain.test (both AAAA and A)
* ipv4.domain.test (only A record)
with:
* sysctl net.ipv6.bindv6only=1 (for all 3 domains)
* disabling ipv6 via kernel-commandline (only ipv4 tested)
* disabling ipv6 via sysctl (only ipv4 tested)
* only configuring an ipv6 address (only ipv6 tested)

[0] https://man.openbsd.org/inet6.4
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
src/PVE/ACME/StandAlone.pm