unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#47013] [PATCH] gnu: Harden filesystem links.
@ 2021-03-08 20:50 Leo Famulari
  2021-03-12 22:05 ` Leo Famulari
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Leo Famulari @ 2021-03-08 20:50 UTC (permalink / raw)
  To: 47013

These sysctl options are enabled on most GNU/Linux distros, including
Debian, Fedora, NixOS, and OpenSUSE.

I've tested this patch on Guix System for several weeks, and it doesn't
appear to break anything. Plus, we know that Guix works on other distros
that enable these restrictions.

References:

https://sysctl-explorer.net/fs/protected_hardlinks/
https://sysctl-explorer.net/fs/protected_symlinks/

* gnu/services/base.scm (%base-services): Add a default
sysctl-configuration that enables fs.protected_hardlinks and
fs.protected_symlinks.
---
 gnu/services/base.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index f6a490f712..edd2c8e355 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -3,7 +3,7 @@
 ;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
 ;;; Copyright © 2015, 2016, 2020 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
-;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
+;;; Copyright © 2016, 2017, 2021 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2016 David Craven <david@craven.ch>
 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
@@ -35,6 +35,7 @@
   #:use-module (gnu services)
   #:use-module (gnu services admin)
   #:use-module (gnu services shepherd)
+  #:use-module (gnu services sysctl)
   #:use-module (gnu system pam)
   #:use-module (gnu system shadow)                ; 'user-account', etc.
   #:use-module (gnu system uuid)
@@ -2532,6 +2533,12 @@ to handle."
                  (udev-configuration
                    (rules (list lvm2 fuse alsa-utils crda))))
 
+        (service sysctl-service-type
+                 (sysctl-configuration
+                   (settings
+                     '(("fs.protected_hardlinks" . "1")
+                       ("fs.protected_symlinks" . "1")))))
+
         (service special-files-service-type
                  `(("/bin/sh" ,(file-append bash "/bin/sh"))
                    ("/usr/bin/env" ,(file-append coreutils "/bin/env"))))))
-- 
2.30.1





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

end of thread, other threads:[~2021-03-24 12:56 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-08 20:50 [bug#47013] [PATCH] gnu: Harden filesystem links Leo Famulari
2021-03-12 22:05 ` Leo Famulari
2021-03-12 22:51   ` Leo Famulari
2021-03-15 18:56     ` Leo Famulari
2021-03-15 20:23       ` Julien Lepiller
2021-03-18 17:39         ` Leo Famulari
2021-03-18 19:45           ` Julien Lepiller
2021-03-16 21:42       ` Ludovic Courtès
2021-03-16 22:18     ` Ludovic Courtès
2021-03-17  0:54       ` Leo Famulari
2021-03-17  2:14         ` [bug#47013] [PATCH v4] " Leo Famulari
2021-03-17 20:49           ` [bug#47013] [PATCH] " Ludovic Courtès
2021-03-17 21:01             ` Leo Famulari
2021-03-18  7:27               ` Leo Famulari
2021-03-18  9:36                 ` Ludovic Courtès
2021-03-18 17:25                   ` Leo Famulari
2021-03-24  7:19 ` [bug#47013] (no subject) muradm
2021-03-24 10:38 ` [bug#47013] services: export sysctl-configuration record field accessors muradm

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).