mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 21:20:33 +02:00
services: openssh: Fix 'PrintLastLog' default behaviour.
* gnu/services/ssh.scm (openssh-config-file): Add 'print-last-log?' option. (<openssh-configuration>)[print-last-log?]: Add it. (openssh-activation): Touch /var/log/lastlog. * doc/guix.texi (Networking Services): Document 'print-last-log?'. Before that, the service did not work as expected because /var/log/lastlog did not exist. Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
This commit is contained in:
committed by
Danny Milosavljevic
parent
1806a670f0
commit
f895dce41b
@@ -279,6 +279,8 @@ The other options should be self-descriptive."
|
||||
(challenge-response-authentication? openssh-challenge-response-authentication?
|
||||
(default #f)) ;Boolean
|
||||
(use-pam? openssh-configuration-use-pam?
|
||||
(default #t)) ;Boolean
|
||||
(print-last-log? openssh-configuration-print-last-log?
|
||||
(default #t))) ;Boolean
|
||||
|
||||
(define %openssh-accounts
|
||||
@@ -298,6 +300,14 @@ The other options should be self-descriptive."
|
||||
(mkdir-p "/etc/ssh")
|
||||
(mkdir-p (dirname #$(openssh-configuration-pid-file config)))
|
||||
|
||||
(define (touch file-name)
|
||||
(call-with-output-file file-name (const #t)))
|
||||
|
||||
(let ((lastlog "/var/log/lastlog"))
|
||||
(when #$(openssh-configuration-print-last-log? config)
|
||||
(unless (file-exists? lastlog)
|
||||
(touch lastlog))))
|
||||
|
||||
;; Generate missing host keys.
|
||||
(system* (string-append #$(openssh-configuration-openssh config)
|
||||
"/bin/ssh-keygen") "-A")))
|
||||
@@ -336,6 +346,9 @@ The other options should be self-descriptive."
|
||||
(format port "UsePAM ~a\n"
|
||||
#$(if (openssh-configuration-use-pam? config)
|
||||
"yes" "no"))
|
||||
(format port "PrintLastLog ~a\n"
|
||||
#$(if (openssh-configuration-print-last-log? config)
|
||||
"yes" "no"))
|
||||
#t))))
|
||||
|
||||
(define (openssh-shepherd-service config)
|
||||
|
||||
Reference in New Issue
Block a user