Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

8.3 (2 of 5): Security tools, rules and hardening

The whole lesson, free. Read it and have a go at the activities. To work the tasks and labs in the real lesson, press Start lab, with no account needed.

55 minutes

A quick check that you are not a bot, then your own lab opens on the interactive lesson.

Already have an account? Sign in

A school laptop has many guards

Think about a school laptop. A password stops a stranger. A program checks files for harm. The teacher lets you install only some programs. The school checks the people who run the IT.

No single guard is enough. By the end of this lesson: I can give a benefit and a drawback of each main guard.

Key words

WordWhat it meansExample
Anti-malwareSoftware that finds and removes harmful software.a virus scanner
SignatureA known pattern of a harmful file that a scanner looks for.a known bad piece of code
QuarantineA safe place to lock away a suspect file.a locked box for a file
Intrusion detectionA system that watches for signs of an attack and raises an alert.a burglar alarm
HardeningMaking a system harder to attack by removing what it does not need.switching off unused services
Least privilegeGiving each person only the access they need.a student cannot edit marks
VettingChecking a person's background before you hire them.asking a past boss about the person
Access controlRules and tools that decide who may use what.a login and a list of roles

The cells students fill in are left blank in this preview.

Quick check: which guard?

Have a go

Quick check: which guard?

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Guards that work on the machine

GuardWhat it doesBenefitDrawback
Security settings (hardware)A password when the computer starts. USB ports switched offStops a thief or a USB attackStaff may find it annoying
Security settings (software)Screen lock after a few minutes. Only trusted programs allowedStops others using it while you are awayMay block a tool people need
Anti-malwareScans files. Finds known and suspect software. Quarantines or deletes itCatches most common malwareSlows the machine. Misses very new malware. Sometimes blocks good files
Software access controlLogins and roles decide who can open whatLimits the damage one account can doNeeds setting up and looking after
Device hardeningRemove unused software. Close unused ports. Change default passwords. Install updatesFewer weak points to attackTakes time. A fix may break an old program

The cells students fill in are left blank in this preview.

How anti-malware decides

flowchart TD
  file([A file arrives]) --> scan{Does it match a known signature?}
  scan -->|yes| quarantine[Quarantine it and alert the user]
  scan -->|no| behave{Does it act in a suspect way?}
  behave -->|yes| quarantine
  behave -->|no| allow[Allow it]
  quarantine --> choose[User or admin chooses: delete or restore]

Match the guard to its purpose

Have a go

Loading…

Your answers are marked here and are not kept. A college account keeps every student’s marks.

The alarm that does not lock the door

An intrusion detection system watches for signs of an attack. For example: 50 wrong passwords in one minute. It sends an alert. It does not stop the attack by itself. It is the alarm and not the locked door.

A drawback: an alarm can ring when nothing is wrong. Someone must read each alert.

Guards about people

GuardWhat it isBenefitDrawback
User access policyWritten rules: who may use what, and how to do it safelyEveryone knows the rulesRules nobody reads do nothing
Staff vettingChecks on a person before they are hiredLess risk of a bad hireTakes time and money. Cannot know what a person will do later
Staff trainingLessons on phishing (fake messages that trick you), passwords and reportingFewer mistakesPeople forget. It must be repeated

The cells students fill in are left blank in this preview.

Least privilege

Tip

Ask: what is the least access this person needs to do their job? Give that. No more. If their account is stolen, the thief gets only that little access.

Your turn: build three small guards

Build three small guards. The first is an anti-malware scan: find files that hold a known bad snippet. The second is an intrusion alert: find users with too many failed logins. The third is access control: say if a role may do an action. Press Run Tests.

Code: python
def scan(files, signatures):
    # files is a dictionary: file name -> the text inside it.
    # signatures is a list of known bad text snippets.
    # Give back a sorted list of the names of files that contain ANY signature.
    return []


def failed_login_alerts(attempts, limit):
    # attempts is a list of entries. Each entry is a list: [user, worked].
    # For example [["sam", True], ["eve", False], ["eve", False]].
    # worked is True if the login worked and False if it failed.
    # Give back a sorted list of users with limit or more FAILED logins.
    return []


def can_do(role, action, policy):
    # policy is a dictionary: role -> list of actions that role may do.
    # Give back True only if the role has the action. An unknown role may do nothing.
    return False

Make a free account to save your work, or press Start lab to work through the whole lesson.

Extra: Detection and prevention

Note

A system that also blocks the attack is called an intrusion prevention system. Detection is the alarm. Prevention is the locked door.

Extra: The one rule: your lab only

Warning

The hardening lab is your own private copy of a web server. Change only that. Never change or attack a server that is not yours: it is a crime under the Computer Misuse Act 1990.

Extra: Harden a web server in five steps

Press Start the lab on the bar at the top of this lesson. Wait until it says it is running.

A web server often tells every visitor its exact version. An attacker can search for weak points in that version. Hardening means it should say less.

Extra: 1. See what the server says

Command
curl -I http://web

A command for the lesson’s lab terminal. It is shown here and not run.

Extra: 2. Run the lab check

Command
docker exec web lab-check

A command for the lesson’s lab terminal. It is shown here and not run.

Extra: 3. Fix one thing

Command
docker exec web sed -i 's/server_tokens on/server_tokens off/' /etc/nginx/conf.d/default.conf

A command for the lesson’s lab terminal. It is shown here and not run.

Extra: 4. Load the change

Command
docker exec web nginx -s reload

A command for the lesson’s lab terminal. It is shown here and not run.

Extra: 5. Look again

Command
curl -I http://web

A command for the lesson’s lab terminal. It is shown here and not run.

Scenario: what went wrong?

Have a go

Scenario: what went wrong?

4 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Key words crossword

Have a go

Loading…

Your answers are marked here and are not kept. A college account keeps every student’s marks.

Final check

Have a go

Final check

5 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Teach this lesson with your class

On a college account your students work the tasks and the labs as well, and every mark is kept for you.