/go/cmd: cmd from the Command Line

/go/cmd uses the Linux audit system (auditd) to record every program that is executed on the server, then reports on what was recorded. It works in two stages: Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

# First run: enable command auditing
/go/cmd

# Later runs: view the report
/go/cmd

[!WARNING]
The first run removes and reinstalls the audit and audit-libs packages and deletes every file in /etc/audit/rules.d/, including any audit rules you or your security tools added. Review /etc/audit/rules.d/ before running it on a server that already uses auditing.

Examples

# Enable auditing (first run) or view the report
/go/cmd

# Show only a count per executable instead of every event
aureport -k --summary

# Show full command lines for today, with user names instead of numeric IDs
ausearch -k exec_log -i -ts today

# Show everything one user ran, by numeric user ID
ausearch -k exec_log -ua 1000 -i

# Check that auditing is running
systemctl status auditd

# Turn command logging off again
rm /etc/audit/rules.d/cmd.rules
augenrules --load

Output

The output comes from aureport -k, the audit key report. It lists one line per recorded event, with the date and time, the key, whether the call succeeded, the executable that ran, the numeric user ID of the person who ran it (auid), and the event number.

Situation What you see
Right after the first run An empty report, because nothing has been recorded yet.
Later runs One line for every program executed since auditing began, including those run by cron jobs and system services.
Setup problems Errors from dnf or augenrules.

The report shows the executable’s path, not its arguments. To see full command lines, use ausearch (see Examples).

Every run is logged with a timestamp, for example [Nov 20 09:15:02]# cmd, to /var/log/go/cmd.log.

See the full reference at /go/cmd and the GoAdmio command index.

GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *