0

I'm trying to enable the file_key_management on MariaDB.

I'm working on CentOS 7.5 and MariaDB 15.1.
Here is the centos-release:

CentOS Linux release 7.5.1804 (Core)

And the MariaDB version:

Ver 15.1 Distrib 5.5.60-MariaDB

I've used this commands to prepare the keys:

openssl rand -hex 16 >> /etc/mysql/keys
openssl rand -hex 16 >> /etc/mysql/keys
openssl rand -hex 16 >> /etc/mysql/keys
chown mysql:mysql /etc/mysql/keys
chmod 400 /etc/mysql/keys

After that, I've edited the etc/mysql/keys file to be in format:

1;key_1  
2;key_2
3;key_3

I encrypted the etc/mysql/keys file with openssl enc -aes-256-cbc -md sha1 -k "password" -in /etc/mysql/keys -out /etc/mysql/keys.enc. Last of all, I edited my my.cnf file to be like this:

[mysqld]
...

# File Key Management
plugin_load_add = file_key_management
file_key_management_filename = /etc/mysql/keys.enc
file_key_management_filekey = FILE:/etc/mysql/.key
file_key_management_encryption_algorithm = aes_cbc

[mysqld_safe]
...

After all that, when I reboot the mariadb service, it says the following:

Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details

This is the MariaDB log:

180826 17:06:19 InnoDB: highest supported file format is Barracuda.
180826 17:06:19  InnoDB: Waiting for the background threads to start
180826 17:06:20 Percona XtraDB (http://www.percona.com) 5.5.59-MariaDB-38.11 started; log sequence number 429373685
180826 17:06:20 [Note] Plugin 'FEEDBACK' is disabled.
180826 17:06:20 [ERROR] Can't open shared library '/usr/lib64/mysql/plugin/file_key_management.so' (errno: 17, cannot open shared object file: No such file or directory)
180826 17:06:20 [ERROR] Couldn't load plugins from 'file_key_management.so'.
180826 17:06:20 server_audit: MariaDB Audit Plugin version 1.4.3 STARTED.
180826 17:06:20 [ERROR] /usr/libexec/mysqld: unknown variable 'file_key_management_filename=/etc/mysql/keys.enc'
180826 17:06:20 [ERROR] Aborting

180826 17:06:20 server_audit: STOPPED
180826 17:06:20  InnoDB: Starting shutdown...
180826 17:06:24  InnoDB: Shutdown completed; log sequence number 429373685
180826 17:06:24 [Note] /usr/libexec/mysqld: Shutdown complete

180826 17:06:24 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended

I cannot find how to download the file_key_management.so file to use it. Can somebody help me find any solution? Thanks in advance.

  • Where did you get that MariaDB version string? – Michael Hampton Aug 26 '18 at 20:32
  • @MichaelHampton mysql -V – Shirkam Aug 26 '18 at 20:42
  • Then you have somehow installed multiple versions of MariaDB. How did you do that? – Michael Hampton Aug 26 '18 at 20:43
  • @MichaelHampton I've done yum list installed | grep maria and I only get version 5.5.60 – Shirkam Aug 26 '18 at 21:15
  • Indeed! So where did the version 5.5.59 come from? – Michael Hampton Aug 26 '18 at 21:15
1

Encrypted data was added in the 10.1 series of MariaDB. As you have 5.5.60 there isn't this plugin available.

A 10.1 packages are available for Centos 7 (as are 10.2 and 10.3).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.