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 have 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, and Disable Password Authentication as Public key-based authentication is recommended
[email protected]#~ vi /etc/sshd/sshd_config
#Allow Key-based authentication as its harder to brute-force 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.