Skip to content

fix(packer): drop tpl-kali's build-time eth0 DHCP stanza before templating (#790) - #1341

Merged
Gerrrt merged 3 commits into
mainfrom
gerrrt/kali-no-eth0-dhcp
Nov 9, 2026
Merged

Gerrrt merged 3 commits into
mainfrom
gerrrt/kali-no-eth0-dhcp

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Nov 9, 2026

Copy link
Copy Markdown
Owner

What changed

packer/kali.pkr.hcl's first provisioner now runs
rm -f /etc/network/interfaces.d/eth0 beside cloud-init clean, so
tpl-kali (902) and tpl-kali-saruman (910) no longer ship the preseed's
build-time eth0 DHCP stanza. The preseed still writes it, because the build
needs it. Its comment now says the build removes it before templating.

Why

On gandalf, a throwaway static-only clone of 902 at 172.30.30.199 on
vmbr1 raised both that stanza and cloud-init's static 50-cloud-init
stanza. With no DHCP server, dhcpcd fell back to 169.254.x.x and added
default dev eth0 scope link. That failed build-the-playground.md §8 check
four: a range target must have no default route (ADR-0014/0017).

The installer's ens18 stanza in /etc/network/interfaces stays. Kali names
the NIC eth0 (99-default.link → /dev/null), so no ens18 exists and
ifupdown never raises it.

Refs #790.
Refs #421.

Blast radius

tpl-kali and tpl-kali-saruman, once rebuilt, and future clones of them.
A clone's network now comes only from cloud-init's ipconfigN. Every current
caller sets ipconfig0=ip=dhcp: scripts/packer-smoke.sh,
scripts/make-attack-vm.sh (ragnarok's eth0) and garuda's tofu module.
So their eth0 still comes up. A clone made with no ipconfig0 relies on
cloud-init's own fallback.

  • No change to network segmentation or firewall rules
  • No new port published to a VLAN that could not already reach the service
  • No credential added outside secrets/*.sops.yaml

Verification

  • make validate passes: all checks passed, with 43 skipped and not run.
    This host has no docker and no packer, so packer validate, shellcheck,
    markdownlint, yamllint, ruff, actionlint, promtool/amtool/loki/alloy and the
    Caddyfile checks were skipped. CI runs them.
  • Deployed to the lab and confirmed working. Not rebuilt. Rebuilding
    902 on gandalf (build-the-lab-templates.md §5) and 910 on Saruman
    (§5b) runs from phoenix and is the operator's step. After that, run
    packer-smoke.sh for each, plus a static clone on vmbr1 through §8
    check four.
  • Docs updated: docs/changelog.md, docs/runbooks/build-the-lab-templates.md §5.

🤖 Generated with Claude Code

Copilot AI balanced review requested due to automatic review settings November 9, 2026 20:49
…ating (#790)

The preseed writes /etc/network/interfaces.d/eth0 so the build has a
network. Left in the template, ifupdown raised it beside cloud-init's
static stanza on a static-only clone; with no DHCP server dhcpcd fell
back to 169.254.x.x and added a link-local default route, failing
build-the-playground.md section 8 check four on gandalf. The first
provisioner now removes it beside cloud-init clean, for 902 and 910.
Every clone gets a NoCloud drive, and every caller sets ipconfig0, so
DHCP clones still bring eth0 up through cloud-init.

Neither template is rebuilt yet; that runs from phoenix.

Refs #790.
Refs #421.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Operator verification is still needed on rebuilt templates 902 and 910 to confirm DHCP first boots work and a static-only vmbr1 clone has no default route, since source inspection cannot establish these runtime properties.

No open issues 🎉

What changed in this PR

This PR removes Kali’s build-time DHCP configuration before templating, preventing it from conflicting with cloud-init networking and creating an unwanted default route on static-only range clones.

Changes:

  • Deletes /etc/network/interfaces.d/eth0 during Packer provisioning while retaining it for the installation build.
  • Documents the cause and required rebuilds for templates 902 and 910. Rebuilds and live verification remain pending.
File Description
packer/​kali/​preseed.cfg.pkrtpl Clarifies in comments that the DHCP stanza is build-only.
packer/​kali.pkr.hcl Removes the DHCP stanza before templating.
docs/​runbooks/​build-the-lab-templates.md Explains the network conflict and required template rebuilds.
docs/​changelog.md Records the fix and pending rebuild status.

Review effort: Balanced

@Gerrrt
Gerrrt enabled auto-merge (squash) November 9, 2026 20:51
Gerrrt and others added 2 commits November 9, 2026 12:55
The rebase and merge resolutions kept diff3 base blocks in the
2026-11-09 section. The changelog is now main's plus this PR's one entry.

Refs #790.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gerrrt
Gerrrt merged commit 0e21ffb into main Nov 9, 2026
8 checks passed
@Gerrrt
Gerrrt deleted the gerrrt/kali-no-eth0-dhcp branch November 9, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants