This is the minimum list of hardening and other steps that need to be performed to secure the Linux server containing the DIVOC platform. The assumption is that the installation happens on a bare metal setup. While the concepts remain the same, the methodology might differ for commercial cloud setups.
- Identifying open connections to the internet is a critical mission.
- Once you have identified the open ports, you can stop/purge the applications which keep unnecessary ports open.
- The only acceptable open ports are 22 and 443. Access to the other ports outside the Kubernetes network should be prohibited.
- All ingress should be routed through the 443 port only as needed.
SSH is secure, but we need to harden this service as well. If we can disable SSH, then the problem is solved. However, if we want to use it, we have to change the default configuration of SSH. Password-based authentication should be disabled and only key-based authentication should be allowed. The steps for creating sudo users with public and private keys are as follows:
- Create a non-root sudo user
- Add the user to sudo users group
usermod -aG sudo <user>
- Login to the machine as the user
su - <user>
- Create SSH directory with appropriate permissions
mkdir -p $HOME/.ssh chmod 0700 $HOME/.ssh
- Generate a key pair for the protocol, and run:
ssh-keygen -t ed25519 -C "My key for DIVOC server"
- Share the public key created with users you expect to connect to the server
- You can modify your SSH configuration to be more secure by performing the following changes to the configuration file:
- Make sure that root cannot login remotely through SSH
- Allow some specific users
- Enable public key-based authentication and disable password-based authentication
PubkeyAuthentication yes PasswordAuthentication no
- There are some additional options that must exist in the “sshd_config” file: MaxAuthTries 5
- Finally, set the permissions on the sshd_config file so that only root users can change its contents:
chown root:root /etc/ssh/sshd_config
chmod 600 /etc/ssh/sshd_config