Blog | G5 Cyber Security

auditd Rules: 32/64-bit Support

TL;DR

This guide shows you how to create auditd rules that work correctly on both 32-bit and 64-bit systems. We’ll focus on using the correct architecture specifiers in your rule files.

Setting up Auditd Rules for Both Architectures

  1. Understand Architecture Specifiers
  • Check Your System Architecture
  • Determine the architecture of your systems using:

    uname -m

    This will output something like x86_64 (64-bit) or i686 (32-bit).

  • Create a Dedicated Rule File
  • It’s best practice to create separate rule files for architecture-specific rules. For example, you might have:

  • Write Architecture-Specific Rules
  • Here’s how to write rules targeting specific architectures:

    -a always,exit -F arch=b64 -S execve /path/to/program
  • 32-bit Rule Example: Monitor file access on 32-bit systems.
  • -a always,exit -F arch=b32 -S open /path/to/file
  • Common Rule Example: Monitor all system calls for both architectures (use sparingly).
  • -a always,exit -F arch=all -S syscall
  • Load the Rules
  • After creating or modifying rule files, reload auditd:

    sudo auditctl -R /etc/audit/rules.d/*
  • Test Your Rules
  • Verify that your rules are working as expected by triggering the events they’re designed to capture.

    sudo ausearch -i
  • Troubleshooting
  • Exit mobile version