πŸ“œ Part of Pranav Kulkarni's technical portfolio Visit pranavkulkarni.org β†’
Lesson 1 Β· Security

Security Fundamentals

Understand Linux security principles and defense strategies.

Linux security isn’t one feature β€” it’s a discipline. The goal is to reduce risk by limiting what an attacker can do, detecting bad behavior early, and recovering quickly when something goes wrong.

Security Principles

  • β€’Least Privilege: Users and processes should have minimum necessary permissions
  • β€’Defense in Depth: Multiple layers of security controls
  • β€’Fail Secure: Systems should fail in a secure state

Threat Modeling (the practical version)

Before changing configs, decide what you’re defending against:

  • β€’What is the asset? (customer data, SSH access, API keys, production uptime)
  • β€’Who is the attacker? (internet scanners, insiders, compromised CI)
  • β€’What is the entry point? (SSH, web ports, exposed admin panels, weak creds)
  • β€’What’s the blast radius? (single host vs entire fleet, prod vs staging)

Attack Surface Inventory (quick checks)

# What ports are exposed?
$ ss -tulpn | head

# What services start at boot?
$ systemctl list-unit-files --type=service --state=enabled | head

# Who has sudo access?
$ getent group sudo
$ sudo -l

Security Checklist

  • βœ… Keep system updated (apt update && apt upgrade)
  • βœ… Use strong passwords and SSH keys
  • βœ… Configure firewall (iptables/ufw)
  • βœ… Disable unnecessary services
  • βœ… Monitor logs regularly
  • βœ… Set up intrusion detection (fail2ban)

What β€œgood” looks like (baseline)

  • β€’Patch hygiene: security updates applied quickly; reboot policy defined
  • β€’Strong auth: SSH keys, no root login, and no password auth (when possible)
  • β€’Minimal exposure: only required ports open; default deny inbound
  • β€’Logging: auth/service logs monitored; suspicious patterns alert
  • β€’Recovery: backups tested; secrets rotated; incident runbook exists

βœ… Practice (20 minutes)

  • List listening ports with ss -tulpn and explain why each must be open.
  • Check who can use sudo (getent group sudo and sudo -l).
  • Inspect authentication logs (journalctl -u ssh or /var/log/auth.log) and spot failed login attempts.