proxy: support proxies behind SSH - #57
Open
rlahfa-dinum wants to merge 1 commit into
Open
Conversation
rlahfa-dinum
force-pushed
the
proxy-behind-ssh
branch
2 times, most recently
from
March 27, 2026 21:47
45e2427 to
d081349
Compare
A classical technique to authenticate proxies is to piggy back existing SSH authnz systems and perform SSH forwards to access an unprotected proxy. To ease migrations on users with existing proxy fleet, we allow daisychaining to these sorts of proxies. We implement a very opinionated support of SSH: - .ssh/config must contain an entry with proper preconfiguration for User, etc. - Portail configuration needs proxy-host (must match a .ssh/config entry) and target-address (final proxy target, can be 127.0.0.1) - An SSH agent over UDS must be provided (otherwise it's guessed from the environment variable SSH_AUTH_AGENT_SOCKET) and should be able to authenticate over the SSH server - The server must already be trusted in the standard known-hosts file from OpenSSH If these conditions are reunited, the connection will succeed. Signed-off-by: Ryan Lahfa <ryan.lahfa.ext@numerique.gouv.fr>
rlahfa-dinum
force-pushed
the
proxy-behind-ssh
branch
from
March 27, 2026 23:25
d081349 to
53fc346
Compare
rlahfa-dinum
marked this pull request as ready for review
March 27, 2026 23:25
rlahfa-dinum
commented
Mar 27, 2026
| &mut self, | ||
| server_public_key: &russh::keys::ssh_key::PublicKey, | ||
| ) -> Result<bool, Self::Error> { | ||
| // TODO: check known hosts keys |
Collaborator
Author
There was a problem hiding this comment.
this is checking it now
rlahfa-dinum
commented
Mar 27, 2026
| target_port: config.port(), | ||
| }; | ||
|
|
||
| // TODO: this is using whoami as a last resort... |
Collaborator
There was a problem hiding this comment.
If I am not mistaken, for our use case, this fallback is always wrong. However I don't see a security problem. So I don't have a strong opinion either way.
agrimault-dinum
approved these changes
Mar 31, 2026
agrimault-dinum
left a comment
Collaborator
There was a problem hiding this comment.
At one point, we might want to store the ssh session, call session.channel_open_direct_tcpip many times on it and have a mecanism to refresh it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A classical technique to authenticate proxies is to piggy back existing SSH authnz systems and perform SSH forwards to access an unprotected proxy.
To ease migrations on users with existing proxy fleet, we allow daisychaining to these sorts of proxies.
TODO: