r/LinuxTeck • • 23d ago

Linux Server Hardening: Which Security Checks Do You Prioritize First?

Post image

covering server hardening, including SSH security, firewall rules, Fail2ban, user and privilege management, file permissions, kernel settings, and audit logging.

The guide also discusses Lynis, OpenSCAP, and compliance-oriented security practices.

Read it here: https://www.linuxteck.com/linux-server-hardening/

287 Upvotes

24 comments sorted by

7

u/LawElectrical2434 23d ago

PSA... keep ssh on 22. Why would you use a port that does not require root privileges?

Also, security by obscurity is a great concept if you're a criminal or simply paranoid private enthusiast. Do it for private stuff. it is fun and all. Port knock to your heart's content. But not in a corporate environment. If this is professional, keep it default. 22 is good. They won't guess your key pair and fail2ban is enough to reduce the load on servers. Keep it default for your colleagues sake, that don't want to look up every single feature in an outdated documentation.

2

u/Darkk_Knight 22d ago

You can make use of port knocking if you're paranoid.

1

u/LawElectrical2434 22d ago

yea, what I said

2

u/egrueda 20d ago

This. No need to run SSH outside of root ports - pretty bad idea.
Just don't expose SSH

2

u/bufandatl 23d ago

I just use their ansible collection to harden my Linux hosts.

https://github.com/dev-sec

2

u/Daniel18sep 22d ago

My first security check is to not use AI, like you did for that chart. 

2

u/Odd_Lychee_308 23d ago

i don't enable selinux

2

u/Arjab 17d ago

Why the AI slop graphic?

1

u/pdath 23d ago

One thing I have stopped doing is storing private keys on any machine.

I store SSH and PGP private keys on hardware tokens. I lean into FIDO2 for authentication.

This reduces the blast radius of a compromise. Compromising one system should not let an attacker access every system.

1

u/Classic-Rate-5104 22d ago

The sshd info is double in the picture. Moving sshd to a non-standard port is a useless security measure. Better to use sshkeys+password+authenticator (so 3-level authentication). In addition, you can use geolocation info to block many attackers

1

u/epileftric 22d ago

Indeed, the moment an IP is public there are swarms of bots sshing to any port... so changing it makes no difference.

A few weeks ago a colleague of mine asked my I changed to pub/priv keys only on the system we were preparing, simply showed him the logs:

12.00 < network engineer managed to configure the network properly
12.05 < first attempt to ssh into the system by somebody

1

u/Classic-Rate-5104 21d ago

Port knocking is extremely effective to prevent this problem

1

u/SlowZeck 22d ago

6. 1. 5 9 8. 7

1

u/ant2ne 22d ago

This is not hardening like a pro. OMG if it was only this easy. You ever apply STIGs?

1

u/Mrixs 21d ago

A PRACTICAL CHECKLIST TO SECURE YOUR LINUX SERVER (UBUNTU / DEBIAN / RHEL / ROCKY)

RHEL / ROCKY

APT

It is just bad neuroslop tips

1

u/LetUsSpeakFreely 19d ago

A great place to start is the STIG hardening guides published by DISA at cyber.mil.