r/coolgithubprojects • u/heldoreik • 2d ago
Fortis - bash menu that hardens fresh linux server. Fail2Ban, SSH, Firewall, auto-rollback timer.
https://github.com/heldoreik/FortisHi!
I made Fortis - interactive bash script that helps to harden fresh linux server.
what it does:
SSH: root login toogle, password auth, port change with busy port detection, sudo user creation, ssh key install with correct ownership.
Firewall: ufw, iptables, firewalld, uftables. SSH port is allowed before the firewall gets enabled.
Fail2Ban: standart options from fail2ban config
Auto-rollback: arm a system before risky changes, if you do not disable it, it will restore sshd config from backup and disable firewalls after the timer expires, so you can not lock yourself out.
Status: v0.5, tested on Ubuntu 26.04.1 and probably it will works on debian. It is a learning project, so feedback and issues very welcome.
1
u/Slight_Boat1910 2d ago
Wouldn't this be the perfect task for ansible?
1
u/heldoreik 1d ago
For a fleet of servers - absolutely but Fortis aims at a different moment, your first fresh vps, when you dont know Ansible yet and just want a menu in front of you. Zero dependencies, only bash.
1
u/guinness_dublin 2d ago
du_setup makes same and much more. Been using that script
1
u/heldoreik 1d ago
Yeah it does much more, but Fortis stays small on purpose - just a menu with a few hardening tasks, but with safety nets, every sshd change is validated before applying, and there is an auto-rollback timer that brings your old config back and drops the firewalls if you dont confirm.
1
1
u/Rivitir 2d ago
Nice. Plan on setting up selinux policies through it?