Rule ID
SV-289278r1319177_rule
Version
V1R1
CCIs
For completeness of forensic analysis, it is necessary to track who/what (a user or other principal) logs on to the database management system (DBMS).
Review the DBMS product documentation to determine whether successful logons or connections must be audited. Verify MySQL Enterprise Audit is installed: SELECT * FROM mysql.component WHERE component_urn = 'file://component_audit_log'; Review the configured audit filters and associated users: SELECT NAME, FILTER FROM mysql.audit_log_filter; SELECT USER, HOST, FILTERNAME FROM mysql.audit_log_user; Verify that the applicable audit filter records successful connection activity. For MySQL Enterprise Audit, successful logon activity is represented by the connection event class and the connect event subclass. Verify that the applicable filter includes connection/connect events and is assigned to the required users or configured as the default filter. A filter that records all connection events also satisfies this requirement. If successful logons or connections are required to be audited and the applicable audit policy does not include connection/connect events, this is a finding.
Configure MySQL Enterprise Audit to record successful logons and connection attempts.
Modify the existing audit filter to include the required connection events or create an audit filter for these events. Do not replace an existing audit filter that records additional events required by the organization.
For example:
SET @f = '{ "filter": { "class": { "name": "connection" } } }';
SELECT audit_log_filter_set_filter(
'log_connection_events',
@f
);
Assign the filter to the applicable MySQL account:
SELECT audit_log_filter_set_user(
'<user>@<host>',
'log_connection_events'
);
If the filter is intended to apply as the default to accounts without a specific filter assignment, use % as the account:
SELECT audit_log_filter_set_user('%', 'log_connection_events');
After configuring the audit policy, perform a controlled, successful connection and verify that the corresponding connection/connect audit record is generated with a status of "0".
Refer to the MySQL Reference Manual for MySQL Enterprise Audit component filtering:
https://dev.mysql.com/doc/refman/9.7/en/audit-log-component-filtering.html