Step 4 of 5 · lab · 20 min
The service is denied access
The knowledge base moved to a new disk, and the service no longer sees the articles — even though the permissions are fine and the service user reads them directly. Find what denies the access and give it back to the service without weakening its protection.
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
lab-kbserves 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.- Do not weaken the protection of the service: the process runs under its AppArmor profile
kb-serverin enforce mode. - The service gets only read access to
/srv/kb. It still cannot write there or read/srv/hrand/etc/shadow. - 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.
Lab · on your own
No commands are given in this lab: type them in the terminal yourself. Goals are checked on the machine after every command.
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 done yet
-
The service process runs under the kb-server profile in enforce mode — not done 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 done 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 done yet
The machine is starting
Hints
0 of 3Lab 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 done yet
-
The service process runs under the kb-server profile in enforce mode — not done 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 done 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 done yet
Goals are checked on the machine after every command.