Configuring keystroke logging for Safeguard for Sudo policy
Safeguard for Sudo enables event logging. Each time a sudo command is run, the policy server accepts or rejects the requested command according to the sudoers policy file and creates an event (audit) log. If enabled, the policy server records the keystroke input and terminal output for each accepted command, creating comprehensive "keystroke logs" files. With these logs, you can perform forensic-level auditing of any command that ran by means of sudo.
Event logs are captured and stored on the policy servers in /var/opt/quest/qpm4u/pmevents.db; keystroke logs are stored at /var/opt/quest/qpm4u/iolog.
You can use the iolog_dir and iolog_file policy options to reconfigure the iolog file location.
You can view event logs or replay keystroke logs from the Policy tab of the Management Console for Unix if you are logged in either as the supervisor or an Active Directory account with rights to audit the sudoers file; that is, an account in the Audit Sudo Policy role. See Viewing the log files using a web browser for details.
Configure the sudoers policy for keystroke logging by using the log_input and log_output defaults flags, or the LOG_INPUT and LOG_OUTPUT command tags, as follows:
Defaults log_input, log_output # keystroke logging enabled
Defaults!/sbin/reboot !log_input,!log_output # no logging for reboots
For complete I/O log records you must use both log_input and log_output.
# disable keystroke logging for the pmreplay command
ADMINS ALL = (ALL) NOLOG_INPUT:NOLOG_OUTPUT:/opt/quest/sbin/pmreplay
ADMINS is a User_Alias. See the Sudoers man page for definition of User_Alias.
Validating Sudo commands
To validate that the centrally managed policy is working, log on to a policy server (or a Sudo Plugin host) as a non-root user, run a command that is already set up in your sudoers policy file and observe the results.
Use a command you expect to work, such as:
$ sudo id
Then run a command that you know you do not have sufficient privileges to run. For instance, run a fake command, such as:
$ sudo fakecmd
When Safeguard rejects a command, it displays a message similar to this:
Sorry, user tuser is not allowed to execute ‘fakecmd’ as root on myhost.example.com.
Request rejected by Safeguard
All systems that are joined to the same policy server will have the same results based on how you have the sudoers policy file configured.
Local logging
The location of the error logs for the Safeguard components, pmrun and pmmasterd, is specified using keywords in the pm.settings file. Enter the following to specify that you want the error logs written to the /var/adm directory:
pmmasterdlog /var/adm/pmmasterd.log
pmrunlog /var/adm/pmrun.log
Alternatively, you can enable UNIX syslog error logging in the pm.settings file, by specifying:
syslog YES
Use one of the following keywords to specify which syslog facility to use:
- LOG_KERN
- LOG_USER
- LOG_MAIL
- LOG_DAEMON
- LOG_AUTH (the default)
- LOG_LPR
- LOG_NEWS
- LOG_UUCP
- LOG_CRON
- LOG_LOCAL0 through LOG_LOCAL7
For example, to enable syslog error logging using the LOG_AUTH facility, enter in the pm.settings file:
syslog YES
facility LOG_AUTH
See PM settings variables for more information about modifying the Safeguard configuration settings.
Event logging
Event logs are enabled by default for all requests sent to the Safeguard Policy Servers. The default location of the event log file is /var/opt/quest/qpm4u/pmevents.db.