Fixing means closing what is not needed, updating what is old and tightening the login, in that order of thought: fewer doors, stronger locks. Each fix does one job and none of them does all of them, so you layer them and then check again.
Open these in Waypoints Prepare with one click. To share a file another way, copy its address and paste it into Load URL, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.
WorksheetOpen in PrintDownload Print the student copy; the Teacher edition has the answers.
Students will be able to
I can close a service, upgrade old software and tighten ssh.
I can say what each fix does and does not protect.
I can say why a service must restart for config changes.
Timing
Predict and Try 8 min · Worked example 10 min · Vary 10 min · Practise and Make 12 min
Before class
Try the boards yourselves.
The gate (read first). This course teaches security as audit and defence: you scan, read and fix a lab computer your class owns. The pretend Kali and target in the lessons are safe anywhere. The real-lab version is different, so it needs your sign-off before anyone starts: school policy and IT's agreement, a written lab agreement every student signs (lab-rules.txt on the board is a model), and a lab that is cut off from every other network: a Pi running Kali and a second Pi or a virtual machine as the target, joined by one switch or one ethernet cable, with no router and no internet. Download the Kali image and any tools once, at home or at IT's request. Scan only the target named on the lab sheet. This course does not teach breaking into anything: it stops at find, understand and fix. It relaxes the 'defensive only' rule of the other courses only in that the real lab uses real scanning tools on a computer the class owns.
Simplifications: key login is described but not set up on the board (a real lab would also create a key pair with ssh-keygen and copy it with ssh-copy-id before turning passwords off, or you lock yourself out: test in a second session first). The pretend firewall tracks allow <port> and enable only. apt reads a pretend local mirror (a real offline lab uses a mirror such as apt-cacher-ng or a USB bundle of .deb files). Make sure students know the lockout risk from System admin: allow ssh before enabling the firewall.
Real lab, if you run one: Kali Linux has a Raspberry Pi image (Pi 4 or Pi 5; the Pi 5 wants its 27 W supply); flash it with Raspberry Pi Imager or the Kali image instructions and boot it with a screen and keyboard, or ssh in. The target can be a second Pi (an older Raspberry Pi OS with a few extra services) or a purpose-made practice target your IT team approves. Start from the same state every time: re-flash, or snapshot a virtual machine. nmap is already on Kali. Give each pair a printed lab sheet naming the target's address, the one account they may use and what they are allowed to change.
Other options: ufw is the friendly firewall (nftables is what is underneath); unattended-upgrades installs security updates automatically; fail2ban blocks repeated failures.
Running the lesson
Predict: wrong answers think a service can be closed in the firewall alone.
Try: ask which door is now closed.
Worked example: stop at Sam and ask what the firewall protects.
Vary: ask which fix covers which finding.
Make: ask what is left that you did not fix.
In class
On the slides at these points. Students can do the whole lesson on their own; these are for the room. In the deck, the Run, Modify and Make slides have the live playground in them (the tutorial link is the backup), and the notes above are in each slide's speaker notes.
Think, pair, share(start) You have a list of problems. How do you decide what to fix first?
Which problem is easiest for an attacker?
Which fix removes a whole door?
Close doors first, then strengthen the ones you keep.
Findings to fixes(predict, 5 min)
Cards of four findings and four fixes. Pairs match them and say what each fix does not cover.
Each fix covers one finding.
Layers(investigate) Which gives the strongest result? Stop, upgrade, tighten and filter together Layers.
The hard part (on purpose)
Treating one fix as enough. Each fix does one job; the layering is the point.
When students get stuck
What you will see
A question to ask
The fix
The ssh settings do not seem to apply.
Did you restart ssh?
sudo systemctl restart ssh.
A student's config file lost lines.
Did you use tee without -a?
tee replaces the file: write all the lines you want.
Answers to the checks
stop the service: You stop the telnet service on the target. What happens to port 23? No longer open. A port is only open while a service listens, so stopping the service closes the door.
Try: close two doors: Stop the two services that are findings at any version: telnet and vsftpd. Use sudo systemctl stop.
sudo systemctl stop telnet and sudo systemctl stop vsftpd. Add sudo systemctl disable so they stay off after a reboot.
Four fixes, four jobs: Which fix handles 'OpenSSH 7.2 is old'? sudo apt update, then sudo apt upgrade Upgrade installs the fixed versions. The lab's apt reads the lab's own mirror.
Find the mistake: Sam fixes Apache. Click the line where it first goes wrong. line 3 Line 3: a firewall decides who can reach the door; the old program behind an allowed door is still old. Upgrade it, or take the service away.
What ssh config does: In sshd_config, what does PermitRootLogin no change? root can no longer log in over ssh Guessers target root, so the account is not allowed in over ssh at all. Admins log in as themselves and use sudo.
Upgrade: Upgrade the old software: update the lists, then upgrade.
sudo apt update, then sudo apt upgrade.
Tighten ssh: Turn off password login and root login for ssh, and make ssh read the new settings.
Write PermitRootLogin no and PasswordAuthentication no into /etc/ssh/sshd_config with tee, then sudo systemctl restart ssh.
Filter: Use the firewall so only ssh (22) and web (80) can be reached: allow 22, allow 80, then enable.
Restart: Why must you restart ssh after editing sshd_config? It reads its settings only when it starts Services read their config at start (the same as Samba).
Firewall limits: The firewall allows port 80. Apache behind it is old. Is the finding fixed? No: the old Apache still answers on 80 A firewall does not fix what is behind an allowed door: the old program is still reachable on 80, so update it.
Review: guessing: Review: 14 failures in two minutes for root. Which fix helps most? No root login over ssh, and key login only Take away the prize, or make the lock pointless to guess.
harden it: Harden the target: no telnet or ftp open, nothing old, and no password or root login over ssh.
Stop telnet and vsftpd; apt update and apt upgrade; tee the ssh settings; restart ssh. Four fixes for four findings.
Solutions
One possible solution for each task. Other correct programs are fine.
Vary: change one thing › Upgrade
Open task: any program that does what the step asks.
Vary: change one thing › Tighten ssh
Open task: any program that does what the step asks.
Vary: change one thing › Filter
Open task: any program that does what the step asks.
harden it
Open task: any program that does what the step asks.
Stretch and support
Stretch: Find out how key login works and what must be done before password login is switched off.
Support: A card pairing each finding with its fix.
Exit ticket
Why is upgrading Apache a better fix than just allowing it through the firewall?
The firewall only filters who reaches the door. The old program behind it is still old.
What each step is for
stop the service: Committing to what stopping a service changes tests the new move: no service, no door.
Try: close two doors: Stopping the risky services settles the prediction.
Worked example: Four fixes, four jobs: Following the method once, then finding where a plausible account goes wrong, models the new move.
Vary: change one thing: Each task is one layer of the fix: upgrade, tighten the login, filter with the firewall.
Practise: Choosing fixes and knowing what they do not do is the same move in new forms, plus a review of logs.
harden it: Applying every layer, and leaving nothing behind, is the whole move.
Where it leads
Links: System admin on a Raspberry Pi (services, ufw, users); next: the audit report.