Hardening MariaDB and MySQL for rConfig
Hardening MariaDB and MySQL for rConfig
Section titled “Hardening MariaDB and MySQL for rConfig”rConfig’s database holds every config, user and encrypted credential. These settings follow the CIS MariaDB and MySQL Benchmarks. From V8.5.0, Security Review checks them with rConfig’s own database user, read-only.
Server settings
Section titled “Server settings”Add to the [mysqld] section, for example /etc/my.cnf.d/server.cnf (RHEL) or /etc/mysql/mariadb.conf.d/50-server.cnf (Ubuntu), then restart MariaDB.
[mysqld]# Database on the same server as rConfig: listen on loopback only (db.bind_address)bind-address = 127.0.0.1
# No LOAD DATA LOCAL (db.local_infile)local_infile = 0
# Confine file import/export to one folder outside the web root (db.secure_file_priv)secure_file_priv = /var/lib/mysql-files
# Never log every statement in production (db.statement_logging)general_log = 0Then run sudo mariadb-secure-installation to remove anonymous accounts and the test database. The root server check verifies there are no anonymous accounts.
rConfig’s database user
Section titled “rConfig’s database user”The rConfig user needs rights on the rConfig database only (db.app_user_privileges):
-- Check what it hasSHOW GRANTS FOR 'rconfig'@'localhost';
-- Remove server-wide rights, then grant the rConfig database onlyREVOKE ALL PRIVILEGES, GRANT OPTION FROM 'rconfig'@'localhost';GRANT ALL PRIVILEGES ON rconfig8.* TO 'rconfig'@'localhost';Global ALL PRIVILEGES, SUPER or FILE fail the check; PROCESS, RELOAD, CREATE USER or GRANT OPTION warn.
A database on another server
Section titled “A database on another server”Encrypt the connection (db.transport_tls): enable TLS on the server, set require_secure_transport = ON, and follow Encrypted database connections for the .env side. Restrict the server’s firewall to the rConfig host.
Standards: CIS MariaDB Benchmark, CIS Oracle MySQL Benchmark, NIST SP 800-53 AC-6, SC-7, SC-8, AU-9.