audit_remote - 将 Solaris 审计日志发送到远程服务器
/usr/lib/security/audit_remote.so
用于 Solaris 审计的 audit_remote 插件模块 /usr/lib/security/audit_remote.so 可按照二进制审计记录 (audit.log(5)) 在 auditconfig(8) 中的配置方式将二进制审计记录发送到审计服务器。
The audit_remote plugin is loaded by auditd(8) if the plugin is configured as active via auditconfig.使用 auditconfig –setplugin 选项可以更改所有与插件相关的配置参数。
The Solaris audit service daemon's audit remote service, ars(7), may be configured with auditconfig to receive the binary audit records sent by audit_remote.
下列属性指定 audit_remote 插件的配置:
由 audit_remote 插件审计的审计类。audit_flags(7) 中定义了指定审计标志的语法。The default value for p_flags in audit_remote is all.
host1[:[port1][:mech1]][,host2[:[port2][:mech2]],... \ hostn[:[portn][:mechn]]]
审计主机/服务器列表。审计记录将发送到第一台可用主机。如果在发送数据时主机无法访问或出现超时,则将尝试列表中的下一台主机。如果与所有主机的连接均失败,则将从头开始重新尝试该列表。
p_hosts 条目的 host 部分可采用 getipnodebyname(3C) 接受的任何形式。
p_hosts 条目的 port 部分是将联系以启动审计服务器连接的主机上的端口。如果未指定,则该端口号是分配给 solaris-audit 服务的端口号。See getservbyname(3C).
p_host 条目的 mech 部分是 GSS-API 机制名称 (mech(5))。如果未指定,则使用本地主机的缺省机制。建议的机制为 kerberos_v5。
尝试连接到服务器并向其发送数据的次数。
缺省值为 3。
连接/发送数据超时的秒数。
缺省值为 5 秒。
要保留的未处理审计记录的最大数目。
缺省值是内核队列控制高界限的值。See auditconfig(8).
如果设置为 0,则缺省值是内核队列控制高界限的值。See auditconfig(8).
audit_remote plugin 是一个 TCP 客户机,可使用 GSS-API (libgss) 对配置的审计服务器进行验证。发送的二进制 Solaris 审计记录将通过 gss_wrap(3GSS) 生成的每消息令牌形式实施完整性和保密性保护。
该插件启动与审计服务器 (host:port:mech) 的 TCP 连接并通过相应的安全机制 (mech(5)) 建立 GSS 安全上下文(使用 gss_init_sec_context(3GSS))。
如果未指定端口,则将查找服务名称 solaris-audit 以获取 TCP 端口号。如果未指定机制,GSS_C_NO_OID 将用作 gss_init_sec_context(3GSS) 的 mech_type 参数,并使基础 GSS-API 使用本地缺省机制。
gss_init_sec_context(3GSS) uses GSS_C_NO_CREDENTIAL as the initiator credential handle and a target name of the form audit@<host_fqdn>.服务器需要使用 gss_accept_sec_context(3GSS) 以完成上下文建立。
在建立安全上下文后,客户机(audit_remote 插件)调用 gss_wrap(3GSS) 以对传送的有效负荷(审计记录)实现保密性保护。服务器需要使用 gss_unwrap(3GSS) 才能展开收到的数据,并需要使用 gss_get_mic(3GSS) 获取稍后将作为消息检索确认发送回插件的 MIC(Message Integrity Code,消息完整性代码)。
For example, if the kerberos_v5 mechanism is configured as GSS_API mechanism on the client and both sides agree on using this mechanism, the client side has to be eligible to non-interactively gain session keys for the audit/<host_fqdn>@<REALM> principal from the Kerberos KDC/TGS.At the same time the identity running the audit server application has to have the long term keys associated with the audit/<host_fqdn>@<REALM> principal stored in the keytab file (krb5.conf) to be able to decrypt the session keys.
audit_remote 插件启动与 p_hosts 列表中的第一台服务器的连接。如果连接失败或审计记录发送在 p_timeout 秒内没有响应,则在 p_retries 次尝试后插件会尝试连接到下一台服务器。If the connection to the last server fails, the plugin retries to connect to the first host in the list. audit_warn(8) is executed at every unsuccessful attempt to connect to the server or send timeout with the plugin option plugin audit_remote.so retry <count> <error>.<error> is connection <host:port> <the network error>.EPROTO 网络错误指示客户机插件未获得成功的协议版本握手。
所有协议消息的前面都带有说明后跟数据大小的 4 个八位字节。此大小采用网络字节顺序。
协议以版本协商开头,后跟 GSS-API 安全上下文令牌交换。出现错误时将关闭连接(可以选择发送任何输出令牌)。
版本协商以明文形式进行,插件将发送受支持版本的逗号 (,) 分隔列表的八位字节数组。当前版本号是字符 01。接收者需要使用其接受的版本(在当前情况下为字符 01)进行响应。不匹配将视为错误,并将关闭连接。
插件发送的版本八位字节数组和接收者接受的版本字符串联在一起,以构成 GSS 安全上下文建立的通道绑定的应用程序数据字段。
<plugin version characters> || <server accepted version characters> "||" represents concatenation
后续令牌包含一个采用网络字节顺序的 64 位序列号以及一条审计记录 (audit.log(5));客户机使用保密性保护。wrap (64 位序列号 || 审计记录)
服务器使用收到的 64 位序列号以及已展开的 64 位序列号和审计记录的 MIC 令牌确认收到,然后对任何数据丢失负责。客户端上的 MIC 验证确认可以释放审计记录且不保存其用于可能的重新传输。
64 bit sequence number || mic (64 bit sequence number || audit record)
安全的远程审计客户机/服务器通信流:
1) Client <--> Server - TCP handshake 2) Client <--> Server - protocol version negotiation: a) Client --> Server - send data size - uint32_t value (2) b) Client --> Server - send clear text message of the versions supported comma separated, e.g., "01,02,03" for versions 1 and 2 and 3. The only version supported at present is "01" c) Client <-- Server - send data size - uint32_t value (2) d) Client <-- Server - send clear text version selected ("01") :no version match; close connection; try next host 3) Security context initiation: a) Client - Construct channel bindings: initiator address type (GSS_C_AF_NULLADDR) acceptor address type (GSS_C_AF_NULLADDR) application data value (4 octets "0101") b) Client --> Server - send token (data) size - uint32_t value c) Client --> Server - GSS-API per-context token d) Client <-- Server - send token (data) size e) Client <-- Server - GSS-API per-context token :repeat a-e until security context is initialized; if unsuccessful, close connection; try next host 4) Client - transmit thread, when audit record to be sent: a) Client --> Server - send data size b) Client --> Server - GSS-API per-message token wrap (sequence number || audit record) :repeat a-b while less than max (qsize) outstanding records 5) Client - receive thread: a) Client <-- Server - receive data size - uint32_t value b) Client <-- Server - receive sequence number - uint64_t value c) Client <-- Server - receive MIC d) Client - MIC verification - OK e) Client - remove particular audit record pointed by the sequence number from the retransmit buffer :repeat a-e, on error close connection; try next host; retransmit unacknowledged audit records 6) Server - receive thread: a) Client --> Server - receive data size b) Client --> Server - GSS-API receive, uwrap, store per-message token 7) Server - transmit thread: a) Server - MIC generation - message integrity code mic (sequence number || audit record) b) Client <-- Server - send data size c) Client < -- Server - send sequence number d) Client <-- Server - send MIC
使用以下指令可装入 audit_remote.so 并指定要将审计记录发送到的远程审计服务器。kerberos_v5 安全机制被定义为在与服务器通信时使用。
auditconfig -setplugin audit_remote active \ "p_timeout=90;p_retries=2; p_hosts=eggplant.eng.example.com::kerberos_v5, purple.ebay.example.com:4592:kerberos_v5"示例 2 Using the Default Security Mechanism
The following example shows the configuration using the default security mechanism.It also shows use of the default port on one of the configured servers:
auditconfig -setplugin audit_remote active \ "p_timeout=10;p_retries=2; p_hosts=jedger.eng.example.com, jbadams.ebay.example.com:4592"示例 3 内部插件队列大小设置
某些条件(例如,高峰或突发审计数据通信流量以及服务器和客户机之间线路通信速度缓慢)可能使 audit_remote 插件排队的未处理审计记录的数量达到配置的最大数量。以下示例说明了如何设置队列大小参数。
auditconfig -setplugin audit_remote "" 1000
有关以下属性的说明,请参见 attributes(7):
|
插件配置参数是 "Committed"(已确定)。客户机/服务器协议(版本 "01")是 "Contracted Project Private"(合同项目专用)。有关审计记录格式和内容稳定性,请参见 audit.log(5)。
getipnodebyname(3C), getservbyname(3C), gss_accept_sec_context(3GSS), gss_get_mic(3GSS), gss_init_sec_context(3GSS), gss_unwrap(3GSS), gss_wrap(3GSS), libgss(3LIB), tcp(4P), audit.log(5), mech(5), ars(7), attributes(7), audit_warn(8), auditconfig(8), auditd(8)
《Managing Auditing in Oracle Solaris 11.4》
audit_remote authenticates itself to the remote audit service by way of GSS-API (libgss).使用 gss 实现机制(例如 Kerberos)提供的缺省 gss 凭证。
IANA 分配的 solaris-audit 服务端口为 16162。