Security Setup
This is basic security setup that we use to protect our servers
Last updated
Was this helpful?
This is basic security setup that we use to protect our servers
Last updated
Was this helpful?
Have an application to create keypair. In this case, we will use MobaXterm
Go to mobaxterm and open MobaKeyGen
Choose EdDSA and change the dropdown to Ed25519 > Generate
When generating, you will be asked to move your mouse randomly inside the red highlighted part.
After generating, you will see screen like below
you can change the key comment as you like, and save both keys securely. privatekey is the one that you will use to authenticate to your server later.
The item marked in green is the one we'll use in the next step.
The provided script sets up a new user and enhances server security through several measures. It installs essential packages and configures SSH for secure access by disabling root login and password authentication, allowing only public key authentication. Fail2ban is installed and configured to protect against brute-force attacks by temporarily banning IPs with failed login attempts. The modified SSH configuration restricts various forwarding options, reducing the attack surface. These combined steps provide enhanced protection against unauthorized access.
This script will prevent you to login as root directly and only allow whitelisted user to login with PRIVATEKEY, NOT PASSWORD.
DO WITH CARE OR YOU WILL LOSE ACCESS TO YOUR SERVER. YOU'VE BEEN WARNED!
Modify below script accordingly, change the PUB_KEY and USER part based on your needs, re-check the script and execute.
Now your server is slightly secured. Not that we make it bullet proof, but at least we reduced some of the risks of being hacked. 😁