mirror of
https://github.com/ovh/the-bastion.git
synced 2026-05-09 08:25:27 +02:00
[PR #592] feat: implement proxy jump for egress connections #596
Labels
No labels
answered
bug
documentation
enhancement
enhancement
feature
feature
kept-open-for-info
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/the-bastion#596
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ovh/the-bastion/pull/592
Author: @jon4hz
Created: 9/26/2025
Status: 🔄 Open
Base:
master← Head:feat-proxyjump📝 Commits (10+)
95f9117feat: implement proxy jump for egress connectionsaabbbf9feat(osh): parse proxyjump options correctly030b334feat(scp): support proxyjumpe710b00chore: adjust machine display to include proxy info157a7a1chore: run perl tidy1868261fix: handle access check correctly with proxy options9da71bdfix: reset proxy connection env varf79d4a0fix: handle proxy connection in access testdf6791bfix: return proxyIP and proxyPort in json output11df17bfix: correct proxy parameter in groupAddServer helper📊 Changes
36 files changed (+2466 additions, -423 deletions)
View changed files
📝
bin/helper/osh-accountAddGroupServer(+34 -20)📝
bin/helper/osh-accountModifyPersonalAccess(+36 -9)📝
bin/helper/osh-groupAddServer(+30 -3)📝
bin/plugin/group-aclkeeper/groupAddServer(+60 -33)📝
bin/plugin/group-aclkeeper/groupAddServer.json(+16 -8)📝
bin/plugin/group-aclkeeper/groupDelServer(+42 -18)📝
bin/plugin/group-aclkeeper/groupDelServer.json(+12 -5)📝
bin/plugin/group-gatekeeper/groupAddGuestAccess(+61 -37)📝
bin/plugin/group-gatekeeper/groupAddGuestAccess.json(+9 -1)📝
bin/plugin/group-gatekeeper/groupDelGuestAccess(+55 -31)📝
bin/plugin/group-gatekeeper/groupDelGuestAccess.json(+7 -1)📝
bin/plugin/open/scp(+90 -10)📝
bin/plugin/open/selfListSessions(+29 -13)📝
bin/plugin/restricted/accountAddPersonalAccess(+45 -10)📝
bin/plugin/restricted/accountAddPersonalAccess.json(+11 -11)📝
bin/plugin/restricted/accountDelPersonalAccess(+42 -18)📝
bin/plugin/restricted/accountDelPersonalAccess.json(+7 -1)📝
bin/plugin/restricted/selfAddPersonalAccess(+50 -11)📝
bin/plugin/restricted/selfAddPersonalAccess.json(+11 -11)📝
bin/plugin/restricted/selfDelPersonalAccess(+41 -17)...and 16 more files
📄 Description
Hi there,
Since proxy jumping is an important feature for me, I started to give it a shot at implementing it myself, but I'm a bit stuck and could require some inputs.
My idea was to add
--proxy-hostand--proxy-portflag when adding a new server. For simplicity, the--proxy-portmust be explicit, so there is no flag like--proxy-port-any.If someone adds a server with a proxy, the proxy information gets stored in the comments of the acl rules. I updated the
allowkeeper.inclibrary to parse those parameters accordingly - andallowdeny.incwas adjusted to validate those parameters when checking if access to a server should be granted.The acl validation works well so far, however I'm struggling with the required changes in the
osh.plscript.When I try to add a new access, the
ssh_test_access_wayfunction starts the ssh test command with a newProxyCommandoption.My theory is that the proxy command causes ssh to start a subprocess, this ssh subprocess gets then interpreted by the
osh.plsession. This causes a race condition, because osh.pl is supposed to do acl checks, but the acl for that new server isn't written yet since this is the connection to dermine if the server should get added to the acls.The command from the ssh subprocess also doesn't get interpreted correctly (because it shouldn't be handled by
osh.plin the first place, imo)For example, when I execute:
selfAddPersonalAccess --host 192.168.1.10 --port 22 --user jonah --proxy-host 192.168.1.20 --proxy-port 22, I get the following log:This is the command that
ssh_test_access_wayexecutes:As you can see, this work when executed outside the
osh.plenvironment.If I enable ssh debugging, I get the following log:
That's where my theory of the subprocess spawned by ssh comes from.
I hope this description is somewhat understandable. It would be super nice if you could take a look at this and give some inputs, if you have an idea how to work around this issue.
When a using the proxy feature, the following assumptions are made:
the proxy host uses the same username and supports the same authentication as the target hostLimitations with the current implementation:
only the ssh protocol is supported, not scp, sftp or rsynclogging to the sqlite db isn't implemented (yet). This requires a schema change, and I'm not sure how to implement that bestNot supported by guest accessthe naming of the ttyrec files should probably be adjusted to include the proxy IPcloses #591 and #250
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.