Security Quick Reference • 2026 Edition

Cybersecurity: OpenSSL, Firewalls, Nmap & Hardening

Your pocket reference for locking down Linux servers, verifying TLS certificates, auditing open ports, and choosing modern encryption without locking yourself out.

🛡️ SysAdmin & SecOps 🟢 Beginner-Friendly 📋 One-Click Copy 📅 Updated: 2026
THE CIA TRIAD (THE GOAL) DATA Security Confidentiality Integrity Availability Encrypt (TLS/AES) • Hash (SHA-256) • Firewalls DEFENSE-IN-DEPTH (LAYERS) 1. Perimeter: Firewall (UFW / iptables / firewalld) 2. Network & Access: TLS 1.3 + SSH Keys + Fail2Ban 3. Host & Audit: Minimal Ports (ss / nmap) 4. Data: AES-256 & Argon2id

If one security layer fails, the next layer stops the attacker. Never rely on a single lock.

1 Firewall Commands (UFW, iptables, firewalld)

A firewall is your server's bouncer: it checks every incoming packet against a rule list before letting it reach an app. Beginners usually start with UFW (Ubuntu/Debian) or firewalld (RHEL/Alma/Fedora), both of which sit on top of Linux kernel filtering.

ToolufwFirewall manager
ActionallowPermit traffic
Target22/tcpSSH port & protocol

UFW (Ubuntu / Debian)

sudo ufw status verbose
Check Firewall Status
Shows whether UFW is active, default policies, and all open ports.
sudo ufw allow 22/tcp
Allow SSH (Do This First!)
Keeps your remote SSH terminal open before turning the firewall on.
sudo ufw allow 443/tcp
Allow HTTPS Web Traffic
Lets encrypted web traffic reach Nginx or Apache on port 443.
sudo ufw deny from 203.0.113.50
Block a Specific IP
Drops all incoming connections from an abusive IP address.
sudo ufw enable
Turn On Firewall
Activates UFW now and ensures it starts automatically on reboot.

iptables & firewalld (Low-Level & RHEL/Fedora)

sudo iptables -L -n -v
Inspect Kernel Rules
Lists chains with numeric IPs (-n, fast) and packet counters (-v).
sudo firewall-cmd --list-all
Show Active firewalld Zone
Displays allowed services, ports, and interfaces on RHEL/Alma/Fedora.
sudo firewall-cmd --permanent --add-service=https && sudo firewall-cmd --reload
Allow HTTPS Permanently
Saves the rule across reboots and applies it immediately with --reload.
🧠 Memory Trick: "Allow Before Enable"

Think of UFW like locking a house from the inside: make sure you have your key (ufw allow 22/tcp) before you slam the deadbolt (ufw enable).

2 OpenSSL & Hashing Quick Commands

OpenSSL is the Swiss Army knife for TLS certificates and encryption, while hashing creates a unique digital fingerprint of a file so you can prove it wasn't tampered with.

openssl s_client -connect example.com:443 -servername example.com
Inspect a Live TLS Certificate
Connects to a server's HTTPS port and prints its certificate chain, TLS version, and expiry.
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
Create Self-Signed Lab Cert
Generates a 4096-bit RSA key and 1-year certificate for local dev/testing (-nodes skips passphrase).
sha256sum installer.iso
Verify File Integrity
Prints the 64-character SHA-256 fingerprint—compare it to the vendor's checksum before installing.
ssh-keygen -t ed25519 -C "work-laptop"
Generate Modern SSH Key
Creates a fast, high-security Ed25519 keypair to replace password logins on servers.
openssl rand -base64 32
Generate Cryptographic Secret
Outputs 32 random bytes encoded in Base64—ideal for API tokens or database passwords.
🧠 Memory Trick: Encryption vs. Hashing

Encryption (AES, TLS) is a locked box—you can unlock it with the key. Hashing (SHA-256) is a blender—you can't turn the smoothie back into fruit, only check if two smoothies match.

3 Network Auditing & Port Inspection

⚖️ Authorized Lab & Audit Use Only: Only run active port scans like nmap against systems you own or have explicit written permission to test. Scanning third-party networks without authorization may violate laws and terms of service.
nmap -sV -sC 192.168.56.10
Service & Script Scan
Detects open ports, running service versions (-sV), and runs safe default checks (-sC).
ss -tulpn
Show Local Listening Ports
Lists every TCP (t) & UDP (u) listening (l) socket with numeric ports (n) and process IDs (p).
sudo fail2ban-client status sshd
Check Brute-Force Bans
Shows how many failed SSH attempts Fail2Ban has caught and which attacker IPs are currently banned.

Common Ports to Watch

22/TCP SSH   53/UDP+TCP DNS   80/TCP HTTP   443/TCP HTTPS   3306/TCP MySQL   5432/TCP PostgreSQL

4 Encryption & Security Protocols Quick Table

Use this cheat table to pick the right cryptographic standard for data at rest, data in transit, passwords, Wi-Fi, and user logins.

Protocol / Standard Type Status (2026) When to Use & Why
AES-256-GCM Symmetric Encryption Recommended Encrypting files, disks (LUKS), and databases. Same key locks & unlocks; GCM also verifies integrity.
ECC (Ed25519 / X25519) vs RSA-4096 Asymmetric (Public/Private) ECC Preferred SSH keys & TLS handshakes. ECC gives equal security to RSA-3072/4096 with tiny, fast keys.
Argon2id vs SHA-256 Password Hashing vs File Integrity Role-Specific Argon2id for passwords (slow + memory-hard stops GPUs). SHA-256 for file checksums (fast).
TLS 1.3 Transport Security Required Secures HTTPS traffic. Faster 1-RTT handshake and removes weak legacy ciphers (disable TLS 1.0/1.1).
WPA3-Personal / Enterprise Wi-Fi Security Recommended Replaces WPA2; uses SAE handshake to block offline dictionary cracking of your Wi-Fi password.
MFA (FIDO2 / TOTP) Authentication Factors Essential Combines Something you know (password) + have (hardware key / authenticator app) + are (biometric).

5 Danger Zone & Quick Hardening

⚠️ The Danger Zone: 3 Mistakes That Break or Expose Servers
1. Running ufw enable before ufw allow 22/tcp

UFW blocks all incoming traffic by default. If you enable it on a cloud VM without allowing SSH first, your terminal drops immediately and you are locked out.

2. Using MD5 or SHA-1 (or plain SHA-256) for passwords

MD5 and SHA-1 are cryptographically broken, and plain SHA-256 is too fast—modern GPUs can guess billions of passwords per second. Always use Argon2id or bcrypt with a salt.

3. Leaving PermitRootLogin yes in /etc/ssh/sshd_config

Botnets hammer the root username 24/7. Set PermitRootLogin no and PasswordAuthentication no after testing your Ed25519 SSH key.

🛡️ Quick-Copy: Safe First-5-Minutes Server Baseline (Ubuntu/Debian)
sudo ufw allow 22/tcp          # 1. Keep SSH open first
sudo ufw allow 443/tcp         # 2. Allow HTTPS if hosting web apps
sudo ufw --force enable        # 3. Turn on firewall safely
sudo apt update && sudo apt install -y fail2ban
sudo ss -tulpn                 # 4. Verify only expected ports listen