How to secure SSH jump server / SSH bastion host / SSH gateway
Security measures to harden Ezeelogin Linux SSH Jump server
- Two factor authentication - Enforce 2 factor authentication like Google 2FA Auth or Yubikey 2FA or DUO Security so that both the Ezeelogin web gui and ssh interface has an additional layer of protection.
- SSL For HTTPS - Enable ssl and access your web gui using https only. You would need to install your ssl certificate for the gui and then enable ssl mode in ezeelogin settings. Once the ssl certificates are installed, refer How to enable or force ssl or disable ssl
- Enable Captcha - Enable reCaptcha for the web gui in the ezeelogin settings
- Hardening SSH Server Daemon configuration file.
Disable password authentication, Disable AllowTCPForwarding, Disable Password Authentication as Public key based authentication is recommended
root@jump#~ vi /etc/sshd/sshd_config
#Allow Key based authentication as its harder to bruteforce or sniff than a password
Pubkeyauthentication yes#Disable password authentication to the jump server as key based authentication is much more secure.Make sure to enable this under localhost section below.#Make sure to add in your SSH Public key before you disable password authentication to prevent lock outs.
#Disable Tcp Forwarding on the jump server
#Disable direct root logins to servers and instead login as non privileged user and switch to root
#Make sure that a non privileged user can ssh and switch to become a root user before disabling direct root login.
- Enable Firewall and Lockdown access - Always, restrict the ips from which staffs are allowed to ssh from. You should be allowing only your ips, employees ips and the default rule should block ssh for everyone and should be granted explicitly. You can achieve this using iptables or setting up rules in host.allow/hosts.deny files.
- SSH Gateway behind VPN is Very Good - Having the SSH Jump server behind a VPN is very good as it prevents unauthorized traffic. This is highly recommended.