From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id aDdSBE36vWLCUAAAbAwnHQ (envelope-from ) for ; Thu, 30 Jun 2022 21:32:29 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id UNE5BE36vWKAPAAA9RJhRA (envelope-from ) for ; Thu, 30 Jun 2022 21:32:29 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 82AB63837F for ; Thu, 30 Jun 2022 21:32:28 +0200 (CEST) Received: from localhost ([::1]:41646 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o6ztr-0001Yj-5J for larch@yhetil.org; Thu, 30 Jun 2022 15:32:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52506) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o6ztS-0001YN-5U for bug-guix@gnu.org; Thu, 30 Jun 2022 15:32:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41740) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o6ztR-0002NN-TA for bug-guix@gnu.org; Thu, 30 Jun 2022 15:32:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o6ztR-0006sW-LL for bug-guix@gnu.org; Thu, 30 Jun 2022 15:32:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#56327: Regression: openssh service fails to start if system has no IPv6 Resent-From: =?UTF-8?Q?Andr=C3=A9?= Batista Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 30 Jun 2022 19:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56327 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 56327@debbugs.gnu.org Received: via spool by 56327-submit@debbugs.gnu.org id=B56327.165661751726430 (code B ref 56327); Thu, 30 Jun 2022 19:32:01 +0000 Received: (at 56327) by debbugs.gnu.org; 30 Jun 2022 19:31:57 +0000 Received: from localhost ([127.0.0.1]:35637 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6ztM-0006sE-Qh for submit@debbugs.gnu.org; Thu, 30 Jun 2022 15:31:57 -0400 Received: from mx1.riseup.net ([198.252.153.129]:55184) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6ztK-0006ry-Ee for 56327@debbugs.gnu.org; Thu, 30 Jun 2022 15:31:56 -0400 Received: from fews2.riseup.net (fews2-pn.riseup.net [10.0.1.84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.riseup.net", Issuer "R3" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id 4LYpP01DyXzDq8c for <56327@debbugs.gnu.org>; Thu, 30 Jun 2022 19:31:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1656617508; bh=6eejeDBzruGe199W+8cDP6npL6dnEVynzhbomcngWT8=; h=Date:From:To:Subject:References:In-Reply-To:From; b=cFWKQinkd/2o10AJQMf2Jl6VmJBX9gPfxq/c0V+jc2XKHSpHDPBmCFTHxjR+a84lB RZd5OSlcaQw0lf5sB6i6a7/cVMQDp29PAwu/qZEO99L4djhACf9vbUtQ8kE1peiGpC CzF8ZH3DEAovc+19P/DxSBvN6lnCMu+XVep8+cSo= X-Riseup-User-ID: 5610061A56C7126D31643D9D12E94BCD6EEF62FE3382C2335E8163D659D8A7E0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews2.riseup.net (Postfix) with ESMTPSA id 4LYpNy6lZvz1yWZ for <56327@debbugs.gnu.org>; Thu, 30 Jun 2022 19:31:46 +0000 (UTC) Date: Thu, 30 Jun 2022 16:31:41 -0300 From: =?UTF-8?Q?Andr=C3=A9?= Batista Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="eKg6hZTwQ/6HTHjj" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1656617548; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=xq1tn1b00TaMlTpROfiEmiNk2+Hg7ub+bVnhvJcn9jE=; b=Y8ZNyFFcYQ09ce08NY3THSA3bVdOJZBY0y3cft79KwG8aU1NwpiDXyZinZPbrAZZNoiRCI g8YBWhfl3aP8rDPgGjow1CcaamVwQfaKVmFUPhkWa6+n9dh9DYHpn7NUs+qPL8arolwEeM DpguVx23uCQgGaFZLc3XgPXVB6jQ0vT/eEz3O2D9W/7GXJqqh54kQNVfm+RgGbZ0ECUPBB pyF/H7St7gAcYE+ftcez+GDdlrFNzYYLXoXLG7j9k6EQBWttpVMUbGij1zJalrwEFVFsj7 Gr3YLMws5tAZOtIc4QtNJB/2wOkYlDKeO+Yo+uc7TE5xeqbRTlOW6GLzS8Gcww== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1656617548; a=rsa-sha256; cv=none; b=cAsWtinh59VAZw3Ezpy2g+oQvpLHQYXdoa548uL3PEPbTnAkztXpfNlcpWZ6I9hPtoWDxG QeUP4bgdn5CXCHy+W4FTwtEW4RAuYCkM2TovEOtzB83+FLL3V9GOnPfGqRBCcX38rz8muL +MFBz7db6KNCT4c8CwlpAd7SbgApzugpsrK+wfOAt+fz5XUwjOpFt8WdD6aXs0OUqU0SGJ iE8m8luT0vTmKeM/kHq0r14sDyFgVXwkV4dDIbxjPvgrv1ACJFKABiripWpOUkThMoUSOR iRGGDNfzMdsuIBL5wTLXjs8PuQvC6VUF+oXnunEH0EUMuTcwCIq33vGE7OiUFQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=riseup.net header.s=squak header.b=cFWKQink; dmarc=fail reason="SPF not aligned (relaxed)" header.from=riseup.net (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 5.55 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=riseup.net header.s=squak header.b=cFWKQink; dmarc=fail reason="SPF not aligned (relaxed)" header.from=riseup.net (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 82AB63837F X-Spam-Score: 5.55 X-Migadu-Scanner: scn0.migadu.com X-TUID: Qrr889KsC4FQ --eKg6hZTwQ/6HTHjj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I've tested the following patch, which tests for IPv6 support, on both a system without IPv6 and another with it, but I have not tested on a system with shepherd < 0.9.1. Hopefuly it works as expected. Cheers! --eKg6hZTwQ/6HTHjj Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: attachment; filename="ssh-service.patch" Content-Transfer-Encoding: 8bit >From 30feda7b5ce8803b10e4bca8e86e1caaadc71596 Mon Sep 17 00:00:00 2001 In-Reply-To: References: From: =?UTF-8?q?Andr=C3=A9=20Batista?= Date: Thu, 30 Jun 2022 15:36:03 -0300 Subject: [PATCH] services: openssh: Check if IPv6 is supported and start service accordingly. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To: 56327@debbugs.gnu.org Fixes . Reported by André Batista . * gnu/services/ssh.scm (openssh-shepherd-service)[ipv6-support?]: New variable. : Use it. When using 'make-inetd-constructor', only pass a ipv6 endpoint if the system supports it. --- gnu/services/ssh.scm | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/gnu/services/ssh.scm b/gnu/services/ssh.scm index 57d3ad218c..050c3aa7c3 100644 --- a/gnu/services/ssh.scm +++ b/gnu/services/ssh.scm @@ -8,6 +8,7 @@ ;;; Copyright © 2020 Oleg Pykhalov ;;; Copyright © 2020 Brice Waegeneire ;;; Copyright © 2021 Tobias Geerinckx-Rice +;;; Copyright © 2022 André Batista ;;; ;;; This file is part of GNU Guix. ;;; @@ -536,23 +537,36 @@ (define inetd-style? #~(and (defined? 'make-inetd-constructor) (not (string=? (@ (shepherd config) Version) "0.9.0")))) + (define ipv6-support? + ;; Helper function to start/stop ssh service on systems with no IPv6. + ;; See https://issues.guix.gnu.org/56327. + #~(false-if-exception (socket AF_INET6 SOCK_STREAM 0))) + (list (shepherd-service (documentation "OpenSSH server.") (requirement '(syslogd loopback)) (provision '(ssh-daemon ssh sshd)) - (start #~(if #$inetd-style? - (make-inetd-constructor - (append #$openssh-command '("-i")) - (list (endpoint - (make-socket-address AF_INET INADDR_ANY - #$port-number)) - (endpoint - (make-socket-address AF_INET6 IN6ADDR_ANY - #$port-number))) - #:max-connections #$max-connections) - (make-forkexec-constructor #$openssh-command - #:pid-file #$pid-file))) + (start #~(cond ((and #$inetd-style? #$ipv6-support?) + (make-inetd-constructor + (append #$openssh-command '("-i")) + (list (endpoint + (make-socket-address AF_INET INADDR_ANY + #$port-number)) + (endpoint + (make-socket-address AF_INET6 IN6ADDR_ANY + #$port-number))) + #:max-connections #$max-connections)) + ((and #$inetd-style? (not #$ipv6-support?)) + (make-inetd-constructor + (append #$openssh-command '("-i")) + (list (endpoint + (make-socket-address AF_INET INADDR_ANY + #$port-number))) + #:max-connections #$max-connections)) + (else + (make-forkexec-constructor #$openssh-command + #:pid-file #$pid-file)))) (stop #~(if #$inetd-style? (make-inetd-destructor) (make-kill-destructor))) -- 2.36.0 --eKg6hZTwQ/6HTHjj--