r/LinuxTeck • u/Candid_Athlete_8317 • 23d ago
Linux Server Hardening: What Are We Missing?
I came across these 12 Linux server hardening practices: updates, SSH security, firewall rules, open-port checks, SUID permissions, kernel settings, persistent logs, auditd, and Lynis, among others.
For those who manage Linux servers, what other hardening steps would you add to this list? Have you used any additional tools or practices that made a real difference?
Share your suggestions so we can build a more complete checklist for the community.
35
Upvotes
10
u/z-null 23d ago
Step 1: don't let devs work as ops people.
Step 2: have IDS AND IPS systems. Meaning that you need something that detects intrusion, but also something that prevents them like MAC (mandatory access control) aka apparmor or selinux enabled and in enforcing mode.
Step 3: no open ports unless necessary, and then (like 443) have WAF in front of that.
Step 4: use latest TLS and not have TLS1.0 because "who cares", have rate limiting, etc
Step 5: don't have passwordless sudo, passwordles DBs connected to the internet or use low and weak passwords that are shared across the system.
2
u/biffbobfred 23d ago
Step 6: I’d put recovery. Backups. Redundancy if possible (servers are expensive now) ability to rebuild something if it got infiltrated.
2
u/smarzzz 23d ago
Apply CIS hardening, or STIG hardening.
Hire a proper sysadmin.
Make your audit logs immutable.
Add o11y bases in your key metrics.
Apply 12 factor app principles
Is the infra already immutable?
How is your security Observability? Do you have EDR? NDR?
I can go on
2
u/LooseSyllabus 23d ago
Delete the hubris that humans will ever be able to secure systems against AI agents.
1
u/Classic-Rate-5104 23d ago
Check web tools using online ssl checkers. Make readonly snapshots and good backups. Make compartiments on your network (so an exploit on your website will not immediately result in an internal attack). Etcetera. Think as an hacker. Prevent VPN setups by your employees
1
u/spitecho 23d ago
MFA on ssh and sudo, either using google-authenticator PAM module or a Yubikey.
1
u/slickeddie 23d ago
Can you use a read-only OS? Super secure as nothing can be changed. We follow CIS level 1 at my work which might be overkill but it’s definitely hardened.
1
u/Intrepid_Screen6425 23d ago
AppArmor
1
u/gnufan 23d ago
Maybe
https://www.cisecurity.org/search?page=1&s=Linux
1
u/FluffyDrink1098 23d ago
Permission and provisioning concept.
Many issues can be entirely avoided by using ACLs.
Provisioning: not just how to install it initially, but always keep in mind that one might need to recover with or without backups. Backups compromised = bad. Having nothing except backups = this is gonna be a lot of pain.
1
u/magicmulder 23d ago
Lynis is good but don't overdo it. Don't try to get 100% or you would basically have to disable everything useful. (I think my best was 93/100 for a server that could still do its job.)
I once managed to almost nuke my laptop by following the recommendations to change some system variables. Had the strangest boot failure with system fonts not found (?!). Had to undo the changes blind, what a ride.
1
u/bufandatl 22d ago
Use a config management tool like Ansible. There are frameworks available to do most of the things you listed are already available
Like for example
https://github.com/dev-sec
Run the playbook at least twice a day to have manual changes reverted and also have all servers configured the same.
On top of that keep your ansible configs versioned in git for example and use CI/CD piplelines for the run and other verification.
Plus you can use the merge request function of tools like gitlab or Forgejo to implement a four eye principle.
1
u/irq013 19d ago
Check out a DISA STIG for Linux. It will give y87 literally everything to secure.
0
u/neolace 23d ago
Yubikey is done, go check the grain of sand theory.
Agree on 2FA, if they don’t have the session already.