A simple and interactive script to set up and harden a fresh Ubuntu VPS.
Servo is meant to be used on a freshly provisioned Ubuntu VPS.
-
SSH into your machine, as root.
-
Download the latest release (currently: v0.0.1) of
servo.sh:
$ curl -O https://raw.githubusercontent.com/mjsarfatti/servo/refs/tags/v0.0.1/dist/servo.sh- Make sure the script is executable, then run it:
$ chmod +x servo.sh
$ ./servo.shPS: you can invoke the script with --dry-run to see every command it would launch.
$ ./servo.sh --dry-run-
Create a non-root sudo user
→ You will be asked to choose a username -
Set up SSH key authentication
→ You will be asked to paste your public key, make sure you have it already created and handy -
Harden the SSH configuration
→ You will be able to specify an alternative port to 22
→ You will be able to prohibit root login either entirely, or keeping key-based login open -
Update and upgrade the system
-
Install essential packages
(build-essential,git,ufw,fail2ban) -
Enable unattended upgrades
(security patches only) -
Configure
fail2ban -
Configure
ufw(firewall)
(it will make sure to open the SSH port you specified above)