System Security
System Security covers packet filtering, OpenSSH hardening, and cryptographic tooling. The exam expects rules that work in order, services that stay reachable, and an understanding of key trust.
Core rules
- Netfilter rules are ordered; first match wins. A stateful host firewall sets default policies to DROP, permits loopback, accepts
ESTABLISHED,RELATED, then opens required services.iptables -A INPUT -p tcp --dport 22 -j ACCEPTappends;-Iinserts at the top. Persist withiptables-save/iptables-restoreor distro tooling. - Routing requires
net.ipv4.ip_forward=1and FORWARD rules plus NAT in thenattable. nftables uses tables, chains, and rules withct state established,related accept. sshd_config:PermitRootLogin no,PasswordAuthentication no,AllowUsers,Port. Key auth needs~/.sshmode 700 andauthorized_keys600;ssh-keygen -t ed25519creates keys.- GPG:
gpg --gen-key,--export,--import,--encrypt -r,--sign,--verify. Trust is separate from possession of a public key.
Worked example
Protect a web server: allow SSH only from 192.0.2.0/24, HTTP/HTTPS from anywhere, drop the rest. Commands: iptables -A INPUT -i lo -j ACCEPT; iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT; iptables -A INPUT -s 192.0.2.0/24 -p tcp --dport 22 -j ACCEPT; iptables -A INPUT -p tcp -m multiport --dports 80,443 -j ACCEPT; iptables -P INPUT DROP. Reasoning: allow loopback and established replies first, then the services, and set the default policy last so the active SSH session is not cut off.
Traps
Applying DROP before allowing your SSH session locks you out; putting the stateful rule after a broad drop blocks replies; forgetting FORWARD/NAT on a router; IPv6 remains open if only iptables is configured; SSH rejects keys with group/world-readable permissions; and importing a GPG key does not automatically trust it.