All pages
Powered by GitBook
1 of 1

Loading...

Data-at-Rest Encryption Overview

Overview

Having tables encrypted makes it almost impossible for someone to access or steal a hard disk and get access to the original data. This functionality is also known as Transparent Data Encryption (TDE).

All of the following assumes that encryption keys are stored on another system.

Using encryption has an overhead of roughly 3-5%.

Which Storage Engines Does MariaDB Encryption Support?

MariaDB encryption is fully supported for the storage engines. Encryption is also supported for the Aria storage engine, but only for tables created with ROW_FORMAT=PAGE (the default), and for the binary log (replication log).

MariaDB allows the user to configure flexibly what to encrypt. In or InnoDB, one can choose to encrypt:

  • everything — all tablespaces (with all tables) (with )

  • individual tables

  • everything, excluding individual tables

Additionally, one can choose to encrypt InnoDB log files (recommended, with ) and InnoDB Temporary Tables (with ).

When or an encryption key of 1 must be defined. See .

Limitations

These limitations exist in the data-at-rest encryption implementation:

  • Only data and only at rest is encrypted. Metadata (for example .frm files) and data sent to the client are not encrypted (but see ).

  • Only the MariaDB server knows how to decrypt the data, in particular

    • can read encrypted binary logs only when --read-from-remote-server is used ().

Encryption Key Management

MariaDB's data-at-rest encryption requires the use of a . These plugins are responsible both for the management of encryption keys and for the actual encryption and decryption of data.

MariaDB supports the use of . Each encryption key uses a 32-bit integer as a key identifier. If the specific plugin supports , then encryption keys can also be rotated, which creates a new version of the encryption key.

How MariaDB manages encryption keys depends on which encryption key management solution you choose. Currently, MariaDB has three options:

Once you have an key management and encryption plugin set up and configured for your server, you can begin using encryption options to better secure your data.

Encrypting Data

Encryption occurs whenever MariaDB writes pages to disk. Encrypting table data requires that you install a , such as the plugin. Once you have a plugin set up and configured, you can enable encryption for your InnoDB and Aria tables.

Encrypting Table Data

MariaDB supports data-at-rest encryption for InnoDB and Aria storage engines. Additionally, it supports encrypting the and internal on-disk temporary tables that use the Aria storage engine..

Encrypting Temporary Files

MariaDB also creates temporary files on disk. For example, a binary log cache will be written to a temporary file if the binary log cache exceeds or , and temporary files are also often used for filesorts during query execution. These temporary files can also be encrypted if is set.

Temporary files created internally by InnoDB, such as those used for merge sorts and row logs can also be encrypted if is set. These files are encrypted regardless of whether the tables involved are encrypted or not, and regardless of whether is set or not.

Encrypting Binary Logs

MariaDB can also encrypt (including ).

Encryption and Page Compression

Data-at-rest encryption and can be used together. When they are used together, data is first compressed, and then it is encrypted. In this case you save space and still have your data protected.

Thanks

  • Tablespace encryption was donated to the MariaDB project by Google.

We are grateful to these companies for their support of MariaDB!

See Also

  • A with benchmark results

This page is licensed: CC BY-SA / Gnu FDL

Percona XtraBackup cannot back up instances that use encrypted InnoDB. However, MariaDB's fork, MariaDB Backup, can back up encrypted instances.
  • The Audit plugin cannot create encrypted output. Send it to syslog and configure the protection there instead.

  • File-based general query log and slow query log cannot be encrypted (MDEV-9639).

  • The Aria log is not encrypted (MDEV-8587). This affects only non-temporary Aria tables though.

  • The MariaDB error log is not encrypted. The error log can contain query text and data in some cases, including crashes, assertion failures, and cases where InnoDB write monitor output to the log to aid in debugging. It can sent to syslog too, if needed.

  • InnoDB
    innodb_encrypt_tables=1
    innodb_encrypt_log=1
    innodb_encrypt_temporary_tables=1
    innodb_encrypt_log=1
    innodb_encrypt_temporary_tables=1
    Enabling InnoDB Encryption
    Secure Connections
    mariadb-binlog
    MDEV-8813
    key management and encryption plugin
    multiple encryption keys
    key rotation
    File Key Management Plugin
    AWS Key Management Plugin
    Hashicorp Key Management Plugin
    key management and encryption plugin
    File Key Management
    InnoDB redo log
    Encrypting Data for InnoDB
    Encrypting Data for Aria
    binlog_cache_size
    binlog_stmt_cache_size
    encrypt_tmp_files=ON
    innodb_encrypt_log=ON
    encrypt_tmp_files
    binary logs
    relay logs
    Encrypting Binary Logs
    InnoDB page compression
    Encryption functions
    DES_DECRYPT()
    DES_ENCRYPT()
    blog post about table encryption