Skip to content

Commit 11e412b

Browse files
committed
fix: mount /boot/efi with restrictive fmask/dmask
systemd-boot creates a /boot/efi/loader/random-seed file that should not be accessible by users. Yet, because the backing filesystem is FAT32, by default everyone can read files when the filesystem is mounted. Add fmask and dmask options to the generated /etc/fstab to deny read access to regular users when /boot is mounted, as well as other common options for the ESP partition. Closes: #279 Signed-off-by: Agathe Porte <agathe.porte@oss.qualcomm.com>
1 parent f65b5e8 commit 11e412b

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

ci/qemu_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,10 @@ def test_password_reset_required(vm):
8282
vm.expect_exact("Retype new password:")
8383
vm.send("new password\r\n")
8484
vm.expect_exact("debian@debian:~$")
85+
86+
# The /boot/efi/loader/random-seed file should not be readable to users
87+
# https://github.com/qualcomm-linux/qcom-deb-images/issues/279
88+
vm.send("journalctl | grep 'is world accessible, which is a security hole' || echo not found\r\n")
89+
# Need to match twice because of the serial echo of the command above
90+
vm.expect_exact("not found")
91+
vm.expect_exact("not found")

debos-recipes/qualcomm-linux-debian-image.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,24 @@ actions:
5050
mountpoints:
5151
- mountpoint: /boot/efi/
5252
partition: esp
53+
# Copy options from what systemd does when mounting a discoverable EFI partition:
54+
# https://github.com/qualcomm-linux/qcom-deb-images/pull/309
55+
#
56+
# Restrict fmask/dmask to prevent user access to /boot/efi/loader/random-seed
57+
# used by systemd-boot:
58+
# https://github.com/qualcomm-linux/qcom-deb-images/issues/279
59+
options:
60+
- nosuid
61+
- nodev
62+
- noexec
63+
- relatime
64+
- nosymfollow
65+
- fmask=0177
66+
- dmask=0077
67+
- codepage=437
68+
- iocharset=iso8859-1
69+
- shortname=mixed
70+
- errors=remount-ro
5371
- mountpoint: /
5472
partition: root
5573

0 commit comments

Comments
 (0)