-
Notifications
You must be signed in to change notification settings - Fork 462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intercept remote port forwarding connections and filter out by IP #233
Comments
Kadeessh, a Caddy plugin built atop this amazing lib , can do that by implementing a custom module that implements a specific interface. The filter by remote IP isn't implemented yet, but it can be easily done in a few lines. If you nerdsnipe me enough, I might just it soon 😄 the development on Kadeessh is slow due poverty in time and feedback. I've been trying to revive it. |
Isn't this already possible by inspecting the |
I thought there may have been a Caddy implementation of what I'm trying to do, but attempting to write a service myself 😝 |
If you mean the Forwarded Request Handler, that only fires when the SSH tunnel is created, and inside that is a constant for loop that fires when someone visits the "tunnelled" address. So the IP for that will be the person that is setting up the remote port forward, not the person that is calling the tunnel address. |
When using a ForwardedTCPHandler as a request handler for remote port forwarding, it would be nice to be able to reject connections unless their IP is "allowed".
This can be done with an intercept handler which can be set on the
ForwardedTCPHandler
type and then used withinHandleSSHRequest()
.It could accept a
net.Addr()
and return a true/false result. If true, the incoming connection can be continued as normal but if false, the connection can be closed and thus be rejected.Use case for this is I'm creating a tool (like Ngrok) that will allow a command such as
ssh -R some-domain:5000:localhost:3000 some-domain -p 2222
to be run locally which will allow people to make requests tohttp://some-domain:5000
and it will forward the request to an app running locally. However by doing so, anyone could get hold of that URL and send requests to me..... By allowing an intercept functionality this can be limited by IP address.The text was updated successfully, but these errors were encountered: