Situation
node1 is a new ticket server, helpdesk: nginx on port 80 with the application behind it — the
lab-helpdesk service. The server is about to go public, but the security review sent it back with a
list of findings:
- SSH logins are accepted by password;
- root is allowed to log in to the server;
- extra ports besides the site are visible from the network;
- there is no protection against password brute force;
- the application service runs as root with no restrictions at all.
node1 is your terminal. node2 is the administrator's workstation on the same network; logins to node1
happen from there by key. Run commands on node2 over SSH: ssh node2 'command', or enter its shell
with ssh node2 and leave with exit. sudo works without a password on both machines. There is no
other way into node2: do not lock yourself out of SSH and do not touch its settings.
Task
- SSH login to node1 is key-only: the
studentaccount logs in from node2 with its key, and the server no longer offers a password. - Root cannot log in to node1 over SSH — not even with a key that worked before — and no password is offered to it.
- Only ports
22and80are open on node1 from the network; ports8000and8080are closed. The rules stay in place after a reboot of node1. - SSH password brute force is caught:
fail2banis running, starts on its own and watches logins — thesshdjail is active and able to ban. - The
lab-helpdeskservice runs as non-root and is confined with systemd (at leastNoNewPrivilegesandProtectSystem), so thatsystemd-analyze security lab-helpdesk.servicescores below 6.0. The site still answers, though:curl http://localhost/on node1 returns the ticket list.
Constraints
- Change node1 only. Do not touch SSH settings, keys or services on node2.
- Firewall rules and service settings must survive a reboot: keep them in files (
/etc/...): the live state does not survive a reboot. - The administrator's key access from node2 must stay — both for
studentand after every change.
The lab has no internet — only the network between node1 and node2, and everything you need is installed. Work through the list of findings: which ports services listen on —
sudo ss -tlnp; what is visible from node2 — check it right from there. After each change, re-read the state:sudo systemd-analyze security lab-helpdesk.service,sudo fail2ban-client status sshd,sudo nft list ruleset.
Lab goals
0 of 5-
From node2 the login to node1 is key-only (student logs in with the key; the server offers no password) — not checked yet
-
Root cannot log in to node1 over SSH even with a previously working key, and no password is offered — not checked yet
-
From node2 only ports 22 and 80 are open on node1 while 8000 and 8080 are closed — and the rules survive a reboot — not checked yet
-
fail2ban is running, starts on its own and watches SSH logins — the sshd jail is active with a ban action — not checked yet
-
The lab-helpdesk service answers, runs as non-root and is confined (NoNewPrivileges, ProtectSystem); systemd-analyze security is below the threshold — not checked yet