Ansible playbook to setup an SSH bastion server and clients.
- Non-standard SSH port for bastion
- Require key and password for bastion connections
- 5 minute connection timeout
- Login within 30 seconds of initial connection
- Disable SSHv1
- Separate key for connection to bastion and further hosts
- No warnings from
ssh-audit
Some of the hardening and configuration is based on https://joscor.com/blog/hardening-openssh-server-ubuntu-14-04/.
- Modify the values in
vars.ymlto match your requirements:useris the user to be used on both the client and bastion machinesbastion_ssh_keyis the key to use to connect to the bastion machine.enable_rootenables SSH connections as root to the bastionbastion_ipis the IP of the bastion, to be baked into the config of the clients.
- Populate
hostswith your required hosts. A singlebastion, and however manyclients.standalonecan be used to configure clients who don't require connections through the bastion. - Run the playbook with
ansible-playbook bastion.yml -i hosts --ask-pass -K