From: Andreas Henriksson <andreas@fatal.se>
To: util-linux@vger.kernel.org
Cc: Andreas Henriksson <andreas@fatal.se>
Subject: [RFC/PATCH] Add hardening settings to fstrim.service
Date: Mon, 12 Nov 2018 21:48:43 +0100 [thread overview]
Message-ID: <20181112204843.21641-1-andreas@fatal.se> (raw)
This limits what the fstrim process has access to when it runs.
PrivateUsers can't be enabled because of:
"If this mode is enabled, all unit processes are run without privileges
in the host user namespace[...]"
Further improving this with additional option or making
things even tighter is most likely possible.
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
---
sys-utils/fstrim.service.in | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/sys-utils/fstrim.service.in b/sys-utils/fstrim.service.in
index 2d5daf99d..0bab91a9c 100644
--- a/sys-utils/fstrim.service.in
+++ b/sys-utils/fstrim.service.in
@@ -5,3 +5,13 @@ Documentation=man:fstrim(8)
[Service]
Type=oneshot
ExecStart=@sbindir@/fstrim -Av
+ProtectSystem=strict
+ProtectHome=yes
+PrivateDevices=no
+PrivateNetwork=yes
+PrivateUsers=no
+ProtectKernelTunables=yes
+ProtectKernelModules=yes
+ProtectControlGroups=yes
+MemoryDenyWriteExecute=yes
+SystemCallFilter=@default @file-system @basic-io @system-service
--
2.19.1
next reply other threads:[~2018-11-12 20:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-12 20:48 Andreas Henriksson [this message]
2018-11-22 10:23 ` [RFC/PATCH] Add hardening settings to fstrim.service Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181112204843.21641-1-andreas@fatal.se \
--to=andreas@fatal.se \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).