LWN: Comments on "Restricting SSH agent keys" https://lwn.net/Articles/880458/ This is a special feed containing comments posted to the individual LWN article titled "Restricting SSH agent keys". en-us Mon, 03 Nov 2025 12:49:56 +0000 Mon, 03 Nov 2025 12:49:56 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Restricting SSH agent keys https://lwn.net/Articles/886163/ https://lwn.net/Articles/886163/ misc <div class="FormattedComment"> Or doing git commit or git clone with a repo served over ssh, on that remote server.<br> </div> Fri, 25 Feb 2022 19:48:53 +0000 Restricting SSH agent keys https://lwn.net/Articles/882172/ https://lwn.net/Articles/882172/ djm <div class="FormattedComment"> Yes, you should definitely use ProxyJump over agent forwarding if you can. There are some circumstances where that isn&#x27;t possible or convenient though.<br> </div> Fri, 21 Jan 2022 23:18:59 +0000 physical ssh keydevices - not an issue? https://lwn.net/Articles/882171/ https://lwn.net/Articles/882171/ djm <div class="FormattedComment"> It&#x27;s of benefit to FIDO security keys too. ATM for forwarded agents, it&#x27;s possible for an attacker to &quot;phish&quot; FIDO key touches. E.g. they wait for you to do something that will require a touch and jump in first with their own request. These protocol changes make this more difficult.<br> </div> Fri, 21 Jan 2022 23:17:35 +0000 physical ssh keydevices - not an issue? https://lwn.net/Articles/881912/ https://lwn.net/Articles/881912/ Klavs <div class="FormattedComment"> This only works at solving the problem which only (as I understood it) is relevant for on-disk private keys.<br> So for those of us, using ssh-keys via gnupg daemon (backed by a hardware key like yubikey) - this feature is not a security benefit at all?<br> </div> Thu, 20 Jan 2022 13:12:56 +0000 Restricting SSH agent keys https://lwn.net/Articles/880749/ https://lwn.net/Articles/880749/ NYKevin <div class="FormattedComment"> This is a good example, but I also think that there&#x27;s an element of pets-vs-cattle here. In the cattle case, you&#x27;re absolutely right: Ideally, you never SSH into cattle at all. If you need to SSH into something, it&#x27;s broken and you should probably either redeploy the offending container or just reimage the silly thing, but in practice that&#x27;s not always the case (You use containers, right? You can safely and easily reimage everything whenever you want, right?).<br> <p> But the other practical reality is that not everything is going to be cattle in the first place. Some machines (workstations, mostly) are pets, and will always be pets, because each individual machine has slightly different requirements and there&#x27;s no reasonable way to fully and completely standardize them. For those machines, a certain amount of manual remote administration is inevitable, especially in the brave new world of everyone working from home. Once you realize that this is a real use case, then ProxyJump starts to look a lot less reasonable as (the only) solution. Sometimes, manual multi-hop SSH is just *easier* in the context of everything else you&#x27;re doing at the time.<br> </div> Sun, 09 Jan 2022 05:07:00 +0000 Restricting SSH agent keys https://lwn.net/Articles/880744/ https://lwn.net/Articles/880744/ tiwe <div class="FormattedComment"> Some years from now this might make many uses of ssh-agent-filter obsolete.<br> </div> Sat, 08 Jan 2022 23:58:59 +0000 Restricting SSH agent keys https://lwn.net/Articles/880737/ https://lwn.net/Articles/880737/ atnot <div class="FormattedComment"> One example might be to run programs like ansible that uses ssh to manage a large number of machines at once. Scripts that rsync data between two servers are also not that uncommon in oldschool sysadmining. There&#x27;s definitely better solutions for those things these days but it&#x27;ll take a while for everyone to get there.<br> </div> Sat, 08 Jan 2022 17:46:44 +0000 Restricting SSH agent keys https://lwn.net/Articles/880715/ https://lwn.net/Articles/880715/ droundy <div class="FormattedComment"> One scenario where that wouldn&#x27;t help is if you want to scp between two remote hosts. I think.<br> </div> Sat, 08 Jan 2022 03:18:56 +0000 Restricting SSH agent keys https://lwn.net/Articles/880596/ https://lwn.net/Articles/880596/ NYKevin <div class="FormattedComment"> If you need to run a long-lived thing on the bastion, you may have no choice but to SSH into it in order to configure that long-lived thing. At that point, it&#x27;s largely a matter of convenience.<br> <p> Another possibility is that there are internal services which are inaccessible from your local host, and you need to SSH to a bastion just to do anything interesting at all. It just so happens that one of the various interesting things you need to do is SSH into other servers. But you also need to be on the bastion to do things like send RPCs, check out (proprietary) source code, etc., because your local host is not trusted enough to do those things itself.<br> </div> Thu, 06 Jan 2022 18:21:05 +0000 Restricting SSH agent keys https://lwn.net/Articles/880566/ https://lwn.net/Articles/880566/ pj <div class="FormattedComment"> I wonder if the guardian agent project (<a href="https://github.com/StanfordSNR/guardian-agent">https://github.com/StanfordSNR/guardian-agent</a>) will take advantage of the agent protocol changes? It&#x27;s a local agent that pops up a local &quot;did you auth this? Yes/No/AllLikeThis&quot; kind of prompt whenever a remote agent request is forwarded to the local agent. Due to the mentioned agent protocol limitations it currently uses its own encrypted agent channel so it can add that information, but that may not be necessary now.<br> </div> Thu, 06 Jan 2022 15:10:45 +0000 Restricting SSH agent keys https://lwn.net/Articles/880533/ https://lwn.net/Articles/880533/ grawity <p>The agent protocol has been extended (see <code>session-bind</code> in the <a href="https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.agent">PROTOCOL.agent</a> file) to associate that specific socket with a hostkey, so if you connect to host A, your <em>local</em> client informs ssh-agent that future commands will originate from host A.</p> <p>The <code>publickey</code> SSH auth method has also been <a href="https://github.com/openssh/openssh-portable/blob/master/PROTOCOL">extended</a> (well, forked) to make the to-be-signed challenge include the server's hostkey, so the agent knows what server you're authenticating to. I think that's how the destination constraint is enforced; if the final server doesn't support the extended auth method, but only the standard one, then I assume the agent will not allow the key to be used at all.</p> Thu, 06 Jan 2022 10:58:22 +0000 SSH and ProxyJump https://lwn.net/Articles/880525/ https://lwn.net/Articles/880525/ grawity <p>Realistically, if someone holds valuable SSH keys on the local system, then they're likely using at least OpenSSH 5.2 (2010) which is when the netcat-free <code>-W %h:%p</code> option became available. So I'd rather describe ProxyJump as shorthand for <code>ProxyCommand "ssh &lt;bastion&gt; -W %h:%p"</code>. Although netcat-based fallbacks are definitely still useful in situations where the jumphost's admin deliberately disabled TCP tunnelling...</p> Thu, 06 Jan 2022 10:52:23 +0000 Restricting SSH agent keys https://lwn.net/Articles/880521/ https://lwn.net/Articles/880521/ taladar <div class="FormattedComment"> Unless the agent itself initiates the whole connection how does it know that the SSH process on the compromised server does not present the host key for host A and says it will use user a while actually using the signing result to connect to host B and use user b? Does the content it has to sign to connect contain that information and it inspects it?<br> </div> Thu, 06 Jan 2022 09:37:11 +0000 Restricting SSH agent keys https://lwn.net/Articles/880520/ https://lwn.net/Articles/880520/ taladar <div class="FormattedComment"> Personally I would find having to type any commands on the bastion host a lot less convenient than just putting whatever ProxyCommand or (in newer versions) ProxyJump configurations into my ~/.ssh/config and literally forgetting about which hosts even need one or more levels of connections via bastion hosts.<br> </div> Thu, 06 Jan 2022 09:31:54 +0000 Requiring confirmation before using the key https://lwn.net/Articles/880515/ https://lwn.net/Articles/880515/ fmarier There is a related <tt>ssh-add</tt> option which makes keys subject to a user confirmation (i.e. pressing Enter or clicking a button) via <tt>ssh-askpass</tt> before using the key for authentication. I have the following in my <tt>~/.bash_aliases</tt>: <blockquote><code>alias ssh-add='ssh-add -c'</code></blockquote> Thu, 06 Jan 2022 05:59:28 +0000 Restricting SSH agent keys https://lwn.net/Articles/880511/ https://lwn.net/Articles/880511/ NYKevin <div class="FormattedComment"> It may be the case that you want to have a long-lived session on the bastion, and a bunch of short-lived sessions on various individual servers, perhaps with -L and/or -R forwarding between the bastion and the servers. I&#x27;m fairly certain you can still do that with an appropriate ProxyJump configuration, but it seems like it would be more complicated to set up (as opposed to just typing a bunch of individual ssh commands with appropriate flags after you have ssh&#x27;d into the bastion). Meanwhile, if you *mostly* trust the bastion but want defense in depth against extraordinary insider threats, applying ssh-agent key restrictions might be a good compromise for that use case.<br> </div> Thu, 06 Jan 2022 01:52:04 +0000 SSH and ProxyJump https://lwn.net/Articles/880507/ https://lwn.net/Articles/880507/ rra <p><code>ProxyJump</code> can be easily simulated with older versions of ssh that don't support it by using <code>ProxyCommand</code> in <code>.ssh/config</code> instead:</p> <p><code>ProxyCommand ssh &lt;bastion&gt; nc -w 1 %h 22</code></p> <p><code>ProxyJump</code> is basically shorthand for that, without requiring netcat be installed on the bastion host. (There are variations using other ssh options that were added later, but I think the above <code>ProxyCommand</code> syntax will work with quite old versions of ssh.)</p> Wed, 05 Jan 2022 23:47:15 +0000 SSH and ProxyJump https://lwn.net/Articles/880505/ https://lwn.net/Articles/880505/ nickodell <div class="FormattedComment"> Glad to see this work being done. I want to mention a more secure alternative to agent forwarding which is easy to set up.<br> <p> Many people who use agent forwarding are using it to log into a bastion host of some kind, and then logging into a second host, where the second host is not directly accessible from the internet.<br> <p> For this use case, you can use a jump host instead of agent forwarding. Rather than having the bastion host decrypt and re-encrypt the SSH tunnel, the jump host works by asking the bastion to forward encrypted traffic to the destination server. This way, you don&#x27;t need to trust the bastion host.<br> <p> For more information, take a look at the -J option in the ssh manpage, or the ProxyJump option in the ssh_config manpage. It&#x27;s available since OpenSSH 7.3.<br> </div> Wed, 05 Jan 2022 23:30:44 +0000 Restricting SSH agent keys https://lwn.net/Articles/880506/ https://lwn.net/Articles/880506/ lucaswerkmeister <div class="FormattedComment"> <font class="QuotedText">&gt; A user who remotely connects to HostA, and from there to one or more other hosts using the same SSH key, will likely find it convenient to make the initial SSH connection to HostA with agent-forwarding enabled</font><br> <p> Isn’t it usually better to use ProxyJump for such situations, leaving the authentication with the other hosts to the local SSH instance? Or am I missing something? <br> </div> Wed, 05 Jan 2022 23:14:59 +0000