GNU bug report logs - #33266
guix-copy: Honor the SSH port of a host when defined in ~/.ssh/config

Previous Next

Package: guix;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Mon, 5 Nov 2018 04:59:01 UTC

Severity: normal

Tags: patch

Merged with 74832

To reply to this bug, email your comments to 33266 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#33266; Package guix. (Mon, 05 Nov 2018 04:59:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Mon, 05 Nov 2018 04:59:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: bug-guix <bug-guix <at> gnu.org>
Subject: guix-copy: Honor the SSH port of a host when defined in ~/.ssh/config
Date: Sun, 04 Nov 2018 23:58:27 -0500
[Message part 1 (text/plain, inline)]
Hello,

I recently stumbled on the bug where guix copy would the port 22 even
when I had specified a different one in my ~/.ssh/config file.

This bug is triggered when omitting the port in the --to= (or --from)
expression, such as in

guix copy --to=somehost bash

And where somehost exists in ~/.ssh/config, say:

Host somehost
     User someuser
     HostName someplace.somedns.net
     Port 1234

Instead of using port 1234, the port 22 would be used.  Commit
cc1dfc202f is the reason of this overriding; the attached patch 
reverts it, with a detailed explanation.

Thank you,

Maxim

[0001-Revert-copy-Default-to-port-22.patch (text/x-patch, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#33266; Package guix. (Tue, 06 Nov 2018 14:13:01 GMT) Full text and rfc822 format available.

Message #8 received at 33266 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: 33266 <at> debbugs.gnu.org
Subject: Re: bug#33266: guix-copy: Honor the SSH port of a host when defined
 in ~/.ssh/config
Date: Tue, 06 Nov 2018 15:12:44 +0100
Hello,

Maxim Cournoyer <maxim.cournoyer <at> gmail.com> skribis:

> From 942eb8cabef5b7c8b4425c765b6ee2ac9f529ad8 Mon Sep 17 00:00:00 2001
> From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
> Date: Sun, 4 Nov 2018 23:35:16 -0500
> Subject: [PATCH] Revert "copy: Default to port 22."
>
> This reverts commit cc1dfc202f2fefb6c2eb9467d1fc90a9154550c9.  Specifying a
> default port had the undesirable effect of disregarding a port specification
> for a given host in the ~/.ssh/config that would otherwise have been honored
> at the time `open-ssh-session' calls the `session-parse-config!' method.
>
> In any case, `make-session' will default the port value of the created session
> to 22 if left unspecified.

This looks good, and indeed it’s an unintended consequence of commit
cc1dfc202f2fefb6c2eb9467d1fc90a9154550c9.

However, the log of commit cc1dfc had this:

   Failing to do that, "%p" would be "0" when using "ProxyCommand"
   in ~/.ssh/config.

This is arguably a defect in either Guile-SSH or (more likely) libssh,
and it would be nice to report it.

Would you like to report it upstream?

Thanks,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#33266; Package guix. (Fri, 09 Nov 2018 03:36:02 GMT) Full text and rfc822 format available.

Message #11 received at 33266 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 33266 <at> debbugs.gnu.org
Subject: Re: bug#33266: guix-copy: Honor the SSH port of a host when defined
 in ~/.ssh/config
Date: Thu, 08 Nov 2018 22:35:32 -0500
Hello!

ludo <at> gnu.org (Ludovic Courtès) writes:

[...]

> This looks good, and indeed it’s an unintended consequence of commit
> cc1dfc202f2fefb6c2eb9467d1fc90a9154550c9.
>
> However, the log of commit cc1dfc had this:
>
>    Failing to do that, "%p" would be "0" when using "ProxyCommand"
>    in ~/.ssh/config.

Yeah, I had seen this message, but was doubting if it was still
valid. Helas, it seems so:

Given the ~/.ssh/config snippet (and configured machines):
--8<---------------cut here---------------start------------->8---
Host vm-host
     HostName 10.5.5.5
     User someuser
     
Host some-guest
     IdentityFile ~/.ssh/vm-host/id_rsa
     HostName some-guest
     User guest
     ProxyCommand ssh vm-host nc %h %p
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,use (ssh session)
scheme@(guile-user)> (make-session #:host "some-guest")
$1 = #<session #<undefined>@some-guest:22 (disconnected) 11dffe0>
scheme@(guile-user)> (session-get $1 'host)
$2 = "some-guest"
scheme@(guile-user)> (session-get $1 'port)
$3 = 22
scheme@(guile-user)> (session-parse-config! $1 "~/.ssh/config")
$4 = #<undefined>
scheme@(guile-user)> (session-get $1 'port)
$5 = 22
scheme@(guile-user)> (connect! $1)
$6 = error
scheme@(guile-user)> (make-session #:host "some-guest" #:port 22)
$7 = #<session #<undefined>@some-guest:22 (disconnected) 11dffc0>
scheme@(guile-user)> (session-parse-config! $7 "~/.ssh/config")
$8 = #<undefined>
scheme@(guile-user)> (session-get $7 'port)
$9 = 22
scheme@(guile-user)> (connect! $7)
$10 = ok
--8<---------------cut here---------------end--------------->8---

> This is arguably a defect in either Guile-SSH or (more likely) libssh,
> and it would be nice to report it.
>
> Would you like to report it upstream?

It has to be in libssh. I'll try to come up with a repro in C, and
submit the issue to them.

When it's done, I'll add a note in the code.

To be continued... Thanks for looking :)

Maxim




Information forwarded to bug-guix <at> gnu.org:
bug#33266; Package guix. (Tue, 22 Jan 2019 22:10:02 GMT) Full text and rfc822 format available.

Message #14 received at 33266 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: 33266 <at> debbugs.gnu.org
Subject: Re: bug#33266: guix-copy: Honor the SSH port of a host when defined
 in ~/.ssh/config
Date: Tue, 22 Jan 2019 23:09:07 +0100
Hi Maxim,

Maxim Cournoyer <maxim.cournoyer <at> gmail.com> skribis:

> ludo <at> gnu.org (Ludovic Courtès) writes:
>
> [...]
>
>> This looks good, and indeed it’s an unintended consequence of commit
>> cc1dfc202f2fefb6c2eb9467d1fc90a9154550c9.
>>
>> However, the log of commit cc1dfc had this:
>>
>>    Failing to do that, "%p" would be "0" when using "ProxyCommand"
>>    in ~/.ssh/config.
>
> Yeah, I had seen this message, but was doubting if it was still
> valid. Helas, it seems so:

[...]

>> This is arguably a defect in either Guile-SSH or (more likely) libssh,
>> and it would be nice to report it.
>>
>> Would you like to report it upstream?
>
> It has to be in libssh. I'll try to come up with a repro in C, and
> submit the issue to them.

With the recent upgrade to libssh 0.8.6, is the issue still present?

Ludo’.




Merged 33266 74832. Request was from Maxim Cournoyer <maxim.cournoyer <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 17 Dec 2024 01:28:02 GMT) Full text and rfc822 format available.

This bug report was last modified 176 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.