Skip to content

Commit 3780cdc

Browse files
committed
Encrypt dom0 swap
This encrypts dom0 swap with a randomly generated key, which helps prevent its contents from being recovered later.
1 parent 79756e7 commit 3780cdc

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

rpm_spec/core-dom0-linux.spec.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ install -m 644 system-config/12-qubes-ignore-lvm-devices.rules $RPM_BUILD_ROOT%_
155155
install -m 644 system-config/11-qubes-ignore-zvol-devices.rules $RPM_BUILD_ROOT%_udevrulesdir
156156
install -m 644 system-config/99z-qubes-mark-ready.rules $RPM_BUILD_ROOT%_udevrulesdir
157157
install -m 644 -D system-config/disable-lesspipe.sh $RPM_BUILD_ROOT/etc/profile.d/zz-disable-lesspipe.sh
158+
install -m 644 -D system-config/[email protected] $RPM_BUILD_ROOT%_unitdir/[email protected]
159+
158160
install -m 755 -D system-config/kernel-grub2.install $RPM_BUILD_ROOT/usr/lib/kernel/install.d/80-grub2.install
159161
install -m 755 -D system-config/kernel-xen-efi.install $RPM_BUILD_ROOT/usr/lib/kernel/install.d/90-xen-efi.install
160162
install -m 755 -D system-config/kernel-remove-bls.install $RPM_BUILD_ROOT/usr/lib/kernel/install.d/99-remove-bls.install

system-config/75-qubes-dom0.preset

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,4 @@ enable qubesd.service
7171
enable anti-evil-maid-unseal.service
7272
enable anti-evil-maid-check-mount-devs.service
7373
enable anti-evil-maid-seal.service
74+

system-config/[email protected]

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[Unit]
2+
Description=Qubes OS Encrypted Swap
3+
4+
# This is a dependency of sysinit.target, so it cannot depend on it (deadlock).
5+
DefaultDependencies=no
6+
7+
# Do not stop this when trying to isolate a unit.
8+
IgnoreOnIsolate=true
9+
10+
# Default dependencies for any encrypted volume.
11+
After=cryptsetup-pre.target systemd-udevd-kernel.socket systemd-random-seed.service
12+
13+
# Ensure that this unit comes after its backing device,
14+
# and is shut down if its backing device is shut down.
15+
After=dev-qubes_dom0-swap.device
16+
BindsTo=dev-qubes_dom0-swap.device
17+
18+
# Ensure that this unit is started before the block device gets used.
19+
Before=blockdev@dev-mapper-%i.target
20+
Wants=blockdev@dev-mapper-%i.target
21+
Requires=systemd-random-seed.service
22+
23+
# Stop this unit when umounting volumes on shutdown.
24+
Conflicts=umount.target
25+
Before=umount.target
26+
27+
[Service]
28+
Type=oneshot
29+
RemainAfterExit=yes
30+
TimeoutSec=infinity
31+
ExecStart=/usr/lib/systemd/systemd-cryptsetup attach 'swap' '/dev/qubes_dom0/swap' '/dev/urandom' 'plain,swap,cipher=aes-xts-plain64'
32+
ExecStop=/usr/lib/systemd/systemd-cryptsetup detach 'swap'
33+
ExecStartPost=/usr/lib/systemd/systemd-makefs swap '/dev/mapper/swap'
34+
# Prevent mlock() of the whole locale archive.
35+
Environment=LC_ALL=C

0 commit comments

Comments
 (0)