Linux Labs

Server security / Stage 4 of 10 · step 7 of 8

A password can be anything

medium ~30 min
Not running Starting usually ~20 s
Report a problem

Situation

Interns are joining the server team. Their accounts are created with a temporary password, and after that everyone changes it themselves with passwd. The intern intern set the password qwerty12 — the system did not object. Guessing a password can go on forever too: wrong passwords in su have no consequences.

You are the administrator: you log in with a key (ssh localhost) and work through sudo. The intern's account is handy for checking the result: su - intern, password qwerty12.

Task

  1. With passwd, a user cannot set a password shorter than 12 characters or with fewer than three character classes (lowercase, uppercase, digits, others). A password that follows these rules is accepted.
  2. The rules are written in /etc/security/pwquality.conf (or in a file in /etc/security/pwquality.conf.d/) — pwscore sees them.
  3. After three wrong passwords in a row the account is locked for any password login: the console, su, sudo. A successful login before the lockout resets the counter.
  4. Your own access is intact: student's key login, sudo and the console login work as before.

A mistake in /etc/pam.d can close both logins and sudo. Edit PAM from a root shell sudo -i and do not leave it until su - student -c 'sudo -n true' finishes without an error. There is no internet on the machine; everything you need is already installed.

Visible only to you. Saved as you type.

All notes

Lab goals

0 of 4
  • pwscore rejects passwords shorter than 12 characters or with fewer than three classes and accepts a compliant one — not checked yet
  • passwd does not let a user set a weak password and accepts a compliant one — not checked yet
  • Three wrong passwords in a row lock the account for any password login, and a successful login resets the counter — not checked yet
  • student logs in with the key, and sudo and the console login work as before — not checked yet

Hints

0 of 3 open · they open one at a time
Hint 1
Show the solution after 3 failed checks

Leave the lab?

The machine keeps running for 10 more minutes, then it is removed. Files are lost; completed goals stay.

Loading…