summaryrefslogtreecommitdiff
path: root/gnu/services/ssh.scm
diff options
context:
space:
mode:
authorClément Lassieur <clement@lassieur.org>2017-03-02 22:06:29 +0100
committerDanny Milosavljevic <dannym@scratchpost.org>2017-03-10 19:23:45 +0100
commitf895dce41b5495849a7e26fef747db14f6dd4ef0 (patch)
tree852df68bfff5ac499bb0d370a3945515dc30b3c2 /gnu/services/ssh.scm
parent1806a670f06bd745e7e3744046f50bb6f9113d26 (diff)
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>
Diffstat (limited to 'gnu/services/ssh.scm')
-rw-r--r--gnu/services/ssh.scm13
1 files changed, 13 insertions, 0 deletions
diff --git a/gnu/services/ssh.scm b/gnu/services/ssh.scm
index ef7d546d13c..d8a3ad35ad8 100644
--- a/gnu/services/ssh.scm
+++ b/gnu/services/ssh.scm
@@ -279,6 +279,8 @@ The other options should be self-descriptive."
279 (challenge-response-authentication? openssh-challenge-response-authentication? 279 (challenge-response-authentication? openssh-challenge-response-authentication?
280 (default #f)) ;Boolean 280 (default #f)) ;Boolean
281 (use-pam? openssh-configuration-use-pam? 281 (use-pam? openssh-configuration-use-pam?
282 (default #t)) ;Boolean
283 (print-last-log? openssh-configuration-print-last-log?
282 (default #t))) ;Boolean 284 (default #t))) ;Boolean
283 285
284(define %openssh-accounts 286(define %openssh-accounts
@@ -298,6 +300,14 @@ The other options should be self-descriptive."
298 (mkdir-p "/etc/ssh") 300 (mkdir-p "/etc/ssh")
299 (mkdir-p (dirname #$(openssh-configuration-pid-file config))) 301 (mkdir-p (dirname #$(openssh-configuration-pid-file config)))
300 302
303 (define (touch file-name)
304 (call-with-output-file file-name (const #t)))
305
306 (let ((lastlog "/var/log/lastlog"))
307 (when #$(openssh-configuration-print-last-log? config)
308 (unless (file-exists? lastlog)
309 (touch lastlog))))
310
301 ;; Generate missing host keys. 311 ;; Generate missing host keys.
302 (system* (string-append #$(openssh-configuration-openssh config) 312 (system* (string-append #$(openssh-configuration-openssh config)
303 "/bin/ssh-keygen") "-A"))) 313 "/bin/ssh-keygen") "-A")))
@@ -336,6 +346,9 @@ The other options should be self-descriptive."
336 (format port "UsePAM ~a\n" 346 (format port "UsePAM ~a\n"
337 #$(if (openssh-configuration-use-pam? config) 347 #$(if (openssh-configuration-use-pam? config)
338 "yes" "no")) 348 "yes" "no"))
349 (format port "PrintLastLog ~a\n"
350 #$(if (openssh-configuration-print-last-log? config)
351 "yes" "no"))
339 #t)))) 352 #t))))
340 353
341(define (openssh-shepherd-service config) 354(define (openssh-shepherd-service config)