LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   giving SSH access to machines on LAN from internet (https://www.linuxquestions.org/questions/linux-server-73/giving-ssh-access-to-machines-on-lan-from-internet-866933/)

tkmsr 03-07-2011 06:08 AM

giving SSH access to machines on LAN from internet
 
Hi, I am having a server in a corporate data centre. There are some virtual machines running on it.The main server is accessible from internet via SSH. There are some people who within the lan access the virtual machines whose IPs on LAN are
Quote:

192.168.1.1
192.168.1.2
192.168.1.3
192.168.1.4
from internet only one host is allowed SSH.
This machine has public IP and is also connected to LAN on the IP 192.168.1.50.

Tunnel is not allowed on our network.So now I am came across a solution as explained on this link.
I am not clear with on which machine .ssh/config file I add following
Code:

Host securehost.example.com   
ProxyCommand ssh user1@insidemachine.com nc %h %p

Should above be done on gateway where public IP and ssh is allowed or client on internet who has to login.

Do I need to create separate accounts on the gateway also so that the users who can SSH to gateway then are forwarded to inside machines? Or one account on gateway is sufficient for different people logging in via internet to my gateway and then forwarded to internal machine?

Then do I need to create an account user1 on the gateway also?


1) What is the correct syntax for ProxyCommand on gateway's .ssh/config should I use
Code:

ProxyCommand ssh user1@inside.machine nc %h %p
or I should use
Code:

ProxyCommand    ssh user1@gateway.com in nc %h %p


2) Should I create new user accounts on gateway also which exist on internal machine?

acid_kewpie 03-07-2011 04:54 PM

ALL the config they've given is for your client. You wil be logging in fully to both machines, so need suitable accounts on both. They don't have to be the same account, but in the guide that is how they have configured it by using the %u. You could replace that with a static account if you wanted to.

As for what format for the proxy command, where did the 2nd one come from? 1hr 1st is what is in the guide

Juako 03-08-2011 08:48 PM

I don't get it. If the point is to have an intermediary machine between your client on the Internet and the server inside your network, why don't you just ssh to the intermediary machine and then ssh again from that machine to the internal server? With pubkey auth + agent forwarding this is a matter of seconds. Mind that in this fashion you don't have to store ANY private key in the intermediary machine...

Otherwise i'd also consider just dnating the internal ssh port to outside.

tkmsr 03-08-2011 10:07 PM

Quote:

Originally Posted by Juako (Post 4283480)
I don't get it. If the point is to have an intermediary machine between your client on the Internet and the server inside your network, why don't you just ssh to the intermediary machine and then ssh again from that machine

My boss does not wants this :( so he asked me a one step solution.

acid_kewpie 03-09-2011 02:16 AM

Quote:

Originally Posted by Juako (Post 4283480)
I don't get it. If the point is to have an intermediary machine between your client on the Internet and the server inside your network, why don't you just ssh to the intermediary machine and then ssh again from that machine to the internal server? With pubkey auth + agent forwarding this is a matter of seconds. Mind that in this fashion you don't have to store ANY private key in the intermediary machine...

Otherwise i'd also consider just dnating the internal ssh port to outside.

Well I don't get *this*... the article gives a really simple mechanism of taking this two step system and simplifying it slightly to make a one step system. What you're left with is exactly what you're suggesting, just a bit more polished.


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