Repository navigation
[WIP] fix(azure): validate metadata IPv4 against guest networking - #80
Garrett Settles (gsettles01) wants to merge 5 commits into
Conversation
38ea0e0 to
12d9e9c
Compare
Azure WireServer SharedConfig can report an IPv4 address not assigned to the VM, causing etcd to bind to the wrong address. Validate the route-selected IPv4 against the interface and IMDS before metadata consumers start. Keep this in Azure RPM images, preserve the first raw result, and add offline regression coverage. Validation: 22 offline cases and one fresh ARM64 discovery run passed. All three nodes passed regeneration and reboot with SELinux enforcing. Refs: ACL Bug 18833
The helper runs as ExecStartPost after Afterburn has already reached WireServer and IMDS, so the drop-in needs no network-online ordering. The assigned-address check already rejects impossible IPv4 values, so drop the octet range loop. The pattern check still guards the sed rewrite; the invalid-ipv4 test now uses a value it rejects.
Enable the acl-pipelines testAzureMetadataIpv4 step so PR validation runs the offline test on the build agent. The test only needs Bash and jq because ip and curl are fixtures. Enforce cl.metadata.azure so Azure kola runs catch a wrong COREOS_AZURE_IPV4_DYNAMIC. It is registered for Azure only, so QEMU runs never select it. Requires the acl-pipelines testAzureMetadataIpv4 parameter on main. Refs: ACL Bug 18833
cl.metadata.azure is registered for Azure only, so kola never selects it on QEMU and evaluate_test_results.sh failed the QEMU amd64 gate with "1 enforced test(s) not selected" (build 1209202). Exempt QEMU. acl-t removes the oem-azure sysext that carries azure-metadata-ipv4, so once the stricter Mantle check lands, acl-t on Azure would still report the WireServer address. Keep the test selected there but forgive its failure until acl-t installs the correction. Refs: ACL Bug 18833 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
12d9e9c to
0df0799
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Human confirmation is needed that the shared-pipeline prerequisite has merged and required CI passes before approving this boot-time metadata change.
No open issues 🎉
What changed in this PR
Corrects Azure metadata IPv4 values in RPM images by validating the route-selected address against guest networking and Azure IMDS before releasing metadata consumers.
Changes:
- Adds synchronous validation and correction, preserving the original incorrect metadata.
- Adds 22 offline regression cases and enables their PR validation gate.
- Enforces
cl.metadata.azure, with QEMU and temporary Azure acl-t exceptions.
| File | Description |
|---|---|
| sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/manglefs_rpm.sh | Installs the helper and service drop-in for RPM images. |
| sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/azure-metadata-ipv4 | Validates and corrects Azure IPv4 metadata. |
| sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/20-azure-ipv4.conf | Runs validation after Afterburn completes. |
| build_library/rpm/tests/test_azure_metadata_ipv4.sh | Adds offline validation and packaging coverage. |
| acl/tests/kola_enforcing.yaml | Enforces Azure metadata testing with scoped exceptions. |
| .pipelines/github-pr-validation.yml | Enables the offline regression gate. |
Review effort: Balanced
|
Closing. The region survey on AB#18833 found the wrong IP is Azure's: WireServer reports 10.10.10.10 instead of the VM's IP in 5 of 9 regions tested, and in kola's region it has switched on and off since July. Nothing in ACL or AKS reads |
Summary
On Azure VMs, WireServer SharedConfig can report an IPv4 address that is not assigned to the VM (seen:
10.10.10.10, on both Arm64 and amd64). Afterburn writes it toCOREOS_AZURE_IPV4_DYNAMIC, so anything templated with{PRIVATE_IPV4}gets an address the VM does not have. That is what brokeacl.etcd-member.discoveryandcl.etcd-member.v2-backup-restoreon Azure: etcd bound to or advertised10.10.10.10. Those tests have since been retired on ACL along with the Docker-based etcd wrapper (#91, microsoft/azure-container-linux-mantle#48), but every other consumer of the metadata still gets the wrong address.cl.metadata.azure, made strict by microsoft/azure-container-linux-mantle#45, is now the regression test.After Afterburn writes metadata, a new helper checks the route-selected source IPv4 against the interface's assigned addresses and IMDS (matching MAC and IP), and only then corrects
COREOS_AZURE_IPV4_DYNAMIC. The first WireServer result is kept in/run/metadata/flatcar.wireserver. If any check fails, the metadata is left unchanged andcoreos-metadata.servicefails.To keep CI working, merge in this order:
testAzureMetadataIpv4gate parameter. Until it merges, this PR's validation fails on that unknown parameter.cl.metadata.azurecheck the address.Change Log
azure-metadata-ipv4and acoreos-metadata.servicedrop-in that runs it asExecStartPost;manglefs_rpm.shinstalls both in RPM mode only.build_library/rpm/tests/test_azure_metadata_ipv4.sh(22 offline cases; needs only Bash and jq) and run it in PR validation via.pipelines/github-pr-validation.yml.cl.metadata.azureinacl/tests/kola_enforcing.yaml, with two exceptions:Type of Change
Does this affect the image build?
Adds the helper and drop-in to the Azure OEM sysext in RPM images. Other platforms and Portage builds are unchanged. acl-t images don't get the helper yet, because acl-t removes the OEM sysext.
Associated Issues
gsettles/18833-azure-metadata-ip-fix).Test Methodology
[ARM64]-Prod-BuildACL-Nightly1204420.acl.etcd-member.discoverynodes got DHCP addresses10.100.6.16,.21and.22, and etcd failed on all three withlisten tcp 10.10.10.10:2380: bind: cannot assign requested address.cl.etcd-member.v2-backup-restoreadvertised10.10.10.10while its NIC had10.100.6.21.bash build_library/rpm/tests/test_azure_metadata_ipv4.shpasses 22/22 in the SDK container with no network, on a plain Ubuntu host, and in Azure Linux 3 using the pipeline step. Replacing the helper withexit 0makes it fail.acl.etcd-member.discovery. A third failed on an unrelated DNS error while pulling the etcd image (systemd retried it successfully); its metadata was correct on all 3 nodes.coreos-metadata.servicesucceeded with no restarts.Test azure-metadata-ipv4step on both architectures, except QEMU amd64 kola. It failed with "1 enforced test(s) not selected: cl.metadata.azure", which the QEMU exception fixes.scripts/evaluate_test_results.sh(frommain) against the old and newkola_enforcing.yamlfor QEMU, stock Azure and Azure acl-t on both architectures. The old file reproduces the 1209202 failure. The new file passes on QEMU, forgives acl.metadata.azurefailure only on Azure acl-t, and still blocks it on stock Azure. acl-pipelines'tests/test_exception_matching.shpasses 33/33 with the same tooling.aclmainat 9fe43d2.git range-diffshows four of the five patches unchanged; the one that setstestAzureMetadataIpv4: trueonly picked up new context from Enable IPE audit in GitHub ACL PR validation #113. On the rebased tree the offline test passes 22/22.github-acl-pr-validation(definition 5448) for this branch with acl-pipelines at !29414 compiles, and includes the offline test on both architectures. With acl-pipelinesmainit fails with "Unexpected parameter 'testAzureMetadataIpv4'", as expected until !29414 merges.default) kola set. Every stage succeeded.acl.etcd-member.discovery,cl.etcd-member.v2-backup-restoreand the strictcl.metadata.azurepassed on the first attempt. In the unfixed aclmain nightly 1217971, both etcd tests failed every attempt on both architectures.azure-metadata-ipv4: using 10.100.6.x on eth0 (verified against IMDS)on every node, and etcd bound to and advertised the NIC address. No bind errors, nocoreos-metadata.servicefailures, and no SELinux denials from the helper orcoreos-metadata.cl.metadata.azurefailed every attempt there on both architectures withCOREOS_AZURE_IPV4_DYNAMIC = "10.10.10.10", want Azure NIC private IP ..., and the acl-t exception forgave it as intended.cl.metadata.azureexempt, so the "not selected" failure from 1209202 is gone.github-acl-pr-validationfails with "Unexpected parameter 'testAzureMetadataIpv4'" (for example 1230307).Merge Checklist
All applicable boxes should be checked before merging.
aclmain6adc59d)