Skip to content

Commit 5252dca

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 e31837f commit 5252dca

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

rpm_spec/core-dom0-linux.spec.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ install -m 644 system-config/00-qubes-ignore-devices.rules $RPM_BUILD_ROOT%_udev
143143
install -m 644 system-config/12-qubes-ignore-lvm-devices.rules $RPM_BUILD_ROOT%_udevrulesdir
144144
install -m 644 system-config/99z-qubes-mark-ready.rules $RPM_BUILD_ROOT%_udevrulesdir
145145
install -m 644 -D system-config/disable-lesspipe.sh $RPM_BUILD_ROOT/etc/profile.d/zz-disable-lesspipe.sh
146+
install -m 644 -D system-config/[email protected] $RPM_BUILD_ROOT%_unitdir/[email protected]
147+
install -m 644 -D system-config/99-qubes-cryptsetup.conf $RPM_BUILD_ROOT%_unitdir/[email protected]/30_qubes.conf
148+
146149
install -m 755 -D system-config/kernel-grub2.install $RPM_BUILD_ROOT/usr/lib/kernel/install.d/80-grub2.install
147150
install -m 755 -D system-config/kernel-xen-efi.install $RPM_BUILD_ROOT/usr/lib/kernel/install.d/90-xen-efi.install
148151
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
@@ -54,3 +54,4 @@ enable qubesd.service
5454
enable anti-evil-maid-unseal.service
5555
enable anti-evil-maid-check-mount-devs.service
5656
enable anti-evil-maid-seal.service
57+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[Unit]
2+
Before=dev-mapper-%i.swap
3+
Requires=systemd-random-seed.service
4+
After=systemd-random-seed.service
5+
6+
[Service]
7+
TimeoutSec=infinity
8+
ExecStartPost=/sbin/udevadm trigger /dev/mapper/%I

system-config/[email protected]

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Automatically generated by systemd-cryptsetup-generator
2+
3+
[Unit]
4+
Description=Cryptography Setup for %I
5+
Documentation=man:crypttab(5) man:systemd-cryptsetup-generator(8) man:[email protected](8)
6+
SourcePath=/etc/crypttab
7+
DefaultDependencies=no
8+
IgnoreOnIsolate=true
9+
After=cryptsetup-pre.target
10+
Before=blockdev@dev-mapper-%i.target
11+
Wants=blockdev@dev-mapper-%i.target
12+
Conflicts=umount.target
13+
After=systemd-random-seed.service
14+
BindsTo=dev-qubes_dom0-swap.device
15+
After=dev-qubes_dom0-swap.device
16+
Before=umount.target
17+
18+
[Service]
19+
Type=oneshot
20+
RemainAfterExit=yes
21+
TimeoutSec=0
22+
KeyringMode=shared
23+
OOMScoreAdjust=500
24+
ExecStart=/usr/lib/systemd/systemd-cryptsetup attach 'swap' '/dev/qubes_dom0/swap' '/dev/urandom' 'swap,cipher=aes-xts-plain64,discard,size=512,nofail'
25+
ExecStop=/usr/lib/systemd/systemd-cryptsetup detach 'swap'
26+
ExecStartPost=/sbin/mkswap '/dev/mapper/swap'
27+
28+
[Install]
29+
WantedBy=cryptsetup.target

0 commit comments

Comments
 (0)