Security Quick Reference โ€ข 2026 Edition

Linux & Windows Server Hardening

Server hardening means shrinking your attack surfaceโ€”turning off what you don't need, locking down remote logins, and encrypting disksโ€”so one mistake doesn't hand over the whole machine.

๐Ÿ›ก๏ธ SysAdmin & Blue Team ๐ŸŸข Beginner-Friendly ๐Ÿ“‹ One-Click Copy ๐Ÿ“… Updated: 2026
ATTACK SURFACE REDUCTION LAYERS (OUTSIDE โ†’ INSIDE) 1. NETWORK UFW / Firewall Close unused ports Disable SMBv1 Blocks scanners 2. OS & KERNEL Patching & MAC unattended-upgrades SELinux / AppArmor Confines exploits 3. AUTH & ACCESS SSH Keys & LAPS PermitRootLogin no fail2ban + UAC + MFA Stops brute-force 4. DISK & AUDIT BitLocker / LUKS Full-disk encryption auditd + Event Logs Protects data at rest

Defense-in-Depth: If an attacker slips past the network firewall, OS confinement, strong auth, and disk encryption still stop them.

01 Linux SSH & OS Hardening

The #1 way fresh Linux cloud servers get compromised is weak SSH settings and unpatched packages. Lock down /etc/ssh/sshd_config, ban brute-force bots with fail2ban, and automate security patches.

sudo sshd Daemon OpenSSH server binary
-t Test Flag Checks config syntax before restart
/etc/ssh/sshd_config Config File Controls root login & key auth
PermitRootLogin no
Block Direct Root SSH Logins
Add to /etc/ssh/sshd_config. Real-world: Forces admins to log in as a normal user first and use sudo, stopping 24/7 root bot attacks.
PasswordAuthentication no
Require SSH Keys Only
Disables password guesses completely. Only apply after verifying your Ed25519 SSH key logs in cleanly!
sudo sshd -t && sudo systemctl reload ssh
Test Config & Safely Reload SSH
Validates syntax first with -t; if there's a typo, SSH won't crash or lock you out. (Use sshd on RHEL/AlmaLinux).
sudo apt install -y fail2ban && sudo systemctl enable --now fail2ban
Auto-Ban Brute-Force IPs
Watches auth logs and temporarily blocks any IP that fails SSH login repeatedly. Check jails with sudo fail2ban-client status sshd.
sudo apt install -y unattended-upgrades && sudo dpkg-reconfigure -plow unattended-upgrades
Automatic Security Updates (Debian/Ubuntu)
Installs critical security patches daily without manual intervention. On RHEL/Fedora, use dnf-automatic.

02 Linux Auditing & MAC (AppArmor vs SELinux)

Auditing records who changed what on your server. MAC (Mandatory Access Control) puts strict guardrails on appsโ€”so even if Nginx or Apache gets hacked, it can't read /etc/shadow.

sudo auditctl -w /etc/passwd -p wa -k user_changes
Watch Critical Files with auditd
Logs every write or attribute change to /etc/passwd under the search key user_changes.
sudo ausearch -k user_changes -ts today
Search Audit Logs by Key
Queries /var/log/audit/audit.log for today's events tagged user_changes. Great for spotting unauthorized account creation.
sudo lynis audit system
Run Full Hardening Score Scan
Audits kernel sysctls, SSH, file permissions, and installed packages, then gives a 0โ€“100 Hardening Index plus actionable fixes.
getenforce
Check SELinux Mode (RHEL / Rocky / Fedora)
Prints Enforcing (blocking + logging), Permissive (logging only), or Disabled. Use sudo aa-status on Ubuntu for AppArmor.
Feature AppArmor SELinux
Default Distros Ubuntu, Debian, SUSE RHEL, Rocky, AlmaLinux, Fedora
How It Confines File paths (e.g., /usr/sbin/nginx) Security labels on every file & process
Check Status sudo aa-status getenforce / sestatus
Beginner Difficulty Easier Stricter / Granular
๐Ÿง  Memory Trick: AppArmor vs SELinux

AppArmor = "App Paths" (Debian/Ubuntu uses readable file paths). SELinux = "Security Labels" (Red Hat tags every file and process like a VIP badgeโ€”if your badge doesn't match, access is denied).

03 Windows Server Hardening (PowerShell & CLI)

Windows Server hardening focuses on stopping ransomware lateral movement: encrypt drives with BitLocker, rotate local admin passwords with Windows LAPS, kill legacy SMBv1, and keep Defender & UAC active.

manage-bde -status
Check BitLocker Disk Encryption
Shows encryption percentage and protection status. Enable with manage-bde -on C: -RecoveryPassword (always back up the 48-digit recovery key!).
Get-LapsADPassword -Identity "SRV-01"
Windows LAPS (Unique Local Admin Passwords)
Automatically gives every server a different, rotating local Administrator password stored in AD/Entra IDโ€”stopping "pass-the-hash" lateral movement.
Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol -NoRestart
Disable Legacy SMBv1 Protocol
SMBv1 is the 1990s file-sharing protocol exploited by WannaCry ransomware. Verify it's off with Get-SmbServerConfiguration | Select EnableSMB1Protocol.
Get-MpComputerStatus | Select AntivirusEnabled, RealTimeProtectionEnabled
Verify Windows Defender Status
Confirms real-time malware protection and tamper protection are active. Both values should return True.
Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name EnableLUA
Verify UAC (User Account Control) is On
EnableLUA : 1 means UAC is active, preventing silent background apps from elevating to Administrator without a prompt.

04 CIS Top 10 Baseline Checklist

The Center for Internet Security (CIS) benchmarks are the gold-standard checklist used by auditors and cloud teams. Start with these 10 high-impact controls on every Linux or Windows server.

# Control Linux Implementation Windows Implementation
01 Least Privilege No direct root SSH; scoped sudoers Standard user + UAC; separate Admin accounts
02 MFA Everywhere SSH keys + PAM MFA for jump hosts Entra ID / AD MFA for RDP & admin portals
03 Automated Patching unattended-upgrades / dnf-automatic WSUS / Windows Update for Business
04 Centralized Logging auditd + rsyslog to SIEM Windows Event Forwarding (WEF) to SIEM
05 Disk Encryption LUKS full-disk encryption BitLocker (manage-bde) + TPM
06 Host Firewall ufw / nftables / firewalld Windows Defender Firewall (Domain/Public/Private)
07 Disable Legacy Protocols Remove Telnet, FTP, TLS 1.0/1.1 Disable SMBv1, NTLMv1, LLMNR
08 Unique Admin Creds Per-user SSH keys (never shared) Windows LAPS for local Administrator
09 Endpoint / MAC Defense AppArmor or SELinux Enforcing Defender AV + Attack Surface Reduction (ASR)
10 Tested Backups Encrypted offline/immutable snapshots VSS + offline/immutable backup + restore drill

05 Danger Zone & Quick-Copy Baseline

Hardening mistakes can lock you out of production or silently leave security wide open. Avoid these three classic traps:

โš ๏ธ Danger Zone: Common Hardening Mistakes
1. Disabling PasswordAuthentication no before testing your SSH key

If your public key isn't in ~/.ssh/authorized_keys with 600 permissions, reloading SSH locks you out immediately. Always keep one active root/sudo terminal open while testing a second SSH key session.

2. Running setenforce 0 and leaving SELinux in Permissive mode in prod

setenforce 0 is great for 5 minutes of troubleshooting, but leaving it off disables kernel confinement permanently. Fix the policy or file context with restorecon -Rv and switch back to setenforce 1.

3. Turning on BitLocker without backing up the 48-digit Recovery Key

A BIOS/TPM firmware update can trigger BitLocker recovery on reboot. Without the recovery key escrowed in AD/Entra ID or a password vault, your server data is permanently unreadable.

๐Ÿ›ก๏ธ Quick-Copy: Linux Hardening Audit & SSH Check
sudo sshd -t                              # 1. Verify SSH config syntax has zero errors
sudo systemctl status fail2ban --no-pager # 2. Confirm brute-force protection is active
sudo lynis audit system --quick           # 3. Run non-interactive hardening audit