Skip to content

Commit

Permalink
Use the UUID for the machine ID
Browse files Browse the repository at this point in the history
This avoids leaking the real machine ID into guests, and provides an
easy way for guests to know their own UUID.

Fixes: QubesOS/qubes-issues#8833
  • Loading branch information
DemiMarie committed Dec 23, 2024
1 parent f66c912 commit e4fa85d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions qubes/vm/qubesvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2533,16 +2533,17 @@ def kernelopts_common(self):
"""
if not self.kernel:
return ""
base_kernelopts = "systemd.machine_id=" + self.uuid.hex + " "
kernels_dir = self.storage.kernels_dir

kernelopts_path = os.path.join(
kernels_dir, "default-kernelopts-common.txt"
)
if os.path.exists(kernelopts_path):
with open(kernelopts_path, encoding="ascii") as f_kernelopts:
return f_kernelopts.read().rstrip("\n\r")
return base_kernelopts + f_kernelopts.read().rstrip("\n\r")
else:
return qubes.config.defaults["kernelopts_common"]
return base_kernelopts + qubes.config.defaults["kernelopts_common"]

#
# helper methods
Expand Down

0 comments on commit e4fa85d

Please sign in to comment.