Select any two versions of this STIG to compare the individual requirements
Select any old version/release of this STIG to view the previous requirements
To check the number of connections allowed for each user, as the database administrator, run the following SQL: MariaDB> SELECT user, max_user_connections FROM mysql.user; If any users have more connections configured than documented, this is a finding. A value of 0 indicates unlimited and is a finding.
To limit the number of connections allowed by a specific user, as a user with appropriate privileges, run the following SQL: MariaDB> GRANT USAGE ON *.* TO 'username'@'host' WITH MAX_USER_CONNECTIONS number_of_connections;
If all accounts are authenticated by the organization-level authentication/access mechanism such as LDAP, Kerberos, Active Directory and not by MariaDB, this is not a finding. If there are any accounts managed by the DBMS, review the system documentation for justification and approval of these accounts. If any DBMS-managed accounts exist that are not documented and approved, this is a finding. As the OS administrator, review the configuration files /etc/pam.d and /etc/pam.conf. If file is missing or not configured, this is a finding. Example for LDAP authentication and authorization via PAM would be /etc/pam.d/mariadb_ldap: ############################# auth required pam_ldap.so account required pam_ldap.so ############################# Verify that PAM is by installed the following SQL: MariaDB> SHOW PLUGINS; If pam is not listed as active, this is a finding. To find users not using PAM plugin for authentication: MariaDB> SELECT user, host, plugin FROM mysql.user WHERE plugin != 'pam'; If any users are returned, this is a finding.
Integrate MariaDB security with an organization-level authentication/access mechanism providing account management for all users, groups, roles, and any other principals. As the database administrator, install and configure the PAM authentication module: MariaDB> INSTALL SONAME 'auth_pam'; PAM supports many authentication methods including LDAP, Active Directory, and Kerberos. Each method must be configured properly in /etc/pam.d and /etc/pam.conf. To alter non-PAM authenticated users to using PAM: MariaDB> ALTER USER 'username'@'host' IDENTIFIED VIA pam USING mariadb_ldap;
From the system security plan or equivalent documentation, determine the appropriate permissions on database objects for each kind (group role) of user. If this documentation is missing, this is a finding. First, as the database administrator, check the privileges of all users and roles in the database. Find all users: MariaDB> SELECT user, host FROM mysql.user WHERE is_role = 'N'; Find all roles: MariaDB> SELECT user FROM mysql.user WHERE is_role = 'Y'; For each user found, check grants: MariaDB> SHOW GRANTS FOR 'username'@'host'; For each role found, check grants: MariaDB> SHOW GRANTS FOR 'rolename'; Review all users and roles and their associated privileges. If any users and/or roles privileges exceed those documented, this is a finding. As the database administrator, check the configured authentication settings: MariaDB> SHOW PLUGINS; To find users not using PAM plugin for authentication: MariaDB> SELECT user, host, plugin FROM mysql.user WHERE plugin != 'pam'; If any users are returned, this is a finding. Review all entries and their associated authentication methods. If any entries do not have their documented authentication requirements, this is a finding.
Create and/or maintain documentation of each group roles appropriate permissions on database objects. Implement these permissions in the database and remove any permissions that exceed those documented. The following are examples of how to use role privileges in MariaDB to enforce access controls. Run these as the database administrator. For a complete list of privileges, see the official documentation: https://mariadb.com/kb/en/grant/ #### Roles Example 1 The following example demonstrates how to create an admin role with SHUTDOWN privileges. As the database administrator, run the following SQL: MariaDB> CREATE ROLE admin; MariaDB> GRANT SHUTDOWN ON *.* TO admin; #### Roles Example 2 The following example demonstrates how to create a user make the user a member of the admin role. As the database administrator, run the following SQL: MariaDB> CREATE USER 'admin_user'@'host' IDENTIFIED VIA PAM; MariaDB> GRANT admin TO 'admin_user'@'%'; #### Roles Example 3 The following demonstrates how to revoke privileges from a role using REVOKE. As the database administrator, run the following SQL: MariaDB> REVOKE admin FROM 'admin_user'@'host'; #### Roles Example 4 The following demonstrates how to modify privileges for a role using GRANT. As the database administrator, run the following SQL: MariaDB> GRANT PROCESS ON *.* TO admin; The following are examples of how to use grant privileges in MariaDB to enforce access controls on objects. #### Grant Example 1 The following example demonstrates how to grant INSERT on a table to a role. As the database administrator, run the following SQL: MariaDB> GRANT INSERT ON test.t1 TO admin; #### Grant Example 2 The following example demonstrates how to grant ALL PRIVILEGES on a table to a role. As the database administrator, run the following SQL: MariaDB> GRANT ALL PRIVILEGES ON test.t1 TO admin; #### Grant Example 3 The following example demonstrates how to grant a role to a role. As the database administrator, run the following SQL: MariaDB> CREATE ROLE admin_master; MariaDB> GRANT admin TO admin_master; #### Revoke Example 1 The following example demonstrates how to revoke access from a role. As the database administrator, run the following SQL: MariaDB> REVOKE PROCESS ON *.* FROM admin; To change authentication requirements for the database, as the OS administrator, review the configuration files /etc/pam.d and /etc/pam.conf. After changes to the configuration files /etc/pam.d and /etc/pam.conf, reload the server: # SYSTEMD SERVER ONLY $ sudo systemctl reload mariadb # INITD SERVER ONLY $ sudo service mariadb reload
All users should have individual accounts with appropriate privileges. The root user should be removed after administrative accounts with SUPER privilege are created. Query all users and determine if any are suspected shared accounts. Document any necessary shared accounts. MariaDB> SELECT user, host FROM mysql.user; Determine if any accounts are shared. A shared account is defined as a username, hostname, and password that are used by multiple individuals to log in to MariaDB. An example of a shared account is the MariaDB root account – root@localhost. If accounts are determined to be shared, determine if individuals are first individually authenticated. If individuals are not individually authenticated before using the shared account (e.g., by the operating system or possibly by an application making calls to the database), this is a finding. The key is individual accountability. If this can be traced, this is not a finding. If accounts are determined to be shared, determine if they are directly accessible to end users. If so, this is a finding. Review contents of audit logs, traces, and data tables to confirm the identity of the individual user performing the action is captured. If shared identifiers are found, and not accompanied by individual identifiers, this is a finding.
Remove shared accounts which are not documented and have been determined to not be necessary. MariaDB> DROP USER 'user'@'hostname';
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify audit filters match organization-defined auditing requirements. If not, this is a finding.
Configure MariaDB to generate audit records for at least the DoD minimum set of events. Edit the mariadb-enterprise.cnf configuration file located in /etc/my.cnf.d/. Under [mariadb], add the following: server_audit_logging = ON Save the configuration file. This change will not take effect until MariaDB Enterprise Server is restarted. Using the MariaDB Enterprise Audit plugin, MariaDB can be configured to audit these requests. The MariaDB Enterprise Audit plugin can be configured to audit these changes. Update necessary audit filters. Ex: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' )); More information about MariaDB auditing can be found here: https://mariadb.com/docs/security/mariadb-enterprise-audit/
MariaDB Enterprise Audit plugin stores audit filters in the table mysql.server_audit_filters. Any users with update/delete/insert access to this table can modify the audit filters. Users with global insert, update, delete, and/or drop privileges can modify audit filters. Find users with global insert, update, delete, and/or drop privileges: MariaDB> SELECT user, host, insert_priv, update_priv, delete_priv, drop_priv FROM mysql.user WHERE insert_priv = 'y' OR update_priv = 'y' OR delete_priv = 'y' OR drop_priv = 'y'; Users with insert, update, delete, and/or drop privileges on the mysql database can modify audit filters. Find users with insert, update, delete, and/or drop privileges on the mysql database: MariaDB> SELECT user, host, insert_priv, update_priv, delete_priv, drop_priv FROM mysql.db WHERE db = 'mysql' AND (insert_priv = 'y' OR update_priv = 'y' OR delete_priv = 'y' OR drop_priv = 'y' ); Users with insert, update, delete, and/or drop privileges on the server_audit_filters and server_audit_users tables can modify audit filters. Find users with insert, update, delete, and/or drop privileges on the mysql database: MariaDB> SELECT user, host, db, table_name, grantor, table_priv, timestamp, column_priv FROM mysql.tables_priv WHERE db = 'mysql' AND table_name IN ('server_audit_filters','server_audit_users') AND (table_priv LIKE '%Insert%' OR table_priv LIKE '%Update%' OR table_priv LIKE '%Delete%' OR table_priv LIKE '%Drop%' ); If any users with the above privileges are found which should not have access to modify audit filters, this is a finding.
Grant the necessary privileges to authorized users. Example: MariaDB> GRANT ALL PRIVILEGES ON mysql.server_audit_filters TO 'username'@'host'; MariaDB> GRANT ALL PRIVILEGES ON mysql.server_audit_users TO 'username'@'host'; For users found with access who are not authorized to modify audit filters, review the user's privileges, and update accordingly.
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify query_events ALL is included in corresponding audit filters. If not, this is a finding. MariaDB> SHOW GLOBAL VARIABLES LIKE 'server_audit_file_path'; As a Linux user with sufficient privileges to view logs, tail the audit log file. $ tail -f /var/log/mysql/server_audit.log (default location) In another terminal run: MariaDB> SHOW GRANTS; If an audit record is not produced in the first terminal, this is a finding.
The MariaDB Enterprise Audit plugin can be configured to audit these changes. Update necessary audit filters to include query_event ALL. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
As the database administrator, create a user by running the following SQL: MariaDB> CREATE USER 'test_user'@'localhost' IDENTIFIED BY 'test_user_password'; In one terminal, tail the audit log file: tail -F /var/lib/mysql/server_audit.log (default location) In another terminal attempt to retrieve information from the MariaDB table, mysql.roles_mapping, by logging in as the test_user and running a query which it does not have privileges to do, for example: $ mariadb -u test_user -p MariaDB> SELECT * FROM mysql.roles_mapping; The audit log will show: 20190321 21:39:20,5a7e16cc51f7, test_user ,localhost,127,394,QUERY,, select * from mysql.roles_mapping ,1142 To find failed queries, look for two elements: The notation indicating that it is a QUERY entry, and the last value for the entry. If the query is unsuccessful, the value will be NOT EQUAL TO 0. If the above steps cannot verify that audit records are produced when MariaDB denies retrieval of privileges/permissions/role memberships, this is a finding. If an audit record is not produced in the first terminal, this is a finding.
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Update the filters as necessary.
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. Check what filters are in place for user by running the following as an administrative user: MariaDB> SELECT sau.host, sau.user, saf.filtername, JSON_DETAILED(saf.rule) FROM mysql.server_audit_filters saf JOIN mysql.server_audit_users sau ON saf.filtername = sau.filtername WHERE saf.filtername != 'default'\G Verify the corresponding audit filters are in place. If not, this is a finding.
If not already exists, create a named filter with the required auditing for the user in question. Example: MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('session_auditing', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "table_event":[ "WRITE", "CREATE", "DROP", "RENAME", "ALTER" ] }' )); Then assign the named filter to the user. Example: MariaDB> INSERT INTO mysql.server_audit_users (host, user, filtername) VALUES ("%", "username", "session_auditing"); Reload filters. MariaDB> SET GLOBAL server_audit_reload_filters = ON;
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. Log in to MariaDB Enterprise Server and verify the audit log location. MariaDB> SHOW GLOBAL VARIABLES LIKE 'server_audit_file_path'; Verify the necessary audit filters are in place: MariaDB> SELECT * FROM mysql.server_audit_filters; In another terminal, view the audit log file: $ tail -f /var/log/mysql/audit.log Back in the MariaDB shell, run a query which matches an audit filter. Example if query_events is ALL: MariaDB> SELECT * FROM mysql.help_topic; Verify the entry was logged in the audit log and contains the necessary event type information. If not, this is a finding.
Update necessary audit filters. For example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. Log in to MariaDB Enterprise Server and verify the audit log location. MariaDB> SHOW GLOBAL VARIABLES LIKE 'server_audit_file_path'; Verify the necessary audit filters are in place: MariaDB> SELECT * FROM mysql.server_audit_filters; In another terminal, view the audit log file: $ tail -f /var/log/mysql/audit.log Back in the MariaDB shell, run a query which matches an audit filter. Example if query_events is ALL: MariaDB> SELECT * FROM mysql.help_topic; Verify the entry was logged in the audit log and contains the necessary event user information. If not, this is a finding.
Update necessary audit filters. For example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
If the application owner has determined that the need for system availability outweighs the need for a complete audit trail, this is not applicable (NA). Otherwise, review the procedures, manual and/or automated, for monitoring the space used by audit trail(s) and for off-loading audit records to a centralized log management system. If the procedures do not exist, this is a finding. If the procedures exist, request evidence that they are followed. If the evidence indicates that the procedures are not followed, this is a finding. If the procedures exist, inquire if the system has ever run out of audit trail space in the last two years or since the last system upgrade, whichever is more recent. If it has run out of space in this period, and the procedures have not been updated to compensate, this is a finding.
Modify DBMS, OS, or third-party logging application settings to alert appropriate personnel when a specific percentage of log storage capacity is reached.
If the application owner has determined that the need for system availability outweighs the need for a complete audit trail, this is not applicable (NA). If an externally managed and monitored partition or logical volume that can be grown dynamically is being used for logging, this is not a finding. If MariaDB is auditing to a directory that is not being actively checked for availability of disk space, and if a tool, utility, script, or other mechanism is not being used to ensure sufficient disk space is available for the creation of new audit logs, this is a finding. If a tool, utility, script, or other mechanism is being used to rotate audit logs, and oldest logs are not being removed to ensure sufficient space for newest logs, or oldest logs are not being replaced by newest logs, this is a finding.
Establish a process with accompanying tools for monitoring available disk space and ensuring that sufficient disk space is maintained to continue generating audit logs, overwriting the oldest existing records if necessary. To set up the audit logs to write to sylog: Edit the mariadb-enterprise.cnf file. Add the following under the [mariadb] section: server_audit_output_type = 'syslog' After the .cnf file is updated and saved, the mariadb database service must be restarted. If not writing to syslog, log rotation and purging should be configured.
Determine if the MariaDB Enterprise Audit plugin is logging to a file or syslog. MariaDB> SHOW GLOBAL VARIABLES LIKE 'server_audit_output_type'; If FILE, find the location of the audit log: MariaDB> SHOW GLOBAL VARIABLES LIKE 'server_audit_file_path'; If FILE, check the permission of the file: $ sudo ls -al /path/to/audit.log Consult the organization's security guide on acceptable permissions and ownership of logs with respect to who can modify them. Verify the log files have the set configurations. If the permissions are not set to the organization's standards, this is a finding. If the MariaDB server is configured to use syslog for logging, consult the organization's syslog setting for permissions and ownership of logs with respect to who can modify them.
If the audit.log file permissions do not comply with organization's standards, change the permissions. Example: $ chown user:group /path/to/audit.log $ chmod 660 /path/to/audit.log If the MariaDB server is configured to use syslog for logging, consult the organization's syslog setting for permissions and ownership of logs with respect to who can modify them.
Determine if the MariaDB Enterprise Audit plugin is logging to a file or syslog. MariaDB> SHOW GLOBAL VARIABLES LIKE 'server_audit_output_type'; If FILE, find the location of the audit log: MariaDB> SHOW GLOBAL VARIABLES LIKE 'server_audit_file_path'; If FILE, check the permission of the file: $ sudo ls -al /path/to/audit.log Consult the organization's security guide on acceptable permissions and ownership of logs with respect to who can modify them. Verify the log files have the set configurations. If the permissions are not set to the organization's standards, this is a finding. If the MariaDB server is configured to use syslog for logging, consult the organization's syslog setting for permissions and ownership of logs with respect to who can modify them.
If the audit.log file permissions do not comply with organization's standards, change the permissions. Example: $ chown user:group /path/to/audit.log $ chmod 660 /path/to/audit.log If the MariaDB server is configured to use syslog for logging, consult the organization's syslog setting for permissions and ownership of logs with respect to who can modify them.
Determine if the MariaDB Enterprise Audit plugin is logging to a file or syslog. MariaDB> SHOW GLOBAL VARIABLES LIKE 'server_audit_output_type'; If FILE, find the location of the audit log: MariaDB> SHOW GLOBAL VARIABLES LIKE 'server_audit_file_path'; If FILE, check the permission of the file: $ sudo ls -al /path/to/audit.log Consult the organization's security guide on acceptable permissions and ownership of logs with respect to who can modify them. Verify the log files have the set configurations. If the permissions are not set to the organization's standards, this is a finding. If the MariaDB server is configured to use syslog for logging, consult the organization's syslog setting for permissions and ownership of logs with respect to who can modify them.
If the audit.log file permissions do not comply with organization's standards, change the permissions. Example: $ chown user:group /path/to/audit.log $ chmod 660 /path/to/audit.log If the MariaDB server is configured to use syslog for logging, consult the organization's syslog setting for permissions and ownership of logs with respect to who can modify them.
Determine if the MariaDB Enterprise Audit plugin is logging to a file or syslog. MariaDB> SHOW GLOBAL VARIABLES LIKE 'server_audit_output_type'; If FILE, find the location of the audit log: MariaDB> SHOW GLOBAL VARIABLES LIKE 'server_audit_file_path'; If FILE, check the permission of the file: $ sudo ls -al /path/to/audit.log Consult the organization's security guide on acceptable permissions and ownership of logs with respect to who can modify them. Verify the log files have the set configurations. If the permissions are not set to the organization's standards, this is a finding. If the MariaDB server is configured to use syslog for logging, consult the organization's syslog setting for permissions and ownership of logs with respect to who can modify them.
If the audit.log file permissions do not comply with organization's standards, change the permissions. Example: $ chown user:group /path/to/audit.log $ chmod 660 /path/to/audit.log If the MariaDB server is configured to use syslog for logging, consult the organization's syslog setting for permissions and ownership of logs with respect to who can modify them.
Determine if the MariaDB Enterprise Audit plugin is logging to a file or syslog. MariaDB> SHOW GLOBAL VARIABLES LIKE 'server_audit_output_type'; If FILE, find the location of the audit log: MariaDB> SHOW GLOBAL VARIABLES LIKE 'server_audit_file_path'; If FILE, check the permission of the file: $ sudo ls -al /path/to/audit.log Consult the organization's security guide on acceptable permissions and ownership of logs with respect to who can modify them. Verify the log files have the set configurations. If the permissions are not set to the organization's standards, this is a finding. If the MariaDB server is configured to use syslog for logging, consult the organization's syslog setting for permissions and ownership of logs with respect to who can modify them.
If the audit.log file permissions do not comply with organization's standards, change the permissions. Example: $ chown user:group /path/to/audit.log $ chmod 660 /path/to/audit.log If the MariaDB server is configured to use syslog for logging, consult the organization's syslog setting for permissions and ownership of logs with respect to who can modify them.
Determine if the MariaDB Enterprise Audit plugin is logging to a file or syslog. MariaDB> SHOW GLOBAL VARIABLES LIKE 'server_audit_output_type'; If FILE, find the location of the audit log: MariaDB> SHOW GLOBAL VARIABLES LIKE 'server_audit_file_path'; If FILE, check the permission of the file: $ sudo ls -al /path/to/audit.log Consult the organization's security guide on acceptable permissions and ownership of logs with respect to who can modify them. Verify the log files have the set configurations. If the permissions are not set to the organization's standards, this is a finding. If the MariaDB server is configured to use syslog for logging, consult the organization's syslog setting for permissions and ownership of logs with respect to who can modify them.
If the audit.log file permissions do not comply with organization's standards, change the permissions. Example: $ chown user:group /path/to/audit.log $ chmod 660 /path/to/audit.log If the MariaDB server is configured to use syslog for logging, consult the organization's syslog setting for permissions and ownership of logs with respect to who can modify them.
Review documentation to determine which users are authorized to modify the MariaDB Enterprise Server binary files and shared library paths. If any unauthorized users are granted modify rights, this is a finding. Check what users have access to install/uninstall MariaDB Enterprise Server plugins. This privilege can be listed in one of three places: Table level, database level, or global. Table level: MariaDB> SELECT user, host FROM mysql.tables_priv WHERE db = 'mysql' and table_name = ' plugin'; Database level: MariaDB> SELECT user, host FROM mysql.db WHERE db = 'mysql' and (insert_priv = 'y') or (delete_priv = 'y') or (insert_priv = 'y' and delete_priv = 'y'); Global: SELECT user, host FROM mysql.user WHERE (insert_priv = 'y') or (delete_priv = 'y') or (insert_priv = 'y' and delete_priv = 'y'); If any user identified by the above queries is not authorized to install/uninstall MariaDB Enterprise Server plugins, this is a finding. Review monitoring procedures and implementation evidence to verify monitoring of changes to database software libraries, related applications, and configuration files is done. Verify the list of files and directories being monitored is complete. If monitoring does not occur or is not complete, this is a finding.
Remove privileges from users identified as not authorized to install/uninstall MariaDB Enterprise Server plugins. Implement procedures to monitor for unauthorized changes to DBMS software libraries, related software application libraries, and configuration files. If a third-party automated tool is not employed, an automated job that reports file information on the directories and files of interest and compares them to the baseline report for the same will meet the requirement.
Review procedures for controlling, granting access to, and tracking use of the MariaDB software installation account. If access or use of this account is not restricted to the minimum number of personnel required or if unauthorized access to the account has been granted, this is a finding.
Develop, document, and implement procedures to restrict and track use of the MariaDB software installation account.
Review the MariaDB software library directory and note other root directories located on the same disk directory or any subdirectories. The default install directory is /var/lib/mysql. If any non-MariaDB software directories exist on the disk directory, examine or investigate their use. If any of the directories are used by other applications, including third-party applications that use MariaDB, this is a finding. Only applications that are required for the functioning and administration, not use, of MariaDB should be located in the same disk directory as the MariaDB software libraries. If other applications are located in the same directory as MariaDB, this is a finding.
Install all applications on directories separate from the MariaDB software library directory. Relocate any directories or reinstall other application software that currently shares the MariaDB software library directory.
Review system documentation to identify accounts authorized to have privileges against database objects. Review account privileges on objects in the database(s). To show the list of system privileges that the MariaDB server supports, run: MariaDB> SHOW PRIVILEGES; Gather a list of SHOW GRANTS commands. SHOW GRANTS will list the privileges granted to the account. Run this database query to create the SHOW GRANTS script for each user: MariaDB> SELECT DISTINCT CONCAT( 'SHOW GRANTS FOR ', user,'@', host,';') AS grantQuery FROM mysql.user WHERE is_role = 'N'; Run each SHOW GRANTS command for each user. MariaDB> SHOW GRANTS FOR 'user'@'host'; Verify that all users have the correct privileges, if they do not, this is a finding. Only DEFINERS of routines (functions and procedures) can change routines. To view the DEFINERS of all functions and procedures, as database administrator run the following SQL: MariaDB> SELECT * FROM mysql.proc \G Only DEFINERS of triggers can change triggers. To view all triggers and their DEFINERS, as database administrator run the following SQL: MariaDB> SELECT * FROM information_schema.triggers \G If any database users are found to have unauthorized privileges on database objects, this is a finding.
Assign ownership of authorized objects to authorized object owner accounts.
Gather a list of SHOW GRANTS commands. This list will include users and roles: MariaDB> SELECT DISTINCT CONCAT( 'SHOW GRANTS FOR ', user,'@', host,';') AS grantQuery FROM mysql.user; Run each SHOW GRANTS commands and verify that all objects have the correct privileges, if they do not, this is a finding. MariaDB> SHOW GRANTS FOR 'user'@'host'; Find the data directory and verify its operating system privileges. MariaDB> SHOW GLOBAL VARIABLES LIKE '%datadir%'; # ls -al /path/to/datadir If permissions of the database directory are not limited to an authorized user account, this is a finding.
As the database administrator, revoke any permissions from a role that are deemed unnecessary by running the following SQL: MariaDB> REVOKE PERMISSION FROM ROLE_NAME ; Revoke any roles from a user if they are deemed unnecessary by running the following SQL: MariaDB> REVOKE ROLE_NAME FROM test_user ; If the revoked role is the default role for the user, the REVOKE command should be followed by a command to set a new default role that has appropriate permissions, or no default role: MariaDB> SET DEFAULT ROLE NONE FOR test_user ; MariaDB> SET DEFAULT ROLE ROLE_NAME for test_user ;
As the database administrator, show all databases by running the following SQL: MariaDB> SHOW DATABASES; Determine if the test database still exists. If it does, this is a finding.
If a test database is found, this is a sign that the mysql_secure_installation script was not ran when the database software was installed. It is recommended to do so. This script will prompt the user to set the MariaDB root user's password, remove all anonymous users, disallow the root user from logging in remotely to the database, remove the test database and access to it, and then reload the privilege tables. $ mariadb-secure-installation reply Y to setting a root password if one is not already set. reply Y to Remove anonymous users reply Y to disallow root login remotely reply Y to Remove test database and access to it reply Y to Reload privilege tables now (this ensures that all changes made so far will take effect immediately) Note: For this request only the "reply Y to Remove" test database and access to it is necessary, but "Y" to all the questions is recommended. Alternatively, simply dropping the test database will remedy the finding. MariaDB> DROP DATABASE test;
List all plugins and determine which are acceptable. MariaDB> SHOW PLUGINS; If unused plugins are installed and are not documented and authorized, this is a finding.
To uninstall the plugin but leave the libraries in place: MariaDB> UNINSTALL PLUGIN plugin_name; To uninstall the plugin and the associated libraries: MariaDB> UNINSTALL SONAME plugin_name;
MariaDB's LOAD DATA LOCAL INFILE command can interact with the server's underlying OS. To check the value of this option, run the following command as the database administrator: MariaDB> SHOW GLOBAL VARIABLES LIKE 'local_infile'; Verify the option is set according to the security guide. If it is not, this is a finding. If the value of local_infile is set to ON per the security guide, user privileges must be checked. Only users with FILE privilege can use the LOAD DATA LOCAL INFILE command. To check the users who have FILE privilege against the security guide, run the following commands as the database administrator. 1. Check which users have FILE privilege and GRANT OPTION privileges and compare to the security guide to determine if a user has FILE privilege that should not or if a user has GRANT OPTION and should not. If the users have privileges they should not have, this is a finding. Run this script to create the SHOW GRANTS script for each user: MariaDB> SELECT DISTINCT CONCAT( 'SHOW GRANTS FOR ', user,'@', host,';') AS grantQuery FROM mysql.user WHERE is_role = 'N'; Run each SHOW GRANTS command for each user. MariaDB> SHOW GRANTS FOR 'user'@'host'; 2. Check which roles have FILE privilege and GRANT OPTION privileges and compare to the security guide to determine if a role has FILE privilege that should not or if a role has GRANT OPTION and should not. If the roles have privileges they should not have, this is a finding. MariaDB> SELECT DISTINCT CONCAT('SHOW GRANTS FOR ',role, ';') FROM mysql.roles_mapping; Run each SHOW GRANTS command for each role. 3. From the two outputs above, check which users and roles can set roles and grant privileges by checking who has GRANT OPTION and FILE privileges and comparing to the security guide. If any user or role has GRANT OPTION or FILE privileges they should not have, this is a finding.
To disable LOAD DATA LOCAL INFILE make the following update as the database administrator: Edit the mariadb-enterprise.cnf configuration file located in /etc/my.cnf.d/. Under [mariadb], add the following: local_infile = 0 Save the configuration file. This change will not take effect until MariaDB Enterprise Server is restarted. To remove FILE and GRANT OPTION privileges use the right combination of the following commands: 1. revoke FILE privilege from a user MariaDB> REVOKE FILE FROM 'user'@'host'; 2. revoke FILE privilege from a role MariaDB> REVOKE FILE FROM role; 3. revoke GRANT OPTION privilege from a user MariaDB> REVOKE GRANT OPTION FROM 'user'@'host'; 4. revoke a role grant from a user MariaDB> REVOKE ROLE FROM grantee;
Review system documentation for a list of approved ports. As the database administrator, run the following command to determine the currently defined port: MariaDB> SHOW GLOBAL VARIABLES LIKE '%port%'; If the currently defined port is deemed prohibited, this is a finding.
Modify the MariaDB configuration file located within /etc/my.cnf.d/ and update the variable port to an acceptable port. Restart MariaDB Enterprise Server. Example: [server] port = 4008
All users should have individual accounts with appropriate privileges. The root users should be removed after administrative accounts with SUPER privilege are created. Query all users and determine if any are suspected shared accounts. Document any necessary shared accounts. MariaDB> SELECT user, host FROM mysql.user; Determine if any accounts are shared. A shared account is defined as a username, hostname, and password that are used by multiple individuals to log in to MariaDB. An example of a shared account is the MariaDB root account – root@localhost. If accounts are determined to be shared, determine if individuals are first individually authenticated. If individuals are not individually authenticated before using the shared account (e.g., by the operating system or possibly by an application making calls to the database), this is a finding. The key is individual accountability. If this can be traced, this is not a finding. If accounts are determined to be shared, determine if they are directly accessible to end users. If so, this is a finding. Review contents of audit logs, traces, and data tables to confirm the identity of the individual user performing the action is captured. If shared identifiers are found, and not accompanied by individual identifiers, this is a finding.
Remove shared accounts which are not documented and have been determined to not be necessary. MariaDB> DROP USER 'user'@'hostname';
Check the simple_password_check plugin variables to ensure they match the password requirements. MariaDB> SHOW GLOBAL VARIABLES LIKE 'simple_password_check_%'; Determine whether the following rules are enforced. If they do not meet the following password requirements, this is a finding. a. minimum of 15 characters, including at least one of each of the following character sets: - Uppercase - Lowercase - Numerics - Special characters (e.g., ~ ! @ # $ % ^ & * ( ) _ + = - ' [ ] / ? > <) b. Minimum number of characters changed from previous password: 50 percent of the minimum password length; that is, eight.
Locate the MariaDB Enterprise Server configuration file (mariadb-enterprise.cnf) which contains the simple_password_check plugin variables within /etc/my.cnf.d/. Edit the variables. Example: simple_password_check_digits = 2 simple_password_check_letters_same_case = 2 simple_password_check_minimal_length = 15 simple_password_check_other_characters = 2
Check the default password lifetime variable to verify it matches the password requirement. MariaDB> SHOW GLOBAL VARIABLES LIKE 'default_password_lifetime%'; If the value returned is not 60 or less, this is a finding.
Locate the MariaDB Enterprise Server configuration file (mariadb-enterprise.cnf) that contains the password variables within /etc/my.cnf.d/. Edit the variables. Example: default_password_lifetime = 60
MariaDB stores passwords encrypted. When querying users, the passwords are displayed encrypted. However, third-party applications, scripts, etc., might be storing passwords. In such cases, it is important to ensure these passwords are encrypted. Check all third-party applications, scripts, etc., which connect to the database and verify the passwords are encrypted. If any passwords are found in clear text, this is a finding.
Document all applications, scripts, etc., which connect to the database server. Ensure passwords, if stored, are encrypted and secure.
MariaDB by default only sends passwords encrypted. However, when authenticating via the PAM Authentication Plugin, the password is sent in cleartext. Thus when using PAM authentication, it is recommended to use TLS/SSL encryption for all database connections. If using PAM authentication, verify TLS/SSL is in use. Run the following database command: MariaDB> STATUS; Verify the line which starts with "SSL:" is as expected. If it returns "Not in use", this is a finding.
As the administrator locate the MariaDB configuration file to change. This varies depending on setup and how configuration files are managed but should be in /etc/my.cnf.d/. It is recommended to have a separate configuration file within this directory for SSL connection information. In the [server] section add the lines for SSL: ssl ssl-ca=/path/to/ssl/ca-cert.pem ssl-cert=/path/to/ssl/server-cert.pem ssl-key=/path/to/ssl/server-key.pem Restart of the MariaDB Server and verify SSL is being used. MariaDB> STATUS; Verify line beginning with "SSL:".
As the database administrator, list all users and their SSL setup by running the following: MariaDB> SELECT user, host, ssl_type FROM mysql.user; Use the result of the next query to verify the MariaDB Server is using certificates: MariaDB> STATUS; Verify the line beginning with "SSL:" returns expected SSL information. Using the following query, verify SSL is configured as expected: MariaDB> SHOW GLOBAL VARIABLES LIKE %ssl% ; If not configured as expected, this is a finding.
As the administrator locate the MariaDB configuration file to change. This varies depending on setup and how configuration files are managed but should be in /etc/my.cnf.d/. It is recommended to have a separate configuration file within this directory for SSL connection information. In the [server] section add the lines for SSL: ssl-ca=/path/to/ssl/ca-cert.pem ssl-cert=/path/to/ssl/server-cert.pem ssl-key=/path/to/ssl/server-key.pem To fully implement SSL for MariaDB, the client settings and user accounts need to be set up as well. More information can be found here: https://mariadb.com/kb/en/securing-connections-for-client-and-server/
First, as the database administrator, verify the following settings: Note: If no specific directory given before the filename, the files are stored in DATADIR. MariaDB> SHOW GLOBAL VARIABLES LIKE 'ssl_ca'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'ssl_cert'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'ssl_key'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'ssl_crlpath'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'datadir'; Verify the permissions of the above files. Example: ls -al /path/to/ssl_cert MariaDB Enterprise Server runs as the mysql operating system user, thus should be owned by user mysql and group mysql with user read and group read file level permissions. Example: -r-------. 1 mysql If the files and directories are not properly secured, this is a finding.
If the SSL files are not secured properly in the file system, change the ownership and permissions with operating system operations. Example: chown mysql:mysql /path/to/file chmod 440 /path/to/file
Query all users to confirm issuer and subject are configured correctly: MariaDB>SELECT user, host, ssl_type, CAST(x509_issuer AS CHAR) AS issuer, CAST(x509_subject AS CHAR) AS subject FROM mysql.user; If users are not mapped correctly, this is a finding.
Example command to create users with proper X509 certificate subject and issuer: MariaDB>CREATE USER 'janedoe'@'%' IDENTIFIED BY 'Some_Password_Here_$9' REQUIRE SUBJECT '/C=US/ST=Ohio/L=Columbus/O=MariaDB Corporation/CN=Jane Doe' AND ISSUER '/C=US/ST=Ohio/L=Columbus/O=MariaDB Corporation/CN=MariaDB CA';
Verify best practices are documented and users trained to use the password command line interface flags appropriately. For example, the command line option --password (or -p) prompts for a password to be entered and obscures feedback on the typed in password. Ensure users are trained to use alternatives to command line password parameters, if they are not, this is a finding.
When connecting to the database, the username and password are sent to the server via the command line interface or other connector interface. Using the command line interface, passing the -p or --password flags but not including the password in the command will prompt for the password and not display it on the screen as typed. Example: mariadb -u username -p
As the system administrator, run the following at the Linux commands: # openssl version OpenSSL 1.0.2k-fips 26 Jan 2017 If fips is not included in the openssl version, this is a finding. # sysctl crypto.fips_enabled crypto.fips_enabled = 1 If crypto.fips_enabled = 0, this is a finding. MariaDB> SHOW GLOBAL VARIABLES LIKE '%have_openssl'; If the value of have_openssl is not YES, this is a finding. MariaDB> SHOW GLOBAL VARIABLES LIKE '%version_ssl_library%'; If the value of version_ssl_library does not contain fips, this is a finding. Examine the application's code to verify it does not make calls using libmysqlclient. If code uses libmysqlclient, this is a finding.
If crypto.fips_enabled = 0, for Red Hat Linux, configure the operating system to implement DoD-approved encryption by following the steps below: To enable strict FIPS compliance, the fips=1 kernel option must be added to the kernel command line during system installation so key generation is done with FIPS-approved algorithms and continuous monitoring tests in place. Enable FIPS mode with the following command: # sudo fips-mode-setup --enable Modify the kernel command line of the current kernel in the "grub.cfg" file by adding the following option to the GRUB_CMDLINE_LINUX key in the "/etc/default/grub" file and then rebuild the "grub.cfg" file: fips=1 Changes to "/etc/default/grub" require rebuilding the "grub.cfg" file as follows: On BIOS-based machines, use the following command: # sudo grub2-mkconfig -o /boot/grub2/grub.cfg On UEFI-based machines, use the following command: # sudo grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg If /boot or /boot/efi reside on separate partitions, the kernel parameter "boot=<partition of /boot or /boot/efi>" must be added to the kernel command line. Identify a partition by running the df /boot or df /boot/efi command: # sudo df /boot Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda1 495844 53780 416464 12% /boot To ensure the "boot=" configuration option will work even if device naming changes occur between boots, identify the universally unique identifier (UUID) of the partition with the following command: # sudo blkid /dev/sda1 /dev/sda1: UUID="05c000f1-a213-759e-c7a2-f11b7424c797" TYPE="ext4" For the example above, append the following string to the kernel command line: boot=UUID=05c000f1-a213-759e-c7a2-f11b7424c797 Reboot the system for the changes to take effect. More information can be found here: RedHat: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/security_guide/chap-federal_standards_and_regulations Ubuntu: https://security-certs.docs.ubuntu.com/en/fips
All users should have individual accounts with appropriate privileges. The root users should be removed after administrative accounts with SUPER privilege are created. Query all users and determine if any are suspected shared accounts. Document any necessary shared accounts. MariaDB> SELECT user, host FROM mysql.user; Determine if any accounts are shared. A shared account is defined as a username, hostname, and password that are used by multiple individuals to log in to MariaDB. An example of a shared account is the MariaDB root account – root@localhost. If accounts are determined to be shared, determine if individuals are first individually authenticated. If individuals are not individually authenticated before using the shared account (e.g., by the operating system or possibly by an application making calls to the database), this is a finding. The key is individual accountability. If this can be traced, this is not a finding. If accounts are determined to be shared, determine if they are directly accessible to end users. If so, this is a finding. Review contents of audit logs, traces, and data tables to confirm the identity of the individual user performing the action is captured. If shared identifiers are found, and not accompanied by individual identifiers, this is a finding.
Remove shared accounts which are not documented and have been determined to not be necessary. MariaDB> DROP USER 'user'@'hostname';
Show the list of system privileges that the MariaDB server supports, run: MariaDB> SHOW PRIVILEGES; Gather a list of SHOW GRANTS commands. SHOW GRANTS will list the privileges granted to the account. Run this database query to create the SHOW GRANTS script for each user: MariaDB> SELECT DISTINCT CONCAT( 'SHOW GRANTS FOR ', user,'@', host,';') AS grantQuery FROM mysql.user WHERE is_role = 'N'; Run each SHOW GRANTS command for each user. MariaDB> SHOW GRANTS FOR 'user'@'host'; If any nonadministrative role has any one of the following privileges, this is a finding. Create user Event Process Proxy Reload Replication client Replication slave Show databases Shutdown Supe, Usage If administrator and general user functionality are not separated either physically or logically, this is a finding.
Configure MariaDB Enterprise Server to separate database administration and general user functionality. Do not grant Create user, Event, Process, Proxy, Reload, Replication client, Replication slave, Show databases, Shutdown, Super, Create tablespace, Usage privileges to users and roles that do not require it. To remove privileges, see the following examples: 1. Revoke privileges from a specific user: MariaDB> REVOKE SUPER, PROCESS ON *.* FROM 'user'@'host'; 2. Revoke privileges from a role: MariaDB> REVOKE 'role' FROM 'user'@'host';
As the database administrator, run the following SQL: MariaDB> SHOW GLOBAL VARIABLES LIKE 'tcp_keepalive_interval'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'tcp_keepalive_probes'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'tcp_keepalive_time'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'tcp_nodelay'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'max_statement_time'; If these settings are not set, this is a finding.
As the administrator locate the my.cnf file to change. For Centos, RedHat, and similar distributions this will be in /etc/my.cnf.d/. In the [mariadb] section add the lines: tcp_keepalive_interval == seconds https://mariadb.com/docs/reference/mdb/system-variables/tcp_keepalive_interval/ tcp_keepalive_probes == number of probes https://mariadb.com/docs/reference/mdb/system-variables/tcp_keepalive_probes/ tcp_keepalive_time == seconds https://mariadb.com/docs/reference/mdb/system-variables/tcp_keepalive_time/ tcp_nodelay == boolean (off or on) https://mariadb.com/docs/reference/mdb/system-variables/tcp_nodelay/ max_statement_time == seconds https://mariadb.com/docs/reference/mdb/system-variables/max_statement_time/
Determine if MariaDB is configured to require SSL. MariaDB> SHOW GLOBAL VARIABLES LIKE 'require_secure_transport'; If require_secure_transport is not "ON", this is a finding.
Modify the MariaDB configuration file located within /etc/my.cnf.d/ and set the variable require_secure_transport to "ON" under the server section. Restart MariaDB Enterprise Server. Example: [server] require_secure_transport = ON
Verify InnoDB logging is configured. As the database administrator, verify the following settings: Note: If no specific directory is given before the filename, the files are stored in DATADIR. MariaDB> SHOW GLOBAL VARIABLES LIKE 'log_bin'; If value is "OFF", this is a finding.
If value of log_bin is "OFF", modify the MariaDB configuration file. This can be found in /etc/my.cnf.d/. Optionally specify the location of the binary logs by specifying the full path for the binary logs. [mariadb] log_bin=mariadb_bin
Verify InnoDB logging is configured. As the database administrator, verify the following settings: Note: If no specific directory is given before the filename, the files are stored in DATADIR. MariaDB> SHOW GLOBAL VARIABLES LIKE 'log_bin'; If value is "OFF", this is a finding.
If value of log_bin is "OFF", modify the MariaDB configuration file. This can be found in /etc/my.cnf.d/. Optionally specify the location of the binary logs by specifying the full path for the binary logs. [mariadb] log_bin=mariadb_bin
If the application owner and Authorizing Official have determined that encryption of data at rest is NOT required, this is not a finding. One possible way to encrypt data within MariaDB is to use the file key management plugin. To determine if this is installed, check the following variables as the Database administrator: MariaDB> SHOW PLUGINS; Confirm the file_key_management.so is listed. MariaDB> SHOW GLOBAL VARIABLES LIKE 'file_key%'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'aria_en%'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'innodb_encrypt_tables'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'innodb_encrypt_log'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'innodb_tablespace%'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'encrypt%'; Confirm these are ON. If disk or filesystem requires encryption, ask the system owner, DBA, and SA to demonstrate the use of disk-level encryption. If this is required and is not found, this is a finding. If controls do not exist or are not enabled, this is a finding.
MariaDB's data-at-rest encryption requires the use of a key management and encryption plugin. These plugins are responsible both for the management of encryption keys and for the actual encryption and decryption of data. MariaDB supports the use of multiple encryption keys. Each encryption key uses a 32-bit integer as a key identifier. If the specific plugin supports key rotation, then encryption keys can also be rotated, which creates a new version of the encryption key. The File Key Management plugin that ships with MariaDB is a key management and encryption plugin that reads encryption keys from a plain-text file. Although the plugin's shared library is distributed with MariaDB by default, the plugin is not installed by MariaDB by default. The plugin can be installed by providing the --plugin-load or the --plugin-load-add options. This can be specified as a command-line argument to mysqld or it can be specified in a relevant server option group in an option file. For example: [mariadb] ... plugin_load_add = file_key_management Creating the Key File: To encrypt tables with encryption keys using the File Key Management plugin, first create the file that contains the encryption keys. The file must contain two pieces of information for each encryption key. First, each encryption key must be identified with a 32-bit integer as the key identifier. Second, the encryption key itself must be provided in hex-encoded form. These two pieces of information must be separated by a semicolon. For example, the file is formatted in the following way: <encryption_key_id1>;<hex-encoded_encryption_key1> <encryption_key_id2>;<hex-encoded_encryption_key2> The key file can also be optionally encrypted to make it less accessible from the file system. That is explained further in the section below. The File Key Management plugin uses Advanced Encryption Standard (AES) to encrypt data, which supports 128-bit, 192-bit, and 256-bit encryption keys. Therefore, the plugin also supports 128-bit, 192-bit, and 256-bit encryption keys. Random encryption keys can be generated using the openssl rand command. For example, to create a random 256-bit (32-byte) encryption key, run the following command: $ openssl rand -hex 32 a7addd9adea9978fda19f21e6be987880e68ac92632ca052e5bb42b1a506939a Copy this encryption key to the key file using a text editor, or append a series of keys to a new key file. For example, to append three new encryption keys to a new key file, execute the following: $ sudo openssl rand -hex 32 >> /etc/mysql/encryption/keyfile $ sudo openssl rand -hex 32 >> /etc/mysql/encryption/keyfile $ sudo openssl rand -hex 32 >> /etc/mysql/encryption/keyfile The new key file would look something like the following after this step: a7addd9adea9978fda19f21e6be987880e68ac92632ca052e5bb42b1a506939a 49c16acc2dffe616710c9ba9a10b94944a737de1beccb52dc1560abfdd67388b 8db1ee74580e7e93ab8cf157f02656d356c2f437d548d5bf16bf2a56932954a3 The key file still needs to have a key identifier for each encryption key added to the beginning of each line. Key identifiers do not need to be contiguous. Open the new key file in the preferred text editor and add the key identifiers. For example, the key file would look something like the following after this step: 1;a7addd9adea9978fda19f21e6be987880e68ac92632ca052e5bb42b1a506939a 2;49c16acc2dffe616710c9ba9a10b94944a737de1beccb52dc1560abfdd67388b 100;8db1ee74580e7e93ab8cf157f02656d356c2f437d548d5bf16bf2a56932954a3 The key identifiers give the user a way to reference the encryption keys from MariaDB. In the example above, encryption keys can be referenced using the key identifiers 1, 2, or 100 with the ENCRYPTION_KEY_ID table option or with system variables such as innodb_default_encryption_key_id. Multiple encryption keys are not always necessary; the encryption key with the key identifier "1" is the only mandatory encryption key. Once the File Key Management Plugin is enabled, use it by creating an encrypted table: CREATE TABLE t (i int) ENGINE=InnoDB ENCRYPTED=YES Now, table t will be encrypted using the encryption key from the key file.
Review the procedures for the refreshing of development/test data from production. Review any scripts or code that exists for the movement of production data to development/test systems, or to any other location or for any other purpose. Verify that copies of production data are not left in unprotected locations. If the code that exists for data movement does not comply with the organization-defined data transfer policy and/or fails to remove any copies of production data from unprotected locations, this is a finding.
Modify any code used for moving data from production to development/test systems to comply with the organization-defined data transfer policy, and to ensure copies of production data are not left in unsecured locations.
Review the procedures for the refreshing of development/test data from production. Review any scripts or code that exists for the movement of production data to development/test systems, or to any other location or for any other purpose. Verify that copies of production data are not left in unprotected locations. If the code that exists for data movement does not comply with the organization-defined data transfer policy and/or fails to remove any copies of production data from unprotected locations, this is a finding.
Modify any code used for moving data from production to development/test systems to comply with the organization-defined data transfer policy, and to ensure copies of production data are not left in unsecured locations.
By default, all of the MariaDB database files, log files, and backup files are located in the /var/lib/mysql. To find the location of the datadir run this command: Mariadb > SHOW GLOBAL VARIABLES LIKE 'datadir'; Check the /etc/my.cnf file for the following variables to determine if any of these files have a nondefault location configured. Only variables that specify a directory different from datadir will be in a different directory. If the variable only specifies a file name, that file will still be in the default directory. error_log innodb_log_group_home_dir innodb_temp_data_file_path innodb_tmpdir innodb_undo_directory innodb_temp_data_file_path innodb_tmpdir log_bin_basename log_error relay_log_basename relay_log_file_info sql_error_log_filename tmpdir Review the permissions granted to users by the operating system/file system on the database files, database log files, and database backup files. To verify that all files are owned by the database administrator and have the correct permissions, run the following as the database administrator: $ sudo su - root $ ls -lR {datadir} $ ls -lR other directories defined by variables above If using mysqldump or another tool for backups, also run the "ls" command as above on the directory that will be containing the backup file. If any files are not owned by the database administrator or allow anyone but the database administrator to read/write/execute, this is a finding. If any user/role who is not an authorized system administrator with a need-to-know, database administrator with a need-to-know, or system account for running MariaDB processes is permitted to read/view any of these files, this is a finding.
By default all of the MariaDB database files, log files, and backup files are located in the /var/lib/mysql. To find the location of the datadir run this command: Mariadb > SHOW GLOBAL VARIABLES LIKE 'datadir'; Check the /etc/my.cnf file for the following variables to determine if any of these files have a nondefault location configured. Only variables that specify a directory different from datadir will be in a different directory. If the variable only specifies a file name that file will still be in the datadir directory. error_log innodb_log_group_home_dir innodb_temp_data_file_path innodb_tmpdir innodb_undo_directory innodb_temp_data_file_path innodb_tmpdir log_bin_basename log_error relay_log_basename relay_log_file_info sql_error_log_filename tmpdir Configure the permissions granted by the operating system/file system on the database files, database log files, and database backup files so that only relevant system accounts and authorized system administrators and database administrators with a need to know are permitted to read/view these files. Any files (e.g., extra configuration files) created in datadir, or a nondefault directory defined by a variable above, must be owned by the database administrator, with only owner permissions to read, write, and execute.
Review MariaDB code (trigger procedures, functions), application code, settings, column and field definitions, and constraints to determine whether the database is protected against invalid input. If code exists that allows invalid data to be acted upon or input into the database, this is a finding. If column/field definitions do not exist in the database, this is a finding. If columns/fields do not contain constraints and validity checking where required, this is a finding. Where a column/field is noted in the system documentation as necessarily free-form, even though its name and context suggest that it should be strongly typed and constrained, the absence of these protections is not a finding. Where a column/field is clearly identified by name, caption or context as Notes, Comments, Description, Text, etc., the absence of these protections is not a finding. Check application code that interacts with MariaDB for the use of prepared statements. If prepared statements are not used, this is a finding.
Modify database code to properly validate data before it is put into the database or acted upon by the database. Modify the database to contain constraints and validity checking on database columns and tables that require them for data integrity. Use prepared statements when taking user input. Do not allow general users direct console access to MariaDB.
Review MariaDB source code (stored procedures, functions, triggers) and application source code, to identify cases of dynamic code execution. To list all stored procedures, functions, and triggers in the database, as the database administrator, run the following SQL: MariaDB> SHOW FUNCTION STATUS; MariaDB> SHOW PROCEDURE STATUS; MariaDB> SHOW TRIGGERS; Any user input should be handled through prepared statements. If dynamic code execution is employed in circumstances where the objective could practically be satisfied by static execution with strongly typed parameters, this is a finding.
Where dynamic code execution is employed in circumstances where the objective could practically be satisfied by static execution with strongly typed parameters, modify the code to do so.
Review MariaDB source code (stored procedures, functions, triggers) and application source code to identify cases of dynamic code execution. If dynamic code execution is employed without protective measures against code injection, this is a finding.
Where dynamic code execution is used, modify the code to implement protections against code injection.
MariaDB has five global variables that can be set so that connections will be closed after a certain period of inactivity. Check the values for these variables and verify they correspond to security procedures defined: MariaDB> SHOW GLOBAL VARIABLES LIKE '%timeout%'; interactive_timeout - Time in seconds that the server waits for an interactive connection (one that connects with the mysql_real_connect() CLIENT_INTERACTIVE option) to become active before closing it. See also wait_timeout. wait_timeout - Time in seconds that the server waits for a connection to become active before closing it. The session value is initialized when a thread starts up from either the global value, if the connection is noninteractive, or from the interactive_timeout value, if the connection is interactive. In situations where transactions may be started, but not committed or rolled back, more granular control and a shorter timeout may be desirable so as to avoid locks being held for too long. idle_transaction_timeout idle_write_transaction_timeout idle_readonly_transaction_timeout Review system documentation to obtain the organization's definition of circumstances requiring automatic session termination. If the documentation explicitly states that such termination is not required or is prohibited, this is not a finding. If the security procedures require server-side session termination within a specified amount of time but MariaDB is not configured accordingly, this is a finding.
Configure MariaDB to automatically terminate a user's session based on security procedures requirements regarding conditions or trigger events that require session termination. To change the values of the following timeout variables to conform to organization-defined values for triggering conditions or events requiring session termination select the appropriate variable to change and as the database administrator. As the administrator locate the MariaDB Enterprise Server configuration file to change. For Centos, RedHat, and similar distributions this will be in /etc/my.cnf.d/. In the [mariadb] section add the lines: interactive_timeout = value wait_timeout = value idle_transaction_timeout = value idle_write_transaction_timeout = value idle_readonly_transaction_timeout = value Where value is in seconds and corresponds to the company defined value. Restart MariaDB Enterprise Server for these changes to take effect.
MariaDB has five global variables which can be set so that connections will be closed after a certain period of inactivity. Check the values for these variables and verify they correspond to security procedures defined: MariaDB> SHOW GLOBAL VARIABLES LIKE '%timeout%'; interactive_timeout - Time in seconds that the server waits for an interactive connection (one that connects with the mysql_real_connect() CLIENT_INTERACTIVE option) to become active before closing it. See also wait_timeout. wait_timeout - Time in seconds that the server waits for a connection to become active before closing it. The session value is initialized when a thread starts up from either the global value, if the connection is noninteractive, or from the interactive_timeout value, if the connection is interactive. In situations where transactions may be started, but not committed or rolled back, more granular control and a shorter timeout may be desirable so as to avoid locks being held for too long. idle_transaction_timeout idle_write_transaction_timeout idle_readonly_transaction_timeout Review system documentation to obtain the organization's definition of circumstances requiring automatic session termination. If the documentation explicitly states that such termination is not required or is prohibited, this is not a finding. If the security procedures require server-side session termination within a specified amount of time but MariaDB is not configured accordingly, this is a finding.
As an authorized user locate the session to be terminated and terminate that session. To locate a session and terminate the session follow the following steps: 1. Connect to the MariaDB database using an authorized user: mariadb -u admin_user -p 2. At the MariaDB prompt run either of the following commands: MariaDB> SHOW PROCESSLIST; MariaDB> SELECT id, user, host, db, command, time, state, info, progress FROM information_schema.processlist; 3. Identify the session to be terminated and issue kill process number from display. (**This will kill the session.**) Example: MariaDB> KILL 192; 4. A kill query process number can be issued from display. (**This will kill the active query but leave the session active for run-away queries. **) Configure MariaDB to automatically terminate a user session based on security procedures requirements regarding conditions or trigger events that require session termination. To change the values of the following timeout variables to conform to organization-defined values for triggering conditions or events requiring session termination, select the appropriate variable to change as the database administrator. As the administrator locate the MariaDB Enterprise Server configuration file to change. For Centos, RedHat, and similar distributions this will be in /etc/my.cnf.d/. In the [mariadb] section add the lines: interactive_timeout = value wait_timeout = value idle_transaction_timeout = value idle_write_transaction_timeout = value idle_readonly_transaction_timeout = value Where value is in seconds and corresponds to the company defined value. Restart MariaDB Enterprise Server for these changes to take effect.
If security labeling is not required, this is not a finding. If security labeling requirements have been specified, but the security labeling is not implemented or does not reliably maintain labels on information in storage, this is a finding.
Add custom data structures, data elements and application code, to provide reliable security labeling of information in transmission. Write Custom Code: https://mariadb.com/resources/blog/protect-your-data-row-level-security-in-mariadb-10-0/
If security labeling is not required, this is not a finding. If security labeling requirements have been specified, but the security labeling is not implemented or does not reliably maintain labels on information in process, this is a finding.
Add custom data structures, data elements and application code, to provide reliable security labeling of information in transmission. Write Custom Code: https://mariadb.com/resources/blog/protect-your-data-row-level-security-in-mariadb-10-0/
If security labeling is not required, this is not a finding. If security labeling requirements have been specified, but the security labeling is not implemented or does not reliably maintain labels on information in transmission, this is a finding.
Add custom data structures, data elements and application code, to provide reliable security labeling of information in transmission. Write Custom Code: https://mariadb.com/resources/blog/protect-your-data-row-level-security-in-mariadb-10-0/
Review system documentation to identify the required DAC. Review the security configuration of the database and MariaDB. If applicable, review the security configuration of the application(s) using the database. If the discretionary access control defined in the documentation is not implemented in the security configuration, this is a finding. To check the permissions granted to a user use the following queries: As the database administrator, run the following SQL: **For user privileges: Run this script to create the SHOW GRANTS script for each user: MariaDB> SELECT DISTINCT CONCAT( 'SHOW GRANTS FOR ', user,'@', host,';') AS grantQuery FROM mysql.user WHERE is_role = 'N'; Run each SHOW GRANTS command for each user. Verify that all users have the correct privileges. If they do not, this is a finding. **For role privileges (except admin_option, whether the role can be granted by a particular use): MariaDB> SELECT CONCAT('SHOW GRANTS FOR ',Role,';' ) FROM mysql.roles_mapping; Run each SHOW GRANTS command for each role. Verify that all roles have the correct privileges. If they do not, this is a finding. **To determine if a role has admin_option (Whether the role can be granted by a particular user) MariaDB> SELECT * FROM mysql.roles_mapping; Verify that all privileges are correct. If they are not, this is a finding.
Implement the organization's DAC policy in the security configuration of the database and DBMS, and, if applicable, the security configuration of the application(s) using the database. To grant and revoke privileges, as the database administrator, use the following SQL syntax: **To Grant User and Role privileges: MariaDB> GRANT privilege ON database . table TO user|role ; **To Revoke User and Role privileges: MariaDB> REVOKE privilege_type ON database . table FROM user|role ;
Review the system documentation to obtain the definition of the database/MariaDB functionality considered privileged in the context of the system in question. Review the MariaDB security configuration and/or other means used to protect privileged functionality from unauthorized use. If the configuration does not protect all of the actions defined as privileged, this is a finding.
Configure MariaDB security to protect all privileged functionality.
Functions and Procedures in MariaDB all have DEFINER and SECURITY_TYPE options. If SECURITY_TYPE = DEFINER then the function or procedure is run using the privileges of the DEFINER account. If SECURITY_TYPE = INVOKER, then they will be run using the privileges of the user invoking the function or procedure. To list the values of the DEFINER and SECURITY_TYPE in functions and procedures as the database administrator, run the following SQL: MariaDB> SELECT ROUTINE_NAME, ROUTINE_SCHEMA, ROUTINE_TYPE, DEFINER, SECURITY_TYPE FROM information_schema.routines WHERE ROUTINE_SCHEMA NOT IN ('sys','mysql'); Triggers in MariaDB have a DEFINER option. For Triggers the value of the DEFINER determines the privileges to be used at trigger activation time. To list the values of the DEFINER in Triggers, as the database administrator, run the following SQL: MariaDB> SELECT trigger_schema, trigger_name, action_statement, definer FROM information_schema.triggers; If elevation of MariaDB privileges is utilized but not documented, this is a finding. If elevation of MariaDB privileges is documented, but not implemented as described in the documentation, this is a finding. If the privilege-elevation logic can be invoked in ways other than intended, or in contexts other than intended, or by subjects/principals other than intended, this is a finding.
Determine where, when, how, and by what principals/subjects elevated privilege is needed. To change the values of the SECURITY_TYPE for functions and procedures: MariaDB> USE <database>; MariaDB> ALTER FUNCTION procedure_name | function_name sql security INVOKER | DEFINER ; To change the values of the DEFINER for functions, procedures, and triggers, run the following SQL as the database administrator: MariaDB> SHOW CREATE function | procedure ; MariaDB> DROP function | procedure ; Recreate the function or procedure using the results of the create statement (from the SHOW CREATE results above), with the definer set to the desired user.
Investigate whether there have been any incidents where MariaDB ran out of audit file log disk space since the last time the space was allocated or other corrective measures were taken. If there have been incidents where MariaDB ran out of audit log file disk space, this is a finding. MariaDB can be configured to use syslog or any OS system file to store audit records to designated disk directories. Check the log file location: To check how much storage capacity is available for audit records, first determine the location where the audit logs are being written by executing the following command. Run the following SQL: show global variables like 'server_audit%' ; For system logs (syslog): From the query above verify the value of: server_audit_output_type=SYSLOG For OS file: From the query above verify the value of: server_audit_output_type=FILE If written to SYSLOG, follow the procedure for storage in the corresponding OS STIG. If written to FILE, check the remaining storage on the disk. If it does not meet organizationally defined audit record storage requirements, this is a finding.
MariaDB audit log file location either goes to the syslog directory (if logging is set to SYSLOG) or is controlled by the server_audit_file_path in the MariaDB my.cnf configuration file. If the audit log file directory does not have enough disk space available, then increase the diskspace available for the audit log file directory or move the audit log file directory to another location that has more disk space available. Allocate sufficient audit file space to support peak demand. If server_audit_output_type=FILE set the directory in /etc/my.cnf to one that is managed by the centralized management system. [mariadb] server_audit_file_path= mydir / mylogfilename .log Now, as the system administrator, restart the server with the new configuration: $ systemctl restart mysqld Allocate sufficient audit file space to support peak demand for the log files.
Review OS, or third-party logging application settings to determine whether a warning will be provided when 75 percent of DBMS audit log storage capacity is reached. If no warning will be provided, this is a finding.
Configure the system to notify appropriate support staff immediately upon storage volume utilization reaching 75 percent. MariaDB does not monitor storage, however, it is possible to monitor storage with a script. ##### Example Monitoring Script #!/bin/bash DATADIR=/var/lib/psql/mysql CURRENT=$(df ${DATADIR?} | grep / | awk '{ print $5}' | sed 's/%//g') THRESHOLD=75 if [ "$CURRENT" -gt "$THRESHOLD" ] ; then mail -s 'Disk Space Alert' mail@support.com << EOF The data directory volume is almost full. Used: $CURRENT %EOF fi Schedule this script in cron to run around the clock.
Review MariaDB Server settings, OS, or third-party logging software settings to determine whether a real-time alert will be sent to the appropriate personnel when auditing fails for any reason. If real-time alerts are not sent upon auditing failure, this is a finding.
Configure the system to provide an immediate real-time alert to appropriate support staff when a specified audit failure occurs. It is possible to create scripts or implement third-party tools to enable real-time alerting for audit failures in MariaDB.
Check the current timezone value by running the following command as an administrative user: MariaDB> SHOW GLOBAL VARIABLES LIKE '%zone%'; If time_zone = SYSTEM, and system_time_zone is not equal to UTC, this is a finding. If time_zone is not SYSTEM and is not UTC, this is a finding.
On the OS command line run the following command to get the time zone the system is in: date | awk '{print $5;}' If the system is in UTC, to set the time zone for timestamps to UTC, modify the MariaDB configuration file located within /etc/my.cnf.d/ and set the variable time_zone to SYSTEM under the server section. Restart MariaDB Enterprise Server. Example: [server] Timezone = SYSTEM If the OS system timezone is not set to UTC, to set the time zone for timestamps to UTC, modify the MariaDB configuration file located within /etc/my.cnf.d/ and set the variable time_zone to UTC under the server section. Restart MariaDB Enterprise Server. Example: [server] Timezone = UTC
If MariaDB supports only software development, experimentation and/or developer-level testing (that is, excluding production systems, integration testing, stress testing, and user acceptance testing), this is not a finding. Review MariaDB and database security settings with respect to nonadministrative users ability to create, alter, or replace logic modules, to include but not necessarily only stored procedures, functions, triggers, and views. 1. To list the privileges for all users on all tables and schemas, as the database administrator, do the following: Gather a list of SHOW GRANTS commands. SHOW GRANTS will list the privileges granted to the account. Run this script to create the SHOW GRANTS script for each user: MariaDB> SELECT DISTINCT CONCAT( 'SHOW GRANTS FOR ', user,'@', host,';') AS grantQuery FROM mysql.user WHERE is_role = 'N'; Run each SHOW GRANTS command for each user. 2. Only DEFINERS of routines (functions and procedures) can change routines. To view the DEFINERS of all functions and procedures, as database administrator run the following SQL: MariaDB> SELECT * FROM mysql.proc \G 3. Only DEFINERS of triggers can change triggers. To view all triggers and their DEFINERS, as database administrator run the following SQL: MariaDB> SELECT * FROM information_schema.triggers \G 4. Views: At view definition time, the view creator must have the privileges needed to use the top-level objects accessed by the view. For example, if the view definition refers to table columns, the creator must have privileges for the columns, as described previously. If the definition refers to a stored function, only the privileges needed to invoke the function can be checked. The privileges required when the function runs can be checked only as it executes. For different invocations of the function, different execution paths within the function might be taken. If any such permissions exist and are not documented and approved, this is a finding.
Document and obtain approval for any nonadministrative users who require the ability to create, alter, or replace logic modules. Check the security guide to implement the approved permissions. Revoke any unapproved permissions.
To list all the permissions of individual roles, as the database administrator, run the following SQL: 1. For User privileges: Gather a list of SHOW GRANTS commands. SHOW GRANTS will list the privileges granted to the account. Run this script to create the SHOW GRANTS script for each user: MariaDB> SELECT DISTINCT CONCAT( 'SHOW GRANTS FOR ', user,'@', host,';') AS grantQuery FROM mysql.user WHERE is_role = 'N'; Run each SHOW GRANTS command for each user. 2. For role privileges (except admin_option, whether the role can be granted by a particular use): MariaDB> SELECT CONCAT('SHOW GRANTS FOR ',Role,';' ) FROM mysql.roles_mapping; Run each SHOW GRANTS command for each role. If any role has admin_option that should not, this is a finding. There are no privileges assigned to databases or tables, security is enforced through the traditional way with granting very specific user privileges. If any database or schema has update or create privileges and should not, this is a finding.
Configure MariaDB to enforce access restrictions associated with changes to the configuration of MariaDB or database(s). 1. Use REVOKE to revoke privileges or roles on objects from users. MariaDB> REVOKE privileges ON object FROM user ; 2. Use REVOKE to remove a role from a user or another role that it was previously assigned to. MariaDB> REVOKE role FROM grantee or role ;
To verify that system denies are logged when unprivileged users attempt to change database configuration, run the following commands using the database administrator, and a newly created user shown here as test_user: MariaDB> CREATE USER 'test_user'@'localhost' IDENTIFIED BY 'TEst_Password!2'; MariaDB> CREATE DATABASE myapp; MariaDB> CREATE TABLE myapp.mytable (a int, b char(10)); As the newly created test_user, alter the table: $ mariadb -u test_user -p Enter password: MariaDB> ALTER TABLE mytable ADD COLUMN (c int); Check the latest log to determine if the denial is logged. For example: $ tail -f /var/log/mysql/audit.log 20190909 12:14:29,osboxes,test_user9,localhost,21,0,CONNECT,,,0 20190909 12:14:29,osboxes,test_user9,localhost,21,10,QUERY,, alter table myapp.mytable add column (c int) ,1142 20190909 12:14:29,osboxes,test_user9,localhost,21,0,DISCONNECT,,,0 If the denial is not produced, this is a finding. By default MariaDB configuration files are owned by the OS Administrator user (here root) and cannot be edited by nonprivileged users: $ ls -la /etc | grep my.cnf -rw-r--r--. 1 root root 301 Aug 25 12:45 my.cnf If my.cnf is not owned by the OS administrator (chown here as root) and does not have read and write permissions for the owner, this is a finding.
The MariaDB Enterprise Audit plugin can be configured to audit these changes. Update necessary audit filters to include query_event ALL. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' )); If the config files are not secured properly in the file system, change the ownership and permissions with operating system operations. Example: chown root:root /etc/my.cnf.d chmod 644 /etc/my.cnf.d
Check the ports in use by running the following command as the administrator user: MariaDB > SHOW GLOBAL VARIABLES LIKE 'port'; If the currently defined port configuration is deemed prohibited, this is a finding.
To verify that mariadb system denies specific network functions, locate cnf file and specifically bind ip address to deny (or port): $ ls -la /etc | grep my.cnf -rw-r--r--. 1 root root 301 Aug 25 12:45 my.cnf bind-address = 127.0.0.1 #just an example To specifically change default port (3306) is something different: port = 1234 bind = 10.10.10.10 #as an example After making changes to the .cnf file, stop and restart the database service.
Determine all situations where a user must reauthenticate. Check if the mechanisms that handle such situations use the following SQL: To make a single user reauthenticate, an existing connection must be present: To search for a specific user: MariaDB> SELECT * FROM information_schema.PROCESSLIST where user ='<name>' and host like '%'; To review all connections: MariaDB> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; Note the ID(s) (processlist_id) of the connection(s) for the user that must reauthenticate. To make a user reauthenticate, run the following for each ID returned above (as they can have multiple connections): MariaDB> KILL CONNECTION processslist_id; If the provided SQL does not force reauthentication, this is a finding.
To force a single user reauthenticate, the user must be currently authenticated to the database server. Find the process ID of the user in question: MariaDB> SELECT id FROM information_schema.processlist WHERE user = 'username'; Use the id to kill the process, which kills the connection and forces the user to reauthenticate: MariaDB> KILL id; To force all users to reauthenticate, run the following as the database administrator: MariaDB> SELECT concat( KILL ,id, ; ) FROM information_schema.processlist INTO OUTFILE /tmp/x.txt; MariaDB> SOURCE /tmp/x.txt;
The system parameter idle_transaction_timeout specifies in seconds when a connection will be terminated due to inactivity. After a connection is terminated, a new request to the database must be preceded by an authentication, which is not cached within the database. Run the following SQL: MariaDB> SHOW GLOBAL VARIABLES LIKE 'idle_transaction_timeout'; If the value is 0, this is a finding.
Verify that the idle_transaction_wait is set to a value greater than 0 or is set to the value needed by the administrator. The value of idle_transaction_wait can be validated by issuing SHOW VARIABLES. Example: Locate the MariaDB Enterprise Server configuration files in /etc/my.cnf.d/. Add the following: Under the [mariadb] section: idle_transaction_timeout = 60 After making changes to the .cnf file, stop and restart the database service.
If MariaDB is deployed in an unclassified environment, this is not applicable (NA). If MariaDB is not using NSA-approved cryptography to protect classified information in accordance with applicable federal laws, Executive Orders, directives, policies, regulations, and standards, this is a finding. To check if MariaDB is configured to use SSL, as the database administrator: MariaDB> SHOW GLOBAL VARIABLES LIKE 'have_ssl'; If have_ssl is not YES, this is a finding. Consult network administration staff to determine whether the server is protected by NSA-approved encrypting devices. If not, this a finding.
Configure the DBMS and related system components to use NSA-approved cryptography to protect classified information in accordance with applicable federal laws, Executive Orders, directives, policies, regulations, and standards. Configure MariaDB to use TLS. Details for this procedure can be found here: https://mariadb.com/docs/security/encryption/in-transit/enable-tls-server/
As the database administrator, check the following variables: MariaDB> SHOW GLOBAL VARIABLES LIKE 'ssl_ca'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'ssl_cert'; The Value column will show the fully qualified file name of the ssl_ca and ssl_cert respectively. The issuer can be found by running the following command: $ openssl x509 -in fully-qualified-file-name-of-ssl_ca -noout -issuer $ openssl x509 -in fully-qualified-file-name-of-ssl_cert -noout -issuer The issuer should be checked against the authoritative list of DoD-approved PKIs, which is published at https://dl.dod.cyber.mil/wp-content/uploads/pki-pke/pdf/unclass-ss_using_commercial_pki_certificates.pdf. If the DBMS will accept non-DoD approved PKI end-entity certificates, this is a finding.
Revoke trust in any certificates not issued by a DoD-approved certificate authority. Configure MariaDB to accept only DoD and DoD-approved PKI end-entity certificates.
Review the security guide to determine whether the organization has defined the information at rest that is to be protected from modification, which must include, at a minimum, PII and classified information. If no information is identified as requiring such protection, this is not a finding. Review the configuration of MariaDB, operating system/file system, and additional software as relevant. One possible way to encrypt data within MariaDB is to use the file key management plugin. To determine if this is installed, check the following variables as the Database administrator: MariaDB> SHOW PLUGINS; Confirm the file_key_management.so is listed. MariaDB> SHOW GLOBAL VARIABLES LIKE 'file_key%'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'aria_en%'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'innodb_encrypt_tables'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'innodb_encrypt_log'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'innodb_tablespace%'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'encrypt%'; Confirm that these are ON. If any of the information defined as requiring cryptographic protection from modification is not encrypted in a manner that provides the required level of protection, this is a finding.
Configure MariaDB, operating system/file system, and additional software as relevant, to provide the required level of cryptographic protection. Once the File Key Management Plugin is enabled, use it by creating an encrypted table: MariaDB> CREATE TABLE t (i int) ENGINE=InnoDB ENCRYPTED=YES; Now, table t will be encrypted using the encryption key from the key file.
Review the security guide to determine whether the organization has defined the information at rest that is to be protected from modification, which must include, at a minimum, PII and classified information. If no information is identified as requiring such protection, this is not a finding. Review the configuration of MariaDB, operating system/file system, and additional software as relevant. One possible way to encrypt data within MariaDB is to use the file key management plugin. To determine if this is installed check the following variables as the Database administrator: MariaDB> SHOW PLUGINS; Confirm the file_key_management.so is listed. MariaDB> SHOW GLOBAL VARIABLES LIKE 'file_key%'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'aria_en%'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'innodb_encrypt_tables'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'innodb_encrypt_log'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'innodb_tablespace%'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'encrypt%'; Confirm that these are ON. If any of the information defined as requiring cryptographic protection from modification is not encrypted in a manner that provides the required level of protection, this is a finding.
Configure MariaDB, operating system/file system, and additional software as relevant, to provide the required level of cryptographic protection for information requiring cryptographic protection against disclosure. Secure the premises, equipment, and media to provide the required level of physical protection. One possible way to encrypt data within MariaDB is: How to Set Up and Configure MariaDB for Data-at-Rest Encryption Generate random encryption keys using openssl rand command. $ mkdir -p /etc/mysql/encryption $ for i in {1..5}; do openssl rand -hex 32 >> /etc/mysql/encryption/keyfile; done; Open and edit the file /etc/mysql/encryption/keyfile and add the key IDs that will be referenced when creating encrypted tables as the encryption key id. See ENCRYPTION_KEY_ID for more details. The format will be as follows: <encryption_key_id1>;<hex-encoded_encryption_key1> <encryption_key_id2>;<hex-encoded_encryption_key2> In the example keyfile, this looks similar to the following: $ cat keyfile 1;687a90b4423c10417f2483726a5901007571c16331d2ee9534333fef4e323075 2;e7bf20f1cbde9632587c2996871cff74871890d19b49e273d13def123d781e17 3;9284c9c80da9a323b3ac2c82427942dfbf1718b57255cc0bc0e2c3d6f15ac3ac 4;abf80c3a8b10643ef53a43c759227304bcffa263700a94a996810b0f0459a580 5;bdbc5f67d34a4904c4adc9771420ac2ab2bd9c6af1ec532e960335e831f02933 Create or generate a random password using the similar command from step 1: $ openssl rand -hex 128 > /etc/mysql/encryption/keyfile.key Before proceeding to the next step, it is important to take note of the following details about encrypting the key file: The only algorithm that MariaDB currently supports to encrypt the key file is Cipher Block Chaining (CBC) mode of Advanced Encryption Standard (AES). The encryption key size can be 128-bits, 192-bits, or 256-bits. The encryption key is created from the SHA-1 hash of the encryption password. The encryption password has a max length of 256 characters. To encrypt the key file using openssl enc command, run the following command: $ openssl enc -aes-256-cbc -md sha1 -pass file:/etc/mysql/encryption/keyfile.key -in /etc/mysql/encryption/keyfile -out /etc/mysql/encryption/keyfile.enc Add the following variables in the MySQL configuration file (i.e., /etc/my.cnf on RHEL-based Linux OS or /etc/mysql/my.cnf in Debian/Ubuntu Linux based OS) [mysqld] … #################### DATABASE ENCRYPTION ############################## plugin_load_add = file_key_management file_key_management_filename = /etc/mysql/encryption/keyfile.enc file_key_management_filekey = FILE:/etc/mysql/encryption/keyfile.key file_key_management_encryption_algorithm = aes_cbc encrypt_binlog = 1 innodb_encrypt_tables = ON innodb_encrypt_log = ON innodb_encryption_threads = 4 innodb_encryption_rotate_key_age = 0 # Do not rotate key Restart MariaDB Server now $ systemctl start mariadb Once the File Key Management Plugin is enabled, use it by creating an encrypted table: CREATE TABLE t (i int) ENGINE=InnoDB ENCRYPTED=YES Table t will be encrypted using the encryption key from the key file.
If the data owner does not have a strict requirement for ensuring data integrity and confidentiality is maintained at every step of the data transfer and handling process, this is not a finding. First, as the database administrator, verify the following settings: MariaDB> SHOW GLOBAL VARIABLES LIKE 'ssl_ca'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'ssl_cert'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'ssl_key'; If SSL is not enabled, this is a finding. If MariaDB does not employ protective measures against unauthorized disclosure and modification during preparation for transmission, this is a finding.
Configure the DBMS and related system components to use NSA-approved cryptography to protect classified information in accordance with applicable federal laws, Executive Orders, directives, policies, regulations, and standards. Configure MariaDB to use TLS. Details for this procedure can be found here: https://mariadb.com/docs/security/encryption/in-transit/enable-tls-server/
If the data owner does not have a strict requirement for ensuring data integrity and confidentiality is maintained at every step of the data transfer and handling process, this is not a finding. First, as the database administrator, verify the following settings: MariaDB> SHOW GLOBAL VARIABLES LIKE 'ssl_ca'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'ssl_cert'; MariaDB> SHOW GLOBAL VARIABLES LIKE 'ssl_key'; If SSL is not enabled, this is a finding. If MariaDB, associated applications, and infrastructure do not employ protective measures against unauthorized disclosure and modification during reception, this is a finding.
Configure the DBMS and related system components to use NSA-approved cryptography to protect classified information in accordance with applicable federal laws, Executive Orders, directives, policies, regulations, and standards. Configure MariaDB to use TLS. Details for this procedure can be found here: https://mariadb.com/docs/security/encryption/in-transit/enable-tls-server/
As the database administrator, make a small SQL syntax error by running the following: MariaDB> CREAT TABLEincorrect_syntax(id INT) ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near CREAT TABLEincorrect_syntax(id INT) at line 1 Now verify the syntax error was logged (change the log file name and part to suit the circumstances): $ cat $DATADIR/sql_errors.log 2019-09-05 14:31:22 root[root] @ localhost [] ERROR 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near CREAT TABLEincorrect_syntax(id INT) at line 1 : CREAT TABLEincorrect_syntax(id INT) Review security guide to determine how input errors from application to MariaDB are to be handled in general and if any special handling is defined for specific circumstances. If it does not implement the documented behavior, this is a finding.
All errors and denials are logged to the sql errorlog. If the sql error log does not exist, install the sql error log plugin as follows: MariaDB> INSTALL SONAME 'sql_errlog'; The error log should by default be located as sql_errors.log within the data directory (/var/lib/mysql by default).
If updating through a repository using yum, apt, etc., all MariaDB packages should be updated/upgraded at the same time. Use the package manager to verify no outdated packages remain. Example: $ sudo yum list installed | grep -i mariadb If older packages remain, this is a finding.
If after the upgrade outdated packages remain, update them if needed or remove. Example: $ sudo yum remove package_name
If new packages are available for MariaDB, they can be reviewed in the package manager appropriate for the server operating system. To list the version of installed MariaDB, run the following Linux commands as the system administrator: MariaDB> SELECT @@version; Check the list of installed packages: $ sudo yum list installed | grep -i mariadb All versions of MariaDB will be listed on: https://mariadb.com/downloads/#mariadb_platform-mariadb_server All security-relevant software updates for MariaDB will be listed on: https://mariadb.com/kb/en/library/security/ If MariaDB is not at the latest version, this is a finding. If MariaDB is not at the latest version and the evaluated version has CVEs (IAVAs), this is a CAT I finding.
Institute and adhere to policies and procedures to ensure that patches are consistently applied to MariaDB within the time allowed.
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify query_events includes ALL in corresponding audit filters. If not, this is a finding.
The MariaDB Enterprise Audit plugin can be configured to audit these changes. Update necessary audit filters to include query_event ALL. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify query_events includes ALL in corresponding audit filters. If not, this is a finding.
The MariaDB Enterprise Audit plugin can be configured to audit these changes. Update necessary audit filters to include query_event ALL. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify query_events includes ALL in corresponding audit filters. If not, this is a finding.
The MariaDB Enterprise Audit plugin can be configured to audit these changes. Update necessary audit filters to include query_event ALL. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
If category tracking is not required in the database, this is not applicable. Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify query_events includes ALL in corresponding audit filters. If not, this is a finding.
The MariaDB Enterprise Audit plugin can be configured to audit these changes. Update necessary audit filters to include query_event ALL. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify query_events includes DCL or ALL in corresponding audit filters. If not, this is a finding. In one terminal, tail the audit log file. For example: $ tail -F /var/lib/mysql/server_audit.log (default location) Open a new terminal and connect to the database. As the database administrator, create a user without special permissions: MariaDB> CREATE USER 'user_name_here'@'localhost' IDENTIFIED BY 'password_here'; As the database administrator, create a role by running the following SQL: MariaDB> CREATE ROLE 'role_name_here'; As the database administrator, GRANT role to testuser: MariaDB> GRANT 'role_name_here' TO 'user_name_here'@'localhost'; As the database administrator, add privileges to user_role for testdb, and add GRANT role to testuser: MariaDB> GRANT SELECT ON db_name_here TO 'user_name_here'@'localhost'; MariaDB> GRANT SELECT ON db_name_here TO 'role_name_here'; As the database administrator, modify privileges for testuser and user_role: MariaDB> GRANT DELETE ON db_name_here TO 'user_name_here'@'localhost'; MariaDB> GRANT DELETE ON db_name_here TO 'role_name_here'; If the audit records are not produced for successful attempts to modify privileges/permissions and roles in the first terminal, this is a finding.
The MariaDB Enterprise Audit plugin can be configured to audit these changes. Update necessary audit filters to include query_event ALL. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify query_events includes DCL or ALL in corresponding audit filters. If not, this is a finding. In one terminal, tail the audit log file. For example: $ tail -F /var/lib/mysql/server_audit.log (default location) Open a new terminal and connect to the database. As the database administrator, create a user without special permissions: MariaDB> CREATE USER 'user_name_here'@'localhost' IDENTIFIED BY 'password_here'; As the database administrator, create a role by running the following SQL: MariaDB> CREATE ROLE 'role_name_here'; As the database administrator, GRANT role to testuser: MariaDB> GRANT 'role_name_here' TO 'user_name_here'@'localhost'; As the database administrator, add privileges to user_role for testdb, and add GRANT role to testuser : MariaDB> GRANT SELECT ON db_name_here TO 'user_name_here'@'localhost'; MariaDB> GRANT SELECT ON db_name_here TO 'role_name_here'; As a regular user, modify privileges for testuser and user_role: MariaDB> GRANT DELETE ON db_name_here TO 'user_name_here'@'localhost'; MariaDB> GRANT DELETE ON db_name_here TO 'role_name_here'; If the audit records are not produced for unsuccessful attempts to modify privileges/permissions and roles in the first terminal, this is a finding.
The MariaDB Enterprise Audit plugin can be configured to audit these changes. Update necessary audit filters to include query_event ALL. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify query_events includes DCL or ALL in corresponding audit filters. If not, this is a finding. In one terminal, tail the audit log file. For example: $ tail -F /var/lib/mysql/server_audit.log (default location) Open a new terminal and connect to the database. As the database administrator, create a user without special permissions: MariaDB> CREATE USER 'user_name_here'@'localhost' IDENTIFIED BY 'password_here'; As the database administrator, create a role by running the following SQL: MariaDB> CREATE ROLE 'role_name_here'; As the database administrator, GRANT role to testuser: MariaDB> GRANT 'role_name_here' TO 'user_name_here'@'localhost'; As the database administrator, add privileges to user_role for testdb, and add GRANT role to testuser: MariaDB> GRANT SELECT ON db_name_here TO 'user_name_here'@'localhost'; MariaDB> GRANT SELECT ON db_name_here TO 'role_name_here'; As the database administrator, modify privileges for testuser and user_role: MariaDB> GRANT DELETE ON db_name_here TO 'user_name_here'@'localhost'; MariaDB> GRANT DELETE ON db_name_here TO 'role_name_here'; If the audit records are not produced for successful attempts to modify privileges/permissions and roles in the first terminal, this is a finding.
The MariaDB Enterprise Audit plugin can be configured to audit these changes. Update necessary audit filters to include query_event ALL. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify query_events includes DCL or ALL in corresponding audit filters. If not, this is a finding. In one terminal, tail the audit log file. For example: $ tail -F /var/lib/mysql/server_audit.log (default location) Open a new terminal and connect to the database. As the database administrator, create a user without special permissions: MariaDB> CREATE USER 'user_name_here'@'localhost' IDENTIFIED BY 'password_here'; As the database administrator, create a role by running the following SQL: MariaDB> CREATE ROLE 'role_name_here'; As the database administrator, GRANT role to testuser: MariaDB> GRANT 'role_name_here' TO 'user_name_here'@'localhost'; As the database administrator, add privileges to user_role for testdb, and add GRANT role to testuser: MariaDB> GRANT SELECT ON db_name_here TO 'user_name_here'@'localhost'; MariaDB> GRANT SELECT ON db_name_here TO 'role_name_here'; As a regular user, modify privileges for testuser and user_role: MariaDB> GRANT DELETE ON db_name_here TO 'user_name_here'@'localhost'; MariaDB> GRANT DELETE ON db_name_here TO 'role_name_here'; If the audit records are not produced for unsuccessful attempts to modify privileges/permissions and roles in the first terminal, this is a finding.
The MariaDB Enterprise Audit plugin can be configured to audit these changes. Update necessary audit filters to include query_event ALL. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify query_events ALL is included in corresponding audit filters. If not, this is a finding.
The MariaDB Enterprise Audit plugin can be configured to audit these changes. Update necessary audit filters to include query_event ALL. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify query_events ALL is included in corresponding audit filters. If not, this is a finding.
The MariaDB Enterprise Audit plugin can be configured to audit these changes. Update necessary audit filters to include query_event ALL. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
If category tracking is not required in the database, this is not applicable. Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify query_events ALL is included in corresponding audit filters. If not, this is a finding.
The MariaDB Enterprise Audit plugin can be configured to audit these changes. Update necessary audit filters to include query_event ALL. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
If category tracking is not required in the database, this is not applicable. Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify query_events ALL is included in corresponding audit filters. If not, this is a finding.
The MariaDB Enterprise Audit plugin can be configured to audit these changes. Update necessary audit filters to include query_event ALL. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. As the database administrator, create a user without special permissions: MariaDB> CREATE USER testuser IDENTIFIED BY password ; In one terminal, tail the audit log file. For example: $ tail -F /var/lib/mysql/server_audit.log (default location) As the database administrator, create a role by running the following SQL: MariaDB> CREATE ROLE user_role As the database administrator, GRANT user_role to testuser: MariaDB> GRANT user_role to testuser As the database administrator, add 2 privileges to user_role for testdb and then delete one of the privileges: MariaDB> GRANT SELECT,DELETE on testdb to testuser MariaDB> GRANT SELECT on testdb to testuser As the database administrator, revoke grant from testuser: MariaDB> REVOKE user_role to testuser If the audit records for REVOKE and the second SELECT are not produced in the first terminal, this is a finding.
No super/administrative users should not have access to modify tables within the mysql database. Verify users do not have access and revoke as necessary. Example: View user grants: MariaDB> SHOW GRANTS FOR 'username'@'host'; If user has INSERT, UPDATE, and/or DELETE on the mysql database or all databases, modify the user privileges as necessary. The MariaDB Enterprise Audit plugin can be configured to audit these changes. Update necessary audit filters to include query_event ALL. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. As the database administrator, create a user without special permissions: MariaDB> CREATE USER testuser IDENTIFIED BY password ; In one terminal, tail the audit log file. For example: $ tail -F /var/lib/mysql/server_audit.log (default location) As the database administrator, create a role by running the following SQL: MariaDB> CREATE ROLE user_role As the database administrator, GRANT user_role to testuser: MariaDB> GRANT user_role to testuser As the database administrator, add two privileges to user_role for testdb and then delete one of the privileges: MariaDB> GRANT SELECT,DELETE on testdb to testuser As the testuser, remove the users delete privilege by granting only SELECT, and revoke grant from test user: MariaDB> GRANT SELECT on testdb to testuser MariaDB> REVOKE user_role to testuser If the audit records for REVOKE and the second SELECT are not produced in the first terminal, this is a finding.
No super/administrative users should not have access to modify tables within the mysql database. Verify users do not have access and revoke as necessary. Example: View user grants: MariaDB> SHOW GRANTS FOR 'username'@'host'; If user has INSERT, UPDATE, and/or DELETE on the mysql database or all databases, modify the user privileges as necessary. The MariaDB Enterprise Audit plugin can be configured to audit these changes. Update necessary audit filters to include query_event ALL. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. In one terminal, tail the audit log file. For example: $ tail -F /var/lib/mysql/server_audit.log (default location) As the database administrator, create a role by running the following SQL: MariaDB> CREATE ROLE user_role As the database administrator, delete the user_role: MariaDB> DROP ROLE user_role If the audit records for DROP are not produced in the first terminal, this is a finding.
Super/administrative users must not have access to modify tables within the mysql database. Verify users do not have access and revoke as necessary. Example: View user grants: MariaDB> SHOW GRANTS FOR 'username'@'host'; If user has INSERT, UPDATE, and/or DELETE on the mysql database or all databases, modify the user privileges as necessary. The MariaDB Enterprise Audit plugin can be configured to audit these changes. Update necessary audit filters to include query_event ALL. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. As the database administrator, create a user without special permissions: MariaDB> CREATE USER testuser IDENTIFIED BY password ; In one terminal, tail the audit log file. For example: $ tail -F /var/lib/mysql/server_audit.log (default location) As the database administrator, create a role by running the following SQL: MariaDB> CREATE ROLE user_role As the database administrator, GRANT user_role to testuser: MariaDB> GRANT user_role to testuser As the database administrator, add two privileges to user_role for testdb and then delete one of the privileges: MariaDB> GRANT SELECT,DELETE on testdb to testuser MariaDB> GRANT SELECT on testdb to testuser As the database administrator, revoke grant from testuser: MariaDB> REVOKE user_role to testuser If the audit records for REVOKE and the second SELECT are not produced in the first terminal, this is a finding.
Super/administrative users must not have access to modify tables within the mysql database. Verify users do not have access and revoke as necessary. Example: View user grants: MariaDB> SHOW GRANTS FOR 'username'@'host'; If user has INSERT, UPDATE, and/or DELETE on the mysql database or all databases, modify the user privileges as necessary. The MariaDB Enterprise Audit plugin can be configured to audit these changes. Update necessary audit filters to include query_event ALL. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
If category tracking is not required in the database, this is not applicable. Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify query_events ALL is included in corresponding audit filters. If not, this is a finding.
Update necessary audit filters to include query_event ALL. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
If category tracking is not required in the database, this is not applicable. Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit is not active, this is a finding. Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify query_events ALL is included in corresponding audit filters. If not, this is a finding.
Update necessary audit filters to include query_event ALL. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ], "query_event": [ "ALL" ] }' ));
Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify connect_events include connect in audit filters. If not, this is a finding. Log in to and out of the MariaDB database server. Verify the connect is logged in the audit logfile or syslog depending on how it is configured. If connect is not logged this is a finding.
Edit the necessary filters to include connect_events connect. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ] }' ));
Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify connect_events include connect in audit filters. If not, this is a finding. Log in to and out of the MariaDB database server with both valid and invalid users. Verify the connect and disconnect are logged in the audit logfile or syslog depending on how it is configured. If connect/disconnect and invalid logins are not logged, this is a finding.
Edit the necessary filters to include connect_events connect. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ] }' ));
Review the security plan to obtain the definition of the database/DBMS functionality considered privileged in the context of the system in question. If audit logging covers at least all of the actions defined as privileged, this is not a finding, otherwise, this is a finding. Review the MariaDB audit settings. Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the MariaDB Enterprise Audit plugin is not active, this is a finding. Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Review the filters to verify TABLE and QUERY are included. If QUERY and TABLE are not included, this is a finding.
Edit the necessary filters to include the desired logging actions. Exact steps vary depending on desired logging. Example named audit filter assigned to specific user: MariaDB> INSERT INTO mysql.server_audit_users (host, user, filtername) VALUES ("%", "user1", "filter_example"); MariaDB> SET GLOBAL server_audit_reload_filters=ON;
Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify audit filters are correctly configured to log desired actions per user. If not, this is a finding.
Edit the necessary filters to include the desired logging actions. Exact steps vary depending on desired logging. Example named audit filter assigned to specific user: MariaDB> INSERT INTO mysql.server_audit_users (host, user, filtername) VALUES ("%", "user1", "filter_example"); MariaDB> SET GLOBAL server_audit_reload_filters=ON;
Log in to and out of the MariaDB database server. Verify the connect and disconnect are logged in the audit logfile or syslog depending on how it is configured. If connect and disconnect are not logged, this is a finding.
Edit the necessary filters to include connect_events connect. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event": [ "CONNECT", "DISCONNECT" ] }' ));
Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify connect_events include connect in audit filters. If not, this is a finding.
Edit the necessary filters to include connect_events connect. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event":"CONNECT" }' ));
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; Default Audit Filter is applied to all users by default. Named Audit Filters are assigned to specific users. Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Check what Named Audit Filters are assigned to what users: MariaDB> SELECT sau.host, sau.user, saf.filtername, JSON_DETAILED(saf.rule) FROM mysql.server_audit_filters saf JOIN mysql.server_audit_users sau ON saf.filtername = sau.filtername WHERE saf.filtername != 'default'\G If the MariaDB Enterprise Audit plugin is not active and/or necessary auditing is not in place, this is a finding.
If the MariaDB Enterprise Audit plugin is not active, enable it in one of the two following ways. 1. Config file (requires restart): [mariadb] server_audit_logging = ON 2. SQL (does not require restart): MariaDB> SET GLOBAL server_audit_logging=ON; Once the MariaDB Enterprise Audit plugin is loaded, verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the necessary auditing is not in place for all or specific users, modify the filters. To modify the default filter, delete, and recreate: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "logging":"ON", "connect_event":"ALL", "query_event":"ALL", "table_event":"ALL" }' )); Specific objects can be added to filters with inclusion or exclusion. ignore_databases: Do not log actions on these databases. ignore_tables: Do not log actions on these tables. databases: Log actions on these databases. tables: Log actions on these tables. Example: MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ( 'reporting', JSON_COMPACT( '{ "tables": [ "production.*", "reporting.*", { "table_event": [ "WRITE", "CREATE", "DROP", "RENAME", "ALTER" ], "query_event": [ "DML", "DDL", { "ignore_tables": [ "production.customer_profiles", "production.customer_addresses" ] } ] } ] }' ) );
Verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; Default Audit Filter is applied to all users by default. Named Audit Filters are assigned to specific users. Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Check what Named Audit Filters are assigned to what users: MariaDB> SELECT sau.host, sau.user, saf.filtername, JSON_DETAILED(saf.rule) FROM mysql.server_audit_filters saf JOIN mysql.server_audit_users sau ON saf.filtername = sau.filtername WHERE saf.filtername != 'default'\G If the MariaDB Enterprise Audit plugin is not active and/or necessary auditing is not in place, this is a finding.
If the MariaDB Enterprise Audit plugin is not active, enable it in one of the two following ways. 1. Config file (requires restart): [mariadb] server_audit_logging = ON 2. SQL (does not require restart): MariaDB> SET GLOBAL server_audit_logging=ON; Once the MariaDB Enterprise Audit plugin is loaded, verify the MariaDB Enterprise Audit plugin is loaded and actively logging: MariaDB> SHOW GLOBAL STATUS LIKE 'Server_audit_active'; If the necessary auditing is not in place for all or specific users, modify the filters. To modify the default filter, delete and recreate: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "logging":"ON", "connect_event":"ALL", "query_event":"ALL", "table_event":"ALL" }' )); Specific objects can be added to filters with inclusion or exclusion. ignore_databases: Do not log actions on these databases. ignore_tables: Do not log actions on these tables. databases: Log actions on these databases. tables: Log actions on these tables. Example: MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ( 'reporting', JSON_COMPACT( '{ "tables": [ "production.*", "reporting.*", { "table_event": [ "WRITE", "CREATE", "DROP", "RENAME", "ALTER" ], "query_event": [ "DML", "DDL", { "ignore_tables": [ "production.customer_profiles", "production.customer_addresses" ] } ] } ] }' ) );
Check what filters are in place by running the following as an administrative user: MariaDB> SELECT * FROM mysql.server_audit_filters; Verify connect_events include connect in audit filters. If not, this is a finding.
Edit the necessary filters to include connect_events connect. Example: MariaDB> DELETE FROM mysql.server_audit_filters WHERE filtername = 'default'; MariaDB> INSERT INTO mysql.server_audit_filters (filtername, rule) VALUES ('default', JSON_COMPACT( '{ "connect_event":"CONNECT" }' ));
As the system administrator, run the following at the Linux commands: # openssl version OpenSSL 1.0.2k-fips 26 Jan 2017 If fips is not included in the openssl version, this is a finding. # sysctl crypto.fips_enabled crypto.fips_enabled = 1 If crypto.fips_enabled = 0, this is a finding. MariaDB> SHOW GLOBAL VARIABLES LIKE ‘%have_openssl%'; If the value of have_openssl is not YES, this is a finding. MariaDB> SHOW GLOBAL VARIABLES LIKE ‘%version_ssl_library%'; If the value of version_ssl_library does not contain fips, this is a finding. Examine the application's code to ensure is does not make calls using libmysqlclient. If code uses libmysqlclient this is a finding.
If crypto.fips_enabled = 0, configure operating system per operating system documentation: RedHat: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/security_guide/chap-federal_standards_and_regulations Ubuntu: https://security-certs.docs.ubuntu.com/en/fips
As the system administrator, run the following at the Linux commands: # openssl version OpenSSL 1.0.2k-fips 26 Jan 2017 If fips is not included in the openssl version, this is a finding. # sysctl crypto.fips_enabled crypto.fips_enabled = 1 If crypto.fips_enabled = 0, this is a finding. MariaDB> SHOW GLOBAL VARIABLES LIKE ‘%have_openssl%'; If the value of have_openssl is not YES, this is a finding. MariaDB> SHOW GLOBAL VARIABLES LIKE ‘%version_ssl_library%'; If the value of version_ssl_library does not contain fips this is a finding. Examine the application's code to ensure is does not make calls using libmysqlclient. If code uses libmysqlclient, this is a finding.
If crypto.fips_enabled = 0, configure operating system per operating system documentation: RedHat: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/security_guide/chap-federal_standards_and_regulations Ubuntu: https://security-certs.docs.ubuntu.com/en/fips
As the system administrator, run the following at the Linux commands: # openssl version OpenSSL 1.0.2k-fips 26 Jan 2017 If fips is not included in the openssl version, this is a finding. # sysctl crypto.fips_enabled crypto.fips_enabled = 1 If crypto.fips_enabled = 0, this is a finding. MariaDB> SHOW GLOBAL VARIABLES LIKE ‘%have_openssl%'; If the value of have_openssl is not YES, this is a finding. MariaDB> SHOW GLOBAL VARIABLES LIKE ‘%version_ssl_library%'; If the value of version_ssl_library does not contain fips, this is a finding. Examine the application's code to ensure is does not make calls using libmysqlclient. If code uses libmysqlclient, this is a finding.
If crypto.fips_enabled = 0, configure operating system per operating system documentation: RedHat: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/security_guide/chap-federal_standards_and_regulations Ubuntu: https://security-certs.docs.ubuntu.com/en/fips
Check if the variable server_audit_output_type is set to syslog, and verify the operating system is using a centralized syslog utility such as rsyslogd. MariaDB> SHOW GLOBAL VARIABLES LIKE 'server_audit_output_type'; If not, this is a finding.
To set up the audit logs to write to sylog: Edit the mariadb-enterprise.cnf file. Add the following under the [mariadb] section: server_audit_output_type = 'syslog' After the .cnf file is updated and saved, the mariadb database service must be restarted.
Review the MariaDB documentation and configuration to determine if MariaDB is configured in accordance with DoD security configuration and implementation guidance, including STIGs, NSA configuration guides, CTOs, DTMs, and IAVMs. If MariaDB is not configured in accordance with security configuration settings, this is a finding.
Configure MariaDB in accordance with DoD security configuration and implementation guidance, including STIGs, NSA configuration guides, CTOs, and DTMs and IAVMs. If MariaDB is not configured in accordance with security configuration settings, this is a finding.
Review the version and release information. Verify the MariaDB Enterprise Server version via one of the following methods: MariaDB> SELECT VERSION(); # mariadb --version Verify the version is supported per the MariaDB support policy: https://mariadb.com/engineering-policies/ If the installed version of MariaDB is not supported by the vendor, this is a finding.
Remove or decommission all unsupported software products. Upgrade MariaDB Enterprise to a supported version of the product.