Auditors want to know exactly which commands admins ran with sudo last month. How do you provide that going forward?
IntermediateScenarioUsers, groups and access control
Answer
Situation read → Command-level audit trail that survives on-box tampering.
What I'd do →
- Enable sudo logging in
/etc/sudoers.d/logging:
Defaults logfile=/var/log/sudo.log
Defaults log_input, log_output
Defaults iolog_dir=/var/log/sudo-io/%{user}
- Add auditd rules for execve by admins:
-a always,exit -F arch=b64 -S execve -F euid=0 -F auid>=1000 -k root-cmds. - Ship
/var/log/secureorauth.log, sudo logs and audit logs to a central SIEM. - Answer queries with
ausearch -k root-cmds --start this-monthor in the SIEM.
Why → Local logs can be wiped by root; forwarding them off-box keeps them trustworthy.
Interview tip → sudoreplay can replay recorded sessions when log_output is on.
More on Users, groups and access control
You need to onboard 50 new developers onto a shared build server, each with their own account and SSH key. How do you do it?BeginnerThree teams share one server and each needs a project directory only its members can write to, with new files staying group-owned. How do you set it up?BeginnerA junior engineer needs to restart nginx but must not get full root. How do you grant that?BeginnerAn engineer leaves the company today. What do you do with their Linux account on 30 servers?BeginnerA service account for a backup tool must exist on every server but nobody should be able to log in as it. How do you create it?BeginnerYour security team requires passwords to expire every 90 days for human users only. How do you implement it?Beginner