Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions etc/systemd/system/boot-efi.mount.d/50_security-misc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Mount]
Options=nodev,noexec,nosuid
2 changes: 2 additions & 0 deletions etc/systemd/system/boot.mount.d/50_security-misc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Mount]
Options=nodev,noexec,nosuid
2 changes: 2 additions & 0 deletions etc/systemd/system/home.mount.d/50_security-misc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Mount]
Options=nodev,nosuid
2 changes: 2 additions & 0 deletions etc/systemd/system/tmp.mount.d/50_security-misc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Mount]
Options=nodev,noexec,nosuid
5 changes: 5 additions & 0 deletions etc/systemd/system/usr-share.mount.d/50_security-misc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[Unit]
Before=usr.mount

[Mount]
Options=nodev,nosuid
2 changes: 2 additions & 0 deletions etc/systemd/system/usr.mount.d/50_security-misc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Mount]
Options=nodev
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Mount]
Options=nodev,noexec,nosuid
5 changes: 5 additions & 0 deletions etc/systemd/system/var-log.mount.d/50_security-misc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[Unit]
Before=var.mount

[Mount]
Options=nodev,noexec,nosuid
2 changes: 2 additions & 0 deletions etc/systemd/system/var-tmp.mount.d/50_security-misc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Mount]
Options=nodev,noexec,nosuid
2 changes: 2 additions & 0 deletions etc/systemd/system/var.mount.d/50_security-misc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Mount]
Options=nodev,nosuid
10 changes: 10 additions & 0 deletions lib/systemd/system/boot.mount
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Bind Mount /boot with no dedicated partition

[Mount]
What=/boot
Where=/boot
Options=defaults,nodev,noexec,nosuid,bind

[Install]
WantedBy=sysinit.target
10 changes: 10 additions & 0 deletions lib/systemd/system/home.mount
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Bind Mount /home with no dedicated partition

[Mount]
What=/home
Where=/home
Options=defaults,nodev,nosuid,bind

[Install]
WantedBy=sysinit.target
26 changes: 26 additions & 0 deletions lib/systemd/system/remount-api.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems/
# When not editing fstab, some filesystems have to be remounted in order to be hardened

[Unit]
Description=Remounts what can not be mounted with secure options in the first run without having to edit fstab

Before=sysinit-post.target
Before=basic.target
Before=multi-user.target
Before=graphical.target
Before=getty-pre.target
Before=network-pre.target

After=local-fs.target
After=sysinit.target
After=qubes-sysinit.service

Requires=local-fs.target
Requires=sysinit.target

[Service]
Type=oneshot
ExecStart=remount-api

[Install]
WantedBy=sysinit-post.target
10 changes: 10 additions & 0 deletions lib/systemd/system/tmp.mount
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Bind Mount /tmp with no dedicated partition

[Mount]
What=tmpfs
Where=/tmp
Options=defaults,nodev,noexec,nosuid

[Install]
WantedBy=sysinit.target
11 changes: 11 additions & 0 deletions lib/systemd/system/usr-share.mount
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Bind Mount /usr/share with no dedicated partition
Before=usr.mount

[Mount]
What=/usr/share
Where=/usr/share
Options=defaults,nodev,nosuid,bind

[Install]
WantedBy=sysinit.target
10 changes: 10 additions & 0 deletions lib/systemd/system/usr.mount
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Bind Mount /usr with no dedicated partition

[Mount]
What=/usr
Where=/usr
Options=defaults,nodev,bind

[Install]
WantedBy=sysinit.target
11 changes: 11 additions & 0 deletions lib/systemd/system/var-log.mount
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Bind Mount /var/log with no dedicated partition
Before=var.mount

[Mount]
What=/var/log
Where=/var/log
Options=defaults,nodev,noexec,nosuid,bind

[Install]
WantedBy=sysinit.target
10 changes: 10 additions & 0 deletions lib/systemd/system/var-tmp.mount
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Bind Mount /var/tmp with no dedicated partition

[Mount]
What=/var/tmp
Where=/tmp
Options=defaults,nodev,noexec,nosuid,bind

[Install]
WantedBy=sysinit.target
10 changes: 10 additions & 0 deletions lib/systemd/system/var.mount
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Bind Mount /var with no dedicated partition

[Mount]
What=/var
Where=/var
Options=defaults,nodev,nosuid,bind

[Install]
WantedBy=sysinit.target
7 changes: 7 additions & 0 deletions usr/bin/remount-api
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

## This one seems to be superfluous because debian seems to mount run hardened anyway
# mount -o defaults,nodev,noexec,nosuid,remount /run

mount -o defaults,nodev,noexec,nosuid,remount /dev/shm
mount -o defaults,noexec,nosuid,remount /dev