{
    "content": [
        {
            "type": "text",
            "text": "# auditctl (man)\n\n## NAME\n\nauditctl - a utility to assist controlling the kernel's audit system\n\n## SYNOPSIS\n\nauditctl [options]\n\n## DESCRIPTION\n\nThe  auditctl  program is used to configure kernel options related to auditing, to see status\nof the configuration, and to load discretionary audit rules.\n\n## TLDR\n\n> Utility to control the behavior, get status and manage rules of the Linux Auditing System.\n\n- Display the [s]tatus of the audit system:\n  `sudo auditctl -s`\n- [l]ist all currently loaded audit rules:\n  `sudo auditctl -l`\n- [D]elete all audit rules:\n  `sudo auditctl -D`\n- [e]nable/disable the audit system:\n  `sudo auditctl -e {{1|0}}`\n- Watch a file for changes:\n  `sudo auditctl -a always,exit -F arch=b64 -F path=/{{path/to/file}} -F perm=wa`\n- Recursively watch a directory for changes:\n  `sudo auditctl -a always,exit -F arch=b64 -F dir=/{{path/to/directory}}/ -F perm=wa`\n- Display [h]elp:\n  `auditctl -h`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **CONFIGURATION OPTIONS** (14 subsections)\n- **STATUS OPTIONS** (4 subsections)\n- **RULE OPTIONS** (10 subsections)\n- **PERFORMANCE TIPS** (4 subsections)\n- **EXAMPLES** (10 subsections)\n- **DISABLED BY DEFAULT**\n- **FILES**\n- **SEE ALSO**\n- **AUTHOR**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "auditctl",
        "section": "",
        "mode": "man",
        "summary": "auditctl - a utility to assist controlling the kernel's audit system",
        "synopsis": "auditctl [options]",
        "tldr_summary": "Utility to control the behavior, get status and manage rules of the Linux Auditing System.",
        "tldr_examples": [
            {
                "description": "Display the [s]tatus of the audit system",
                "command": "sudo auditctl -s"
            },
            {
                "description": "[l]ist all currently loaded audit rules",
                "command": "sudo auditctl -l"
            },
            {
                "description": "[D]elete all audit rules",
                "command": "sudo auditctl -D"
            },
            {
                "description": "[e]nable/disable the audit system",
                "command": "sudo auditctl -e {{1|0}}"
            },
            {
                "description": "Watch a file for changes",
                "command": "sudo auditctl -a always,exit -F arch=b64 -F path=/{{path/to/file}} -F perm=wa"
            },
            {
                "description": "Recursively watch a directory for changes",
                "command": "sudo auditctl -a always,exit -F arch=b64 -F dir=/{{path/to/directory}}/ -F perm=wa"
            },
            {
                "description": "Display [h]elp",
                "command": "auditctl -h"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-b",
                "long": null,
                "arg": null,
                "description": "Set max number (limit) of outstanding audit buffers allowed (Kernel Default=64) If all buffers are full, the failure flag is consulted by the kernel for action. --backlogwaittime waittime Set the time for the kernel to wait (Kernel Default 60*HZ) when the backlog limit is reached before queuing more audit events to be transferred to auditd. The number must be greater than or equal to zero and less than 10 times the default value."
            },
            {
                "flag": "",
                "long": "--reset_backlog_wait_time_actual",
                "arg": null,
                "description": "Reset the actual backlog wait time counter shown by the status command."
            },
            {
                "flag": "-c",
                "long": null,
                "arg": null,
                "description": "the rules. The exit code will not be success if any rule fails to load."
            },
            {
                "flag": "-D",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-e",
                "long": null,
                "arg": null,
                "description": "Set enabled flag. When 0 is passed, this can be used to temporarily disable auditing. When 1 is passed as an argument, it will enable auditing. To lock the audit configura‐ tion so that it can't be changed, pass a 2 as the argument. Locking the configuration is intended to be the last command in audit.rules for anyone wishing this feature to be active. Any attempt to change the configuration in this mode will be audited and denied. The configuration can only be changed by rebooting the machine."
            },
            {
                "flag": "-f",
                "long": null,
                "arg": null,
                "description": "Set failure mode 0=silent 1=printk 2=panic. This option lets you determine how you want the kernel to handle critical errors. Example conditions where this mode may have an effect includes: transmission errors to userspace audit daemon, backlog limit ex‐ ceeded, out of kernel memory, and rate limit exceeded. The default value is 1. Secure environments will probably want to set this to 2."
            },
            {
                "flag": "-h",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-i",
                "long": null,
                "arg": null,
                "description": "ditctl to always return a success exit code. If passed as an argument to -s then it gives an interpretation of the numbers to human readable words if possible."
            },
            {
                "flag": "",
                "long": "--loginuid-immutable",
                "arg": null,
                "description": "This option tells the kernel to make loginuids unchangeable once they are set. Chang‐ ing loginuids requires CAPAUDITCONTROL. So, its not something that can be done by unprivileged users. Setting this makes loginuid tamper-proof, but can cause some prob‐ lems in certain kinds of containers."
            },
            {
                "flag": "-q",
                "long": null,
                "arg": null,
                "description": "If you have an existing directory watch and bind or move mount another subtree in the watched subtree, you need to tell the kernel to make the subtree being mounted equiva‐ lent to the directory being watched. If the subtree is already mounted at the time the directory watch is issued, the subtree is automatically tagged for watching. Please note the comma separating the two values. Omitting it will cause errors."
            },
            {
                "flag": "-r",
                "long": null,
                "arg": null,
                "description": "Set limit in messages/sec (0=none). If this rate is non-zero and is exceeded, the failure flag is consulted by the kernel for action. The default value is 0."
            },
            {
                "flag": "",
                "long": "--reset-lost",
                "arg": null,
                "description": "Reset the lost record counter shown by the status command."
            },
            {
                "flag": "-R",
                "long": null,
                "arg": null,
                "description": "Read and execute auditctl commands from a file. The commands are executed line-by- line, in the order that they appear in the file. The file must be owned by root and not readable by other users, or else it will be rejected. Empty lines are skipped. Lines starting with the '#' character are treated as comment lines. Each line is exe‐ cuted as if it was provided to auditctl as command line arguments. Since auditctl is the one reading the file and not a shell such as bash, do not escape special shell characters. See the EXAMPLES section for an example. --signal signal Send a signal to the audit daemon. You must have privileges to do this. Supported sig‐ nals are TERM, HUP, USR1, USR2, CONT and user friendly versions stop, reload, rotate, resume, state."
            },
            {
                "flag": "-t",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-l",
                "long": null,
                "arg": null,
                "description": "either a key option (-k) to list rules that match a key or a (-i) to have a0 through a3 interpreted to help determine the syscall argument values are correct ."
            },
            {
                "flag": "-m",
                "long": null,
                "arg": null,
                "description": "Send a user space message into the audit system. This can only be done if you have CAPAUDITWRITE capability (normally the root user has this). The resulting event will be the USER type."
            },
            {
                "flag": "-s",
                "long": null,
                "arg": null,
                "description": "can be set by -e, -f, -r, and -b options. The pid value is the process number of the audit daemon. Note that a pid of 0 indicates that the audit daemon is not running. The lost entry will tell you how many event records that have been discarded due to the kernel audit queue overflowing. The backlog field tells how many event records are currently queued waiting for auditd to read them. This option can be followed by the -i to get a couple fields interpreted."
            },
            {
                "flag": "-v",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-a",
                "long": null,
                "arg": null,
                "description": "Append rule to the end of list with action. Please note the comma separating the two values. Omitting it will cause errors. The fields may be in either order. It could be list,action or action,list. The following describes the valid list names: task Add a rule to the per task list. This rule list is used only at the time a task is created -- when fork() or clone() are called by the parent task. When using this list, you should only use fields that are known at task creation time, such as the uid, gid, etc. exit Add a rule to the syscall exit list. This list is used upon exit from a system call to determine if an audit event should be created. user Add a rule to the user message filter list. This list is used by the ker‐ nel to filter events originating in user space before relaying them to the audit daemon. It should be noted that the only fields that are valid are: uid, auid, gid, pid, subjuser, subjrole, subjtype, subjsen, subjclr, msgtype, and executable name. All other fields will be treated as non- matching. It should be understood that any event originating from user space from a process that has CAPAUDITWRITE will be recorded into the audit trail. This means that the most likely use for this filter is with rules that have an action of never since nothing has to be done to allow events to be recorded. exclude Add a rule to the event type exclusion filter list. This list is used to filter events that you do not want to see. For example, if you do not want to see any avc messages, you would using this list to record that. Events can be excluded by process ID, user ID, group ID, login user ID, message type, subject context, or executable name. The action is ignored and uses its default of \"never\". filesystem Add a rule that will be applied to a whole filesystem. The filesystem must be identified with a fstype field. Normally this filter is used to exclude any events for a whole filesystem such as tracefs or debugfs. iouring Add a rule to the iouring syscall filter. Rules against this filter spec‐ ify the syscall operation using the -S syscall notion explained below. You can add a key field to the rule so that it may be grouped with other rules watching the same underlying syscall. The following describes the valid actions for the rule: never No audit records will be generated. This can be used to suppress event generation. In general, you want suppressions at the top of the list in‐ stead of the bottom. This is because the event triggers on the first matching rule. always Allocate an audit context, always fill it in at syscall entry time, and always write out a record at syscall exit time."
            },
            {
                "flag": "-A",
                "long": null,
                "arg": null,
                "description": "Add rule to the beginning list with action."
            },
            {
                "flag": "-C",
                "long": null,
                "arg": null,
                "description": "Build an inter-field comparison rule: field, operation, field. You may pass multiple comparisons on a single command line. Each one must start with -C. Each inter-field equation is anded with each other as well as equations starting with -F to trigger an audit record. There are 2 operators supported - equal, and not equal. Valid fields are: auid, uid, euid, suid, fsuid, objuid; and gid, egid, sgid, fsgid, objgid The two groups of uid and gid cannot be mixed. But any comparison within the group can be made. The objuid/gid fields are collected from the object of the event such as a file or directory."
            },
            {
                "flag": "-d",
                "long": null,
                "arg": null,
                "description": "Delete rule from list with action. The rule is deleted only if it exactly matches syscall name(s) and every field name and value."
            },
            {
                "flag": "-F",
                "long": null,
                "arg": null,
                "description": "Build a rule field: name, operation, value. You may have up to 64 fields passed on a single command line. Each one must start with -F. Each field equation is anded with each other (as well as equations starting with -C) to trigger an audit record. There are 8 operators supported - equal, not equal, less than, greater than, less than or equal, and greater than or equal, bit mask, and bit test respectively. Bit test will \"and\" the values and check that they are equal, bit mask just \"ands\" the values. Fields that take a user ID may instead have the user's name; the program will convert the name to user ID. The same is true of group names. Valid fields are: a0, a1, a2, a3 Respectively, the first 4 arguments to a syscall. Note that string argu‐ ments are not supported. This is because the kernel is passed a pointer to the string. Triggering on a pointer address value is not likely to work. So, when using this, you should only use on numeric values. This is most likely to be used on platforms that multiplex socket or IPC operations. arch The CPU architecture of the syscall. The arch can be found doing 'uname -m'. If you do not know the arch of your machine but you want to use the 32 bit syscall table and your machine supports 32 bit, you can also use b32 for the arch. The same applies to the 64 bit syscall table, you can use b64. In this way, you can write rules that are somewhat arch indepen‐ dent because the family type will be auto detected. However, syscalls can be arch specific and what is available on x8664, may not be available on ppc. The arch directive should precede the -S option so that auditctl knows which internal table to use to look up the syscall numbers. auid The original ID the user logged in with. Its an abbreviation of audit uid. Sometimes its referred to as loginuid. Either the user account text or number may be used. devmajor Device Major Number devminor Device Minor Number dir Full Path of Directory to watch. This will place a recursive watch on the directory and its whole subtree. It can only be used on exit list. See \"-w\". egid Effective Group ID. May be numeric or the groups name. euid Effective User ID. May be numeric or the user account name. exe Absolute path to application that while executing this rule will apply to. It supports = and != operators. Note that you can only use this once for each rule. exit Exit value from a syscall. If the exit code is an errno, you may use the text representation, too. fsgid Filesystem Group ID. May be numeric or the groups name. fstype File system type. This is used with the filesystem rule list. The only values supported are debugfs and tracefs. fsuid Filesystem User ID. May be numeric or the user account name. filetype The target file's type. Can be either file, dir, socket, link, character, block, or fifo. gid Group ID. May be numeric or the groups name. inode Inode Number key This is another way of setting a filter key. See discussion above for -k option. msgtype This is used to match the event's record type. It should only be used on the exclude or user filter lists. objuid Object's UID objgid Object's GID objuser Resource's SE Linux User objrole Resource's SE Linux Role objtype Resource's SE Linux Type objlevlow Resource's SE Linux Low Level objlevhigh Resource's SE Linux High Level path Full Path of File to watch. It can only be used on exit list. perm Permission filter for file operations. See \"-p\". It can only be used on exit list. You can use this without specifying a syscall and the kernel will select the syscalls that satisfy the permissions being requested. pers OS Personality Number pid Process ID ppid Parent's Process ID saddrfam Address family number as found in /usr/include/bits/socket.h. For example, IPv4 would be 2 and IPv6 would be 10. sessionid User's login session ID subjuser Program's SE Linux User subjrole Program's SE Linux Role subjtype Program's SE Linux Type subjsen Program's SE Linux Sensitivity subjclr Program's SE Linux Clearance sgid Saved Group ID. See getresgid(2) man page. success If the exit value is >= 0 this is true/yes otherwise its false/no. When writing a rule, use a 1 for true/yes and a 0 for false/no suid Saved User ID. See getresuid(2) man page. uid User ID. May be numeric or the user account name."
            },
            {
                "flag": "-k",
                "long": null,
                "arg": null,
                "description": "can be up to 31 bytes long. It can uniquely identify the audit records produced by a rule. Typical use is for when you have several rules that together satisfy a security requirement. The key value can be searched on with ausearch so that no matter which rule triggered the event, you can find its results. The key can also be used on delete all (-D) and list rules (-l) to select rules with a specific key. You may have more than one key on a rule if you want to be able to search logged events in multiple ways or if you have an auditd plugin that uses a key to aid its analysis."
            },
            {
                "flag": "-p",
                "long": null,
                "arg": null,
                "description": "Describe the permission access type that a file system watch will trigger on. r=read, w=write, x=execute, a=attribute change. These permissions are not the standard file permissions, but rather the kind of syscall that would do this kind of thing. The read & write syscalls are omitted from this set since they would overwhelm the logs. But rather for reads or writes, the open flags are looked at to see what permission was requested."
            },
            {
                "flag": "-S",
                "long": null,
                "arg": null,
                "description": "Any syscall name or number may be used. The word 'all' may also be used. If the given syscall is made by a program, then start an audit record. If a field rule is given and no syscall is specified, it will default to all syscalls. You may also specify multi‐ ple syscalls in the same rule by using multiple -S options in the same rule. Doing so improves performance since fewer rules need to be evaluated. Alternatively, you may pass a comma separated list of syscall names. If you are on a bi-arch system, like x8664, you should be aware that auditctl simply takes the text, looks it up for the native arch (in this case b64) and sends that rule to the kernel. If there are no ad‐ ditional arch directives, IT WILL APPLY TO BOTH 32 & 64 BIT SYSCALLS. This can have undesirable effects since there is no guarantee that any syscall has the same number on both 32 and 64 bit interfaces. You will likely want to control this and write 2 rules, one with arch equal to b32 and one with b64 to make sure the kernel finds the events that you intend. See the arch field discussion for more info."
            },
            {
                "flag": "-w",
                "long": null,
                "arg": null,
                "description": "Insert a watch for the file system object at path. You cannot insert a watch to the top level directory. This is prohibited by the kernel. Wildcards are not supported ei‐ ther and will generate a warning. The way that watches work is by tracking the inode internally. If you place a watch on a file, its the same as using the -F path option on a syscall rule. If you place a watch on a directory, its the same as using the -F dir option on a syscall rule. The -w form of writing watches is for backwards compati‐ bility and the syscall based form is more expressive. Unlike most syscall auditing rules, watches do not impact performance based on the number of rules sent to the ker‐ nel. The only valid options when using a watch are the -p and -k. If you need to do anything fancy like audit a specific user accessing a file, then use the syscall au‐ diting form with the path or dir fields. See the EXAMPLES section for an example of converting one form to another."
            },
            {
                "flag": "-W",
                "long": null,
                "arg": null,
                "description": "Remove a watch for the file system object at path. The rule must match exactly. See -d discussion for more info."
            },
            {
                "flag": "-D",
                "long": null,
                "arg": null,
                "description": "# Never record sudo invocations -A exclude,always -F exe=/usr/bin/sudo"
            }
        ],
        "examples": [
            "To see all syscalls made by a specific program:",
            "# By pid:",
            "# By executable path",
            "To see files opened by a specific user:",
            "To see unsuccessful openat calls:",
            "To watch a file for changes (2 ways to express):",
            "To recursively watch a directory for changes (2 ways to express):",
            "To see if an admin is accessing other user's files:",
            "This is an example rules file:",
            "# Remove all existing rules",
            "# Never record sudo invocations",
            "-A exclude,always -F exe=/usr/bin/sudo"
        ],
        "see_also": [
            {
                "name": "audit.rules",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/audit.rules/7/json"
            },
            {
                "name": "ausearch",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/ausearch/8/json"
            },
            {
                "name": "aureport",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/aureport/8/json"
            },
            {
                "name": "auditd",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/auditd/8/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "CONFIGURATION OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-b _",
                        "lines": 8,
                        "flag": "-b"
                    },
                    {
                        "name": "--reset_backlog_wait_time_actual",
                        "lines": 2,
                        "long": "--reset_backlog_wait_time_actual"
                    },
                    {
                        "name": "-c",
                        "lines": 2,
                        "flag": "-c"
                    },
                    {
                        "name": "-D",
                        "lines": 1,
                        "flag": "-D"
                    },
                    {
                        "name": "-e",
                        "lines": 7,
                        "flag": "-e"
                    },
                    {
                        "name": "-f",
                        "lines": 6,
                        "flag": "-f"
                    },
                    {
                        "name": "-h",
                        "lines": 1,
                        "flag": "-h"
                    },
                    {
                        "name": "-i",
                        "lines": 3,
                        "flag": "-i"
                    },
                    {
                        "name": "--loginuid-immutable",
                        "lines": 5,
                        "long": "--loginuid-immutable"
                    },
                    {
                        "name": "-q _",
                        "lines": 6,
                        "flag": "-q"
                    },
                    {
                        "name": "-r _",
                        "lines": 3,
                        "flag": "-r"
                    },
                    {
                        "name": "--reset-lost",
                        "lines": 2,
                        "long": "--reset-lost"
                    },
                    {
                        "name": "-R _",
                        "lines": 13,
                        "flag": "-R"
                    },
                    {
                        "name": "-t",
                        "lines": 1,
                        "flag": "-t"
                    }
                ]
            },
            {
                "name": "STATUS OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-l",
                        "lines": 3,
                        "flag": "-l"
                    },
                    {
                        "name": "-m _",
                        "lines": 4,
                        "flag": "-m"
                    },
                    {
                        "name": "-s",
                        "lines": 7,
                        "flag": "-s"
                    },
                    {
                        "name": "-v",
                        "lines": 1,
                        "flag": "-v"
                    }
                ]
            },
            {
                "name": "RULE OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-a _",
                        "lines": 49,
                        "flag": "-a"
                    },
                    {
                        "name": "-A _",
                        "lines": 2,
                        "flag": "-A"
                    },
                    {
                        "name": "-C",
                        "lines": 13,
                        "flag": "-C"
                    },
                    {
                        "name": "-d _",
                        "lines": 3,
                        "flag": "-d"
                    },
                    {
                        "name": "-F",
                        "lines": 120,
                        "flag": "-F"
                    },
                    {
                        "name": "-k _",
                        "lines": 8,
                        "flag": "-k"
                    },
                    {
                        "name": "-p",
                        "lines": 7,
                        "flag": "-p"
                    },
                    {
                        "name": "-S",
                        "lines": 14,
                        "flag": "-S"
                    },
                    {
                        "name": "-w _",
                        "lines": 13,
                        "flag": "-w"
                    },
                    {
                        "name": "-W _",
                        "lines": 3,
                        "flag": "-W"
                    }
                ]
            },
            {
                "name": "PERFORMANCE TIPS",
                "lines": 5,
                "subsections": [
                    {
                        "name": "auditctl -a always,exit -F arch=b64 -S openat -F success=0",
                        "lines": 1
                    },
                    {
                        "name": "auditctl -a always,exit -F arch=b64 -S truncate -F success=0",
                        "lines": 2
                    },
                    {
                        "name": "auditctl -a always,exit -F arch=b64 -S openat -S truncate -F success=0",
                        "lines": 5
                    },
                    {
                        "name": "auditctl -a always,exit -S openat -S truncate -F dir=/etc -F success=0",
                        "lines": 4
                    }
                ]
            },
            {
                "name": "EXAMPLES",
                "lines": 3,
                "subsections": [
                    {
                        "name": "auditctl -a always,exit -S all -F pid=1005",
                        "lines": 1
                    },
                    {
                        "name": "auditctl -a always,exit -S all -F exe=/usr/bin/ls",
                        "lines": 2
                    },
                    {
                        "name": "auditctl -a always,exit -S openat -F auid=510",
                        "lines": 2
                    },
                    {
                        "name": "auditctl -a always,exit -S openat -F success=0",
                        "lines": 2
                    },
                    {
                        "name": "auditctl -w /etc/shadow -p wa",
                        "lines": 1
                    },
                    {
                        "name": "auditctl -a always,exit -F path=/etc/shadow -F perm=wa",
                        "lines": 2
                    },
                    {
                        "name": "auditctl -w /etc/ -p wa",
                        "lines": 1
                    },
                    {
                        "name": "auditctl -a always,exit -F dir=/etc/ -F perm=wa",
                        "lines": 2
                    },
                    {
                        "name": "auditctl -a always,exit -F dir=/home/ -F uid=0 -C auid!=obj_uid",
                        "lines": 3
                    },
                    {
                        "name": "-D",
                        "lines": 4,
                        "flag": "-D"
                    }
                ]
            },
            {
                "name": "DISABLED BY DEFAULT",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "FILES",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 3,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "auditctl - a utility to assist controlling the kernel's audit system\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "auditctl [options]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The  auditctl  program is used to configure kernel options related to auditing, to see status\nof the configuration, and to load discretionary audit rules.\n",
                "subsections": []
            },
            "CONFIGURATION OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-b _",
                        "content": "Set max number (limit) of outstanding audit buffers allowed (Kernel Default=64) If all\nbuffers are full, the failure flag is consulted by the kernel for action.\n\n--backlogwaittime waittime\nSet the time for the kernel to wait (Kernel Default 60*HZ) when the backlog  limit  is\nreached  before queuing more audit events to be transferred to auditd. The number must\nbe greater than or equal to zero and less than 10 times the default value.\n",
                        "flag": "-b"
                    },
                    {
                        "name": "--reset_backlog_wait_time_actual",
                        "content": "Reset the actual backlog wait time counter shown by the status command.\n",
                        "long": "--reset_backlog_wait_time_actual"
                    },
                    {
                        "name": "-c",
                        "content": "the rules. The exit code will not be success if any rule fails to load.\n",
                        "flag": "-c"
                    },
                    {
                        "name": "-D",
                        "content": "",
                        "flag": "-D"
                    },
                    {
                        "name": "-e",
                        "content": "Set  enabled flag. When 0 is passed, this can be used to temporarily disable auditing.\nWhen 1 is passed as an argument, it will enable auditing. To lock the audit configura‐\ntion so that it can't be changed, pass a 2 as the argument. Locking the  configuration\nis  intended  to be the last command in audit.rules for anyone wishing this feature to\nbe active. Any attempt to change the configuration in this mode will  be  audited  and\ndenied. The configuration can only be changed by rebooting the machine.\n",
                        "flag": "-e"
                    },
                    {
                        "name": "-f",
                        "content": "Set  failure  mode  0=silent  1=printk 2=panic. This option lets you determine how you\nwant the kernel to handle critical errors. Example conditions where this mode may have\nan effect includes: transmission errors to userspace audit daemon, backlog  limit  ex‐\nceeded,  out of kernel memory, and rate limit exceeded. The default value is 1. Secure\nenvironments will probably want to set this to 2.\n",
                        "flag": "-f"
                    },
                    {
                        "name": "-h",
                        "content": "",
                        "flag": "-h"
                    },
                    {
                        "name": "-i",
                        "content": "ditctl  to  always  return a success exit code. If passed as an argument to -s then it\ngives an interpretation of the numbers to human readable words if possible.\n",
                        "flag": "-i"
                    },
                    {
                        "name": "--loginuid-immutable",
                        "content": "This option tells the kernel to make loginuids unchangeable once they are set.  Chang‐\ning  loginuids  requires  CAPAUDITCONTROL. So, its not something that can be done by\nunprivileged users. Setting this makes loginuid tamper-proof, but can cause some prob‐\nlems in certain kinds of containers.\n",
                        "long": "--loginuid-immutable"
                    },
                    {
                        "name": "-q _",
                        "content": "If you have an existing directory watch and bind or move mount another subtree in  the\nwatched subtree, you need to tell the kernel to make the subtree being mounted equiva‐\nlent to the directory being watched. If the subtree is already mounted at the time the\ndirectory  watch  is  issued, the subtree is automatically tagged for watching. Please\nnote the comma separating the two values. Omitting it will cause errors.\n",
                        "flag": "-q"
                    },
                    {
                        "name": "-r _",
                        "content": "Set limit in messages/sec (0=none). If this rate is  non-zero  and  is  exceeded,  the\nfailure flag is consulted by the kernel for action. The default value is 0.\n",
                        "flag": "-r"
                    },
                    {
                        "name": "--reset-lost",
                        "content": "Reset the lost record counter shown by the status command.\n",
                        "long": "--reset-lost"
                    },
                    {
                        "name": "-R _",
                        "content": "Read  and  execute  auditctl  commands from a file. The commands are executed line-by-\nline, in the order that they appear in the file. The file must be owned  by  root  and\nnot  readable  by  other  users, or else it will be rejected. Empty lines are skipped.\nLines starting with the '#' character are treated as comment lines. Each line is  exe‐\ncuted  as  if it was provided to auditctl as command line arguments. Since auditctl is\nthe one reading the file and not a shell such as bash, do  not  escape  special  shell\ncharacters. See the EXAMPLES section for an example.\n\n--signal signal\nSend a signal to the audit daemon. You must have privileges to do this. Supported sig‐\nnals are TERM, HUP, USR1, USR2, CONT\nand user friendly versions stop, reload, rotate, resume, state.\n",
                        "flag": "-R"
                    },
                    {
                        "name": "-t",
                        "content": "",
                        "flag": "-t"
                    }
                ]
            },
            "STATUS OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-l",
                        "content": "either  a  key option (-k) to list rules that match a key or a (-i) to have a0 through\na3 interpreted to help determine the syscall argument values are correct .\n",
                        "flag": "-l"
                    },
                    {
                        "name": "-m _",
                        "content": "Send a user space message into the audit system. This can only be  done  if  you  have\nCAPAUDITWRITE capability (normally the root user has this). The resulting event will\nbe the USER type.\n",
                        "flag": "-m"
                    },
                    {
                        "name": "-s",
                        "content": "can  be  set by -e, -f, -r, and -b options. The pid value is the process number of the\naudit daemon. Note that a pid of 0 indicates that the audit daemon is not running. The\nlost entry will tell you how many event records that have been discarded  due  to  the\nkernel  audit  queue  overflowing.  The backlog field tells how many event records are\ncurrently queued waiting for auditd to read them. This option can be followed  by  the\n-i to get a couple fields interpreted.\n",
                        "flag": "-s"
                    },
                    {
                        "name": "-v",
                        "content": "",
                        "flag": "-v"
                    }
                ]
            },
            "RULE OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-a _",
                        "content": "Append  rule  to the end of list with action. Please note the comma separating the two\nvalues. Omitting it will cause errors. The fields may be in either order. It could  be\nlist,action or action,list. The following describes the valid list names:\n\ntask        Add a rule to the per task list. This rule list is used only at the time a\ntask  is  created -- when fork() or clone() are called by the parent task.\nWhen using this list, you should only use fields that are  known  at  task\ncreation time, such as the uid, gid, etc.\n\nexit        Add  a  rule  to the syscall exit list. This list is used upon exit from a\nsystem call to determine if an audit event should be created.\n\nuser        Add a rule to the user message filter list. This list is used by the  ker‐\nnel to filter events originating in user space before relaying them to the\naudit  daemon. It should be noted that the only fields that are valid are:\nuid, auid, gid, pid, subjuser, subjrole, subjtype, subjsen,  subjclr,\nmsgtype,  and  executable  name.  All other fields will be treated as non-\nmatching. It should be understood that any  event  originating  from  user\nspace  from  a  process that has CAPAUDITWRITE will be recorded into the\naudit trail. This means that the most likely use for this filter  is  with\nrules  that  have an action of never since nothing has to be done to allow\nevents to be recorded.\n\nexclude     Add a rule to the event type exclusion filter list. This list is  used  to\nfilter events that you do not want to see. For example, if you do not want\nto  see any avc messages, you would using this list to record that. Events\ncan be excluded by process ID, user ID, group ID, login user  ID,  message\ntype,  subject context, or executable name. The action is ignored and uses\nits default of \"never\".\n\nfilesystem  Add a rule that will be applied to a whole filesystem. The filesystem must\nbe identified with a fstype field. Normally this filter is used to exclude\nany events for a whole filesystem such as tracefs or debugfs.\n\niouring    Add a rule to the iouring syscall filter. Rules against this filter spec‐\nify the syscall operation using the -S syscall notion explained below. You\ncan add a key field to the rule so that it may be grouped with other rules\nwatching the same underlying syscall.\n\nThe following describes the valid actions for the rule:\n\nnever       No audit records will be generated. This can be  used  to  suppress  event\ngeneration.  In  general, you want suppressions at the top of the list in‐\nstead of the bottom. This is because  the  event  triggers  on  the  first\nmatching rule.\n\nalways      Allocate  an  audit  context, always fill it in at syscall entry time, and\nalways write out a record at syscall exit time.\n",
                        "flag": "-a"
                    },
                    {
                        "name": "-A _",
                        "content": "Add rule to the beginning list with action.\n",
                        "flag": "-A"
                    },
                    {
                        "name": "-C",
                        "content": "Build an inter-field comparison rule: field, operation, field. You may  pass  multiple\ncomparisons  on  a  single command line. Each one must start with -C. Each inter-field\nequation is anded with each other as well as equations starting with -F to trigger  an\naudit  record.  There  are  2 operators supported - equal, and not equal. Valid fields\nare:\n\nauid, uid, euid, suid, fsuid, objuid; and gid, egid, sgid, fsgid, objgid\n\nThe two groups of uid and gid cannot be mixed. But any comparison within the group can\nbe made. The objuid/gid fields are collected from the object of the event such  as  a\nfile or directory.\n\n",
                        "flag": "-C"
                    },
                    {
                        "name": "-d _",
                        "content": "Delete  rule  from  list  with  action. The rule is deleted only if it exactly matches\nsyscall name(s) and every field name and value.\n",
                        "flag": "-d"
                    },
                    {
                        "name": "-F",
                        "content": "Build a rule field: name, operation, value. You may have up to 64 fields passed  on  a\nsingle  command  line.  Each one must start with -F. Each field equation is anded with\neach other (as well as equations starting with -C) to trigger an audit  record.  There\nare  8  operators  supported - equal, not equal, less than, greater than, less than or\nequal, and greater than or equal, bit mask, and bit test respectively. Bit  test  will\n\"and\"  the  values  and  check  that  they are equal, bit mask just \"ands\" the values.\nFields that take a user ID may instead have the user's name; the program will  convert\nthe name to user ID. The same is true of group names. Valid fields are:\n\na0, a1, a2, a3\nRespectively,  the  first 4 arguments to a syscall. Note that string argu‐\nments are not supported. This is because the kernel is passed a pointer to\nthe string. Triggering on a pointer address value is not likely  to  work.\nSo,  when  using this, you should only use on numeric values. This is most\nlikely to be used on platforms that multiplex socket or IPC operations.\n\narch        The CPU architecture of the syscall. The arch can be  found  doing  'uname\n-m'.  If  you do not know the arch of your machine but you want to use the\n32 bit syscall table and your machine supports 32 bit, you  can  also  use\nb32  for  the  arch. The same applies to the 64 bit syscall table, you can\nuse b64.  In this way, you can write rules that are somewhat arch indepen‐\ndent because the family type will be auto detected. However, syscalls  can\nbe  arch specific and what is available on x8664, may not be available on\nppc. The arch directive should precede the  -S  option  so  that  auditctl\nknows which internal table to use to look up the syscall numbers.\n\nauid        The original ID the user logged in with. Its an abbreviation of audit uid.\nSometimes  its  referred  to  as loginuid. Either the user account text or\nnumber may be used.\n\ndevmajor    Device Major Number\n\ndevminor    Device Minor Number\n\ndir         Full Path of Directory to watch. This will place a recursive watch on  the\ndirectory  and  its  whole  subtree. It can only be used on exit list. See\n\"-w\".\n\negid        Effective Group ID. May be numeric or the groups name.\n\neuid        Effective User ID. May be numeric or the user account name.\n\nexe         Absolute path to application that while executing this rule will apply to.\nIt supports = and != operators. Note that you can only use this  once  for\neach rule.\n\nexit        Exit  value  from a syscall. If the exit code is an errno, you may use the\ntext representation, too.\n\nfsgid       Filesystem Group ID. May be numeric or the groups name.\n\nfstype      File system type. This is used with the filesystem  rule  list.  The  only\nvalues supported are debugfs and tracefs.\n\nfsuid       Filesystem User ID. May be numeric or the user account name.\n\nfiletype    The  target file's type. Can be either file, dir, socket, link, character,\nblock, or fifo.\n\ngid         Group ID. May be numeric or the groups name.\n\ninode       Inode Number\n\nkey         This is another way of setting a filter key. See discussion above  for  -k\noption.\n\nmsgtype     This  is  used to match the event's record type. It should only be used on\nthe exclude or user filter lists.\n\nobjuid     Object's UID\n\nobjgid     Object's GID\n\nobjuser    Resource's SE Linux User\n\nobjrole    Resource's SE Linux Role\n\nobjtype    Resource's SE Linux Type\n\nobjlevlow Resource's SE Linux Low Level\n\nobjlevhigh\nResource's SE Linux High Level\n\npath        Full Path of File to watch. It can only be used on exit list.\n\nperm        Permission filter for file operations. See \"-p\". It can only  be  used  on\nexit  list.  You  can use this without specifying a syscall and the kernel\nwill select the syscalls that satisfy the permissions being requested.\n\npers        OS Personality Number\n\npid         Process ID\n\nppid        Parent's Process ID\n\nsaddrfam   Address family number as found in /usr/include/bits/socket.h. For example,\nIPv4 would be 2 and IPv6 would be 10.\n\nsessionid   User's login session ID\n\nsubjuser   Program's SE Linux User\n\nsubjrole   Program's SE Linux Role\n\nsubjtype   Program's SE Linux Type\n\nsubjsen    Program's SE Linux Sensitivity\n\nsubjclr    Program's SE Linux Clearance\n\nsgid        Saved Group ID. See getresgid(2) man page.\n\nsuccess     If the exit value is >= 0 this is true/yes otherwise  its  false/no.  When\nwriting a rule, use a 1 for true/yes and a 0 for false/no\n\nsuid        Saved User ID. See getresuid(2) man page.\n\nuid         User ID. May be numeric or the user account name.\n",
                        "flag": "-F"
                    },
                    {
                        "name": "-k _",
                        "content": "can be up to 31 bytes long. It can uniquely identify the audit records produced  by  a\nrule.  Typical use is for when you have several rules that together satisfy a security\nrequirement. The key value can be searched on with ausearch so that  no  matter  which\nrule triggered the event, you can find its results. The key can also be used on delete\nall  (-D)  and  list rules (-l) to select rules with a specific key. You may have more\nthan one key on a rule if you want to be able to search logged events in multiple ways\nor if you have an auditd plugin that uses a key to aid its analysis.\n",
                        "flag": "-k"
                    },
                    {
                        "name": "-p",
                        "content": "Describe the permission access type that a file system watch will trigger on.  r=read,\nw=write,  x=execute,  a=attribute  change. These permissions are not the standard file\npermissions, but rather the kind of syscall that would do this kind of thing. The read\n& write syscalls are omitted from this set since they would overwhelm  the  logs.  But\nrather  for  reads  or writes, the open flags are looked at to see what permission was\nrequested.\n",
                        "flag": "-p"
                    },
                    {
                        "name": "-S",
                        "content": "Any syscall name or number may be used. The word 'all' may also be used.  If the given\nsyscall is made by a program, then start an audit record. If a field rule is given and\nno syscall is specified, it will default to all syscalls. You may also specify  multi‐\nple  syscalls in the same rule by using multiple -S options in the same rule. Doing so\nimproves performance since fewer rules need to be evaluated.  Alternatively,  you  may\npass  a  comma  separated  list of syscall names. If you are on a bi-arch system, like\nx8664, you should be aware that auditctl simply takes the text, looks it up  for  the\nnative  arch (in this case b64) and sends that rule to the kernel. If there are no ad‐\nditional arch directives, IT WILL APPLY TO BOTH 32 & 64 BIT SYSCALLS.  This  can  have\nundesirable  effects  since there is no guarantee that any syscall has the same number\non both 32 and 64 bit interfaces. You will likely want to control  this  and  write  2\nrules,  one  with arch equal to b32 and one with b64 to make sure the kernel finds the\nevents that you intend. See the arch field discussion for more info.\n",
                        "flag": "-S"
                    },
                    {
                        "name": "-w _",
                        "content": "Insert a watch for the file system object at path. You cannot insert a  watch  to  the\ntop level directory. This is prohibited by the kernel. Wildcards are not supported ei‐\nther  and  will generate a warning. The way that watches work is by tracking the inode\ninternally. If you place a watch on a file, its the same as using the -F  path  option\non  a  syscall rule. If you place a watch on a directory, its the same as using the -F\ndir option on a syscall rule. The -w form of writing watches is for backwards compati‐\nbility and the syscall based form is more expressive.  Unlike  most  syscall  auditing\nrules, watches do not impact performance based on the number of rules sent to the ker‐\nnel.  The  only  valid options when using a watch are the -p and -k. If you need to do\nanything fancy like audit a specific user accessing a file, then use the  syscall  au‐\nditing  form  with  the path or dir fields. See the EXAMPLES section for an example of\nconverting one form to another.\n",
                        "flag": "-w"
                    },
                    {
                        "name": "-W _",
                        "content": "Remove a watch for the file system object at path. The rule must match exactly. See -d\ndiscussion for more info.\n",
                        "flag": "-W"
                    }
                ]
            },
            "PERFORMANCE TIPS": {
                "content": "Syscall rules get evaluated for each syscall for every program. If you have 10 syscall rules,\nevery program on your system will delay during a syscall while  the  audit  system  evaluates\neach  rule.  Too  many syscall rules will hurt performance. Try to combine as many as you can\nwhenever the filter, action, key, and fields are identical. For example:\n",
                "subsections": [
                    {
                        "name": "auditctl -a always,exit -F arch=b64 -S openat -F success=0",
                        "content": ""
                    },
                    {
                        "name": "auditctl -a always,exit -F arch=b64 -S truncate -F success=0",
                        "content": "could be re-written as one rule:\n"
                    },
                    {
                        "name": "auditctl -a always,exit -F arch=b64 -S openat -S truncate -F success=0",
                        "content": "Also, try to use file system auditing wherever practical. This improves performance. For  ex‐\nample,  if you were wanting to capture all failed opens & truncates like above, but were only\nconcerned about files in /etc and didn't care about /usr or /sbin, its possible to  use  this\nrule:\n"
                    },
                    {
                        "name": "auditctl -a always,exit -S openat -S truncate -F dir=/etc -F success=0",
                        "content": "This will be higher performance since the kernel will not evaluate it each and every syscall.\nIt  will  be  handled  by the filesystem auditing code and only checked on filesystem related\nsyscalls.\n"
                    }
                ]
            },
            "EXAMPLES": {
                "content": "To see all syscalls made by a specific program:\n\n# By pid:",
                "subsections": [
                    {
                        "name": "auditctl -a always,exit -S all -F pid=1005",
                        "content": "# By executable path"
                    },
                    {
                        "name": "auditctl -a always,exit -S all -F exe=/usr/bin/ls",
                        "content": "To see files opened by a specific user:\n"
                    },
                    {
                        "name": "auditctl -a always,exit -S openat -F auid=510",
                        "content": "To see unsuccessful openat calls:\n"
                    },
                    {
                        "name": "auditctl -a always,exit -S openat -F success=0",
                        "content": "To watch a file for changes (2 ways to express):\n"
                    },
                    {
                        "name": "auditctl -w /etc/shadow -p wa",
                        "content": ""
                    },
                    {
                        "name": "auditctl -a always,exit -F path=/etc/shadow -F perm=wa",
                        "content": "To recursively watch a directory for changes (2 ways to express):\n"
                    },
                    {
                        "name": "auditctl -w /etc/ -p wa",
                        "content": ""
                    },
                    {
                        "name": "auditctl -a always,exit -F dir=/etc/ -F perm=wa",
                        "content": "To see if an admin is accessing other user's files:\n"
                    },
                    {
                        "name": "auditctl -a always,exit -F dir=/home/ -F uid=0 -C auid!=obj_uid",
                        "content": "This is an example rules file:\n\n# Remove all existing rules"
                    },
                    {
                        "name": "-D",
                        "content": "# Never record sudo invocations\n-A exclude,always -F exe=/usr/bin/sudo\n\n",
                        "flag": "-D"
                    }
                ]
            },
            "DISABLED BY DEFAULT": {
                "content": "On many systems auditd is configured to install an -a never,task rule by default.  This  rule\ncauses  every  new process to skip all audit rule processing. This is usually done to avoid a\nsmall performance overhead imposed by syscall auditing. If you want to use auditd,  you  need\nto  remove that rule by deleting 10-no-audit.rules and adding 10-base-config.rules to the au‐\ndit rules directory.\n\nIf you have defined audit rules that are not matching when they should, check auditctl -l  to\nmake sure there is no never,task rule there.\n\n",
                "subsections": []
            },
            "FILES": {
                "content": "/etc/audit/audit.rules /etc/audit/audit-stop.rules\n\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "audit.rules(7), ausearch(8), aureport(8), auditd(8).\n\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Steve Grubb\n\nRed Hat                                       Feb 2023                                   AUDITCTL(8)",
                "subsections": []
            }
        }
    }
}