Linux Audit system | NXLog Docs (2024)

The Linux Audit system generates events according to Audit rules.These rules can be set dynamically with the auditctl utility or stored persistently in the /etc/audit/rules.d folder.Persistent rule files are automatically compiled to /etc/audit/audit.rules when auditd is initialized.

There are three types of rules:

  1. A control rule modifies the auditing behavior

  2. A file system rule watches a file or directory

  3. A system call rule logs an event for a particular system call

See Defining Audit Rules in the Red Hat Enterprise Linux Security Guide for further details on Linux Audit rules.

Some common control rules are:

  • -b backlog to set the maximum number of audit buffers.Specify a bigger value for busier systems with a high log volume.

  • -D to delete all rules and watches.This rule is typically the first one.

  • -e [0..2] to control auditing.The accepted values are 0 to disable auditing temporarily, 1 to enable it, or 2 to lock the configuration until the next reboot (typically the last rule).

Example 1. Linux Audit control rules

The following is a set of basic rules commonly found in rulesets.

# Delete all rules (typically the first rule)-D# Increase buffers from the default 64 to 320-b 320# Lock Audit rules until the next reboot (the last rule)-e 2

To create a file system rule, use -w path -p permissions -k key_name as follows:

  • The path argument defines the file or directory you want to audit.

  • The permissions argument sets the type of access to audit.It accepts a combination of r (read access), w (write access), x (execute access), and a (attribute change).

  • The key_name argument is an optional tag for identifying the rule.

Example 2. Linux Audit file system rule

This rule monitors /etc/passwd for modifications and tags access events with passwd.

-w /etc/passwd -p wa -k passwd

To create a system call rule, use -a action,filter -S system_call -F field=value -k key_name as follows:

  • The action argument can be either always (to generate a log entry) or never (to suppress a log entry).Generally, you add always rules first because rules are matched from top to bottom.

  • The filter argument is one of task (when a task is created), exit (when a system call exits), user (when a call originates from user space), or exclude (to filter events).

  • The system_call argument specifies the system call name.You can specify the -S flag more than once to monitor multiple system calls.

  • The field=value pair can be used for additional filtering options and can also be specified more than once.

  • The key_name argument is an optional tag for identifying the rule.

Example 3. Linux Audit system call rule

This rule audits system time changes.

-a always,exit -F arch=b64 -S adjtimex -S settimeofday -k system_time

System call rules can audit activities related to files, such as:

  • Creation

  • Modification

  • Deletion

  • Changes in access permissions and ownership

Example 4. Linux Audit file deletion rule

This rule audits file deletions with the unlink or rename command.

-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete

You can also audit network connections with system call rules.

Example 5. Linux Audit networking rule

This rule audits successful incoming or outgoing external network connections.

-a always,exit -F arch=b64 -S accept,connect -F key=external-access

Combine the different rules to create a ruleset.

Example 6. Linux Audit rules file

Below is a simple Linux Audit ruleset based on the above examples.

/etc/audit/rules.d/audit.rules

# Delete all rules-D# Increase buffers from the default 64 to 320-b 320# Watch /etc/passwd for modifications and tag with 'passwd'-w /etc/passwd -p wa -k passwd# Audit system time changes-a always,exit -F arch=b64 -S adjtimex -S settimeofday -k system_time# Lock Audit rules until the next reboot-e 2

See The Linux Audit Project and auditd-attack repositories on GitHub for more examples.

Linux Audit system | NXLog Docs (2024)
Top Articles
How Much Should I Charge for Photography – Photography Pricing Guide | Skylum Blog
How Long Does It Take To Fall In Love? What Research & Experts Say
Cpmc Mission Bernal Campus & Orthopedic Institute Photos
Spn 1816 Fmi 9
Brady Hughes Justified
O'reilly's Auto Parts Closest To My Location
Doublelist Paducah Ky
Whiskeytown Camera
Qhc Learning
Detroit Lions 50 50
Socket Exception Dunkin
Identogo Brunswick Ga
6001 Canadian Ct Orlando Fl
Hood County Buy Sell And Trade
Learn2Serve Tabc Answers
Uktulut Pier Ritual Site
Decosmo Industrial Auctions
Cincinnati Adult Search
Teen Vogue Video Series
R. Kelly Net Worth 2024: The King Of R&B's Rise And Fall
Magic Seaweed Daytona
Ecampus Scps Login
Elite Dangerous How To Scan Nav Beacon
The Procurement Acronyms And Abbreviations That You Need To Know Short Forms Used In Procurement
897 W Valley Blvd
Ewg Eucerin
Our Leadership
Allegheny Clinic Primary Care North
Mark Ronchetti Daughters
R/Orangetheory
Best New England Boarding Schools
Mumu Player Pokemon Go
NIST Special Publication (SP) 800-37 Rev. 2 (Withdrawn), Risk Management Framework for Information Systems and Organizations: A System Life Cycle Approach for Security and Privacy
Skroch Funeral Home
Rogers Centre is getting a $300M reno. Here's what the Blue Jays ballpark will look like | CBC News
Dr. John Mathews Jr., MD – Fairfax, VA | Internal Medicine on Doximity
Emerge Ortho Kronos
Myanswers Com Abc Resources
Craigslist Tulsa Ok Farm And Garden
Cranston Sewer Tax
Infinite Campus Parent Portal Hall County
968 woorden beginnen met kruis
Bcy Testing Solution Columbia Sc
2023 Fantasy Football Draft Guide: Rankings, cheat sheets and analysis
Birmingham City Schools Clever Login
Gt500 Forums
Samsung 9C8
Egg Inc Wiki
Acuity Eye Group - La Quinta Photos
Compete My Workforce
Primary Care in Nashville & Southern KY | Tristar Medical Group
Latest Posts
Article information

Author: Tyson Zemlak

Last Updated:

Views: 6178

Rating: 4.2 / 5 (43 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Tyson Zemlak

Birthday: 1992-03-17

Address: Apt. 662 96191 Quigley Dam, Kubview, MA 42013

Phone: +441678032891

Job: Community-Services Orchestrator

Hobby: Coffee roasting, Calligraphy, Metalworking, Fashion, Vehicle restoration, Shopping, Photography

Introduction: My name is Tyson Zemlak, I am a excited, light, sparkling, super, open, fair, magnificent person who loves writing and wants to share my knowledge and understanding with you.