| Summary: | ControlMaster started by scp (non-ssh?) doesn't forward agent | ||
|---|---|---|---|
| Product: | Portable OpenSSH | Reporter: | Steffen (Daode) Nurpmeso <steffen> |
| Component: | Miscellaneous | Assignee: | Assigned to nobody <unassigned-bugs> |
| Status: | NEW --- | ||
| Severity: | normal | CC: | djm, hamish-openssh, matthijs |
| Priority: | P5 | ||
| Version: | 7.3p1 | ||
| Hardware: | All | ||
| OS: | All | ||
|
Description
Steffen (Daode) Nurpmeso
2016-10-05 06:32:12 AEDT
This seems a more general problem: Agent forwarding seems only to happen when starting a new ControlMaster. If ssh re-uses an existing ControlMaster, the -A option seems to be (silently!) ignored: Passing -A to the master works: matthijs@grubby:~$ ssh tika-login -o ControlMaster=yes -o ControlPath=/tmp/foo -A matthijs@login:~$ echo $SSH_AUTH_SOCK /tmp/ssh-Kmwf42CH18/agent.3830 matthijs@login:~$ logout Connection to tikatika.nl closed. But passing -A to a "slave" ssh does not: matthijs@grubby:~$ ssh tika-login -o ControlMaster=yes -o ControlPath=/tmp/foo And in another terminal: matthijs@grubby:~$ ssh -o ControlPath=/tmp/foo tika-login -A matthijs@login:~$ echo $SSH_AUTH_SOCK matthijs@login:~$ I can imagine there's a technical reason to not support this, but then at least it should be documented and passing -A should show an error or warning (possibly depending on ExitOnForwardFailure). I originally tested on 7.4p1 from Debian Stretch, and I just tested 7.5p1 from Debian Sid, which shows the same behaviour. Agent forwarding is always inherited from the multiplexing master process. This is documented in sshd_config:
> X11 and ssh-agent(1) forwarding is supported over these multi‐
> plexed connections, however the display and agent forwarded will
> be the one belonging to the master connection i.e. it is not pos‐
> sible to forward multiple displays or agents.
Putting the original bug title back, because this bug is specific to scp/sftp's explicit deactivation-by-default of agent forwarding.
Ah, thanks for clarifying, I've must have missed that part in the manpage. I've created a new bug for showing a warning when this happens, which does still seem like a valid, but indeed separate issue to me: https://bugzilla.mindrot.org/show_bug.cgi?id=2780 I see in scp.c that -oForwardAgent=no is added to the command line arguments internally to disable forwarding, but can be overridden. Would it be helpful to also add -oControlMaster=no so that scp does not end up creating the control master with agent forwarding disabled? Alternatively it would be useful if the config file could match against scp/sftp so that ControlMaster=no could be set for that case. |