Lesson 7 of 12
Lab 7 — MFA & Access Control
Lock down accounts with multi-factor authentication, least privilege and smart permission design.
Learn it
A password is something you know. MFA adds something you have (a phone or key) or something you are (a fingerprint).
Least privilege means every account only gets the access it truly needs — nothing more.
Even if a password leaks, MFA usually stops the attacker logging in.
Key terms
- MFA
- Multi-factor authentication — proving identity with two or more different types of factor.
- TOTP
- Time-based one-time password, the 6-digit code an authenticator app shows.
- Passkey
- A phishing-resistant login using a cryptographic key stored on your device.
- Least privilege
- Giving each account the minimum access needed for its job.
- RBAC
- Role-based access control — permissions assigned to roles, not individuals.
Audit a school's accounts
You are the new IT admin. Work through what you find.
- 11. Shared admin: The 'admin' account is shared by five staff. No one knows who changed what. Fix: personal accounts, audit logs.
- 22. Old leavers: Three teachers who left last year still have active logins. Fix: an offboarding checklist.
- 33. Students as editors: Every student can edit the grades folder. Fix: read-only role for students.
- 44. SMS-only MFA: Admins use SMS codes. Fix: move admins to security keys or passkeys.
- 55. Push spam: A teacher reports 20 login prompts at midnight. That is MFA fatigue — deny, reset password, report.
Generating a TOTP code
pythonimport hmac, hashlib, struct, time
def totp(secret: bytes, step=30, digits=6):
counter = int(time.time()) // step
mac = hmac.new(secret, struct.pack('>Q', counter), hashlib.sha1).digest()
offset = mac[-1] & 0x0F
code = struct.unpack('>I', mac[offset:offset+4])[0] & 0x7FFFFFFF
return str(code % 10**digits).zfill(digits)
print(totp(b'shared-secret-from-qr-code'))Your phone and the server share a secret from the QR code. Both hash it with the current 30-second time slot, so they get the same code without talking to each other.
Try it
Match each factor to its type.
Challenge
Design the permissions for a school file system with Students, Teachers, IT Admins and Visitors. For each role, list what they can read, edit and delete, and say which roles must use phishing-resistant MFA.
Pick whichever way suits you — every mode earns the same bonus XP.
Write at least 40 more characters to submit.
Mark your own work
Guided walkthrough — 0/3 clues revealed
- Clue 1 locked — reveal it only if you get stuck.
- Clue 2 locked — reveal it only if you get stuck.
- Clue 3 locked — reveal it only if you get stuck.
Each clue costs 4 XP (never below 20 XP). You'd earn 40 XP right now.