Skip to content

Commit 769c37f

Browse files
authored
Log TDX measurements on boot (#143)
* Log TDX measurements on boot * Use perl script rather than attested-tls-proxy for measurement logging * Switch to systemd oneshot service
1 parent 63c4f20 commit 769c37f

4 files changed

Lines changed: 22 additions & 0 deletions

File tree

shared/mkosi.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Packages=kmod
3636
busybox
3737
util-linux
3838
procps
39+
perl
3940
ca-certificates
4041
openssl
4142
iproute2
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
Description=Log TDX measurements
3+
After=basic.target
4+
5+
[Service]
6+
Type=oneshot
7+
ExecStart=/usr/bin/print-measurements
8+
StandardOutput=journal+console
9+
StandardError=journal+console
10+
11+
[Install]
12+
WantedBy=minimal.target
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env perl
2+
3+
my $errmsg = "Measurements not available on this platform\n";
4+
my $b = "\0" x 1088;
5+
sysopen F, "/dev/tdx_guest", 2 or do { warn $errmsg; exit 0; };
6+
ioctl F, 0xc4405401, $b or do { warn $errmsg; exit 0; };
7+
my @r = unpack "(H96)4", substr $b, 784, 192;
8+
print "RTMR$_: $r[$_]\n" for 0..3;

shared/mkosi.postinst.d/90-debloat-systemd.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ done
5050
# Enable chrony service
5151
mkosi-chroot systemctl add-wants minimal.target \
5252
chrony.service \
53+
print-measurements.service \
5354
systemd-resolved.service \
5455
systemd-networkd.service \
5556
systemd-networkd-wait-online.service

0 commit comments

Comments
 (0)