

In setups like this you may also want to consider the following: Private keysĭon’t provision these on your bastion host. Alternatively you can just use the private IP address for the protected server on the Host line of. This domain should only be resolvable within members of the private network - either by using an internal DNS server or by simply modifying /etc/hosts on the bastion. I used domain names in the examples above to make the process clearer.Īlso, in the above example I refer to the domain for use within the private network. Instead you can just include the IP address directly in the ProxyJump line of. Generally I would probably avoid assigning public domain names to a bastion host, as this may invite unwanted attention and traffic (even if the host is secured). Note: depending on your system you may need to add the key to your local agent first, but you just need to do this once per login ( ssh-add ~/.ssh/identity). SSH port-forwarding is a widely-used concept, in which a secure tunnel to a service running on the protected server is opened via a port on the local machine (using ssh’s -L option).Īnother option is to use proxy jumping (with the -J option): This server then enables administrators to connect through to the protected servers in order to carry out maintenance, upgrades, or other tasks. They often accept SSH connections, from which one can “jump” through to the protected servers through the bastion’s private networking interface.īastion hosts should be hardened as much as possible (with firewalls and other network rules), and should run a limited set of services - in many cases simply SSHd. Bastion hostsīastion hosts - like the NAT gateway and load balancers - sit in the public subnet and so they are available to the outside world. Traditionally this is done by introducing bastion hosts into your network. Now the question is around how one does manage the services running on the protected server, since it is no longer available to connect to.

In both these cases the NAT gateway and load-balancer would exist in public subnets (with internet-facing network interfaces) and can reach the sensitive server through private network interfaces in order to forward requests (e.g. In this type of scenario, outbound traffic from the sensitive server can be routed through a NAT gateway and inbound traffic can be funnelled through a load-balancer or reverse proxy server. This means that the server is not reachable from the outside world.

This is usually done by placing these “sensitive/protected” servers in a private subnet, without direct internet-facing network interfaces. In more complex production scenarios heightened security can be achieved by isolating application (webapp, API, database, etc.) servers from external internet traffic. Linode has some great getting-started guides on the essentials of securing your server. Such servers should be hardened with firewalls, employ an SSHd config that denies root and password-based login, run fail2ban, and other services and practices.

Disclaimer: The challenge focuses on writing frequency rather than quality, and so posts may not always be fully planned out!įor many small or personal services running on a VPS in the cloud, administration is often done by connecting directly to the server via SSH.
Ssh tunnel through bastion host series#
This article is one of a series of posts I have written for the 100 Days to Offload challenge.
