@@ -1657,6 +1657,12 @@ const (
16571657 // Keep these generated paths stable: cloud-init, systemd, and validation
16581658 // tests all depend on this Docker firewall handoff.
16591659 dockerFirewallScriptPath = "/usr/local/sbin/brev-apply-docker-firewall.sh"
1660+
1661+ // This is a docker.service drop-in because the firewall rules must be
1662+ // re-applied immediately after Docker initializes or resets DOCKER-USER. If
1663+ // we need a separately inspectable status surface later, this can move to a
1664+ // named oneshot unit such as brev-docker-firewall.service; for now the
1665+ // execution is visible through docker.service journal/status output.
16601666 dockerServiceDropInDir = "/etc/systemd/system/docker.service.d"
16611667 dockerFirewallDropInPath = dockerServiceDropInDir + "/10-brev-firewall.conf"
16621668)
@@ -1670,20 +1676,17 @@ func generateDockerFirewallWriteFiles() string {
16701676 // NAT/FORWARD rules that can make `docker run -p host:container` reachable
16711677 // from the public internet even when UFW says incoming traffic is denied.
16721678 //
1673- // DOCKER-USER is Docker's documented filter hook for this traffic. The
1674- // ordering is important: some Nebius images run cloud-init before Docker has
1675- // created DOCKER-USER, and Docker may create/reset the chain during daemon
1676- // startup. We therefore install both:
1677- // - an immediate cloud-init run for images where Docker is already active
1678- // - a docker.service ExecStartPost hook for images where Docker starts later
1679+ // DOCKER-USER is Docker's documented filter hook for this traffic. The script
1680+ // ensures the chain exists before configuring it. If Docker already created
1681+ // the chain, the create command fails harmlessly and the script continues.
16791682 //
16801683 // The generated script exits successfully even if an iptables command fails
16811684 // because failing Docker startup would be worse operationally. Validation
16821685 // tests assert that the rule set is actually present and blocks published
16831686 // ports.
16841687 //
1685- // UFW persists its own rules in /etc/ufw; only DOCKER-USER needed a Docker
1686- // startup hook after removing netfilter-persistent .
1688+ // UFW persists its own rules in /etc/ufw; Docker firewall rules are applied
1689+ // through cloud-init and the docker.service post-start hook .
16871690 return fmt .Sprintf (`
16881691write_files:
16891692 - path: %s
0 commit comments