在 CentOS 7.5 上启用 MariaDB 的文件密钥插件

在 CentOS 7.5 上启用 MariaDB 的文件密钥插件

我正在尝试在 MariaDB 上启用 file_key_management。

我正在使用 CentOS 7.5 和 MariaDB 15.1。
以下是 centos-release:

CentOS Linux 版本 7.5.1804(核心)

MariaDB 版本:

Ver 15.1 发行版 5.5.60-MariaDB

我已经使用以下命令来准备密钥:

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

之后,我将etc/mysql/keys文件编辑为以下格式:

1;key_1  
2;key_2
3;key_3

etc/mysql/keys使用 加密了文件openssl enc -aes-256-cbc -md sha1 -k "password" -in /etc/mysql/keys -out /etc/mysql/keys.enc。最后,我将my.cnf文件编辑如下:

[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]
...

完成所有这些之后,当我重新启动 mariadb 服务时,它会显示以下内容:

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

这是 MariaDB 日志:

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

我找不到如何下载file_key_management.so文件以使用它。有人能帮我找到解决方案吗?提前谢谢。

答案1

加密数据已添加到 MariaDB 10.1 系列中。由于您使用的是 5.5.60,因此没有此插件可用。

A10.1适用于 Centos 7(10.2 和 10.3)的软件包。

相关内容