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>
This commit is contained in:
parent
45695cc8a7
commit
898489f48e
@ -31378,6 +31378,21 @@ instantiated as:
|
|||||||
(sysctl-configuration
|
(sysctl-configuration
|
||||||
(settings '(("net.ipv4.ip_forward" . "1")))))
|
(settings '(("net.ipv4.ip_forward" . "1")))))
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
||||||
|
Since @code{sysctl-service-type} is used in the default lists of
|
||||||
|
services, @code{%base-services} and @code{%desktop-services}, you can
|
||||||
|
use @code{modify-services} to change its configuration and add the
|
||||||
|
kernel parameters that you want (@pxref{Service Reference,
|
||||||
|
@code{modify-services}}).
|
||||||
|
|
||||||
|
@lisp
|
||||||
|
(modify-services %base-services
|
||||||
|
(sysctl-service-type config =>
|
||||||
|
(sysctl-configuration
|
||||||
|
(settings (append '(("net.ipv4.ip_forward" . "1"))
|
||||||
|
%default-sysctl-settings)))))
|
||||||
|
@end lisp
|
||||||
|
|
||||||
@end defvr
|
@end defvr
|
||||||
|
|
||||||
@deftp {Data Type} sysctl-configuration
|
@deftp {Data Type} sysctl-configuration
|
||||||
@ -31387,11 +31402,16 @@ The data type representing the configuration of @command{sysctl}.
|
|||||||
@item @code{sysctl} (default: @code{(file-append procps "/sbin/sysctl"})
|
@item @code{sysctl} (default: @code{(file-append procps "/sbin/sysctl"})
|
||||||
The @command{sysctl} executable to use.
|
The @command{sysctl} executable to use.
|
||||||
|
|
||||||
@item @code{settings} (default: @code{'()})
|
@item @code{settings} (default: @code{%default-sysctl-settings})
|
||||||
An association list specifies kernel parameters and their values.
|
An association list specifies kernel parameters and their values.
|
||||||
@end table
|
@end table
|
||||||
@end deftp
|
@end deftp
|
||||||
|
|
||||||
|
@defvr {Scheme Variable} %default-sysctl-settings
|
||||||
|
An association list specifying the default @command{sysctl} parameters
|
||||||
|
on Guix System.
|
||||||
|
@end defvr
|
||||||
|
|
||||||
@cindex pcscd
|
@cindex pcscd
|
||||||
@subsubheading PC/SC Smart Card Daemon Service
|
@subsubheading PC/SC Smart Card Daemon Service
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#:use-module (gnu services)
|
#:use-module (gnu services)
|
||||||
#:use-module (gnu services admin)
|
#:use-module (gnu services admin)
|
||||||
#:use-module (gnu services shepherd)
|
#:use-module (gnu services shepherd)
|
||||||
|
#:use-module (gnu services sysctl)
|
||||||
#:use-module (gnu system pam)
|
#:use-module (gnu system pam)
|
||||||
#:use-module (gnu system shadow) ; 'user-account', etc.
|
#:use-module (gnu system shadow) ; 'user-account', etc.
|
||||||
#:use-module (gnu system uuid)
|
#:use-module (gnu system uuid)
|
||||||
@ -2532,6 +2533,8 @@ to handle."
|
|||||||
(udev-configuration
|
(udev-configuration
|
||||||
(rules (list lvm2 fuse alsa-utils crda))))
|
(rules (list lvm2 fuse alsa-utils crda))))
|
||||||
|
|
||||||
|
(service sysctl-service-type)
|
||||||
|
|
||||||
(service special-files-service-type
|
(service special-files-service-type
|
||||||
`(("/bin/sh" ,(file-append bash "/bin/sh"))
|
`(("/bin/sh" ,(file-append bash "/bin/sh"))
|
||||||
("/usr/bin/env" ,(file-append coreutils "/bin/env"))))))
|
("/usr/bin/env" ,(file-append coreutils "/bin/env"))))))
|
||||||
|
@ -25,20 +25,26 @@
|
|||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:export (sysctl-configuration
|
#:export (sysctl-configuration
|
||||||
sysctl-service-type))
|
sysctl-service-type
|
||||||
|
%default-sysctl-settings))
|
||||||
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; System Control Service.
|
;;; 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>
|
(define-record-type* <sysctl-configuration>
|
||||||
sysctl-configuration make-sysctl-configuration
|
sysctl-configuration make-sysctl-configuration
|
||||||
sysctl-configuration?
|
sysctl-configuration?
|
||||||
(sysctl sysctl-configuration-sysctl ; path of the 'sysctl' command
|
(sysctl sysctl-configuration-sysctl ; path of the 'sysctl' command
|
||||||
(default (file-append procps "/sbin/sysctl")))
|
(default (file-append procps "/sbin/sysctl")))
|
||||||
(settings sysctl-configuration-settings ; alist of string pairs
|
(settings sysctl-configuration-settings ; alist of string pairs
|
||||||
(default '())))
|
(default %default-sysctl-settings)))
|
||||||
|
|
||||||
(define (sysctl-configuration-settings->sysctl.conf settings)
|
(define (sysctl-configuration-settings->sysctl.conf settings)
|
||||||
"Return a file for @command{sysctl} to set kernel parameters as specified by
|
"Return a file for @command{sysctl} to set kernel parameters as specified by
|
||||||
|
Loading…
x
Reference in New Issue
Block a user