-
Notifications
You must be signed in to change notification settings - Fork 16
Feature: [Ubuntu, no-CVM] CVM machines to not get UEFI and kek certificate updates #356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rane-rajasi
wants to merge
3
commits into
master
Choose a base branch
from
rarane/certupdate/nocvm
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| #!/usr/bin/env bash | ||
| # Copyright 2020 Microsoft Corporation | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| HOSTNAME=$(hostname) | ||
|
|
||
| ROOT_SRC=$(findmnt -n -o SOURCE /) | ||
| ROOT_DEV=$(readlink -f "$ROOT_SRC" || echo "$ROOT_SRC") | ||
|
|
||
| FDE="false" | ||
| DETAILS="" | ||
|
|
||
| check_device() { | ||
| local dev="$1" | ||
|
|
||
| if blkid "$dev" 2>/dev/null | grep -qi 'crypto_LUKS'; then | ||
| FDE="true" | ||
| DETAILS="LUKS:$dev" | ||
| return | ||
| fi | ||
|
|
||
| local type | ||
| type=$(lsblk -dn -o TYPE "$dev" 2>/dev/null || true) | ||
|
|
||
| if [[ "$type" == "crypt" ]]; then | ||
| FDE="true" | ||
| DETAILS="CRYPT:$dev" | ||
| return | ||
| fi | ||
| } | ||
|
|
||
| walk_parents() { | ||
| local dev="$1" | ||
|
|
||
| while [[ -n "$dev" ]]; do | ||
| check_device "$dev" | ||
|
|
||
| if [[ "$FDE" == "true" ]]; then | ||
| return | ||
| fi | ||
|
|
||
| local parent | ||
| parent=$(lsblk -ndo PKNAME "$dev" 2>/dev/null | head -1 || true) | ||
|
|
||
| if [[ -z "$parent" ]]; then | ||
| break | ||
| fi | ||
|
|
||
| dev="/dev/$parent" | ||
| done | ||
| } | ||
|
|
||
| walk_parents "$ROOT_DEV" | ||
|
|
||
| if [[ "$FDE" != "true" ]]; then | ||
| while read -r name type; do | ||
| if [[ "$type" == "crypt" ]]; then | ||
| mapper="/dev/mapper/$name" | ||
|
|
||
| if mount | grep -q "^$mapper on / "; then | ||
| FDE="true" | ||
| DETAILS="DMCRYPT_ROOT:$mapper" | ||
| break | ||
| fi | ||
| fi | ||
| done < <(dmsetup ls --target crypt 2>/dev/null || true) | ||
| fi | ||
|
|
||
| if [[ "$FDE" != "true" ]]; then | ||
| if systemctl list-units 2>/dev/null | grep -qi azure; then | ||
| if ls /var/lib/waagent/*Encryption* >/dev/null 2>&1; then | ||
| FDE="true" | ||
| DETAILS="AZURE_ADE_ARTIFACTS" | ||
| fi | ||
| fi | ||
| fi | ||
|
|
||
| echo "$HOSTNAME,$ROOT_DEV,FDE=$FDE,$DETAILS" | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a chance this IP address changes and could be spoofed/taken by a malicious actor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have much insight on this one, simply used the command that was shared by partners to fetch from imds.
Here's Copilot's response:
✅ Short answer
No, the IP does not change
No, it cannot be externally spoofed or taken over by another tenant
🔎 Why this is safe
169.254.169.254 is a hard-coded Azure IMDS endpoint, not assigned from your VNet or subnet. [learn.microsoft.com]
It’s part of the link‑local range (169.254.0.0/16), reserved for host-local communication. [simonpainter.com]
➡️ This means:
It is not customer-controlled
It is not dynamically allocated
Azure guarantees its availability and consistency
The endpoint is non-routable and only accessible from within the VM [learn.microsoft.com]
Traffic to IMDS never leaves the host [learn.microsoft.com]
➡️ So:
No external attacker can “impersonate” this endpoint over the network
It’s effectively a host-side service exposed into the VM
Azure automatically injects a route to 169.254.169.254 via the VM’s primary NIC (not via your VNet config) [simonpainter.com]
➡️ This prevents:
DNS spoofing
Route hijacking from within normal networking config
The only realistic risk is:
If an attacker already has root/admin access inside the VM, they could:
Intercept traffic locally
Modify iptables / routing
Run a fake service on that IP
✅ But:
At that point, the VM is already compromised
This is not specific to IMDS (applies to any local endpoint)
💡 Best-practice statement
The IMDS endpoint (169.254.169.254) is a well-known, platform-defined link-local address that is not part of the customer-controlled network and does not change across deployments. It is non-routable and only accessible from within the VM, with traffic handled entirely within the Azure host fabric.
This prevents external spoofing or takeover by other tenants. The only theoretical risk would require local root-level compromise of the VM, in which case any local endpoint (not just IMDS) could be intercepted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Thanks!