LPIC-1 110.1: Security administration tasks
Setuid files, open ports and their processes, user limits, a narrow sudo rule, and a locked account.
Before you start
The lab creates users tess and locky (password Lab-Pass-1) and a
service labweb. It runs a program that listens on a TCP port, which task
2 finds. The peer, at 10.99.0.2 (name peer), stands in for another VM:
get a shell there with sudo ip netns exec lepeer bash. If a firewall
runs here, the lab lets the peer through it, so a scan sees every port.
Tasks
- List every setuid and setgid file on the root filesystem into
/root/lab-answers/1-before. Copy/usr/bin/bashto/usr/local/bin/testbash, set the setuid bit on the copy, list again into/root/lab-answers/1-after, anddiffthe two lists. Then delete the copy. - Scan this VM from the peer with
nmap(scan10.99.0.1), and match each open TCP port to a process withss -tlnpandfuser. Write one line per open port to/root/lab-answers/2: the port number and the process name, such as22 sshd. - Give
tessa hard limit of 50 processes (nproc) in/etc/security/limits.confor a file in/etc/security/limits.d/, log in astess, and checkulimit -u. - Give
tesspermission to runsystemctl restart labwebwith sudo, and nothing else. Check withsudo -lastess, and try another command. - Lock
locky's password withpasswd -l, checkpasswd -S, and try to log in aslocky(for example withsu - lockyastess). Then read the attempt withlastborjournalctl.
Hints
find / -xdev -perm /6000 -type f;chmod u+s;diff.nmapis a package of its own; it runs in the peer withsudo ip netns exec lepeer nmap 10.99.0.1.ss -tlnp,fuser -n tcp PORT,ps -p PID -o comm=.tess hard nproc 50;su - tess,ulimit -Hu.- A file in
/etc/sudoers.d/checked withvisudo -cf; the full path ofsystemctl(command -v systemctl);sudo -l -U tess. passwd -S locky;journalctl -t suorjournalctl --since -10min.