Linux Labs

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

The service is denied access

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

Situation

The intranet knowledge base — the lab-kb service, the kb-server application — moved to a new disk last week: the articles were moved from /var/lib/kb to /srv/kb, and the path in /etc/kb-server/kb.conf was updated. Since then the knowledge base does not open:

curl -s http://127.0.0.1:8098/

A colleague has already checked the permissions: directories 755, files 644. The service user can read an article — sudo -u kb cat /srv/kb/howto/vpn.md. Next to it on the same disk lies /srv/hr — exports of the HR department.

Task

  1. lab-kb serves the main page with the list of articles and the articles themselves from /srv/kb, new ones included. The application code and the article path in the settings stay the same.
  2. Do not weaken the protection of the service: the process runs under its AppArmor profile kb-server in enforce mode.
  3. The service gets only read access to /srv/kb. It still cannot write there or read /srv/hr and /etc/shadow.
  4. Do not edit the packaged profile file /etc/apparmor.d/usr.local.bin.kb-server — a package upgrade replaces it. Keep your rules in /etc/apparmor.d/local/usr.local.bin.kb-server: the fix has to work after the profile is loaded from disk as well.

There is no internet on the machine; everything you need is already installed. Run administrative commands with sudo.

Visible only to you. Saved as you type.

All notes

Lab goals

0 of 4
  • lab-kb serves the main page and the articles from /srv/kb, new ones included; the application code and the article path are unchanged — not checked yet
  • The service process runs under the kb-server profile in enforce mode — not checked yet
  • The profile gives the service only read access to /srv/kb — /srv/hr, /etc/shadow and writing to /srv/kb stay closed to it — not checked yet
  • Your rules are in /etc/apparmor.d/local, the packaged profile file is unchanged; after the profile is loaded from disk the service works — 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…