SSH agent forwarding is dangerous. Here's how to secure it.

(kimhq.net)

2 points | by Kimcha 3 hours ago ago

1 comments

  • Kimcha 3 hours ago ago

    Author here.

    I needed to deploy my git-synced dotfiles on an untrusted server, but didn't want to store the credentials or ssh-agent-forward all my keys.

    The fix ended up being:

    1. ssh-agent-filter, a small proxy agent that only exposes the keys you choose

    2. The somewhat new `ForwardAgent <socket path>` option that was added in OpenSSH 8.2

    Together, your real agent handles authentication, and only a filtered agent gets forwarded.

    The article also covers the 2019 Matrix.org breach, which was a good example of how agent forwarding can be exploited.

    Curious whether anyone has a better approach.

    AI Usage Disclosure:

    This article was handwritten by me (like in the olden days).

    AI agents were used for the feature image, light editing, spell-checking, research, and the development of the presented solutions.