Files
jcoffey-dev dfc61c1c10
ci / test (pull_request) Successful in 40s
Give the project network IPv6, so IPv6 clients keep their address
The network the installer writes was IPv4 only. Docker relays an IPv6
connection to a published port of an IPv4-only container through
docker-proxy, so the server saw every client that connected over IPv6 as
the network's gateway, 172.31.253.1: SPF, DMARC and iprev were checked
against it, IPv6 senders shared one set of bans and rate limits, and
with --proxy snippets (or front ends on the host) the gateway is on the
server's allowed list, so IPv6 clients were never banned at all.

On a machine with IPv6, compose.yaml now gives the network a unique
local /64 (fd69:6e62:7578::/64) beside the IPv4 subnet. Re-running
install converges an existing deployment: compose recreates the network.

That is enough with Docker 27 and later and with podman, which forward
both families themselves. Docker before 27 still relays IPv6 unless
ip6tables is on, which there also takes "experimental" (with ip6tables
alone the daemon does not start). The survey now reads the engine
version and /etc/docker/daemon.json, and deps offers to set both keys,
keeping the old file as daemon.json.before-inbuxa and putting it back if
Docker does not come up on the new one. Without --install-deps the plan
warns instead, and it never writes over a daemon.json it cannot parse.

Outbound mail is unchanged in practice: the server tries IPv4 first by
default and uses IPv6 only for hosts that have no IPv4 address.

e2e/cases/ipv6-sources.sh opens SMTP sessions from a second network
namespace with addresses of its own; with OLD_REF it shows the bug on an
install from before the fix, then converges it.

Fixes #65
2026-11-15 12:31:52 -07:00

56 lines
1.8 KiB
Go

// SPDX-FileCopyrightText: 2026 Coffey Labs LLC
// SPDX-License-Identifier: AGPL-3.0-or-later
package deps
import (
"testing"
"git.coffeylabs.org/inbuxa/inbuxa-installer/internal/host"
)
func hasNeed(needs []Need, name string) bool {
for _, n := range needs {
if n.Name == name {
return true
}
}
return false
}
// #65: Docker's IPv6 forwarding is offered where Docker relays IPv6 and the
// machine has it, and for a Docker this run installs; never for podman, a
// machine without IPv6, or Docker that already forwards.
func TestDockerIPv6Offered(t *testing.T) {
const want = "docker IPv6 forwarding"
relays := host.Facts{IPv6: true, Runtime: host.Runtime{Kind: "docker", Present: true, Usable: true, Version: "26.1.5+dfsg1", Compose: "v2"}}
if !hasNeed(For(relays, true, false), want) {
t.Error("not offered for Docker 26 that relays IPv6")
}
if hasNeed(For(relays, false, false), want) {
t.Error("offered with nothing in containers")
}
noV6 := relays
noV6.IPv6 = false
if hasNeed(For(noV6, true, false), want) {
t.Error("offered on a machine without IPv6")
}
forwards := relays
forwards.Runtime.ForwardsIPv6 = true
if hasNeed(For(forwards, true, false), want) {
t.Error("offered for Docker that already forwards")
}
podman := host.Facts{IPv6: true, OS: host.OSInfo{Family: "rhel"}, Runtime: host.Runtime{Kind: "podman", Present: true, Usable: true, ForwardsIPv6: true}}
if hasNeed(For(podman, true, false), want) {
t.Error("offered for podman")
}
fresh := host.Facts{IPv6: true, OS: host.OSInfo{ID: "debian", Family: "debian"}}
needs := For(fresh, true, false)
if !hasNeed(needs, "docker") || !hasNeed(needs, want) {
t.Errorf("a Debian machine with no runtime: got %v", needs)
}
if needs[len(needs)-1].Name != want {
t.Error("IPv6 forwarding is not offered after Docker itself")
}
}