A computer records every login attempt. A long run of failures for one account from one address in a short time is someone guessing passwords. Reading the log is the defender's view of an attack, and the fix is to make guessing harder, not to hope it fails.
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.
Predict and Try 8 min · Worked example 10 min · Vary 10 min · Practise and Make 12 min
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: the log on the board is made up for the lesson (14 failures from one address, one success). The pretend admin can read it with sudo; on a real Pi the first account can read it without. The addresses are private lab addresses. This lesson stays on the defender's side: it reads and counts, and does not teach how guessing is done.
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: fail2ban blocks addresses automatically after repeated failures; journalctl -u ssh is the same story on systems that use the journal; a central log server keeps the record safe from the computer being attacked.
With internet: a server on the open internet is guessed at within minutes, all day, by automated scanners. That is why exposing a server raises the stakes (see System admin on a Raspberry Pi).
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.
The log, and the pattern of failures.
Hand out six log lines. Students sort them: mistyped password, guessing, a normal login.
Rate, repetition and account tell the story.
Seeing the pattern rather than the lines. Ask what a real person who forgot a password looks like.
| What you will see | A question to ask | The fix |
|---|---|---|
| Permission denied reading the log. | Did you use sudo? | sudo grep ... /var/log/auth.log. |
| fails.txt is empty or missing. | Where is your > ? | sudo grep -c ... > fails.txt |
One possible solution for each task. Other correct programs are fine.
Open task: any program that does what the step asks.
Open task: any program that does what the step asks.
Open task: any program that does what the step asks.
Open task: any program that does what the step asks.
Stretch: Find out what fail2ban does and what it cannot protect against.
Support: A card of the three grep commands.
What pattern in a log says someone is guessing passwords?
Many failed logins for one account from one address in a short time.
Links: Security and privacy › Sign-in and permissions; Cyber safety and privacy › Passwords; next: Close the doors.