1.7 Ensure MariaDB is Run Under a Sandbox Environment

Warning! Audit Deprecated

This audit has been deprecated and will be removed in a future update.

View Next Audit Version

Information

Use of the chroot() system call at startup, Systemd with settings to achieve isolation, or docker will put MariaDB in a Sandbox environment.

Rationale:

Running MariaDB in a Sandbox environment may reduce the impact of a MariaDB-born vulnerability by making portions of the file system inaccessible to the MariaDB instance.

Impact:

Use of the chroot option somewhat limits LOAD DATA INFILE and SELECT ... INTO OUTFILE.

Solution

Perform one of the following steps to remediate this setting:

Configure MariaDB to use chroot:

Choose a non-system partition <chroot location> for MariaDB

Add chroot=<chroot_location> to the my.cnf option file

Configure MariaDB to run under systemd:

If MariaDB is managed by systemd and running, stop the service:

$ sudo systemctl stop <mysqld>.service

If a mysql user and group do not already exist, create them:

$ sudo groupadd mysql
$ sudo useradd -r -g mysql -s /bin/false mysql

Set the ownership of the base directory:

$ sudo chown -R mysql:mysql /usr/local/mysql/

Create or modify the <mysqld>.service file in /lib/systemd/system to include the following entries, if not already present:

[Unit]
Description=MariaDB Server

[Install]
WantedBy=multi-user.target

[Service]
User=mysql
Group=mysql

If MariaDB was not already managed by systemd execute this command:

$ sudo systemctl daemon-reload

Start the MariaDB server:

$ sudo systemctl start <mariadb>.service

If you would like MariaDB to automatically run at startup execute this command:

$ sudo systemctl enable <mariadb>.service

Follow documentation in the references for standing up MariaDB in a Docker container.

See Also

https://workbench.cisecurity.org/benchmarks/12270