[SLE] Monitor port and start ssh tunnel. Is there such a beast?
I am looking for a program that will monitor a configurable local port and when an attempt is made to access that port, it will start SSH to tunnel to a remote server and forward this port through the tunnel. For example, I am running a mail client behind a firewall which does not allow port 25 access. I would like to set up the mail client to use localhost port 1234 (for example) and set up this program I am looking for to listen to this port. When the mail client attempts to connect to port 1234 it will cause the program to bring up the SSH tunnel and forward the traffic through SSH. I know I can use SSH to do this tunneling but I would like to find a program which will bring up that tunnel on demand. I was wondering if there is such a beast. Avi -- Avi Schwartz http://public.xdi.org/=avi.schwartz -- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
Avi Schwartz wrote:
I am looking for a program that will monitor a configurable local port and when an attempt is made to access that port, it will start SSH to tunnel to a remote server and forward this port through the tunnel.
I believe SSH itself will do something like that for you. If not, you could use xinetd to start SSH.
I know I can use SSH to do this tunneling but I would like to find a program which will bring up that tunnel on demand.
I think xinetd is what you're looking for. /Per Jessen, Zürich -- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
You were absolutely right, xinetd did it. If anyone cares to know the
details, here they are:
I wanted to be able to create a tunnel automatically when I connect to
localhost port 1234 to a remote port 25 in order to tunnel through the
office's block on port 25.
1) Create a file in /etc/xinetd.d/ and call it something like tunnel_smtp
The content of the file:
---------- BEGIN tunnel_smtp -----------
service tunnel_smtp
{
type = UNLISTED
port = 1234
socket_type = stream
protocol = tcp
wait = no
user = your_user_name
disable = no
server = /usr/bin/ssh
server_args = remote -T socat - TCP4:mail:25
groups = yes
bind = 127.0.0.1
}
---------- END tunnel_smtp -----------
Replace
Avi Schwartz wrote:
I am looking for a program that will monitor a configurable local port and when an attempt is made to access that port, it will start SSH to tunnel to a remote server and forward this port through the tunnel. I know I can use SSH to do this tunneling but I would like to find a program which will bring up that tunnel on demand.
I think xinetd is what you're looking for. -- Avi Schwartz http://public.xdi.org/=avi.schwartz
-- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
participants (2)
-
Avi Schwartz
-
Per Jessen