feat(lab_seal_dns): seal lab DNS so a sealed host reads SEALED

A sealed lab host now reports SEALED. A new lab-only role, lab_seal_dns, closes the DNS leg that the simulator's seal leaves open. offline_check is unchanged and never touches DNS, so it still runs against any instance, including a customer's.

Why

The simulator's airgap seal allows egress to private ranges and to the GCE metadata address. That address also answers public DNS. On a sealed GCE host example.com still resolves, so the DNS leg of offline_check reaches and the seal reads NOT_SEALED. On the 2026-11-23 rig someone pointed the hosts' resolver at loopback by hand. Nothing in either repo did it.

What changes

  • ansible/roles/lab_seal_dns: writes internal lab names to /etc/hosts from lab_seal_dns_hosts, sets NetworkManager dns=none, saves the original resolv.conf once, and writes nameserver 127.0.0.1. lab_seal_dns_state=absent reverts.
  • ansible/lab-seal-dns.yml runs the role. ansible/lab-sealed-check.yml runs it, then offline-check.yml.
  • scripts/test_lab_seal_dns.py: checks the play order, that offline_check holds no resolver change, and that an open resolver gives NOT_SEALED and a loopback one gives SEALED.
  • Runbook 10 section 6 and the role README say when to use it and how to revert.
flowchart LR
  A[sim airgap-seal<br/>metadata still answers DNS] --> B[lab_seal_dns<br/>hosts file, resolver to loopback]
  B --> C[offline_check seal legs<br/>tcp, https, dns, mirror]
  C --> D{verdict}
  D -->|any internet leg reached| E[NOT_SEALED]
  D -->|all blocked, mirror answers| F[SEALED]

How it was checked

One bare AlmaLinux 9 VM on GCE, sealed with the simulator's seal, then offline-check.yml with every capability probe off (seal legs only) and a loopback mirror as the positive control. The VM was deleted afterwards.

Arm Result
A. Sim seal only NOT_SEALED. The three TCP legs and both HTTPS legs were blocked. The DNS leg reached.
B. After lab_seal_dns SEALED. Six internet legs blocked, including DNS. The mirror target, addressed by an /etc/hosts name, answered.
C. Second apply changed=0.
D. Internal names /etc/hosts names still resolve; example.com fails with getent exit 2.

The revert run restored the cloud resolver, removed the NetworkManager file and the hosts block, and example.com resolved again.

Also run: python3 -m unittest scripts/test_lab_seal_dns.py scripts/test_offline_check.py, ansible-lint and yamllint on the new files.

Checklist

  • Verified on a deployment, or the reason it was not: applied and re-applied with ansible-playbook on a disposable VM (see above).
  • Runbook and README updated if a step, variable or default changed.
  • No secrets, hostnames or account IDs committed; certs stay in the git-ignored certs/.
  • Release and service image pins changed in ansible/group_vars/all/versions.yml; other pins edited where they sit. Not applicable: no pin changed.

AI assisted in drafting this change.

Merge request reports

Loading
Loading