services: openssh: Enable PAM.
* gnu/services/ssh.scm: (openssh-pam-services): New procedure. (openssh-service-type): Use it to extend PAM-ROOT-SERVICE-TYPE. (<openssh-configuration>)[challenge-response-authentication?]: New field. (<openssh-configuration>)[use-pam?]: New field. (openssh-config-file): Add them. * doc/guix.texi (Networking Services): Document them. Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
This commit is contained in:
parent
856be82323
commit
563c5d42c9
@ -9344,6 +9344,22 @@ enabled---in other words, @command{ssh} options @option{-X} and
|
|||||||
|
|
||||||
@item @code{protocol-number} (default: @code{2})
|
@item @code{protocol-number} (default: @code{2})
|
||||||
The SSH protocol number to use.
|
The SSH protocol number to use.
|
||||||
|
|
||||||
|
@item @code{challenge-response-authentication?} (default: @code{#f})
|
||||||
|
Specifies whether challenge response authentication is allowed (e.g. via
|
||||||
|
PAM).
|
||||||
|
|
||||||
|
@item @code{use-pam?} (default: @code{#t})
|
||||||
|
Enables the Pluggable Authentication Module interface. If set to
|
||||||
|
@code{#t}, this will enable PAM authentication using
|
||||||
|
@code{challenge-response-authentication?} and
|
||||||
|
@code{password-authentication?}, in addition to PAM account and session
|
||||||
|
module processing for all authentication types.
|
||||||
|
|
||||||
|
Because PAM challenge response authentication usually serves an
|
||||||
|
equivalent role to password authentication, you should disable either
|
||||||
|
@code{challenge-response-authentication?} or
|
||||||
|
@code{password-authentication?}.
|
||||||
@end table
|
@end table
|
||||||
@end deftp
|
@end deftp
|
||||||
|
|
||||||
|
@ -279,7 +279,11 @@ The other options should be self-descriptive."
|
|||||||
(x11-forwarding? openssh-configuration-x11-forwarding? ;Boolean
|
(x11-forwarding? openssh-configuration-x11-forwarding? ;Boolean
|
||||||
(default #f))
|
(default #f))
|
||||||
(protocol-number openssh-configuration-protocol-number ;integer
|
(protocol-number openssh-configuration-protocol-number ;integer
|
||||||
(default 2)))
|
(default 2))
|
||||||
|
(challenge-response-authentication? openssh-challenge-response-authentication?
|
||||||
|
(default #f)) ;Boolean
|
||||||
|
(use-pam? openssh-configuration-use-pam?
|
||||||
|
(default #t))) ;Boolean
|
||||||
|
|
||||||
(define %openssh-accounts
|
(define %openssh-accounts
|
||||||
(list (user-group (name "sshd") (system? #t))
|
(list (user-group (name "sshd") (system? #t))
|
||||||
@ -336,6 +340,12 @@ The other options should be self-descriptive."
|
|||||||
"yes" "no"))
|
"yes" "no"))
|
||||||
(format port "PidFile ~a\n"
|
(format port "PidFile ~a\n"
|
||||||
#$(openssh-configuration-pid-file config))
|
#$(openssh-configuration-pid-file config))
|
||||||
|
(format port "ChallengeResponseAuthentication ~a\n"
|
||||||
|
#$(if (openssh-challenge-response-authentication? config)
|
||||||
|
"yes" "no"))
|
||||||
|
(format port "UsePAM ~a\n"
|
||||||
|
#$(if (openssh-configuration-use-pam? config)
|
||||||
|
"yes" "no"))
|
||||||
#t))))
|
#t))))
|
||||||
|
|
||||||
(define (openssh-shepherd-service config)
|
(define (openssh-shepherd-service config)
|
||||||
@ -356,11 +366,20 @@ The other options should be self-descriptive."
|
|||||||
#:pid-file #$pid-file))
|
#:pid-file #$pid-file))
|
||||||
(stop #~(make-kill-destructor)))))
|
(stop #~(make-kill-destructor)))))
|
||||||
|
|
||||||
|
(define (openssh-pam-services config)
|
||||||
|
"Return a list of <pam-services> for sshd with CONFIG."
|
||||||
|
(list (unix-pam-service
|
||||||
|
"sshd"
|
||||||
|
#:allow-empty-passwords?
|
||||||
|
(openssh-configuration-allow-empty-passwords? config))))
|
||||||
|
|
||||||
(define openssh-service-type
|
(define openssh-service-type
|
||||||
(service-type (name 'openssh)
|
(service-type (name 'openssh)
|
||||||
(extensions
|
(extensions
|
||||||
(list (service-extension shepherd-root-service-type
|
(list (service-extension shepherd-root-service-type
|
||||||
openssh-shepherd-service)
|
openssh-shepherd-service)
|
||||||
|
(service-extension pam-root-service-type
|
||||||
|
openssh-pam-services)
|
||||||
(service-extension activation-service-type
|
(service-extension activation-service-type
|
||||||
openssh-activation)
|
openssh-activation)
|
||||||
(service-extension account-service-type
|
(service-extension account-service-type
|
||||||
|
Loading…
Reference in New Issue
Block a user