diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2019-05-09 12:02:20 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2019-05-09 12:11:36 +0200 |
| commit | e6b1a2248ff164e14d1b2f495224faf8a8326142 (patch) | |
| tree | 33d98a5b9dd782965e84e8054dc7621779c347a2 /gnu | |
| parent | af55ca481d9e6c1d1e06632f96d550b42f33210f (diff) | |
services: Log-in services now require "pam_loginuid".
Fixes <https://bugs.gnu.org/35553>.
Reported by Bruno Haible <bruno@clisp.org>.
* gnu/services/base.scm (login-pam-service): Pass #:login-uid? #t to
'unix-pam-service'.
* gnu/services/ssh.scm (lsh-pam-services, openssh-pam-services):
Likewise.
* gnu/services/xorg.scm (slim-pam-service): Likewise.
(gdm-pam-service): Likewise for "gdm-autologin" and "gdm-password".
* gnu/tests/base.scm (run-basic-test)["getlogin on tty1"]: New test.
* gnu/tests/ssh.scm (run-ssh-test): Add #:test-getlogin? parameter.
["getlogin"]: New test.
(%test-dropbear): Pass #:test-getlogin? #f.
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/services/base.scm | 1 | ||||
| -rw-r--r-- | gnu/services/ssh.scm | 2 | ||||
| -rw-r--r-- | gnu/services/xorg.scm | 5 | ||||
| -rw-r--r-- | gnu/tests/base.scm | 12 | ||||
| -rw-r--r-- | gnu/tests/ssh.scm | 28 |
5 files changed, 44 insertions, 4 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 952f6f9ab20..015d8733083 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm | |||
| @@ -830,6 +830,7 @@ Return a service that sets up Unicode support in @var{tty} and loads | |||
| 830 | "Return the list of PAM service needed for CONF." | 830 | "Return the list of PAM service needed for CONF." |
| 831 | ;; Let 'login' be known to PAM. | 831 | ;; Let 'login' be known to PAM. |
| 832 | (list (unix-pam-service "login" | 832 | (list (unix-pam-service "login" |
| 833 | #:login-uid? #t | ||
| 833 | #:allow-empty-passwords? | 834 | #:allow-empty-passwords? |
| 834 | (login-configuration-allow-empty-passwords? config) | 835 | (login-configuration-allow-empty-passwords? config) |
| 835 | #:motd | 836 | #:motd |
diff --git a/gnu/services/ssh.scm b/gnu/services/ssh.scm index 25db7834204..d026c3115e6 100644 --- a/gnu/services/ssh.scm +++ b/gnu/services/ssh.scm | |||
| @@ -182,6 +182,7 @@ | |||
| 182 | "Return a list of <pam-services> for lshd with CONFIG." | 182 | "Return a list of <pam-services> for lshd with CONFIG." |
| 183 | (list (unix-pam-service | 183 | (list (unix-pam-service |
| 184 | "lshd" | 184 | "lshd" |
| 185 | #:login-uid? #t | ||
| 185 | #:allow-empty-passwords? | 186 | #:allow-empty-passwords? |
| 186 | (lsh-configuration-allow-empty-passwords? config)))) | 187 | (lsh-configuration-allow-empty-passwords? config)))) |
| 187 | 188 | ||
| @@ -506,6 +507,7 @@ of user-name/file-like tuples." | |||
| 506 | "Return a list of <pam-services> for sshd with CONFIG." | 507 | "Return a list of <pam-services> for sshd with CONFIG." |
| 507 | (list (unix-pam-service | 508 | (list (unix-pam-service |
| 508 | "sshd" | 509 | "sshd" |
| 510 | #:login-uid? #t | ||
| 509 | #:allow-empty-passwords? | 511 | #:allow-empty-passwords? |
| 510 | (openssh-configuration-allow-empty-passwords? config)))) | 512 | (openssh-configuration-allow-empty-passwords? config)))) |
| 511 | 513 | ||
diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index 29955754fa0..3a9fa53d291 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm | |||
| @@ -501,6 +501,7 @@ desktop session from the system or user profile will be used." | |||
| 501 | "Return a PAM service for @command{slim}." | 501 | "Return a PAM service for @command{slim}." |
| 502 | (list (unix-pam-service | 502 | (list (unix-pam-service |
| 503 | "slim" | 503 | "slim" |
| 504 | #:login-uid? #t | ||
| 504 | #:allow-empty-passwords? | 505 | #:allow-empty-passwords? |
| 505 | (slim-configuration-allow-empty-passwords? config)))) | 506 | (slim-configuration-allow-empty-passwords? config)))) |
| 506 | 507 | ||
| @@ -830,7 +831,8 @@ the GNOME desktop environment.") | |||
| 830 | "Return a PAM service for @command{gdm}." | 831 | "Return a PAM service for @command{gdm}." |
| 831 | (list | 832 | (list |
| 832 | (pam-service | 833 | (pam-service |
| 833 | (inherit (unix-pam-service "gdm-autologin")) | 834 | (inherit (unix-pam-service "gdm-autologin" |
| 835 | #:login-uid? #t)) | ||
| 834 | (auth (list (pam-entry | 836 | (auth (list (pam-entry |
| 835 | (control "[success=ok default=1]") | 837 | (control "[success=ok default=1]") |
| 836 | (module (file-append (gdm-configuration-gdm config) | 838 | (module (file-append (gdm-configuration-gdm config) |
| @@ -844,6 +846,7 @@ the GNOME desktop environment.") | |||
| 844 | (control "required") | 846 | (control "required") |
| 845 | (module "pam_permit.so"))))) | 847 | (module "pam_permit.so"))))) |
| 846 | (unix-pam-service "gdm-password" | 848 | (unix-pam-service "gdm-password" |
| 849 | #:login-uid? #t | ||
| 847 | #:allow-empty-passwords? | 850 | #:allow-empty-passwords? |
| 848 | (gdm-configuration-allow-empty-passwords? config)))) | 851 | (gdm-configuration-allow-empty-passwords? config)))) |
| 849 | 852 | ||
diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm index f9390ee8e49..d578f1977a7 100644 --- a/gnu/tests/base.scm +++ b/gnu/tests/base.scm | |||
| @@ -307,6 +307,18 @@ info --version") | |||
| 307 | (wait-for-file "/root/logged-in" marionette | 307 | (wait-for-file "/root/logged-in" marionette |
| 308 | #:read 'get-string-all))) | 308 | #:read 'get-string-all))) |
| 309 | 309 | ||
| 310 | (test-equal "getlogin on tty1" | ||
| 311 | "\"root\"" | ||
| 312 | (begin | ||
| 313 | ;; Assume we logged in in the previous test and type. | ||
| 314 | (marionette-type "guile -c '(write (getlogin))' > /root/login-id\n" | ||
| 315 | marionette) | ||
| 316 | |||
| 317 | ;; It can take a while before the shell commands are executed. | ||
| 318 | (marionette-eval '(use-modules (rnrs io ports)) marionette) | ||
| 319 | (wait-for-file "/root/login-id" marionette | ||
| 320 | #:read 'get-string-all))) | ||
| 321 | |||
| 310 | ;; There should be one utmpx entry for the user logged in on tty1. | 322 | ;; There should be one utmpx entry for the user logged in on tty1. |
| 311 | (test-equal "utmpx entry" | 323 | (test-equal "utmpx entry" |
| 312 | '(("root" "tty1" #f)) | 324 | '(("root" "tty1" #f)) |
diff --git a/gnu/tests/ssh.scm b/gnu/tests/ssh.scm index e5cd439cdf9..a74227ea4a3 100644 --- a/gnu/tests/ssh.scm +++ b/gnu/tests/ssh.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org> | 3 | ;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org> |
| 4 | ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com> | 4 | ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com> |
| 5 | ;;; | 5 | ;;; |
| @@ -31,7 +31,8 @@ | |||
| 31 | #:export (%test-openssh | 31 | #:export (%test-openssh |
| 32 | %test-dropbear)) | 32 | %test-dropbear)) |
| 33 | 33 | ||
| 34 | (define* (run-ssh-test name ssh-service pid-file #:key (sftp? #f)) | 34 | (define* (run-ssh-test name ssh-service pid-file |
| 35 | #:key (sftp? #f) (test-getlogin? #t)) | ||
| 35 | "Run a test of an OS running SSH-SERVICE, which writes its PID to PID-FILE. | 36 | "Run a test of an OS running SSH-SERVICE, which writes its PID to PID-FILE. |
| 36 | SSH-SERVICE must be configured to listen on port 22 and to allow for root and | 37 | SSH-SERVICE must be configured to listen on port 22 and to allow for root and |
| 37 | empty-password logins. | 38 | empty-password logins. |
| @@ -54,10 +55,12 @@ When SFTP? is true, run an SFTP server test." | |||
| 54 | (use-modules (gnu build marionette) | 55 | (use-modules (gnu build marionette) |
| 55 | (srfi srfi-26) | 56 | (srfi srfi-26) |
| 56 | (srfi srfi-64) | 57 | (srfi srfi-64) |
| 58 | (ice-9 textual-ports) | ||
| 57 | (ice-9 match) | 59 | (ice-9 match) |
| 58 | (ssh session) | 60 | (ssh session) |
| 59 | (ssh auth) | 61 | (ssh auth) |
| 60 | (ssh channel) | 62 | (ssh channel) |
| 63 | (ssh popen) | ||
| 61 | (ssh sftp)) | 64 | (ssh sftp)) |
| 62 | 65 | ||
| 63 | (define marionette | 66 | (define marionette |
| @@ -147,6 +150,20 @@ root with an empty password." | |||
| 147 | (and (zero? (channel-get-exit-status channel)) | 150 | (and (zero? (channel-get-exit-status channel)) |
| 148 | (wait-for-file "/root/witness" marionette)))))) | 151 | (wait-for-file "/root/witness" marionette)))))) |
| 149 | 152 | ||
| 153 | ;; Check whether the 'getlogin' procedure returns the right thing. | ||
| 154 | (unless #$test-getlogin? | ||
| 155 | (test-skip 1)) | ||
| 156 | (test-equal "getlogin" | ||
| 157 | '(0 "root") | ||
| 158 | (call-with-connected-session/auth | ||
| 159 | (lambda (session) | ||
| 160 | (let* ((pipe (open-remote-input-pipe | ||
| 161 | session | ||
| 162 | "guile -c '(display (getlogin))'")) | ||
| 163 | (output (get-string-all pipe)) | ||
| 164 | (status (channel-get-exit-status pipe))) | ||
| 165 | (list status output))))) | ||
| 166 | |||
| 150 | ;; Connect to the guest over SFTP. Make sure we can write and | 167 | ;; Connect to the guest over SFTP. Make sure we can write and |
| 151 | ;; read a file there. | 168 | ;; read a file there. |
| 152 | (unless #$sftp? | 169 | (unless #$sftp? |
| @@ -217,4 +234,9 @@ root with an empty password." | |||
| 217 | (dropbear-configuration | 234 | (dropbear-configuration |
| 218 | (root-login? #t) | 235 | (root-login? #t) |
| 219 | (allow-empty-passwords? #t))) | 236 | (allow-empty-passwords? #t))) |
| 220 | "/var/run/dropbear.pid")))) | 237 | "/var/run/dropbear.pid" |
| 238 | |||
| 239 | ;; XXX: Our Dropbear is not built with PAM support. | ||
| 240 | ;; Even when it is, it seems to ignore the PAM | ||
| 241 | ;; 'session' requirements. | ||
| 242 | #:test-getlogin? #f)))) | ||
