Discussion:
[Fab-user] Tunneling Stalls
Adrián
2013-10-02 17:38:09 UTC
Permalink
Hi,

I'm trying to use the tunnel functionality in Fabric to execute commands on
a remote machine through a bastion host. However, right after being
prompted for the password it stalls and nothing happens. It's also quite
unclear which password you're entering, but that's not an issue because
I've set up the same password and user in both boxes for the tests. The
code I'm using is pasted below.

from fabric.api import run, env

env.no_keys=True
env.host_string='***@destination_host:22'
env.gateway='***@bastion_host:4242'

run("uname -a")

And the output from running it looks like this:

adrian$ python test-tunnels.py
[***@destination_host:22] run: uname -a
[***@destination_host:22] Login password for 'adrian':
[***@destination_host:22] Login password for 'adrian':

After entering the password twice, it stalls, nothing else happens. If I
hit Ctrl-C, this is the stack trace it produces:

^CTraceback (most recent call last):
File "tunnels.py", line 7, in <module>
run("uname -a")
File "/Library/Python/2.7/site-packages/fabric/network.py", line 578, in
host_prompting_wrapper
return func(*args, **kwargs)
File "/Library/Python/2.7/site-packages/fabric/operations.py", line 1042,
in run
shell_escape=shell_escape)
File "/Library/Python/2.7/site-packages/fabric/operations.py", line 909,
in _run_command
channel=default_channel(), command=wrapped_command, pty=pty,
File "/Library/Python/2.7/site-packages/fabric/state.py", line 388, in
default_channel
chan = _open_session()
File "/Library/Python/2.7/site-packages/fabric/state.py", line 380, in
_open_session
return connections[env.host_string].get_transport().open_session()
File "/Library/Python/2.7/site-packages/fabric/network.py", line 118, in
__getitem__
self.connect(key)
File "/Library/Python/2.7/site-packages/fabric/network.py", line 110, in
connect
self[key] = connect(user, host, port, sock)
File "/Library/Python/2.7/site-packages/fabric/network.py", line 392, in
connect
sock=sock
File "/Library/Python/2.7/site-packages/paramiko/client.py", line 311, in
connect
t.start_client()
File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 462,
in start_client
event.wait(0.1)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 394, in wait
self.__cond.wait(timeout)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 257, in wait
_sleep(delay)
KeyboardInterrupt

I'm sure it's not a SSH problem, since the tunneling command in SSH works.
I say more, I was looking online for an answer and I came across this (
https://gist.github.com/shnjp/856179), that also works for the same
boxes/users. I wonder how that one is different from the built in mechanism
into Fabric. I've gone through the documentation and I've not been able to
find what I'm doing wrong, so if anyone could shed any light onto this I'd
appreciate it very much.

Regards,
Adrian
Adrián
2013-10-14 14:52:01 UTC
Permalink
No one? I've been trying to work this one out for over a week now, and no
matter how I try this doesn't seem to work at all. Any help would be
appreciated. If it's a bug I'd also like to know to stop banging my head
with the settings. Even using fab tool and a fabfile.py like this:

$ cat fabfile.py
from fabric.api import run

def host_type():
run('uname -a')


$ fab -f fabfile.py -H host.org:4242 -k host_type --user adrian --gateway
***@192.168.242.153:22
[host.org:4242] Executing task 'host_type'
[host.org:4242] run: uname -a
[host.org:4242] Login password for 'adrian':
[host.org:4242] Login password for 'adrian':

It stalls there forever. Then I Ctrl-C and get this:

^C
Stopped.
Disconnecting from ***@192.168.242.153... done.

And stalls again.Then I Ctrl-C on that one too and get this:

^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py",
line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 65,
in _join_lingering_threads
thr.stop_thread()
File "/Library/Python/2.7/site-packages/paramiko/transport.py", line
1395, in stop_thread
self.join(10)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 653, in join
self.__block.wait(delay)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 257, in wait
_sleep(delay)
KeyboardInterrupt
Error in sys.exitfunc:
Traceback (most recent call last):
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py",
line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 65,
in _join_lingering_threads
thr.stop_thread()
File "/Library/Python/2.7/site-packages/paramiko/transport.py", line
1395, in stop_thread
self.join(10)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 653, in join
self.__block.wait(delay)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 257, in wait
_sleep(delay)
KeyboardInterrupt

Thanks!

Kind Regards,
Adrian
Post by Adrián
Hi,
I'm trying to use the tunnel functionality in Fabric to execute commands
on a remote machine through a bastion host. However, right after being
prompted for the password it stalls and nothing happens. It's also quite
unclear which password you're entering, but that's not an issue because
I've set up the same password and user in both boxes for the tests. The
code I'm using is pasted below.
from fabric.api import run, env
env.no_keys=True
run("uname -a")
adrian$ python test-tunnels.py
After entering the password twice, it stalls, nothing else happens. If I
File "tunnels.py", line 7, in <module>
run("uname -a")
File "/Library/Python/2.7/site-packages/fabric/network.py", line 578, in
host_prompting_wrapper
return func(*args, **kwargs)
File "/Library/Python/2.7/site-packages/fabric/operations.py", line
1042, in run
shell_escape=shell_escape)
File "/Library/Python/2.7/site-packages/fabric/operations.py", line 909,
in _run_command
channel=default_channel(), command=wrapped_command, pty=pty,
File "/Library/Python/2.7/site-packages/fabric/state.py", line 388, in
default_channel
chan = _open_session()
File "/Library/Python/2.7/site-packages/fabric/state.py", line 380, in
_open_session
return connections[env.host_string].get_transport().open_session()
File "/Library/Python/2.7/site-packages/fabric/network.py", line 118, in
__getitem__
self.connect(key)
File "/Library/Python/2.7/site-packages/fabric/network.py", line 110, in
connect
self[key] = connect(user, host, port, sock)
File "/Library/Python/2.7/site-packages/fabric/network.py", line 392, in
connect
sock=sock
File "/Library/Python/2.7/site-packages/paramiko/client.py", line 311,
in connect
t.start_client()
File "/Library/Python/2.7/site-packages/paramiko/transport.py", line
462, in start_client
event.wait(0.1)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 394, in wait
self.__cond.wait(timeout)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 257, in wait
_sleep(delay)
KeyboardInterrupt
I'm sure it's not a SSH problem, since the tunneling command in SSH works.
I say more, I was looking online for an answer and I came across this (
https://gist.github.com/shnjp/856179), that also works for the same
boxes/users. I wonder how that one is different from the built in mechanism
into Fabric. I've gone through the documentation and I've not been able to
find what I'm doing wrong, so if anyone could shed any light onto this I'd
appreciate it very much.
Regards,
Adrian
Jeff Forcier
2013-10-14 15:54:48 UTC
Permalink
Hi Adrián,

Sorry for the radio silence, must've missed your first mail :(

It sounds like you're seeing this issue:
https://github.com/fabric/fabric/issues/957 (n.b. when curious if it's
a bug, searching the issue tracker can help ;)) I'll add your info
there - thanks a lot for the details.

Clearly this is biting a number of folks so I'll try to check it out
this week if I don't find any pull requests about it.

Thanks,
Jeff
Post by Adrián
No one? I've been trying to work this one out for over a week now, and no
matter how I try this doesn't seem to work at all. Any help would be
appreciated. If it's a bug I'd also like to know to stop banging my head
$ cat fabfile.py
from fabric.api import run
run('uname -a')
$ fab -f fabfile.py -H host.org:4242 -k host_type --user adrian --gateway
[host.org:4242] Executing task 'host_type'
[host.org:4242] run: uname -a
^C
Stopped.
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py",
line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 65,
in _join_lingering_threads
thr.stop_thread()
File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 1395,
in stop_thread
self.join(10)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 653, in join
self.__block.wait(delay)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 257, in wait
_sleep(delay)
KeyboardInterrupt
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py",
line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 65,
in _join_lingering_threads
thr.stop_thread()
File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 1395,
in stop_thread
self.join(10)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 653, in join
self.__block.wait(delay)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 257, in wait
_sleep(delay)
KeyboardInterrupt
Thanks!
Kind Regards,
Adrian
Post by Adrián
Hi,
I'm trying to use the tunnel functionality in Fabric to execute commands
on a remote machine through a bastion host. However, right after being
prompted for the password it stalls and nothing happens. It's also quite
unclear which password you're entering, but that's not an issue because I've
set up the same password and user in both boxes for the tests. The code I'm
using is pasted below.
from fabric.api import run, env
env.no_keys=True
run("uname -a")
adrian$ python test-tunnels.py
After entering the password twice, it stalls, nothing else happens. If I
File "tunnels.py", line 7, in <module>
run("uname -a")
File "/Library/Python/2.7/site-packages/fabric/network.py", line 578, in
host_prompting_wrapper
return func(*args, **kwargs)
File "/Library/Python/2.7/site-packages/fabric/operations.py", line
1042, in run
shell_escape=shell_escape)
File "/Library/Python/2.7/site-packages/fabric/operations.py", line 909,
in _run_command
channel=default_channel(), command=wrapped_command, pty=pty,
File "/Library/Python/2.7/site-packages/fabric/state.py", line 388, in
default_channel
chan = _open_session()
File "/Library/Python/2.7/site-packages/fabric/state.py", line 380, in
_open_session
return connections[env.host_string].get_transport().open_session()
File "/Library/Python/2.7/site-packages/fabric/network.py", line 118, in
__getitem__
self.connect(key)
File "/Library/Python/2.7/site-packages/fabric/network.py", line 110, in
connect
self[key] = connect(user, host, port, sock)
File "/Library/Python/2.7/site-packages/fabric/network.py", line 392, in
connect
sock=sock
File "/Library/Python/2.7/site-packages/paramiko/client.py", line 311,
in connect
t.start_client()
File "/Library/Python/2.7/site-packages/paramiko/transport.py", line
462, in start_client
event.wait(0.1)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 394, in wait
self.__cond.wait(timeout)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 257, in wait
_sleep(delay)
KeyboardInterrupt
I'm sure it's not a SSH problem, since the tunneling command in SSH works.
I say more, I was looking online for an answer and I came across this
(https://gist.github.com/shnjp/856179), that also works for the same
boxes/users. I wonder how that one is different from the built in mechanism
into Fabric. I've gone through the documentation and I've not been able to
find what I'm doing wrong, so if anyone could shed any light onto this I'd
appreciate it very much.
Regards,
Adrian
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
--
Jeff Forcier
Unix sysadmin; Python/Ruby engineer
http://bitprophet.org
Jeff Forcier
2013-10-14 15:56:54 UTC
Permalink
Aha, I see you're the @adrianbn who commented on the ticket?. Didn't
see a mention of that so didn't double check :) Still - adding a link
to these details via the ML archives. (Having this info in the ticket
is often essential, fwiw.)
Post by Jeff Forcier
Hi Adrián,
Sorry for the radio silence, must've missed your first mail :(
https://github.com/fabric/fabric/issues/957 (n.b. when curious if it's
a bug, searching the issue tracker can help ;)) I'll add your info
there - thanks a lot for the details.
Clearly this is biting a number of folks so I'll try to check it out
this week if I don't find any pull requests about it.
Thanks,
Jeff
Post by Adrián
No one? I've been trying to work this one out for over a week now, and no
matter how I try this doesn't seem to work at all. Any help would be
appreciated. If it's a bug I'd also like to know to stop banging my head
$ cat fabfile.py
from fabric.api import run
run('uname -a')
$ fab -f fabfile.py -H host.org:4242 -k host_type --user adrian --gateway
[host.org:4242] Executing task 'host_type'
[host.org:4242] run: uname -a
^C
Stopped.
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py",
line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 65,
in _join_lingering_threads
thr.stop_thread()
File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 1395,
in stop_thread
self.join(10)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 653, in join
self.__block.wait(delay)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 257, in wait
_sleep(delay)
KeyboardInterrupt
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py",
line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 65,
in _join_lingering_threads
thr.stop_thread()
File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 1395,
in stop_thread
self.join(10)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 653, in join
self.__block.wait(delay)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 257, in wait
_sleep(delay)
KeyboardInterrupt
Thanks!
Kind Regards,
Adrian
Post by Adrián
Hi,
I'm trying to use the tunnel functionality in Fabric to execute commands
on a remote machine through a bastion host. However, right after being
prompted for the password it stalls and nothing happens. It's also quite
unclear which password you're entering, but that's not an issue because I've
set up the same password and user in both boxes for the tests. The code I'm
using is pasted below.
from fabric.api import run, env
env.no_keys=True
run("uname -a")
adrian$ python test-tunnels.py
After entering the password twice, it stalls, nothing else happens. If I
File "tunnels.py", line 7, in <module>
run("uname -a")
File "/Library/Python/2.7/site-packages/fabric/network.py", line 578, in
host_prompting_wrapper
return func(*args, **kwargs)
File "/Library/Python/2.7/site-packages/fabric/operations.py", line
1042, in run
shell_escape=shell_escape)
File "/Library/Python/2.7/site-packages/fabric/operations.py", line 909,
in _run_command
channel=default_channel(), command=wrapped_command, pty=pty,
File "/Library/Python/2.7/site-packages/fabric/state.py", line 388, in
default_channel
chan = _open_session()
File "/Library/Python/2.7/site-packages/fabric/state.py", line 380, in
_open_session
return connections[env.host_string].get_transport().open_session()
File "/Library/Python/2.7/site-packages/fabric/network.py", line 118, in
__getitem__
self.connect(key)
File "/Library/Python/2.7/site-packages/fabric/network.py", line 110, in
connect
self[key] = connect(user, host, port, sock)
File "/Library/Python/2.7/site-packages/fabric/network.py", line 392, in
connect
sock=sock
File "/Library/Python/2.7/site-packages/paramiko/client.py", line 311,
in connect
t.start_client()
File "/Library/Python/2.7/site-packages/paramiko/transport.py", line
462, in start_client
event.wait(0.1)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 394, in wait
self.__cond.wait(timeout)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
line 257, in wait
_sleep(delay)
KeyboardInterrupt
I'm sure it's not a SSH problem, since the tunneling command in SSH works.
I say more, I was looking online for an answer and I came across this
(https://gist.github.com/shnjp/856179), that also works for the same
boxes/users. I wonder how that one is different from the built in mechanism
into Fabric. I've gone through the documentation and I've not been able to
find what I'm doing wrong, so if anyone could shed any light onto this I'd
appreciate it very much.
Regards,
Adrian
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
--
Jeff Forcier
Unix sysadmin; Python/Ruby engineer
http://bitprophet.org
--
Jeff Forcier
Unix sysadmin; Python/Ruby engineer
http://bitprophet.org
Loading...