summary refs log tree commit diff
path: root/gnu/services/sysctl.scm
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2021-03-16 21:36:36 -0400
committerLudovic Courtès <ludo@gnu.org>2021-03-18 12:17:33 +0100
commit898489f48e436e45e86e1ba0fcdb6df5cd5a051a (patch)
treec9a100f2a5278eb0dfb629ec092f7f0d707c82a9 /gnu/services/sysctl.scm
parent45695cc8a7b56b711baf664ceedaa66124d6de26 (diff)
downloadguix-898489f48e436e45e86e1ba0fcdb6df5cd5a051a.tar.gz
services: Enable "protected hardlinks" and "protected symlinks" by default.
References:

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

* gnu/services/sysctl.scm (%default-sysctl-settings): New public variable.
(<sysctl-configuration>): Use %default-sysctl-settings as the default value.
* gnu/services/base.scm (%base-services): Add sysctl-service-type.
* doc/guix.texi (Miscellaneous Services): Document the new defaults.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/services/sysctl.scm')
-rw-r--r--gnu/services/sysctl.scm10
1 files changed, 8 insertions, 2 deletions
diff --git a/gnu/services/sysctl.scm b/gnu/services/sysctl.scm
index eb7a61b2a9..aaea7cc30d 100644
--- a/gnu/services/sysctl.scm
+++ b/gnu/services/sysctl.scm
@@ -25,20 +25,26 @@
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 match)
   #:export (sysctl-configuration
-            sysctl-service-type))
+            sysctl-service-type
+            %default-sysctl-settings))
 
 
 ;;;
 ;;; System Control Service.
 ;;;
 
+(define %default-sysctl-settings
+  ;; Default kernel parameters enabled with sysctl.
+  '(("fs.protected_hardlinks" . "1")
+    ("fs.protected_symlinks" . "1")))
+
 (define-record-type* <sysctl-configuration>
   sysctl-configuration make-sysctl-configuration
   sysctl-configuration?
   (sysctl   sysctl-configuration-sysctl    ; path of the 'sysctl' command
             (default (file-append procps "/sbin/sysctl")))
   (settings sysctl-configuration-settings  ; alist of string pairs
-            (default '())))
+            (default %default-sysctl-settings)))
 
 (define (sysctl-configuration-settings->sysctl.conf settings)
   "Return a file for @command{sysctl} to set kernel parameters as specified by