audit 命令

用途

控制系统审计。

语法

审计 { 关于 [ 慌乱 | 全径] | 关闭 | 询问 | 启动 | 关闭 }{-@ wparname ...}

描述

audit 命令通过几个关键字控制系统审计。 每次输入命令时必须包括一个关键字。 start 关键字和 shutdown 关键字启动和停止审计系统并重新设置系统配置。 off 关键字和 on 关键字暂挂和重新启动审计系统,且不会影响系统配置。 query 关键字让您查询当前状态。

审计系统遵循以下配置文件中建立的指示信息:

  • /etc/security/audit/config
  • /etc/security/audit/events
  • /etc/security/audit/objects
  • /etc/security/audit/bincmds
  • /etc/security/audit/streamcmds

WPAR 中运行时,不支持-@选项。

关键字

描述
启动 启动审计子系统。 此关键字读取配置文件中的指示信息并执行以下任务:
角色审计
审计系统中所有当前处于活动状态的角色(如果已在 /etc/security/audit/config 文件的角色节中配置这些角色)。
object auditing(对象审计)
/etc/security/audit/objects 文件中的审计事件定义写入内核以定义对象审计事件。
注意:当其中一个文件系统对象的父目录不存在时,标记会失败并发出ENOENT错误。
事件审计
/etc/security/audit/config 文件中的审计类定义写入到内核中来定义审计类。
二进制审计
根据/etc/security/audit/config文件 中 bin 节的配置信息启动auditbin 守护进程,如果启动节包含binmode=on.
流审计
调用/etc/security/audit/config文件 中流字段定义的审计流命令,如果开始字段包含streammode=on.
注意:除非标准输出(stdout)和标准错误(stderr)进程在调用时关闭,即运行以下命令时关闭,否则应避免在启动时或从远程 shell (rsh) 调用流审计: /usr/sbin/audit start 1>&- 2>&-.
完整路径审计
捕获 "FILE_Open、"FILE_Read和 "FILE_Write审计事件的文件全路径名,如果 "/etc/security/audit/config文件中的起始节包含fullpath=on.
用户审计
审计当前登录到系统的所有用户(如果在 /etc/security/audit/config 文件的用户节中已设置这些用户)。
审计记录日志
/etc/security/audit/config  文件中的启动节中定义的那样启用审计日志记录组件。
审计范围
如果在/etc/security/audit/config文件的WPAR审计范围 (WAR) 节中设置了可信AIX®审计范围,则将其写入内核。
全球启动的WPAR审计
如果 WPAR 存储在 /etc/security/audit/config 文件的 WPARS 节中,那么将审计这些 WPAR。 通过在命令中指定-@wparname参数,只能在全局WPAR中使用审计功能。
关闭 终止审计记录的收集并通过从内核表中除去类的定义来重新设置配置信息。 根据后端命令的规范,将所有审计记录从内核缓冲区清仓到二进制文件中(包含在用于二进制方式审计的 /etc/security/audit/bincmds 文件中)或审计流中(包含在用于流审计的 /etc/security/audit/streamcmds 文件中)。 审计数据的收集停止,直到给出下一个 audit start 命令才重新开始。 使用-@wparname参数和此关键字时,指定WPAR 的审计将被禁用。
暂挂审计系统,但使配置保留有效。 数据收集暂停,直到给出 audit on 命令才重新开始。 此关键字与 -@ 选项一起使用时不受支持。
on[panic | fullpath] 如果系统正确配置(例如事先使用 audit start 命令且配置依旧有效),那么在暂挂后重新启动审计系统。 如果给出命令时,审计已经启动,那么只有二进制数据收集可以更改。

此关键字与 -@ 选项一起使用时不受支持。

如果指定 panic 选项,那么假如启用二进制数据收集但它们不能写到二进制文件,那么系统将突然停止。 在WPAR 中运行时,不支持panic选项。

如果指定 fullpath 选项,那么 FILE_Open、FILE_Read 和 FILE_Write 审计事件将捕获文件的完整路径名。

查询 查询审计子系统的审计状态。 如果指定-@选项,该关键字将查询全局启动的WPAR 的审计状态。 此关键字按以下格式显示审计子系统的当前状态:
auditing on {panic | fullpath} | auditing off
  
bin manager off |  is process number pid
 
audit events:
    audit class: audit event, audit event...
audit objects:
    object name: object mode: audit event 

安全性

访问控制

此命令应向 root 用户和审计组的成员授予执行 (x) 访问权。 对于 root 用户命令是 setuid,并且有可信计算库属性。

访问的文件

方式 文件
R /etc/security/audit/config
R /etc/security/audit/objects
X /usr/sbin/auditbin
X /usr/sbin/auditstream

RBAC 用户和 Trusted AIX 用户注意:该命令可执行特权操作。 只有特权用户才能执行特权限定的操作。 有关权限与特权的更多信息,请参阅安全性中的“特权限定的命令数据库”。 有关与该命令相关联的特权和权限的列表,请参阅 lssecattr 命令或 getcmdattr 子命令。

示例

  1. To start the audit process, configure the audit system as described in "Setting up Auditing" in 安全, and add the following line to the system initialization file (the /etc/rc in the global environment or the /etc/rc.bootc in WPAR):
    /usr/sbin/audit start 1>&- 2>&- 
    每次系统初始化时,审计进程启动(如配置的那样)。
  2. 启动名为WPAR的审计程序wpar1从全局WPAR 输入以下命令:
    /usr/sbin/audit start -@ wpar1
  3. To terminate the operation of the auditing process, enter the following command:
    /usr/sbin/audit shutdown
    数据收集将停止,直到再次指定 audit start 命令才重新开始。 操作系统内核中的类的配置丢失。
    注:audit shutdown 命令也应位于 /etc/shutdown 文件中。
  4. 终止名为WPAR的审计程序wpar1从全局WPAR 输入以下命令:
    /usr/sbin/audit shutdown -@ wpar1
    数据收集将停止,直到再次指定 audit start -@ wpar1 命令才重新开始。 操作系统内核中的类的配置丢失。

    记住 audit shutdown命令不带任何选项,会关闭从全局 WPAR 启动的所有WPAR 的审计进程。

  5. To suspend the audit subsystem, enter the following command:
    /usr/sbin/audit off
  6. 要重新启动被 "审计命令暂停的审计进程,请输入以下命令:
    /usr/sbin/audit on
    只要系统正确配置,那么暂挂的状态结束,再次生成审计记录。
  7. To display the current status of the auditing system, enter the following command:
    /usr/sbin/audit query
    以下是审计查询状态消息的示例:
    auditing on
     
    bin manager is process number 123
     
    audit events:
        authentication- USER_Login, USER_Logout
        administration- USER_Create, GROUP_Create
     
    audit objects:
        /etc/security/passwd :
          r = AUTH_Read
        /etc/security/passwd : 
          w = AUTH_Write 
    此查询告诉您当指定的用户登录或注销时、当指定的管理员创建用户或组时,以及当系统接收到对 /etc/security/passwd 文件进行读写的授权的读写指令时,都将写下审计记录。

文件

描述
/etc/security/audit/bincmds 包含处理审计二进制数据的 shell 命令。
/etc/security/audit/config                包含审计配置信息。
/etc/security/audit/events            列出审计事件和它们的尾部格式规范。
/etc/security/audit/objects            列出了每个文件(对象)的审计事件。
/etc/security/audit/streamcmds    包含审计流命令。
/etc/rc 包含系统初始化命令。
/usr/sbin/audit 包含 audit 命令的路径。