From d6188bd805581e9aced961ccf350e65bc7a381aa Mon Sep 17 00:00:00 2001 From: John Coffey Date: Sun, 15 Nov 2026 12:31:52 -0700 Subject: [PATCH 1/4] 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 --- e2e/cases/ipv6-sources.sh | 104 +++++++++++++++++ internal/apply/apply.go | 6 + internal/apply/join.go | 3 + internal/compose/compose.go | 20 +++- internal/compose/compose_test.go | 21 ++++ internal/compose/templates/compose.yaml.tmpl | 9 ++ internal/deps/deps.go | 115 +++++++++++++++++++ internal/deps/ipv6_test.go | 55 +++++++++ internal/host/host.go | 69 +++++++++++ internal/host/ipv6_test.go | 41 +++++++ internal/plan/plan.go | 21 ++++ 11 files changed, 458 insertions(+), 6 deletions(-) create mode 100755 e2e/cases/ipv6-sources.sh create mode 100644 internal/deps/ipv6_test.go create mode 100644 internal/host/ipv6_test.go diff --git a/e2e/cases/ipv6-sources.sh b/e2e/cases/ipv6-sources.sh new file mode 100755 index 0000000..1b53ccc --- /dev/null +++ b/e2e/cases/ipv6-sources.sh @@ -0,0 +1,104 @@ +#!/bin/bash +# SPDX-FileCopyrightText: 2026 Coffey Labs LLC +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# #65: a client that connects over IPv6 has to reach the server with its own +# address. On an IPv4-only project network Docker relays IPv6 connections +# through docker-proxy, and the server saw every one of them as the network's +# gateway, 172.31.253.1: SPF and DMARC were checked against that, IPv6 +# senders shared one set of bans and rate limits, and with --proxy snippets +# the gateway is an address the server is told never to ban. +# +# A second network namespace stands in for the internet, with an IPv6 and an +# IPv4 address of its own, and opens SMTP sessions to this machine. The +# server's log says which address each one came from. +# +# With OLD_REF (any installer from before the fix) the bug is shown first and +# the fixed installer then converges that install: +# OLD_REF=v2026.10.15.2 e2e/vm/run.sh e2e/cases/ipv6-sources.sh +# Without it, a fresh install is checked. +set -uo pipefail + +pass=0; fail=0 +ok() { echo " ok $*"; pass=$((pass+1)); } +bad() { echo " FAIL $*"; fail=$((fail+1)); } + +DIR=/var/lib/inbuxa +D=example.test +CLIENT6=fd00:99::2; HOST6=fd00:99::1 +CLIENT4=10.99.0.2; HOST4=10.99.0.1 +compose() { docker compose -f "$DIR/compose.yaml" "$@"; } + +ip netns add outside +ip link add v-host type veth peer name v-out +ip link set v-out netns outside +ip addr add $HOST6/64 dev v-host nodad; ip addr add $HOST4/24 dev v-host; ip link set v-host up +ip -n outside addr add $CLIENT6/64 dev v-out nodad; ip -n outside addr add $CLIENT4/24 dev v-out +ip -n outside link set v-out up; ip -n outside link set lo up + +# One SMTP session from outside to $1, then the address the server logged +# for it: the client's own, or the gateway's. +seen_as() { + local to=$1 before + before=$(compose logs server 2>&1 | wc -l) + ip netns exec outside python3 - "$to" <<'PY' >/dev/null 2>&1 +import smtplib, sys +s = smtplib.SMTP(sys.argv[1], 25, timeout=20); s.ehlo("outside.test"); s.quit() +PY + sleep 2 + compose logs server 2>&1 | tail -n +$((before + 1)) \ + | grep -oE "$CLIENT6|$CLIENT4|172\.31\.253\.1\b|fd69:6e62:7578::1\b" | head -1 +} + +check_sources() { + local got + got=$(seen_as $HOST6) + [ "$got" = "$CLIENT6" ] && ok "an IPv6 client reaches the server as itself ($got)" \ + || bad "an IPv6 client reaches the server as '${got:-nothing in the log}', not $CLIENT6" + got=$(seen_as $HOST4) + [ "$got" = "$CLIENT4" ] && ok "an IPv4 client still reaches it as itself ($got)" \ + || bad "an IPv4 client reaches the server as '${got:-nothing in the log}', not $CLIENT4" +} + +echo "==> a machine with nginx already on it" +DEBIAN_FRONTEND=noninteractive apt-get install -y -qq nginx libnginx-mod-stream openssl >/dev/null 2>&1 +systemctl is-active --quiet nginx && ok "nginx is running" || { bad "no nginx"; echo "==> $pass passed, $fail failed"; exit 1; } + +if [ -x /tmp/inbuxa-old ]; then + echo + echo "==> installed by the installer from before the fix" + OUT="$(/tmp/inbuxa-old install --domain $D --proxy snippets --install-deps --yes 2>&1)"; rc=$? + [ $rc -eq 0 ] && ok "installed (exit 0)" || { bad "exit $rc"; echo "$OUT" | tail -20 | sed 's/^/ /'; } + got=$(seen_as $HOST6) + [ "$got" = "172.31.253.1" ] && ok "the bug, shown: an IPv6 client reached the server as the gateway" \ + || bad "the old install did not show the bug: an IPv6 client was seen as '${got:-nothing}'" +fi + +echo +echo "==> installed (or converged) by this installer" +OUT="$(/tmp/inbuxa install --domain $D --proxy snippets --install-deps --yes 2>&1)"; rc=$? +echo "$OUT" | grep -v '^ |' | grep -iE "ipv6|docker|network|exit|error" | head -12 | sed 's/^/ /' +[ $rc -eq 0 ] && ok "installed (exit 0)" || { bad "exit $rc"; echo "$OUT" | tail -25 | sed 's/^/ /'; } +grep -q "enable_ipv6: true" $DIR/compose.yaml && grep -q "subnet: fd69:6e62:7578::/64" $DIR/compose.yaml \ + && ok "compose.yaml gives the project network IPv6" || bad "no IPv6 in compose.yaml" +[ "$(docker network inspect inbuxa_stack --format '{{.EnableIPv6}}' 2>/dev/null)" = true ] \ + && ok "the network Docker made has IPv6" || bad "the network inbuxa_stack has no IPv6" +v=$(docker version --format '{{.Server.Version}}') +if [ "${v%%.*}" -lt 27 ]; then + grep -q '"ip6tables": true' /etc/docker/daemon.json && grep -q '"experimental": true' /etc/docker/daemon.json \ + && ok "Docker $v: ip6tables and experimental turned on in daemon.json" || bad "Docker $v: daemon.json not changed: $(cat /etc/docker/daemon.json 2>&1)" +fi +for _ in $(seq 1 30); do curl -sf http://127.0.0.1:8081/healthz/live >/dev/null && break; sleep 2; done +check_sources + +echo +echo "==> a second run changes nothing" +OUT="$(/tmp/inbuxa install --domain $D --proxy snippets --install-deps --yes 2>&1)"; rc=$? +[ $rc -eq 0 ] && ok "second run (exit 0)" || { bad "exit $rc"; echo "$OUT" | tail -15 | sed 's/^/ /'; } +grep -q "already forwards IPv6" <<<"$OUT" && bad "the IPv6 step ran again on Docker that forwards" || ok "no IPv6 step the second time" +check_sources + +ip netns del outside +echo +echo "==> $pass passed, $fail failed" +[ "$fail" -eq 0 ] diff --git a/internal/apply/apply.go b/internal/apply/apply.go index 31859a8..71090f8 100644 --- a/internal/apply/apply.go +++ b/internal/apply/apply.go @@ -50,6 +50,9 @@ const ( DefaultWebmailImage = "registry.coffeylabs.org/inbuxa/inbuxa-webmail:" + release.WebmailVersion DefaultCaddyImage = "docker.io/library/caddy:2-alpine" DefaultSubnet = "172.31.253.0/24" + // DefaultIPv6Subnet is a unique local /64 for the same network, on a + // machine with IPv6 (#65). Nothing outside the machine ever sees it. + DefaultIPv6Subnet = "fd69:6e62:7578::/64" ) // Result is what the operator is left holding. @@ -146,6 +149,9 @@ func Run(ctx context.Context, p plan.Plan, f host.Facts, log Log) (*Result, erro WebmailBind: "127.0.0.1:8080", Subnet: DefaultSubnet, } + if f.IPv6 { + stack.IPv6Subnet = DefaultIPv6Subnet + } if o.Local { // Nothing is published and nothing is certified: the addresses are // the loopback binds, which is what the front ends are told to use. diff --git a/internal/apply/join.go b/internal/apply/join.go index bad3ec7..8fbe504 100644 --- a/internal/apply/join.go +++ b/internal/apply/join.go @@ -143,6 +143,9 @@ func Join(ctx context.Context, p plan.Plan, f host.Facts, key string, log Log) ( Subnet: DefaultSubnet, ACMEDirectory: o.ACMEDirectory, } + if f.IPv6 { + stack.IPv6Subnet = DefaultIPv6Subnet + } if o.Shape(plan.Console) != plan.Skip { stack.ConsoleURL = consoleURL } diff --git a/internal/compose/compose.go b/internal/compose/compose.go index bd836f0..b53460b 100644 --- a/internal/compose/compose.go +++ b/internal/compose/compose.go @@ -72,12 +72,20 @@ type Stack struct { ConsoleBind string WebmailBind string - Subnet string - GatewayIP string // the project network's gateway: where the host is, seen from inside it - ServerIP string - ConsoleIP string - WebmailIP string - CaddyIP string + Subnet string + // IPv6Subnet, when set, gives the network IPv6 as well, so that a + // client connecting over IPv6 reaches the containers with its own + // address. On an IPv4-only network Docker relays such a connection + // over IPv4 from the gateway, and the server saw every IPv6 client as + // GatewayIP: SPF and DMARC failed for IPv6 senders, they shared one + // set of bans and rate limits, and GatewayIP is an address the server + // is told never to ban (#65). Empty on a machine without IPv6. + IPv6Subnet string + GatewayIP string // the project network's gateway: where the host is, seen from inside it + ServerIP string + ConsoleIP string + WebmailIP string + CaddyIP string MailPorts []int // published as-is: 25, 465, 993, 995, 4190 diff --git a/internal/compose/compose_test.go b/internal/compose/compose_test.go index 657515e..cd5f84b 100644 --- a/internal/compose/compose_test.go +++ b/internal/compose/compose_test.go @@ -205,3 +205,24 @@ func TestFrontEndsOnTheHost(t *testing.T) { t.Errorf("nginx-inbuxa.conf:\n%s", nginx) } } + +// #65: on a machine with IPv6 the project network carries it too, or Docker +// relays every IPv6 client from the gateway; without IPv6 it stays as it was. +func TestNetworkCarriesIPv6WhenTheMachineHasIt(t *testing.T) { + s := stack(false) + c, _ := render(t, s) + if strings.Contains(c, "enable_ipv6") || strings.Contains(c, "fd69:") { + t.Errorf("a machine without IPv6 got an IPv6 network:\n%s", c) + } + s = stack(false) + s.IPv6Subnet = "fd69:6e62:7578::/64" + c, _ = render(t, s) + for _, want := range []string{" enable_ipv6: true\n", " - subnet: 172.31.253.0/24\n - subnet: fd69:6e62:7578::/64\n"} { + if !strings.Contains(c, want) { + t.Errorf("compose.yaml lacks %q:\n%s", want, c) + } + } + if s.GatewayIP != "172.31.253.1" { + t.Errorf("the IPv4 gateway moved: %q", s.GatewayIP) + } +} diff --git a/internal/compose/templates/compose.yaml.tmpl b/internal/compose/templates/compose.yaml.tmpl index 4eb0ecb..6b2b3af 100644 --- a/internal/compose/templates/compose.yaml.tmpl +++ b/internal/compose/templates/compose.yaml.tmpl @@ -178,9 +178,18 @@ services: networks: stack: +{{- if .IPv6Subnet}} + # IPv6 as well, so a client that connects over IPv6 reaches the + # containers with its own address. On an IPv4-only network Docker relays + # those connections over IPv4, and every one arrives from the gateway. + enable_ipv6: true +{{- end}} ipam: config: - subnet: {{.Subnet}} +{{- if .IPv6Subnet}} + - subnet: {{.IPv6Subnet}} +{{- end}} {{- end}} {{- if or .Server .Proxy}} diff --git a/internal/deps/deps.go b/internal/deps/deps.go index 08114ae..fd9f1a6 100644 --- a/internal/deps/deps.go +++ b/internal/deps/deps.go @@ -30,6 +30,7 @@ import ( "context" "crypto/sha256" "encoding/hex" + "encoding/json" "fmt" "io" "net/http" @@ -82,6 +83,9 @@ func For(f host.Facts, wantContainers, wantHostWebmail bool) []Need { var needs []Need if wantContainers { needs = append(needs, runtimeNeeds(f)...) + if f.IPv6 { + needs = append(needs, dockerIPv6Need(f, needs)) + } } // The webmail on the host runs on the installer's own Node, in // /opt/inbuxa/node, whatever else the machine has: the version it was @@ -192,6 +196,117 @@ func dockerNeed(f host.Facts) Need { return n } +// dockerIPv6Need turns on Docker's own IPv6 forwarding where it is off, so +// a client that connects over IPv6 reaches the containers with its own +// address. Without it docker-proxy relays the connection, and the server +// sees the project network's gateway for every IPv6 client: SPF and DMARC +// are checked against it, and bans and rate limits lump them together (#65). +// +// It is offered for Docker that is here and relays, and for Docker this run +// is about to install, whose version is not known yet; the step looks again +// once it is there and leaves a Docker that already forwards alone. Not for +// podman, which forwards both families itself, and not for a daemon.json +// that is not JSON, which the plan warns about instead: writing over a file +// that cannot be read is not a fix. +func dockerIPv6Need(f host.Facts, before []Need) Need { + installing := false + for _, n := range before { + if n.Name == "docker" && n.Fixable { + installing = true + } + } + if !installing { + if f.Runtime.Kind != "docker" || !f.Runtime.Usable || f.Runtime.ForwardsIPv6 { + return Need{} + } + cur, _ := os.ReadFile(host.DockerDaemonConfig) + if _, err := host.DockerForwardsIPv6(f.Runtime.Version, cur); err != nil { + return Need{} + } + } + n := Need{Name: "docker IPv6 forwarding", Because: "mail and web clients that connect over IPv6", Fixable: true} + if installing { + n.Actions = append(n.Actions, "if the Docker it installs relays IPv6 rather than forwarding it:") + } + n.Actions = append(n.Actions, + `set "ip6tables": true in `+host.DockerDaemonConfig+` (and "experimental": true, which Docker before 27 needs for it), keeping a copy of the file as it was`, + "restart Docker, which restarts the containers already running on this machine", + ) + n.steps = []step{{"turning on Docker's IPv6 forwarding", dockerIPv6On}} + return n +} + +func dockerIPv6On(ctx context.Context, log io.Writer) error { + out, err := exec.CommandContext(ctx, "docker", "version", "--format", "{{.Server.Version}}").Output() + if err != nil { + return fmt.Errorf("asking docker its version: %w", err) + } + version := strings.TrimSpace(string(out)) + path := host.DockerDaemonConfig + cur, err := os.ReadFile(path) + if err != nil && !os.IsNotExist(err) { + return err + } + on, err := host.DockerForwardsIPv6(version, cur) + if err != nil { + return err + } + if on { + fmt.Fprintf(log, " Docker %s already forwards IPv6\n", version) + return nil + } + cfg := map[string]any{} + if len(strings.TrimSpace(string(cur))) > 0 { + if err := json.Unmarshal(cur, &cfg); err != nil { + return err + } + } + cfg["ip6tables"] = true + if host.DockerMajor(version) < 27 { + cfg["experimental"] = true + } + next, err := json.MarshalIndent(cfg, "", " ") + if err != nil { + return err + } + if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { + return err + } + if cur != nil { + backup := path + ".before-inbuxa" + if _, err := os.Stat(backup); os.IsNotExist(err) { + if err := os.WriteFile(backup, cur, 0o644); err != nil { + return err + } + fmt.Fprintf(log, " the file as it was is in %s\n", backup) + } + } + if err := writeFile(path, append(next, '\n')); err != nil { + return err + } + if err := run(ctx, log, "systemctl", "restart", "docker"); err != nil { + // A daemon that will not start on the new file is worse than one + // that relays IPv6: put the old one back and start it on that. + if cur != nil { + _ = writeFile(path, cur) + } else { + _ = os.Remove(path) + } + _ = run(ctx, log, "systemctl", "restart", "docker") + return fmt.Errorf("docker did not restart with ip6tables on, so %s is back as it was: %w", path, err) + } + return nil +} + +// writeFile replaces path in one step, so a reader never finds half a file. +func writeFile(path string, b []byte) error { + tmp := path + ".tmp" + if err := os.WriteFile(tmp, b, 0o644); err != nil { + return err + } + return os.Rename(tmp, path) +} + // composeNeed is the same plugin whichever runtime is underneath: compose // speaks the Docker API, and podman serves it. func composeNeed(f host.Facts) Need { diff --git a/internal/deps/ipv6_test.go b/internal/deps/ipv6_test.go new file mode 100644 index 0000000..777ca4f --- /dev/null +++ b/internal/deps/ipv6_test.go @@ -0,0 +1,55 @@ +// 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") + } +} diff --git a/internal/host/host.go b/internal/host/host.go index b73b1cb..c9cc261 100644 --- a/internal/host/host.go +++ b/internal/host/host.go @@ -14,6 +14,7 @@ package host import ( "bufio" "context" + "encoding/json" "errors" "fmt" "net" @@ -41,6 +42,13 @@ type Facts struct { DiskFreeGB int // on the filesystem that would hold the install MemoryMB int Existing string // path of a previous install's state file, or "" + + // IPv6 is whether this kernel has IPv6 turned on. When it does, clients + // can connect over it, and the project network has to carry it too: + // Docker relays an IPv6 connection to an IPv4-only container from its + // own gateway, so every IPv6 client arrives from one private address + // (#65). + IPv6 bool } // OSInfo is the distribution, as os-release describes it. @@ -65,6 +73,14 @@ type Runtime struct { Socket string // for podman, the API socket compose is pointed at Why string // why it is unusable, in a sentence fit to show someone + // ForwardsIPv6 is whether the runtime forwards a published port's IPv6 + // connections to a container with the client's own address. Podman + // does. Docker does from 27 on, unless turned off; before 27 only with + // ip6tables turned on, which is experimental there. Without it Docker + // relays them through docker-proxy, and the container sees the + // gateway instead of the client. + ForwardsIPv6 bool + // What is missing, named rather than described, so the caller does not // have to read Why to decide what to do. Reporting only the first thing // in the way meant fixing one of them and being told about the next. @@ -140,6 +156,7 @@ func Survey(ctx context.Context) Facts { Node: surveyNode(ctx), Glibc: surveyGlibc(ctx), MemoryMB: memoryMB(), + IPv6: kernelIPv6(), } if u, err := user.Current(); err == nil { f.Root = u.Uid == "0" @@ -244,6 +261,8 @@ func surveyDocker(ctx context.Context) Runtime { } r.Usable = true r.Version = strings.TrimSpace(string(out)) + daemon, _ := os.ReadFile(DockerDaemonConfig) + r.ForwardsIPv6, _ = DockerForwardsIPv6(r.Version, daemon) if err := exec.CommandContext(ctx, bin, "compose", "version").Run(); err == nil { r.Compose = "v2" @@ -305,10 +324,60 @@ func surveyPodman(ctx context.Context) Runtime { r.Why = "the compose plugin is not installed" default: r.Usable = true + // Netavark forwards published ports with nftables for both + // families, so the container sees the client's own address. + r.ForwardsIPv6 = true } return r } +// DockerDaemonConfig is the Docker daemon's own configuration file. +const DockerDaemonConfig = "/etc/docker/daemon.json" + +// DockerForwardsIPv6 works out from the engine's version and its +// daemon.json whether Docker forwards IPv6 connections to containers itself +// (ip6tables) rather than relaying them. ip6tables is on by default from +// Docker 27; before that it is off, and turning it on also takes +// "experimental", without which the daemon refuses to start. +// +// The error is for a daemon.json that is not JSON: then nothing can be said, +// and nothing should be written over it either. +func DockerForwardsIPv6(version string, daemonJSON []byte) (bool, error) { + cfg := map[string]any{} + if len(strings.TrimSpace(string(daemonJSON))) > 0 { + if err := json.Unmarshal(daemonJSON, &cfg); err != nil { + return false, fmt.Errorf("%s: %w", DockerDaemonConfig, err) + } + } + on, set := cfg["ip6tables"].(bool) + if DockerMajor(version) >= 27 { + return !set || on, nil + } + exp, _ := cfg["experimental"].(bool) + return set && on && exp, nil +} + +// DockerMajor is the major number of an engine version such as +// "26.1.5+dfsg1", or 0 when there is none to read. +func DockerMajor(version string) int { + major, _, _ := strings.Cut(strings.TrimPrefix(strings.TrimSpace(version), "v"), ".") + n, err := strconv.Atoi(major) + if err != nil { + return 0 + } + return n +} + +// kernelIPv6 is whether IPv6 is on: the module is loaded (if_inet6 exists +// only then) and not turned off for every interface. +func kernelIPv6() bool { + if _, err := os.Stat("/proc/net/if_inet6"); err != nil { + return false + } + b, err := os.ReadFile("/proc/sys/net/ipv6/conf/all/disable_ipv6") + return err != nil || strings.TrimSpace(string(b)) != "1" +} + // ComposePluginPath is where this installer puts the compose plugin, and // where it looks for one it put there before. The same file serves docker // and podman. diff --git a/internal/host/ipv6_test.go b/internal/host/ipv6_test.go new file mode 100644 index 0000000..995eecb --- /dev/null +++ b/internal/host/ipv6_test.go @@ -0,0 +1,41 @@ +// SPDX-FileCopyrightText: 2026 Coffey Labs LLC +// SPDX-License-Identifier: AGPL-3.0-or-later + +package host + +import "testing" + +// Measured on Debian 13's docker.io 26.1.5 (#65): without ip6tables an IPv6 +// client of a published port reached the container as the gateway; with +// "ip6tables" and "experimental" on, as itself; with "ip6tables" alone the +// daemon would not start. +func TestDockerForwardsIPv6(t *testing.T) { + for _, c := range []struct { + version, daemon string + want bool + }{ + {"26.1.5+dfsg1", "", false}, + {"26.1.5+dfsg1", `{"ip6tables": true}`, false}, + {"26.1.5+dfsg1", `{"ip6tables": true, "experimental": true}`, true}, + {"27.0.3", "", true}, + {"29.0.1", `{"log-driver": "journald"}`, true}, + {"29.0.1", `{"ip6tables": false}`, false}, + {"", "", false}, + } { + got, err := DockerForwardsIPv6(c.version, []byte(c.daemon)) + if err != nil || got != c.want { + t.Errorf("Docker %q with %q: got %v, %v; want %v", c.version, c.daemon, got, err, c.want) + } + } + if _, err := DockerForwardsIPv6("29.0.1", []byte("{not json")); err == nil { + t.Error("a daemon.json that is not JSON was read as something") + } +} + +func TestDockerMajor(t *testing.T) { + for v, want := range map[string]int{"26.1.5+dfsg1": 26, "v29.0.1": 29, "28": 28, "": 0, "dev": 0} { + if got := DockerMajor(v); got != want { + t.Errorf("DockerMajor(%q) = %d, want %d", v, got, want) + } + } +} diff --git a/internal/plan/plan.go b/internal/plan/plan.go index bcd9685..0bb5c05 100644 --- a/internal/plan/plan.go +++ b/internal/plan/plan.go @@ -270,6 +270,9 @@ func Build(f host.Facts, o Options) (Plan, error) { // tarball. The installer says what it would do about each and does it when // told, rather than handing the operator a chore and calling it an error. p.Needs = deps.For(f, wantContainers, wantHostWebmail) + if w := ipv6Warning(f, wantContainers, o.InstallDeps); w != "" { + p.Warnings = append(p.Warnings, w) + } for _, c := range []Component{Server, Console, Webmail} { s := o.Shape(c) @@ -458,6 +461,24 @@ func Build(f host.Facts, o Options) (Plan, error) { // covered says whether a cell's unavailability is one of the things the // installer offered to fix. +// ipv6Warning is what the operator should hear about IPv6 when Docker here +// relays it and this run will not change that: every client that connects +// over IPv6 would reach the suite from one private address (#65). +func ipv6Warning(f host.Facts, wantContainers, installDeps bool) string { + if !wantContainers || !f.IPv6 || f.Runtime.Kind != "docker" || !f.Runtime.Usable || f.Runtime.ForwardsIPv6 { + return "" + } + const why = "every client that connects over IPv6 would reach the suite from one private address, so mail from IPv6 senders fails SPF and their bans and rate limits are shared" + cur, _ := os.ReadFile(host.DockerDaemonConfig) + if _, err := host.DockerForwardsIPv6(f.Runtime.Version, cur); err != nil { + return fmt.Sprintf("Docker %s relays IPv6 rather than forwarding it, and %v: until \"ip6tables\" is on there, %s", f.Runtime.Version, err, why) + } + if installDeps { + return "" + } + return fmt.Sprintf("Docker %s relays IPv6 rather than forwarding it: %s. --install-deps turns its IPv6 forwarding on (and restarts Docker); or keep the mail host's AAAA record out of DNS", f.Runtime.Version, why) +} + func covered(needs []deps.Need, c Component, s Shape) bool { want := map[string]bool{} switch { -- 2.54.0 From 8b3133546353895aa75b140545ccaf5b74a6509b Mon Sep 17 00:00:00 2001 From: John Coffey Date: Sun, 15 Nov 2026 12:58:36 -0700 Subject: [PATCH 2/4] Install server 2026.11.11 and console 2026.10.26.7 on the stable line --- internal/release/release.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/release/release.go b/internal/release/release.go index d2f4b8e..7638998 100644 --- a/internal/release/release.go +++ b/internal/release/release.go @@ -12,7 +12,7 @@ package release import "fmt" // ServerVersion is the inbuxa-server release this installer installs. -const ServerVersion = "2026.10.29.1" +const ServerVersion = "2026.11.11" // ServerImage is that release as a container image. const ServerImage = "registry.coffeylabs.org/inbuxa/inbuxa-server:" + ServerVersion @@ -22,8 +22,8 @@ const ServerImage = "registry.coffeylabs.org/inbuxa/inbuxa-server:" + ServerVers // rather than fetched beside the download: a checksum that arrives with the // file only proves the file arrived. var ServerSHA256 = map[string]string{ - "amd64": "6fd2d097a11cdb35a724018113891d1255313f0a56e3c6c419772ba0ac73fe0b", - "arm64": "610eebcac4041eeee12eb13bc6d76f52429f53fcc84812dea52c48e1304d57e4", + "amd64": "0602618ab7cc55f34f870119b8c7fabe9305db41a6f7be76ad52827f7735bc08", + "arm64": "aa705533ea71c0009c03c793783bcc3f6ac2ada1acc5b4a888bc7ad2ef1f0ab7", } // ServerTarball is where the release's tarball for an architecture is. @@ -38,8 +38,8 @@ func ServerTarball(arch string) string { // unavailable until one does. INBUXA_CONSOLE_TARBALL and // INBUXA_WEBMAIL_TARBALL name a local file instead, for testing. const ( - ConsoleVersion = "2026.10.26.5" - ConsoleSHA256 = "c5085550585cd7e58b512afadc33f1c4719888baa441bc79882aa9f3c31c54ad" + ConsoleVersion = "2026.10.26.7" + ConsoleSHA256 = "3fea4aed273258d45d5f956dccca94039e66a5131793de47d29a60fd5fc90834" WebmailVersion = "2026.10.26-gcff6f1f" // its tag is inbuxa-v ) -- 2.54.0 From ebf27e6b16b2cc3822461e348c434ec81c7b254f Mon Sep 17 00:00:00 2001 From: John Coffey Date: Sun, 8 Nov 2026 16:29:52 -0700 Subject: [PATCH 3/4] e2e: upgrade-containers reads the archive's whole listing before matching grep -q stops reading at its first match; under pipefail the tar it cut off fails the pipeline, so the check said an archive with config.json in it had none. Seen on the 27.1-rc.15 pins, where config.json comes third of 33 entries. --- e2e/cases/upgrade-containers.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/e2e/cases/upgrade-containers.sh b/e2e/cases/upgrade-containers.sh index 652d6be..bee9b79 100644 --- a/e2e/cases/upgrade-containers.sh +++ b/e2e/cases/upgrade-containers.sh @@ -47,7 +47,10 @@ OUT="$(/tmp/inbuxa upgrade --yes 2>&1)"; rc=$? echo "$OUT" | grep -v '^ |' | tail -16 | sed 's/^/ /' [ $rc -eq 0 ] && ok "upgraded (exit 0)" || bad "upgrade exit $rc" ls $DIR/backups/server-*.tar.gz >/dev/null 2>&1 && ok "the server's data was archived: $(ls $DIR/backups)" || bad "no archive in $DIR/backups" -tar -tzf $DIR/backups/server-*.tar.gz 2>/dev/null | grep -q "config.json" && ok "with its configuration in it" || bad "the archive has no config.json" +# The whole listing first: grep -q stops reading at the first match, and +# under pipefail the tar it cut off would fail the check. +LIST="$(tar -tzf $DIR/backups/server-*.tar.gz 2>/dev/null)" +grep -q "config.json" <<<"$LIST" && ok "with its configuration in it" || bad "the archive has no config.json" AFTER="$(img server) $(img admin) $(img webmail)" [ "$AFTER" != "$BEFORE" ] && ok "now: $AFTER" || bad "the images did not change" STATE="$($(rt) compose -f $DIR/compose.yaml ps --format '{{.Service}} {{.State}}')" -- 2.54.0 From 71dbb54c101271531d07b4487fa32c5e851c3f97 Mon Sep 17 00:00:00 2001 From: John Coffey Date: Sun, 15 Nov 2026 13:48:26 -0700 Subject: [PATCH 4/4] Build with Go 1.26.11 (GO-2026-6859) --- .gitea/workflows/ci.yml | 2 +- .gitea/workflows/release.yml | 2 +- go.mod | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 7131008..cd73ed1 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: test: runs-on: light container: - image: golang:1.26-bookworm@sha256:23ce71337b726608afb1bc00986e630a05034a87a87ea1fc2cd1ae5cf33387eb # 1.26-bookworm (1.26.10) + image: golang:1.26-bookworm@sha256:dc40a13b61304647ed7e5d581d246b86413dfc29d63c6d018310feb93cd98fc0 # 1.26-bookworm (1.26.11) steps: - uses: coffey-labs/actions/checkout@fab0c4d45e0162963965f1555df27b7bed5e20ec - name: Standard library only diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 0195701..fd99c4e 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -31,7 +31,7 @@ jobs: release: runs-on: light container: - image: golang:1.26-bookworm@sha256:23ce71337b726608afb1bc00986e630a05034a87a87ea1fc2cd1ae5cf33387eb # 1.26-bookworm (1.26.10) + image: golang:1.26-bookworm@sha256:dc40a13b61304647ed7e5d581d246b86413dfc29d63c6d018310feb93cd98fc0 # 1.26-bookworm (1.26.11) env: TAG: ${{ github.ref_name }} TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/go.mod b/go.mod index 663ac5c..c42514f 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module git.coffeylabs.org/inbuxa/inbuxa-installer -go 1.26.10 +go 1.26.11 -- 2.54.0