Linux Hardening
What this is: Securing Linux systems by reducing attack surface, enforcing least privilege, and implementing defence-in-depth controls.
Competition relevance: Infrastructure hardening. Core skill for all competition levels.
Why it matters: Linux hardening tasks are high-value, clearly defined, and have explicit marking criteria. Correct hardening without breaking services is essential.
WSOS 2026 alignment: This topic directly supports Section 4: Secure systems operation and maintenance (configuring and securing systems) and Section 5: Secure systems protection and defence (implementing security controls). You demonstrate competence by hardening Linux systems to industry standards under time pressure.
Competition area: This topic is core to the infrastructure hardening area, where you harden server environments to reduce attack surface and enforce security policies.
Offline competence: In competition environments with limited or no internet, use man pages (e.g., man iptables, man sshd_config, man chmod), check /usr/share/doc for package documentation, and prepare Zeal docsets or Kiwix offline resources for reference materials.
Competency Matrix
Section titled “Competency Matrix”| Level | Expectation |
|---|---|
| Regional | Disable obvious insecure services (telnet, FTP). Configure UFW firewall. Disable root SSH login. Set file permissions on sensitive files. |
| National | SELinux/AppArmor basic policies. iptables rule chains. SSH hardening with fail2ban. Audit daemon configuration. Automated hardening scripts. |
| Squad/Team Selection | SELinux troubleshooting and custom policies. Complex iptables with NAT/forwarding. Advanced SSH configurations (certificates, port knocking). |
| International | Zero-trust network segmentation. Kernel hardening (sysctl). Container security. Performance impact analysis of security controls. |
Technical Content
Section titled “Technical Content”Basic Hardening
Section titled “Basic Hardening”Core principle: Minimize attack surface by disabling unnecessary services and enforcing secure defaults.
Essential tasks:
- Disable insecure services:
# Check running servicessystemctl list-units --type=service --state=running
# Disable telnet, FTP, rshsystemctl stop telnet.socketsystemctl disable telnet.socketsystemctl stop vsftpdsystemctl disable vsftpd- Remove unnecessary packages:
# List installed packagesdpkg -l | grep -E "telnet|ftp|rsh"
# Remove insecure packagesapt remove telnet ftp rsh-client rsh-server- Secure file permissions:
# /etc/passwd should be 644, /etc/shadow should be 640chmod 644 /etc/passwdchmod 640 /etc/shadow
# Secure SSH configchmod 600 /etc/ssh/sshd_config
# World-writable files are dangerousfind / -xdev -type f -perm -0002 -ls 2>/dev/null- Disable root login:
# Edit /etc/passwd or use usermodusermod -s /sbin/nologin root
# For SSH specifically, edit /etc/ssh/sshd_config# PermitRootLogin noCompetition context: These are quick wins (5-15 minutes each). Always screenshot before/after state. Document what you disabled and why.
Firewall Configuration
Section titled “Firewall Configuration”UFW (Uncomplicated Firewall):
# Enable UFWufw enable
# Default policiesufw default deny incomingufw default allow outgoing
# Allow specific servicesufw allow 22/tcp # SSHufw allow 80/tcp # HTTPufw allow 443/tcp # HTTPS
# Allow from specific IPufw allow from 192.168.1.100 to any port 22
# Check statusufw status verboseiptables (more control):
# View current rulesiptables -L -v -n
# Flush existing rules (careful!)iptables -F
# Set default policiesiptables -P INPUT DROPiptables -P FORWARD DROPiptables -P OUTPUT ACCEPT
# Allow established connectionsiptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow loopbackiptables -A INPUT -i lo -j ACCEPT
# Allow SSHiptables -A INPUT -p tcp --dport 22 -j ACCEPT
# Save rulesiptables-save > /etc/iptables/rules.v4Competition context: Firewall rules are a large part of most hardening tasks. Test after each rule to ensure services still work.
SSH Hardening
Section titled “SSH Hardening”Essential sshd_config changes:
# Edit /etc/ssh/sshd_configPermitRootLogin noPasswordAuthentication yes # Set to 'no' for key-only at higher levelsPermitEmptyPasswords noX11Forwarding noMaxAuthTries 3ClientAliveInterval 300ClientAliveCountMax 2AllowUsers specificuser # Whitelist usersPort 2222 # Non-standard port (national+)
# Restart SSHsystemctl restart sshdKey-based authentication (national+):
# Generate key pairssh-keygen -t ed25519 -C "competition-key"
# Copy to serverssh-copy-id user@server
# Disable password auth in sshd_configPasswordAuthentication nofail2ban integration (national+):
# Install fail2banapt install fail2ban
# Configure /etc/fail2ban/jail.local[sshd]enabled = trueport = 22filter = sshdlogpath = /var/log/auth.logmaxretry = 3bantime = 3600
# Start fail2bansystemctl enable fail2bansystemctl start fail2ban
# Check statusfail2ban-client status sshdMandatory Access Control
Section titled “Mandatory Access Control”SELinux basics (RHEL/CentOS):
# Check SELinux statussestatusgetenforce
# Set enforcing modesetenforce 1
# Make permanent in /etc/selinux/configSELINUX=enforcing
# View contextsls -Z /var/www/html
# Restore default contextsrestorecon -Rv /var/www/html
# Check for denialsausearch -m avc -ts recentAppArmor basics (Ubuntu/Debian):
# Check statusaa-status
# Enforce a profileaa-enforce /etc/apparmor.d/usr.sbin.apache2
# Complain mode (log only)aa-complain /etc/apparmor.d/usr.sbin.apache2
# Reload profilessystemctl reload apparmorCompetition context: SELinux/AppArmor appears at national+ level. Expect to enforce existing profiles, not write custom policies (unless international).
User and Privilege Management
Section titled “User and Privilege Management”sudo configuration:
# Edit /etc/sudoers with visudo# Allow user to run specific commandsuser ALL=(ALL) /usr/bin/systemctl restart apache2
# Disable password for sudo (dangerous - only if task requires)user ALL=(ALL) NOPASSWD: ALL
# Audit sudo usagegrep sudo /var/log/auth.logPassword policies:
# Install password quality checkerapt install libpam-pwquality
# Edit /etc/security/pwquality.confminlen = 12dcredit = -1ucredit = -1ocredit = -1lcredit = -1
# Force password changechage -d 0 usernameCompetition Strategy & Marking
Section titled “Competition Strategy & Marking”What gets marked:
- Services disabled correctly (systemctl status screenshots)
- Firewall rules implemented (ufw status or iptables -L output)
- SSH configuration changes (before/after sshd_config snippets)
- Users/permissions corrected (ls -l screenshots)
Evidence and reporting requirements:
- Before/after screenshots for every change (systemctl status, ufw status, ls -l output)
- Configuration file snippets showing exact changes (diff format preferred)
- Service status output proving changes persisted after reboot (systemctl status after reboot)
- Written justification for each hardening action (why this change improves security)
- Documented testing (proof that services still function correctly)
- Timestamp all evidence to demonstrate work sequence
- Use clear file naming:
hostname_task_before.png,hostname_task_after.png
Time allocation:
- Basic hardening (services, permissions): 20-30 minutes
- Firewall configuration: 15-20 minutes
- SSH hardening: 10-15 minutes
- Advanced (SELinux, audit): 15-25 minutes (national+)
Common marking criteria:
- Service still functional after hardening: 50%
- Configuration persists after reboot: 30%
- Documentation quality: 20%
Time-boxed drill suggestion: 90-minute Linux hardening grind: Given a vulnerable VM, disable insecure services, configure UFW or iptables, harden SSH, set correct permissions on /etc/shadow and /etc/passwd, configure sudo, and document all changes. Reboot and verify hardening persists. This drill builds muscle memory for competition-day execution.
False Flags / Wrong Paths
Section titled “False Flags / Wrong Paths”Red herrings from past competitions:
- Services that look insecure but are required for scoring (e.g., a specific port must remain open)
- Firewall rules that seem redundant but are part of the marking scheme
- Users that look suspicious but are legitimate service accounts
Practice Checklist
Section titled “Practice Checklist”- Can identify and disable insecure services in under 10 minutes
- Can configure UFW to allow specific ports and deny all others
- Can write iptables rules manually (no UFW wrapper)
- Can harden SSH configuration (disable root, key-based auth, non-standard port)
- Can set correct file permissions on /etc/shadow, /etc/passwd, SSH keys
- Understand SELinux/AppArmor basics (status, enforce, troubleshoot denials)
- Can configure sudo to allow specific commands only
- Can implement fail2ban for SSH brute-force protection
- Can produce competition-compliant screenshots for all changes
- Can verify hardening persists after reboot
References
Section titled “References”- Regional Roadmap: Infrastructure hardening
- National Roadmap: Infrastructure hardening
- Cheat Sheet: Linux Hardening Checklist (planned)
Unofficial study guide, not endorsed by WorldSkills International or WorldSkills UK. Topics are example areas to prepare for, not the content of any test project: competition tasks are confidential, competitions are closed book, and formats change between competitions. More about this site.