how to all ssh connection from to ssh jump server - ssh

I set a ssh jump server on public and the server can access all my other servers. How can i set all internal client access other servers from the server.
I haven't static server list and static ip list.
How can i set all ssh connection send to ssh jump server on clients?
Best Regards,

Related

VPN's IP of remote machine connected to that VPN

I would like to connect the remote machine to my local VPN and then ssh to that remote machine from the other machines in my local network.
Is this possible? Will the remote machine get new IP which will be visible in my local network? Do I need to configure anything manually?
I'm using FortiClient for VPN.
Yes this is absolutely possible. Try Following steps
1-Deploy VPN and assign the ipranges in DHCP public or private
2-Make Sure to turn off the firewall for vpn server for now
3-Turn off the Clients Firewall
4-Connect to VPN
5-If your connection loose try to see the client's IP from server
side and try to take SSH
6-Take ssh from your server
7- Ping the server from other local machines
8-Then enable the server side firewall and see the effect if ssh is
still possible if not make a rule for specific port for ssh

How does SSH dynamic forward (-D) function under the hood?

How does SSH dynamic forward (-D) function under the hood?
I understand that SSH dynamic forward opens a SOCSK4 proxy on the local host, and that each connection to the SOCK4 proxy is forwarded over the SSH tunnel to the remote destination.
Does SSH intercept the connections to the SOCKS4 proxy? I mean, it cannot be a "normal" SOCKS4 proxy, because then it would directly proxy the connections to the remote hosts.
Furthermore, how does SSH handle responses from the remote hosts, i.e., how does it transfer them back over the SSH tunnel to the recipients on the local host?
When the -D flag is given, the SSH client will start a built-in SOCKS4/5 proxy. (note: "SOCKS", not "SOCK").
-D [bind_address:]port
Specifies a local “dynamic” application-level port forwarding. This works by allocating a socket to listen to port on the local side, optionally bound to the specified bind_address. Whenever a connection is made to this port, the connection is forwarded over the secure channel, and the application protocol is then used to determine where to connect to from the remote machine. Currently the SOCKS4 and SOCKS5 protocols are supported, and ssh will act as a SOCKS server.
When another application wishes to connect to a proxied service, they will establish a connection via this SOCKS server. The SOCKS protocol is a little bit of negotiation that occurs at the beginning of a connection, something like this: (inspired by the wiki page)
ssh -D 1234 user#remote is execute, the SSH client starts a SOCKS proxy server listening on port 1234.
A local application wishes to communicate with a service via the SOCKS proxy, so connects to port 1234.
The SOCKS client asks for a connection to a particular IP address and port - e.g: 66.102.7.99, port 4321.
The SOCKS server, in this case the SSH client, will negotiate to establish this onward connection with it's server (remote, from above). This may fail.
The SOCKS serve will respond to the client with success / failure information.
If successful, all data passed through this socket will now be forwarded appropriately:
From the local application, to the SSH server (remote), and then onto 66.102.7.99.
From 66.102.7.99 to the SSH server (remote), and then onto the local SSH client, and ultimately the local application.
Does SSH intercept the connections to the SOCK4 proxy?
No, the SSH Client is the SOCKS proxy.
I mean, it cannot be a "normal" SOCK4 proxy, because then it would directly proxy the connections to the remote hosts.
I suppose it's not really - the SSH Client and Server act together to achieve the function of a "normal" SOCKS proxy. The high-level result is that the proxy listens on one host, but forwards data from another host, with a magical link in between.
Furthermore, how does SSH handle responses from the remote hosts, i.e., how does it transfer them back over the SSH tunnel to the recipients on the local host?
TCP is a connection-oriented method of communication. That is to say that once a connection is established, data can flow in both directions, and is reliably identified as "related to that connection". With this information it is trivial to associate the data with arbitrary rules such as "forward to the SSH server, who will forward to 66.102.7.99".

SSH into EC2 binding to private IP, not public IP

I've got an EC2 instance which has been set up to access a secure server via a VPN. The second server will only respond to calls that are bound to the EC2 server's public IP address.
I'm successfully using ssh to access the EC2 instance from my laptop...
ssh -i mypem.pem ubuntu#ec2-my-public-ip-address.eu-west-1.compute.amazonaws.com
but my command line sets up as:
ubuntu#my-private-ip-address:~$
So, when I try and run a piece of java code on the EC2 server, which makes a call to the secure server via the VPN it is failing because it is using the private IP address as its identifier. The java code can't be provided here, because it is for a secure service, but it has been extensively tested with other examples and on EC2 and we know that there isn't a problem here.
I'm trying to see if there's a way to ensure that any code I execute from the EC2 server uses my public IP address rather than the private IP address is this possible?
The private IP address is the only IP address that an EC2 instance knows about.
The public IP address is translated to/from the private IP by the EC2 network infrastructure using automatic static NAT, so the instance is never actually aware of it.
Check ifconfig and you will notice that the public IP is nowhere to be seen.
Yet, if you $ curl ipv4.icanhazip.com (or any other "what is my IP?" service), you'll find that your instance's public IP address will always be returned as the address seen by the external service.
Using the private IP internally automatically causes the public IP address to be used when you access the Internet.
You can connect ssh or ftp tools with EC2 instance private IP.
1) You need to create an Elastic IP. Navigate to EC2 service > Network Security.
2) Associate this Elastic IP with EC2 instance private ip.
3) Update inbound rules in security group of your EC2 instance. Add SSH port 22 with source "My IP" option.
Now you can use terminal:
ssh ec2-user#<elastic ip>
Make user you have installed your EC2 key pair certificate. If not run following:
ssh-add -K <.pem file>

What's the best way to reverse ssh tunnel to access system behind corp firewall?

I am trying to access a linux server through ssh. Typically this is accessed through a Win2012 jump server using putty.
I was able to setup a reverse ssh connection in putty from jump server to a AWS VM through HTTP proxy. And this was supposed to forward it to my linux server. But when I connect to my AWS VM and initiate ssh over my remote port, the whole thing just hangs. What am I doing wrong, and is there a better/easier way? No malicious intent, I have physical access to both jump server and linux server. Just bypassing shitty corp firewall.
Can you explain what you did in details ?
Typically on unix systems, for a reverse ssh tunnel, you can do this on your server behind the firewall:
ssh -NR ssh_port_AWS:localhost:ssh_port_local_server user#ip_AWS
You need to replace
ssh_port_AWS by the port of the distant server that you want to use to access the local server.
ssh_port_local_server by the port of the ssh server of your local server (if you don't change anything, 22).
user#ip_AWS by your AWS connection details (user#IP)

How to ssh port forward and access browser

There are complicated situation.
Participants: Laptop, development server, server2, server1.
From my laptop via ssh I need access development server (ssh only).
From development server I need access server2 (ssh only).
From servers2 browser (lynx) I need access server1 (uses https).
Is it possible to forward ssh ports and access server1 using my laptop browser?
Please, advice me :)
If you forward your ssh port, you cannot connect to the original server anymore. However, you can assign your ssh server different ports. These can be forwarded.