Re: How do I setup a multiple hop tunnel to chain port forwarding?
- From: "Noah" <noah@xxxxxxxx>
- Date: 23 Mar 2006 17:28:37 -0800
I got this to work pretty well:
ssh -t -L 5432:127.0.0.1:9991 firewall.example.com \
ssh -t dbserver \
ssh -t -R 9991:127.0.0.1:5432 firewall
Note that I was not able to use -f because the first SSH would
fork before the last SSH asked me for my password.
I found that I had to use -t on all three ssh commands.
It did not seem to work otherwise.
Is there anything I can clean up?
So using this I am able to use psql on my localhost machine
to connect to dbserver (although, I have to tell to use 127.0.0.1
as the host so it would make an IP connection instead of
trying to use a local pipe, "psql -h 127.0.0.1 my_database").
The Postgres server on dbserver allows the
connection without a password because
host based authentication sees that the connection
originates from dbserver's localhost.
Richard E. Silverman wrote:
The problem is that the second ssh instance does not have a tty, so it"Noah" == Noah <noah@xxxxxxxx> writes:
can't prompt for your password. You can fix this with -t on the first ssh
instance.
Yes, the -t was the trick. Thanks.
What you're doing will work, but it's fragile in various respects. I
would remove the -f from the second ssh; it will fork and then not
terminate when the first one does, preventing you from running the same
command again (since that port is now bound).
When you have to go through multiple hops, it's usually better to get an
end-to-end connection. In this case:
ssh -oproxycommand="ssh -qaxT firewall nc %h %p" -L 5432:localhost:5432 dbserver
If you have a copy of the snail book, section 11.4 (p444) has a discussion
of these two approaches.
I will check this out. Thanks!
Yours,
Noah
.
- References:
- How do I setup a multiple hop tunnel to chain port forwarding?
- From: Noah
- Re: How do I setup a multiple hop tunnel to chain port forwarding?
- From: Richard E. Silverman
- How do I setup a multiple hop tunnel to chain port forwarding?
- Prev by Date: Re: Any OpenSSH for sunos4?
- Next by Date: Re: Any OpenSSH for sunos4?
- Previous by thread: Re: How do I setup a multiple hop tunnel to chain port forwarding?
- Next by thread: Congestion avoidance in ssh ?
- Index(es):
Relevant Pages
|
|