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

Free lesson

Defence in depth: layers of security

After this lesson: I can layer controls so that one failure is not fatal.

55 min lesson2 commandsLinux administration lab: users, permissions, cron and systemd in your browser

What is defence in depth?

Defence in depth means protecting an asset with several layers of controls, so that one failure is not fatal. No single control is perfect, so a safe system never depends on only one.

A castle had a moat, a wall, a gate and guards. A shop's data needs the same idea.

By the end of this lesson

Note

I can layer controls so that one failure is not fatal.

Key words

WordWhat it means
Defence in depthseveral layers of controls around one asset
Preventa control that stops harm from happening
Detecta control that notices harm or an attempt
Responda control that limits harm once it is noticed
Recovera control that restores things afterwards
Single point of failureone part whose failure ruins the whole defence

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

Each layer catches what the last one missed

Imagine an attacker who wants a shop's customer list. They must pass a firewall, then a login, then the rights of the account, and the list may also be encrypted.

Each layer is a control that can fail. The layers are meant to fail in different ways. What gets past one is stopped by the next.

Controls prevent, detect, respond and recover

Controls do four different jobs.

To prevent is to stop the harm, like a lock. To detect is to notice it, like a log or an alarm. To respond is to limit it once noticed, like switching an account off. To recover is to restore, like a backup.

A defence with only prevention has no plan for the day it fails.

Worked example: four jobs for one asset

JobControl for the customer listWhat it does
PreventLogin with a codeKeeps strangers out
DetectA log of every loginShows who tried and when
RespondA rule to lock an account after odd useStops further harm
RecoverA nightly backupBrings the data back

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

Is the lab's backup script there and runnable?

Command
test -x /usr/local/bin/backup.sh && echo "the backup script is there"

Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.

Which backup line does the copying?

Command
grep "^cp" /usr/local/bin/backup.sh

Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.

A backup is a recover control

The first Run prints the backup script is there. The second prints one line, cp -a /srv/projects/. /var/backups/projects/.

That line copies the team's folder to a second place. It does not stop an attack. It means a deleted or damaged folder can be put back, which is recovery.

A common mistake

Warning

Many people think one strong control is enough, such as a very good password. A control can fail, be bypassed, or be switched off by mistake. If it is the only one, nothing else stands in the way. Check that each important asset has more than one kind of control.

Look for gaps and single points of failure

To review a defence, list the controls for one asset. Sort them into the four jobs. Any job with no control is a gap.

Then look at assets with only one kind of control. If that one control fails, nothing is left. That is a single point of failure.

Going further

Pick an asset you own, such as your photos. List every control that protects it and sort each one into prevent, detect, respond or recover.

Which job has nothing? Write one control that would fill the gap, and say what it would cost.

About this lab and its source: Linux administration lab: users, permissions, cron and systemd in your browser

Teaching a class? Set this module for your students with a teacher guide, marked assignments and a lab for every student.