Skip to main content

Linux Hardening

Some information on linux hardening


Linux Hardening Overview

Linux Hardening Testing Checklist

AreaAction
1. File PermissionsEnsure sensitive files have restricted permissions.
Verify directory permissions and ownerships.
2. System UpdatesEnsure the system is up-to-date.
Check for installed kernel patches.
3. User Account SecurityDisable unused or unnecessary user accounts.
Lock or expire unnecessary accounts.
4. Password PoliciesEnforce strong password policies.
Set password expiration and history.
5. SSH ConfigurationDisable root login via SSH.
Disable password-based authentication for SSH.
Use SSH key pairs instead.
Enforce SSH protocol 2 only.
6. Firewall ConfigurationEnsure firewall is enabled and configured correctly.
Allow only necessary ports through the firewall.
7. File IntegrityImplement file integrity checking.
8. Logs and AuditingEnsure auditing is enabled and logs are monitored.
Check logs for suspicious activity.
9. Sudo and PrivilegesLimit sudo access to specific users.
Avoid unnecessary privileges to users.
10. Security UpdatesEnable automatic security updates.
11. Intrusion DetectionInstall an IDS system for monitoring.
12. System ServicesDisable unnecessary or unused services.
13. SELinux/AppArmorEnable SELinux or AppArmor for mandatory access control (MAC).
14. Cron JobsEnsure that cron jobs are secure and not vulnerable.
15. Network ConfigurationDisable IPv6 if not needed.
16. Kernel HardeningEnable kernel security features like grsecurity.
Disable core dumps to prevent information leakage.
17. Removal of Unnecessary PackagesRemove unnecessary software packages.
18. Virtualization HardeningDisable unnecessary virtualization features.
19. Secure Boot ConfigurationEnsure secure boot is enabled (if available).
20. EncryptionUse disk encryption for sensitive data.

Tools for Linux Hardening Testing

ToolPurpose
LynisAuditing tool for security hardening of Linux systems.
OpenSCAPCompliance scanning and vulnerability management tool.
TigerSecurity scanner to detect misconfigurations and vulnerabilities.
OSSECHost-based Intrusion Detection System.
AuditdAuditing framework to log and monitor system activities.
AIDEFile integrity checker to detect changes to critical files.
ChkrootkitRootkit detection tool.
RKHunterRootkit scanner for Linux systems.
NessusVulnerability scanning tool for system security checks.
NmapNetwork scanner used to detect open ports and services.
Fail2banProtects the system from brute force attacks by banning IPs.
NetcatNetworking utility often used in penetration testing.
SnortNetwork intrusion detection system (NIDS).
HIDS (Host-based IDS)For host intrusion detection.
SELinuxMandatory access control (MAC) implementation.
AppArmorMAC for Linux.

Conclusion

This checklist helps you systematically harden your Linux system and can be used with the tools provided to ensure maximum security. Regularly audit and update the system to stay protected against new vulnerabilities.