diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2014-07-11 14:02:44 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2014-07-11 23:20:48 +0200 |
| commit | da417ffe3b3e06f1e1d8b0217b4b780026d7e3b9 (patch) | |
| tree | e7c8360d74dbbb559c81641c2915c071cbc38319 /gnu | |
| parent | f1096964735512beacde6ff178a6ada1a14b91d3 (diff) | |
system: Allow root to use 'groupadd' & co. without authenticating.
This fixes a bug whereby, if #:allow-root-passwords was #f, 'groupadd'
would ask for a password. This is particularly problematic during
activation.
* gnu/system/linux.scm (rootok-pam-service): New procedure.
(base-pam-services): Use it for all the user* and group* commands.
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/system/linux.scm | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/gnu/system/linux.scm b/gnu/system/linux.scm index 5440f5852fd..524ad012619 100644 --- a/gnu/system/linux.scm +++ b/gnu/system/linux.scm | |||
| @@ -152,15 +152,36 @@ should be the name of a file used as the message-of-the-day." | |||
| 152 | (list #~(string-append "motd=" #$motd))))) | 152 | (list #~(string-append "motd=" #$motd))))) |
| 153 | (list unix)))))))) | 153 | (list unix)))))))) |
| 154 | 154 | ||
| 155 | (define (rootok-pam-service command) | ||
| 156 | "Return a PAM service for COMMAND such that 'root' does not need to | ||
| 157 | authenticate to run COMMAND." | ||
| 158 | (let ((unix (pam-entry | ||
| 159 | (control "required") | ||
| 160 | (module "pam_unix.so")))) | ||
| 161 | (pam-service | ||
| 162 | (name command) | ||
| 163 | (account (list unix)) | ||
| 164 | (auth (list (pam-entry | ||
| 165 | (control "sufficient") | ||
| 166 | (module "pam_rootok.so")))) | ||
| 167 | (password (list unix)) | ||
| 168 | (session (list unix))))) | ||
| 169 | |||
| 155 | (define* (base-pam-services #:key allow-empty-passwords?) | 170 | (define* (base-pam-services #:key allow-empty-passwords?) |
| 156 | "Return the list of basic PAM services everyone would want." | 171 | "Return the list of basic PAM services everyone would want." |
| 157 | (cons %pam-other-services | 172 | ;; TODO: Add other Shadow programs? |
| 158 | (map (cut unix-pam-service <> | 173 | (append (list %pam-other-services) |
| 159 | #:allow-empty-passwords? allow-empty-passwords?) | 174 | |
| 160 | '("su" "passwd" "sudo" | 175 | ;; These programs are setuid-root. |
| 161 | "useradd" "userdel" "usermod" | 176 | (map (cut unix-pam-service <> |
| 162 | "groupadd" "groupdel" "groupmod" | 177 | #:allow-empty-passwords? allow-empty-passwords?) |
| 163 | ;; TODO: Add other Shadow programs? | 178 | '("su" "passwd" "sudo")) |
| 164 | )))) | 179 | |
| 180 | ;; These programs are not setuid-root, and we want root to be able | ||
| 181 | ;; to run them without having to authenticate (notably because | ||
| 182 | ;; 'useradd' and 'groupadd' are run during system activation.) | ||
| 183 | (map rootok-pam-service | ||
| 184 | '("useradd" "userdel" "usermod" | ||
| 185 | "groupadd" "groupdel" "groupmod")))) | ||
| 165 | 186 | ||
| 166 | ;;; linux.scm ends here | 187 | ;;; linux.scm ends here |
