Nine spreads on the ideas that matter: what you're protecting, who's attacking, and the layers that keep the damage small.
"Assume breach. Reduce the attack surface, verify identity, encrypt, monitor, and rehearse the response."
This book is defensive. For hands-on testing see the Kali book, and only on systems you're authorized to test. Use the tabs or ← → keys.
Security is risk management. You can't stop everything, so you decide what matters most and spend effort there.
| Threat | What it looks like | Main defence |
|---|---|---|
| Phishing | fake email asks for a login | MFA, training, mail filtering |
| Malware / ransomware | code encrypts or steals files | patching, EDR, offline backups |
| Credential stuffing | leaked passwords replayed | unique passwords, MFA, rate limits |
| Insider | staff misuse access | least privilege, logging |
| DoS | flood knocks service over | CDN, rate limiting, capacity |
| Supply chain | bad dependency or vendor | pin, scan, vet vendors |
"Which of confidentiality, integrity, or availability is at stake, and what's the business impact?"
HTTPS combines them: asymmetric crypto proves the server's identity and agrees a key, then fast symmetric crypto protects the traffic. Never invent your own crypto. Use vetted libraries.
$ sha256sum report.pdf # fingerprint $ openssl rand -base64 32 # strong random key $ openssl enc -aes-256-cbc -pbkdf2 -in a.txt -out a.enc $ openssl enc -d -aes-256-cbc -pbkdf2 -in a.enc $ ssh-keygen -t ed25519 # key pair $ openssl s_client -connect example.com:443 </dev/null | openssl x509 -noout -dates
"TLS in transit, AES at rest, keys in a KMS, and nobody rolls their own crypto."
Authentication proves identity. Authorization decides what that identity may do. Strong MFA blocks the large majority of account takeovers.
$ lastlog | head ; last -n 10 # recent logins $ sudo awk -F: '$2==""{print $1}' /etc/shadow # empty passwords? $ grep -E '^(sudo|wheel)' /etc/group # who's admin
"Phishing-resistant MFA, SSO, least-privilege roles, and a quarterly access review."
Every open port is attack surface. Firewalls default to deny. Segmentation keeps a compromised laptop from reaching the database.
$ sudo ss -tulpn # what's listening $ sudo ufw default deny incoming $ sudo ufw allow 22/tcp ; sudo ufw allow 443/tcp $ sudo ufw enable ; sudo ufw status verbose $ nmap -sV 192.168.1.0/24 # only on your own network
"Default deny, segmented zones, and nothing on the internet that doesn't need to be."
$ sudo apt update && sudo apt upgrade -y $ sudo apt install unattended-upgrades fail2ban $ sudo systemctl disable --now cups # stop unused services $ sudoedit /etc/ssh/sshd_config PermitRootLogin no PasswordAuthentication no # keys only $ sudo systemctl reload ssh $ lsblk -f # is the disk encrypted (crypto_LUKS)?
"Patched, minimal, key-only SSH, encrypted disk, EDR, and a restore we've actually tested."
$ npm audit # known-vulnerable dependencies $ pip-audit ; trivy fs . # Python deps / files / images $ gitleaks detect # secrets committed to git? $ curl -sI https://yoursite.com | grep -i -E 'strict|content-security|x-frame'
"Input validated, queries parameterized, output encoded, and dependency scans gate the build."
Prevention fails sometimes. Detection shortens the time an attacker stays unnoticed (dwell time). Centralize logs, keep them tamper-resistant, and write alerts for things that really matter.
$ sudo grep "Failed password" /var/log/auth.log | tail $ sudo grep "Failed password" /var/log/auth.log \ | awk '{print $(NF-3)}' | sort | uniq -c | sort -rn | head $ journalctl -u ssh --since "1 hour ago" $ sudo fail2ban-client status sshd
"Central logging, correlation rules mapped to ATT&CK, and tuned alerts someone actually reads."
$ sudo journalctl --since "yesterday" > /evidence/journal.txt $ sha256sum /evidence/* > /evidence/SHA256SUMS # prove it wasn't altered $ sudo ip link set eth0 down # isolate, if it's safe to
"Contain first, preserve evidence, communicate on schedule, and run a blameless post-mortem."
Rate each risk by likelihood and impact, then choose: reduce it with controls, transfer it (insurance), avoid it, or knowingly accept it.
Paths in: CompTIA Security+, then Blue Team Level 1, CySA+, or SC-200. Practice defence on free labs like Blue Team Labs Online and CyberDefenders.
"We rank by risk, cover the CIS basics first, and treat training and reporting as controls too."