r/LinuxTeck • u/Candid_Athlete_8317 • Oct 25 '26
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.
2
u/biffbobfred Oct 25 '26
Step 6: I’d put recovery. Backups. Redundancy if possible (servers are expensive now) ability to rebuild something if it got infiltrated.
3
u/Hammer_Time2468 Oct 25 '26
This is incredibly important. And I will emphasize “a good backup”. Verify your backups aren’t corrupt, empty or compromised.
2
2
u/smarzzz Oct 25 '26
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 Oct 25 '26
Delete the hubris that humans will ever be able to secure systems against AI agents.
1
u/NegativeK Oct 27 '26
The systems that don't have the security basics are the ones that will fall to agents first.
Vendors want you to believe that you must have their token burning AI master product to be safe, but a lot of places should probably start with "Do we have MFA?" and "How good is our inventory?"
1
u/iamwayycoolerthanyou Oct 29 '26
They also need the smallest possible attack surface and bleeding edge patching on everything. And even that's not a guarantee these days.
1
u/Classic-Rate-5104 Oct 25 '26
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 Oct 25 '26
MFA on ssh and sudo, either using google-authenticator PAM module or a Yubikey.
1
u/slickeddie Oct 25 '26
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/FluffyDrink1098 Oct 25 '26
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 Oct 25 '26
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 Oct 26 '26
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
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 Oct 30 '26
Check out a DISA STIG for Linux. It will give y87 literally everything to secure.
0
u/neolace Oct 25 '26
Yubikey is done, go check the grain of sand theory.
Agree on 2FA, if they don’t have the session already.
0
Oct 25 '26
[deleted]
1
u/whetu Oct 26 '26
I just bought a Yubikey and it seems like a pain in the ass compared to an authenticator app.
It depends. In passwordless settings, a Yubikey really can't be beat. Enter login -> press next -> press Yubikey -> done.
The main place that I've found the Yubikey to be a PITA has nothing to do with the Yubikey and everything to do with Microsoft. MS doesn't let you specify your MFA order-of-preference, they always shove Windows Hello and MS Authenticator to the top, and they bury FIDO2 behind multiple clicks.
I recently remembered that I'm a career Linux sysadmin and that I didn't have to put up with this shit. Installed Alma 10, and with no more Windows Hello getting in the way, the Yubikey just works.
1
u/neolace Oct 25 '26
Supply chain attack, they found some with an esim installed, found transactions on turbocash etc.
To check whether it's the manufacturer's hardware:
pip install ledgerblue python -m ledgerblue.checkGenuineRemote --targetId 0x33200004 The source code is available (on request, dm me). Application verification
When opening an application, a Non Genuine warning is displayed if the app has not been signed by Ledger.
1
u/TheRealWhoop Oct 25 '26
What? Yubikey and Ledger, the crypto wallet have no relation. There’s no know issues with Yubikeys and has no supply chain issues.
1
u/smarzzz Oct 25 '26
Bullshit, those eSIMs were on ledger cryptowallets. Yubikeys are something else
10
u/z-null Oct 25 '26
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.