Linux Labs

Server security / Stage 9 of 10

Who changed the file: auditd

Not running Starting usually ~20 s
Leave the lesson

Step 5 of 6 · lab · 20 minmedium

The config changes by itself

The portal settings keep reverting to someone else's, even though they were just fixed. Put an audit rule on the file, find from the events who rewrites it and with what, and stop it without touching anyone else.

Situation

The company portal reads its settings from /etc/portal/portal.conf. This morning it turned out to have debug = true, open sign-up and the address of someone else's database. You put the working settings back — a minute later the file was the same as before:

cat /etc/portal/portal.conf
ls -l /etc/portal/portal.conf

The portal group can write the config — the developers and the deployment account. Your crontab -l is empty, and /etc/cron.d holds only the settings backup.

Task

  1. Put an audit rule on writes to /etc/portal/portal.conf. The rule is in effect now and lives in /etc/audit/rules.d — it survives a reboot.
  2. Use the audit events to find who rewrites the config. Write to ~/culprit.txt, on one line, the user name and the full path of the program that writes to the file.
  3. Take that job off the schedule.
  4. Leave everything else as it was: cron runs, the other users' jobs and the backup are in place, and the portal group keeps write access to the config.

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
  • An audit rule watches writes to /etc/portal/portal.conf — it is in effect now and lives in /etc/audit/rules.d — not done yet
  • ~/culprit.txt names the user and the full path of the program that writes to the config — not done yet
  • The job that changes the config is no longer scheduled — not done yet
  • Everything else is as before — cron runs, the other jobs and the backup are in place, the portal group can write the config — not done yet
Ctrl+Enter
Starts the machine node1 · Ubuntu 24.04

The machine is starting

Hints

0 of 3

Lab goals

0 of 4
  • An audit rule watches writes to /etc/portal/portal.conf — it is in effect now and lives in /etc/audit/rules.d — not done yet
  • ~/culprit.txt names the user and the full path of the program that writes to the config — not done yet
  • The job that changes the config is no longer scheduled — not done yet
  • Everything else is as before — cron runs, the other jobs and the backup are in place, the portal group can write the config — not done yet
node1 Ubuntu 24.04

Lab goals

0 of 4
  • An audit rule watches writes to /etc/portal/portal.conf — it is in effect now and lives in /etc/audit/rules.d — not done yet
  • ~/culprit.txt names the user and the full path of the program that writes to the config — not done yet
  • The job that changes the config is no longer scheduled — not done yet
  • Everything else is as before — cron runs, the other jobs and the backup are in place, the portal group can write the config — not done yet
Loading…