[Twisted-Python] help ssh forwarding.
Sorry If you get two of these, I sent the last one with the wrong email account. Hi, I have a series of linux based internet kiosks at a variety of sites. I need to be able to connect back into the kiosk from the main server. However direct connections aren't possible as kiosks are behind there own router/firewall. The solution to this is to forward port 22 on the kiosk to a port on the server. I was thinking of just spawning the command "ssh -R11122:my_server:22 user@my_server" from the kiosk, when ever I need to connect to a machine. However I'm hoping to do this with twisted, since the kiosk app uses it already, and spawning the ssh command won't play well with twisted's event system. I decided to try and hack together a simple version of what I want to do, based on the example sshsimpleclient.py. I don't seem to be able to figure out how to forward from the server to the kiosk. My program (attached) just forwards from 11122 on the kiosk to 22 on the server which isn't what I want. Can anyone suggest what I'm doing wrong? Can twisted actually do this? Thanks in advance, om -- Oisin Mulvihill Engines Of Creation Email: oisin@enginesofcreationsoftware.com Email: oisin@enginesofcreation.ie Mobile: +353 868191540
Hi, I've just spotted an error in my email, which could cause confusion. The line: ...the command "ssh -R11122:my_server:22 user@my_server"... should read: ...the command "ssh -R11122:localhost:22 user@my_server"... Just to clear it up, this is what I'm trying to do in twisted. This should allow me to do ssh -p 11122 localhost on my server and it will the connect back into the kiosk machine. ssh forwarding always messes with my head, om On 11 Mar 2004, at 14:04, Oisin Mulvihill wrote:
Sorry If you get two of these, I sent the last one with the wrong email account.
Hi,
I have a series of linux based internet kiosks at a variety of sites. I need to be able to connect back into the kiosk from the main server. However direct connections aren't possible as kiosks are behind there own router/firewall.
The solution to this is to forward port 22 on the kiosk to a port on the server. I was thinking of just spawning the command "ssh -R11122:my_server:22 user@my_server" from the kiosk, when ever I need to connect to a machine. However I'm hoping to do this with twisted, since the kiosk app uses it already, and spawning the ssh command won't play well with twisted's event system.
I decided to try and hack together a simple version of what I want to do, based on the example sshsimpleclient.py. I don't seem to be able to figure out how to forward from the server to the kiosk. My program (attached) just forwards from 11122 on the kiosk to 22 on the server which isn't what I want.
Can anyone suggest what I'm doing wrong? Can twisted actually do this?
Thanks in advance,
om
<cli.py>
-- Oisin Mulvihill Engines Of Creation
Email: oisin@enginesofcreationsoftware.com Email: oisin@enginesofcreation.ie Mobile: +353 868191540
-- Oisin Mulvihill Engines Of Creation Email: oisin@enginesofcreationsoftware.com Email: oisin@enginesofcreation.ie Mobile: +353 868191540
On Thu, 2004-03-11 at 09:04, Oisin Mulvihill wrote:
The solution to this is to forward port 22 on the kiosk to a port on the server. I was thinking of just spawning the command "ssh -R11122:my_server:22 user@my_server" from the kiosk, when ever I need to connect to a machine. However I'm hoping to do this with twisted, since the kiosk app uses it already, and spawning the ssh command won't play well with twisted's event system.
Take a look at reactor.spawnProcess().
Can anyone suggest what I'm doing wrong? Can twisted actually do this?
Well, what you're doing wrong is you're using local->remote forwarding in your example. What you want is to ask the server to forward a remote port over the connection. Look at twisted.scripts.conch.SSHConnection, methods requestRemoteForwarding and channel_forwarded_tcpip for an example of how to implement remote->local forwarding. -p -- Paul Swartz (o_ z3p at twistedmatrix dot com //\ http://www.twistedmatrix.com/users/z3p.twistd/ V_/_ AIM: Z3Penguin
On Mar 11, 2004, at 9:04 AM, Oisin Mulvihill wrote:
I have a series of linux based internet kiosks at a variety of sites. I need to be able to connect back into the kiosk from the main server. However direct connections aren't possible as kiosks are behind there own router/firewall.
This might be considered heresy here, but I've solved this exact problem using autossh ( http://www.harding.motd.ca/autossh/ ) and crontab entries. -bob
Bob Ippolito wrote:
On Mar 11, 2004, at 9:04 AM, Oisin Mulvihill wrote:
I have a series of linux based internet kiosks at a variety of sites. I need to be able to connect back into the kiosk from the main server. However direct connections aren't possible as kiosks are behind there own router/firewall.
This might be considered heresy here, but I've solved this exact problem using autossh (
I won't tell if you won't ;)
http://www.harding.motd.ca/autossh/ ) and crontab entries.
-bob
From a quick glance at this looks like what I need. I'll check it out properly asap. Using twisted's Process to spawn ssh does work, its just not very pretty. Thanks, om
participants (3)
-
Bob Ippolito
-
Oisin Mulvihill
-
Paul Swartz