我已通过AWS Key Management Service (KMS) Plugin设置MariaDB 进行静态加密。
除了关键的循环之外,一切似乎都有效。
我根据附加的配置文件配置了以下选项:
/etc/my.cnf
[mysqld]
# InnoDB/XtraDB Encryption
innodb_encrypt_tables = On
innodb_encrypt_log = On
innodb_encryption_threads = 8
innodb_encryption_rotate_key_age = 1
innodb_encryption_rotation_iops = 100
/etc/my.cnf.d/aws_key_management.cnf
[mariadb]
# Load the AWs plugin and enable it for use
plugin-load-add=aws_key_management.so
# Link to the AWS KMS 'Customer Master Key' used to decrypt MariaDB
encryption keys on disk
# during MariaDB start up and save the decrypted keys into memory
aws_key_management_master_key_id = alias/MariaDB-Encryption-Key
# Specify the AWS region our KMS key is stored in
aws_key_management_region = eu-west-2
# Specify the key specification
aws_key_management_key_spec = AES_256
# Rotate all keys
aws_key_management_rotate_key = -1
# Change the plugins log level
# Options: "Off" (default), "Fatal", "Error", "Warn", "Info",
"Debug", and "Trace".
aws_key_management_log_level = Warn
!include /etc/my.cnf.d/enable_encryption.preset
如您所见,我已将所有密钥设置为轮换 usingaws_key_management_rotate_key = -1
并将密钥年龄设置为 1 using innodb_encryption_rotate_key_age = 1
,但我可以从密钥/var/lib/mysql/
版本 1 中的密钥中看到,尽管这些设置已经实施了多天,但仍在使用:
/var/lib/mysql/aws-kms-key.1.1
/var/lib/mysql/aws-kms-key.2.1
(注:文件名最后的.n后缀代表密钥版本)
我唯一能想到的是,我对innodb_encryption_rotate_key_age
以天为单位的理解不正确?这个选项的文档可以在下面看到,并且根本没有提到这个数值使用的度量单位是什么?
innodb_encryption_rotate_key_age
描述:在后台重新加密密钥早于 >this 的任何页面。设置加密时,此变量必须设置为非零 > 值。否则,当您通过 innodb_encrypt_tables >MariaDB 启用加密时,MariaDB 将无法自动加密任何未加密的表。
谁能解释为什么会这样以及为什么我的钥匙不旋转?
MariaDB 版本
mysql --version
mysql Ver 15.1 Distrib 10.2.15-MariaDB, for Linux (x86_64) using readline 5.1`
AWS KMS 插件版本
yum list installed | grep mariadb
MariaDB-aws-key-management.x86_64 10.2.15-1.el7.centos @mariadb-main