[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#37309: [PATCH] services: openssh: Restrict to IPv4.
From: |
Julien Lepiller |
Subject: |
bug#37309: [PATCH] services: openssh: Restrict to IPv4. |
Date: |
Tue, 03 Dec 2019 22:53:11 +0100 |
User-agent: |
K-9 Mail for Android |
Le 3 décembre 2019 21:12:51 GMT+01:00, Leo Famulari <address@hidden> a écrit :
>This works around <https://issues.guix.info/issue/30993>.
>
>* gnu/services/ssh.scm (<openssh-configuration>)[address-family]: New
>field.
>(openssh-config-file): Use it.
>* doc/guix.texi: Document it.
>---
> doc/guix.texi | 10 ++++++++++
> gnu/services/ssh.scm | 16 +++++++++++++++-
> 2 files changed, 25 insertions(+), 1 deletion(-)
>
>diff --git a/doc/guix.texi b/doc/guix.texi
>index 39eb25385c..cf0e141baf 100644
>--- a/doc/guix.texi
>+++ b/doc/guix.texi
>@@ -13913,6 +13913,16 @@ This is a symbol specifying the logging level:
>@code{quiet}, @code{fatal},
>@code{error}, @code{info}, @code{verbose}, @code{debug}, etc. See the
>man
> page for @file{sshd_config} for the full list of level names.
>
>+@item @code{address-family} (default: @code{'inet})
>+This is a symbol specifying which type of internet addresses should be
>+handled by @command{sshd}. The options are @code{inet} (IPv4),
>+@code{inet6} (IPv6), or @code{any}, which selects both @code{inet} and
>+@code{inet6}. The upstream default in @code{any}. However, we
default *is*
>+currently default to @code{inet} due to a nondeterministic
>+@command{sshd} startup failure when using IPv6 on Guix. See
>+@uref{https://issues.guix.info/issue/30993, the bug report} for more
>+information on this temporary limitation.
>+
> @item @code{extra-content} (default: @code{""})
>This field can be used to append arbitrary text to the configuration
>file. It
>is especially useful for elaborate configurations that cannot be
>expressed
>diff --git a/gnu/services/ssh.scm b/gnu/services/ssh.scm
>index d2dbb8f80d..7e25810eff 100644
>--- a/gnu/services/ssh.scm
>+++ b/gnu/services/ssh.scm
>@@ -4,6 +4,7 @@
> ;;; Copyright © 2016 Julien Lepiller <address@hidden>
> ;;; Copyright © 2017 Clément Lassieur <address@hidden>
> ;;; Copyright © 2019 Ricardo Wurmus <address@hidden>
>+;;; Copyright © 2019 Leo Famulari <address@hidden>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
>@@ -340,7 +341,16 @@ The other options should be self-descriptive."
>;; proposed in <https://bugs.gnu.org/27155>. Keep it
>internal/undocumented
> ;; for now.
> (%auto-start? openssh-auto-start?
>- (default #t)))
>+ (default #t))
>+
>+ ;; Symbol
>+ ;; XXX: This shouldn't be required, but due to limitations with IPv6
>+ ;; on Guix, sshd often fails to start when it attempts to bind to
>both
>+ ;; 0.0.0.0 and ::, because the IPv6 interface is not ready in time.
>+ ;; Accepted options are inet (IPv4), inet6 (IPv6), or any (both).
>+ ;; <https://issues.guix.info/issue/30993>
>+ (address-family openssh-configuration-address-family
>+ (default 'inet)))
>
> (define %openssh-accounts
> (list (user-group (name "sshd") (system? #t))
>@@ -468,6 +478,10 @@ of user-name/file-like tuples."
> (symbol->string
> (openssh-configuration-log-level config))))
>
>+ (format port "AddressFamily ~a\n"
>+ #$(symbol->string
>+ (openssh-configuration-address-family config)))
>+
> ;; Add '/etc/authorized_keys.d/%u', which we populate.
> (format port "AuthorizedKeysFile \
>.ssh/authorized_keys .ssh/authorized_keys2
>/etc/ssh/authorized_keys.d/%u\n")