Linux Auditing Logs

What are Linux Audit logs?

Native Linux feature that collects logs of system activity. Can be leveraged for forensic investigations.

Linux Auditing System monitors 3 distinct things:

  • System calls: See which system calls were called, along with contextual information like arguments passed to it, user info, etc

  • File Access: Monitor file access activity, rather than directly monitoring the open system calls and related calls.

  • Select, pre-configured auditable events within the kernel. List of event types by Red Hat.

Configuration

  • /etc/audit/audit.rules

Logs

  • /var/log/audit/audit.log

What important info does auditd contain?

If configured well, logon information, user related events (add user, group, account locks, and unlocks), and file execution.

Auditd commands during live analysis:

aureport shows a summary report of auditd recorded activity.

auditctl is used to review and set auditing rules.

ausearch can be used to filter audit logs for a specific rule

Common RHEL 7 and 8 audit record types

ADD_GROUP

ADD_USER

USER_LOGIN

USER_LOGOUT

USER_AUTH

SYSTEM_SHUTDOWN

SOFTWARE_UPDATE

Understanding Audit Log Files:

The following command will output the below output in audit logs that are monitoring sshd_config.

Directories

Details inside the directory

/var/log/syslog or /var/log/messages

Displays system-wide messages and information. Essentially, it’s a data log of every activities across the entire global system. Everything occurs on Redhat-based systems, such as CentOS or Rhel, will be recorded in messages. They go into Syslog on Ubuntu and other Debian systems.

/var/log/auth.log or /var/log/secure

Keep track of successful and unsuccessful logins, as well as authentication processes. The amount of storage available is determined by the system type. Look at /var/log/auth.log for Debian/Ubuntu. Go to /var/log/secure on Redhat/CentrOS.

/var/log/boot.log

Keep track of start-up messages and boot information.

/var/log/maillog or var/log/mail.log

It’s for mail server logs, which can be useful for postfix, smtpd, or other email-related services on your server.

/var/log/kern

Kernel logs and warning information are saved. Also important for resolving issues with custom kernels.

/var/log/dmesg

It serves as a central location for device driver communications. To view the messages in this file, use dmesg.

/var/log/faillog

It will keep track of failed login attempts. As a result, it’s useful for investigating suspected security breaches like credential hacks and brute-force attacks.

/var/log/cron

It will maintain a log of Crond-related messages (cron jobs). For example, it will keep the record of like When the cron daemon started a job.

/var/log/daemon.log

Keeps track of background services that are operating but does not display them graphically.

/var/log/btmp

keeps a note of all failed login attempts.

/var/log/utmp

Keeps track of current login state by the user

/var/log/wtmp

Keeps track of every login and logout.

/var/log/lastlog

Each login/logout is tracked in this log.

/var/log/yum.log

It contains information about any yum command-based package installations. So you can see if everything went smoothly.

/var/log/httpd/

It is a directory holding the Apache httpd daemon’s error log and access log files. The error log file records every error that httpd encounters. Consider memory issues and other system-related issues. All requests that come in via HTTP are logged by access_log.

/var/log/mysqld.log or /var/log/mysql.log

Every debug, failure, and success message, as well as the starting, stopping, and restarting of the MySQL daemon mysqld, is recorded in the MySQL log file. The directory is chosen by the system. /var/log/mariadb/mariadb.log is used by RedHat, CentOS, Fedora, and other RedHat-based systems. Debian/Ubuntu, on the other hand, uses the /var/log/mysql/error.log directory.

/var/log/pureftp.log

Using the pureftp process, it keeps track of FTP connections. Here you may find information about every connection, FTP login, and authentication failure.

/var/log/spooler

Except for a few USENET mails, it usually contains nothing.

/var/log/sudo.log

Contains administrative privilege use.

/var/log/xferlog

Keeps track of FTP file transfers. File names and user-initiated FTP transfer information are included.

Last updated