8.4.4.5 Using the component_keyring_encrypted_file Encrypted File-Based Keyring

Component (original) (raw)

8.4.4.5 Using the component_keyring_encrypted_file Encrypted File-Based Keyring Component

Note

component_keyring_encrypted_file is an extension included in MySQL Enterprise Edition, a commercial product. To learn more about commercial products, seehttps://www.mysql.com/products/.

The component_keyring_encrypted_file keyring component stores keyring data in an encrypted, password-protected file local to the server host.

Warning

For encryption key management, thecomponent_keyring_file andcomponent_keyring_encrypted_file components, and the keyring_file andkeyring_encrypted_file plugins are not intended as a regulatory compliance solution. Security standards such as PCI, FIPS, and others require use of key management systems to secure, manage, and protect encryption keys in key vaults or hardware security modules (HSMs).

To use component_keyring_encrypted_file for keystore management, you must:

  1. Write a manifest that tells the server to loadcomponent_keyring_encrypted_file, as described inSection 8.4.4.2, “Keyring Component Installation”.
  2. Write a configuration file forcomponent_keyring_encrypted_file, as described here.

When it initializes,component_keyring_encrypted_file reads either a global configuration file, or a global configuration file paired with a local configuration file:

Local configuration files permit setting up multiple server instances to usecomponent_keyring_encrypted_file, such that component configuration for each server instance is specific to a given data directory instance. This enables the same keyring component to be used with a distinct data file for each instance.

component_keyring_encrypted_file configuration files have these properties:

Given the preceding configuration file properties, to configurecomponent_keyring_encrypted_file, create a global configuration file namedcomponent_keyring_encrypted_file.cnf in the directory where thecomponent_keyring_encrypted_file library file is installed, and optionally create a local configuration file, also namedcomponent_keyring_encrypted_file.cnf, in the data directory. The following instructions assume that a keyring data file named/usr/local/mysql/keyring/component_keyring_encrypted_file is to be used in read/write fashion. You must also choose a password.

{  
  "path": "/usr/local/mysql/keyring/component_keyring_encrypted_file",  
  "password": "password",  
  "read_only": false  
}  

Create this file in the directory where thecomponent_keyring_encrypted_file library file is installed.
The path must be readable and writable by the system MySQL user (Windows: NETWORK SERVICES; Linux:mysql user; MacOS:_mysql user). It should not be accessible to other users.
Important
In MySQL 8.0.29 and later, it is not possible for this path to point to the MySQL data directory.

{  
  "read_local_config": true  
}  

Create this file in the directory where thecomponent_keyring_encrypted_file library file is installed.
The local file looks like this:

{  
  "path": "/usr/local/mysql/keyring/component_keyring_encrypted_file",  
  "password": "password",  
  "read_only": false  
}  

The path must be readable and writable by the system MySQL user (Windows: NETWORK SERVICES; Linux:mysql user; MacOS:_mysql user). It should not be accessible to other users.
Important
In MySQL 8.0.29 and later, it is not possible for this path to point to the MySQL data directory.

Keyring operations are transactional:component_keyring_encrypted_file uses a backup file during write operations to ensure that it can roll back to the original file if an operation fails. The backup file has the same name as the data file with a suffix of.backup.

component_keyring_encrypted_file supports the functions that comprise the standard MySQL Keyring service interface. Keyring operations performed by those functions are accessible in SQL statements as described inSection 8.4.4.15, “General-Purpose Keyring Key-Management Functions”.

Example:

SELECT keyring_key_generate('MyKey', 'AES', 32);
SELECT keyring_key_remove('MyKey');

For information about the characteristics of key values permitted bycomponent_keyring_encrypted_file, seeSection 8.4.4.13, “Supported Keyring Key Types and Lengths”.