mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-11 13:49:23 -05:00
services: openssh: Listen on IPv6 only when IPv6 is supported.
Fixes <https://issues.guix.gnu.org/56327>. Reported by André Batista <nandre@riseup.net>. * gnu/services/ssh.scm (openssh-shepherd-service)[ipv6-support?]: New variable. Use it in 'start' method.
This commit is contained in:
parent
b512dadfd6
commit
bf7e07d299
1 changed files with 16 additions and 4 deletions
|
@ -536,6 +536,15 @@ (define inetd-style?
|
|||
#~(and (defined? 'make-inetd-constructor)
|
||||
(not (string=? (@ (shepherd config) Version) "0.9.0"))))
|
||||
|
||||
(define ipv6-support?
|
||||
;; Expression that returns true if IPv6 support is available.
|
||||
#~(catch 'system-error
|
||||
(lambda ()
|
||||
(let ((sock (socket AF_INET6 SOCK_STREAM 0)))
|
||||
(close-port sock)
|
||||
#t))
|
||||
(const #f)))
|
||||
|
||||
(list (shepherd-service
|
||||
(documentation "OpenSSH server.")
|
||||
(requirement '(syslogd loopback))
|
||||
|
@ -544,12 +553,15 @@ (define inetd-style?
|
|||
(start #~(if #$inetd-style?
|
||||
(make-inetd-constructor
|
||||
(append #$openssh-command '("-i"))
|
||||
(list (endpoint
|
||||
(cons (endpoint
|
||||
(make-socket-address AF_INET INADDR_ANY
|
||||
#$port-number))
|
||||
(endpoint
|
||||
(make-socket-address AF_INET6 IN6ADDR_ANY
|
||||
#$port-number)))
|
||||
(if #$ipv6-support?
|
||||
(list
|
||||
(endpoint
|
||||
(make-socket-address AF_INET6 IN6ADDR_ANY
|
||||
#$port-number)))
|
||||
'()))
|
||||
#:max-connections #$max-connections)
|
||||
(make-forkexec-constructor #$openssh-command
|
||||
#:pid-file #$pid-file)))
|
||||
|
|
Loading…
Reference in a new issue