Rule ID
SV-289314r1319225_rule
Version
V1R1
CCIs
Session auditing is for use when a user's activities are under investigation. To be sure of capturing all activity during those periods when session auditing is in use, it needs to be in operation for the whole time the database management system (DBMS) is running.
Determine whether MySQL Enterprise Audit is configured to load automatically and is enabled. Verify that the MySQL Enterprise Audit component is installed: SELECT * FROM mysql.component WHERE component_urn = 'file://component_audit_log'; If no row is returned, this is a finding. Components registered in mysql.component are loaded by MySQL at server startup. Verify that audit logging has not been disabled: SHOW GLOBAL VARIABLES LIKE 'audit_log.disable'; If audit_log.disable is ON, this is a finding. 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; If no organization-required audit filters are configured or assigned, this is a finding. If organizational policy requires MySQL startup to fail when the Audit Log component cannot initialize, verify the following startup setting is configured: [mysqld] audit-log=FORCE_PLUS_PERMANENT Refer to https://dev.mysql.com/doc/refman/9.7/en/audit-log-component-installation.html.
Configure MySQL Enterprise Audit using the Audit Log component so it is loaded automatically when MySQL starts.
Install the component using the supported installation script in the MySQL share directory:
audit_log_component_filter_install.sql
For example:
mysql -u root -p -D mysql < /usr/share/mysql-9.7/audit_log_component_filter_install.sql
Verify installation:
SELECT *
FROM mysql.component
WHERE component_urn = 'file://component_audit_log';
Components registered in mysql.component are loaded automatically during MySQL startup.
To prevent runtime removal and require MySQL startup to fail if the Audit Log component cannot initialize, configure:
[mysqld]
audit-log=FORCE_PLUS_PERMANENT
Configure the organization-required audit filters and assignments. For example, to create a default filter that logs all events:
SELECT audit_log_filter_set_filter('log_all', '{ "filter": { "log": true } }');
SELECT audit_log_filter_set_user('%', 'log_all');
Refer to:
https://dev.mysql.com/doc/refman/9.7/en/audit-log-component-installation.html
https://dev.mysql.com/doc/refman/9.7/en/audit-log-component-filtering.html