Util-Linux Archive on lore.kernel.org
 help / Atom feed
* [RFC/PATCH] Add hardening settings to fstrim.service
@ 2018-11-12 20:48 Andreas Henriksson
  2018-11-22 10:23 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Henriksson @ 2018-11-12 20:48 UTC (permalink / raw)
  To: util-linux; +Cc: Andreas Henriksson

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFC/PATCH] Add hardening settings to fstrim.service
  2018-11-12 20:48 [RFC/PATCH] Add hardening settings to fstrim.service Andreas Henriksson
@ 2018-11-22 10:23 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2018-11-22 10:23 UTC (permalink / raw)
  To: Andreas Henriksson; +Cc: util-linux

On Mon, Nov 12, 2018 at 09:48:43PM +0100, Andreas Henriksson wrote:
> --- a/sys-utils/fstrim.service.in
> +++ b/sys-utils/fstrim.service.in

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-12 20:48 [RFC/PATCH] Add hardening settings to fstrim.service Andreas Henriksson
2018-11-22 10:23 ` Karel Zak

Util-Linux Archive on lore.kernel.org

Archives are clonable: git clone --mirror https://lore.kernel.org/util-linux/0 util-linux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 util-linux util-linux/ https://lore.kernel.org/util-linux \
		util-linux@vger.kernel.org util-linux@archiver.kernel.org
	public-inbox-index util-linux


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.util-linux


AGPL code for this site: git clone https://public-inbox.org/ public-inbox