LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-05-2018, 06:36 AM   #1
opeth281
LQ Newbie
 
Registered: Oct 2018
Posts: 5

Rep: Reputation: Disabled
SSH Tunneling via xinetd


I'm working on a Centos project where I'd like to have a service as per below in order to forward the SMTP & POP3 ports (25 & 110) in two different mail servers. The below are now online and everything works properly for one Mail Server. My question is how to add a second service or add on the below service commands, in order to forward at 5551 & 5551 the SMTP & POP3 Ports to a second mail Server (in case we have failure in the first Email Server) automatically. Your kind assistance will be greatly appreciated.

Services at /etc/xinetd.d:

service smtp_1

{

groups = yes

port = 5551

bind = 172.2.16.10 -- > (local IP Email client)

socket_type = stream

protocol = tcp

user = root

server = /usr/bin/ssh

server_args = -q -C -T -p 22 root@xxx.xxx.xxx.xxx --> Public IP nc xxx.xxx.xxx.xxx --> Local IP Mail Server IP 25

type = UNLISTED

wait = no

}

service pop3_1

{

disable = no

socket_type = stream

protocol = tcp

port = 5552

wait = no

user = root

server = /usr/bin/ssh

server_args = -q -C -T -p 22 root@xxx.xxx.xxx.xxx -- > Public IP nc xxx.xxx.xxx.xxx -- > Local IP Mail Server 110

groups = yes

bind = 172.2.16.10 -- > Loacal IP Email Client

}
 
Old 10-06-2018, 12:53 AM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,001
Blog Entries: 3

Rep: Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632
You need to get the tunneling working manually first. Please re-read the manual for the SSH client.

Code:
man ssh
The option you are looking for would be -L

Also please wrap the configuration text in [code] [/code] tags.
 
Old 10-06-2018, 05:00 AM   #3
opeth281
LQ Newbie
 
Registered: Oct 2018
Posts: 5

Original Poster
Rep: Reputation: Disabled
Wink SSH Tunneling via xinetd

Hello and many thanks for your reply,

I will be more specifi in the above. Now i am forwarding 5551 & 5552 via the above services at 25 & 110 SMTP & POP3 to an email server. The above services running with success. My question is how to add a second Email Server in order to forward my email if the first email server has a failure. Could you please be more specific about -L ssh option.

Many thanks again.
 
Old 10-06-2018, 09:57 AM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,001
Blog Entries: 3

Rep: Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632
Yes but you must read about -L, -i, and the other options you are using in the manual page:

Code:
man ssh
man ssh_config
Then get it working from the shell manually before messing with xinetd

Code:
ssh -o GatewayPorts=yes -L 5551:127.0.0.1:22 -p 25  notroot@xxx.xxx.xxx.xxx 
ssh -o GatewayPorts=yes -L 5552:127.0.0.1:22 -p 110 notroot@yyy.yyy.yyy.yyy
Then get it working with keys.

Then add it to xinetd's configuration.

Last edited by Turbocapitalist; 10-06-2018 at 10:05 AM. Reason: corrected destination ports
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH server and SSH tunneling Achical Linux - Security 5 05-20-2012 10:07 AM
About SSH Tunneling RedNeck-LQ Linux - General 3 07-25-2011 09:34 AM
Tunneling with ssh ssherman Linux - Networking 3 07-16-2007 02:13 AM
SSH tunneling entz Linux - Networking 3 04-04-2007 07:22 AM
X tunneling with SSH phekno Linux - Networking 3 05-31-2005 10:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration