unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [RFC]: Respect /etc/security/limits.conf
@ 2015-09-19 10:51 Ricardo Wurmus
  2015-09-20 16:41 ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Ricardo Wurmus @ 2015-09-19 10:51 UTC (permalink / raw)
  To: guix-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1293 bytes --]

Hi Guix,

I noticed that we aren’t using pam_limits.so, so it is impossible to set
session-wide limits per user.  This is useful to explicitly grant the
“audio” group realtime priorities and lift memory allocation
restrictions.

The attached patch tries to add an entry for pam_limits.so, but I have
no idea if this actually works or if this is the way it should be done.
As far as I can tell we only need the pam_limits.so entry for
“/etc/pam.d/login”, but I could not find where this file is generated.

Also, I wonder how users are supposed to edit /etc/security/limits.conf
at all.  I suppose they are not to edit anything in /etc anyway.
pam_limits.so also reads *.conf files in “/etc/security/limits.d/” and
maybe it would make sense for packages to provide a
“$out/etc/security/limits.d/$name.conf” file with settings.  For
example, the “jack” packages could then provide
“$out/etc/security/limits.d/realtime.conf”, which contains the
following:

    @realtime   -  rtprio     99
    @realtime   -  memlock    unlimited

(See http://www.jackaudio.org/faq/linux_rt_config.html)

A user in the “realtime” group could then finally use JACK in realtime
mode.

What is the best way to make this work?  (I really want to run JACK in
realtime mode.)

~~ Ricardo


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-WIP-respect-etc-security-limits.conf.patch --]
[-- Type: text/x-patch, Size: 1809 bytes --]

From 7a92f5a3f9bfa22749d0a635d5ac878560336611 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Sat, 19 Sep 2015 12:40:20 +0200
Subject: [PATCH] WIP: respect /etc/security/limits.conf

---
 gnu/system/linux.scm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gnu/system/linux.scm b/gnu/system/linux.scm
index 7461a4a..d94e4ca 100644
--- a/gnu/system/linux.scm
+++ b/gnu/system/linux.scm
@@ -132,7 +132,10 @@ dumped in /etc/pam.d/NAME, where NAME is the name of SERVICE."
 (define unix-pam-service
   (let ((unix (pam-entry
                (control "required")
-               (module "pam_unix.so"))))
+               (module "pam_unix.so")))
+        (limits (pam-entry
+                 (control "required")
+                 (module "pam_limits.so"))))
     (lambda* (name #:key allow-empty-passwords? motd)
       "Return a standard Unix-style PAM service for NAME.  When
 ALLOW-EMPTY-PASSWORDS? is true, allow empty passwords.  When MOTD is true, it
@@ -154,13 +157,13 @@ should be the name of a file used as the message-of-the-day."
                           ;; Store SHA-512 encrypted passwords in /etc/shadow.
                           (arguments '("sha512" "shadow")))))
          (session (if motd
-                      (list unix
+                      (list unix limits
                             (pam-entry
                              (control "optional")
                              (module "pam_motd.so")
                              (arguments
                               (list #~(string-append "motd=" #$motd)))))
-                      (list unix))))))))
+                      (list unix limits))))))))
 
 (define (rootok-pam-service command)
   "Return a PAM service for COMMAND such that 'root' does not need to
-- 
2.5.0


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

end of thread, other threads:[~2015-10-19 14:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-19 10:51 [RFC]: Respect /etc/security/limits.conf Ricardo Wurmus
2015-09-20 16:41 ` Ludovic Courtès
2015-10-12  5:23   ` Ricardo Wurmus
2015-10-12 17:13     ` Ludovic Courtès
2015-10-17 18:24       ` Ricardo Wurmus
2015-10-19 14:58         ` Ludovic Courtès

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).