Applicability
This topic applies only to OCP Enterprise Edition. OCP Community Edition does not provide this feature.
OceanBase Database supports encryption at the data storage layer, namely Transparent Data Encryption (TDE).
TDE encrypts sensitive data stored on disks. Data is automatically encrypted before being written to storage devices and decrypted automatically when read. This process is transparent to users, and authenticated database users can access data without restrictions. If a storage medium is stolen, TDE ensures that sensitive data stored on it cannot be accessed by unauthorized users. Even if a storage medium is lost, data loss can still be prevented, maximizing the protection of user data security.
This topic describes how to enable TDE and create tablespaces for tenants.
Enable TDE
You can refer to this section to enable TDE for a cluster.
Notice
Once TDE is enabled, it cannot be disabled and may degrade database performance. If decryption is required later, move the table out of the encrypted tablespace and perform a full compaction.
Prerequisites
- Ensure the current OCP user is in the ADMIN or ORG_ADMIN role.
- The tenant to be encrypted is in the RUNNING state.
- When using an OCP-provided key, ensure the OceanBase cluster is version V4.x or later.
- When using a third-party vendor key, ensure the OceanBase cluster meets one of the following version requirements:
- [V4.2.5.4, V4.3.0)
- [V4.3.5.2, +∞)
- When using a key provided by the third-party vendor Geer, configure the following parameters in advance based on the service type:
- Standard Edition: Set both the
ocp.kms.tde.koal.useTLS.enabledandocp.kms.tde.koal.kcsp.mode.enabledparameter values to false. - Password: Set both the
ocp.kms.tde.koal.useTLS.enabledandocp.kms.tde.koal.kcsp.mode.enabledparameter values to true. For more information about the parameters, see the Parameter description section in this topic.
- Standard Edition: Set both the
Procedure
Log in to OCP.
In the left navigation bar, click Cluster. The system goes to the Clusters page by default.
On the Clusters page, find the target cluster and click its name to go to the cluster Overview page.
In the left navigation bar of the displayed page, click Security.
Switch to the Transparent Data Encryption tab.
Select the tenant for which you want to enable encryption and click Enable Encryption in the Actions column.
Select the key type in the dialog box.
Use an OCP-provided key: An automatically generated key by OCP. In this case, the
tde_methodvalue is internal, indicating the master key is stored in an internal OceanBase table.Use a third-party vendor key: A key managed by KMS. Configure the key information as follows.
ParameterDescriptionVendor Supports six vendor types: Alibaba Cloud, Tencent Cloud, Jiangnan Tianan, KOAL, Sansec, and JN Union. Service Type Selected when the vendor is KOAL, specifying the KMS service type. - Standard Edition: Ensure the KMS Standard service version is 2.0 or later.
- Password: Ensure the KMS Password service version is 3.2.0 or later.
Access Domain Name The KMS endpoint information. AK The access_key_id used for signature authentication. SK The access_key_secret used for signature authentication. SK Version Number Filled in when the vendor is KOAL and the service type is Password. The specific SK version number. Master Key ID The user's master key ID. Region The region information of KMS. This parameter is required when the vendor is Tencent Cloud.
Click Enable.
Parameters
Parameter |
Description |
Whether to Restart for Effectiveness |
|---|---|---|
ocp.kms.tde.koal.useTLS.enabled |
Specifies whether to use the Transport Layer Security (TLS) protocol for encryption of data in the Key Management Service (KMS). This parameter is stored in the config_properties table of the OCP MetaDB. The default value is false. When the server address is https, the parameter value must be set to true. |
No |
ocp.kms.tde.koal.kcsp.mode.enabled |
Specifies whether to use the KSP version for GEL KMS encryption. This parameter can be configured on the OCP console under System Management > System Parameters. The default value is true. |
No |
Create a tablespace
OceanBase supports enabling transparent data encryption on a per-tablespace basis to ensure secure data storage.
Prerequisites
- Ensure the current OCP user is in the ADMIN or ORG_ADMIN role.
- Ensure the OceanBase cluster version is V4.x or later.
- Transparent data encryption (TDE) is enabled.
Procedure
Log in to OCP.
In the left navigation pane, click Cluster. The system goes to the Clusters page by default.
On the Clusters page, find the target cluster and click its name. The cluster Overview page appears.
In the left navigation pane of the displayed page, click Security.
Switch to the Transparent Data Encryption tab.
Select the target tenant and click Create Tablespace in the Actions column.
In the dialog box, specify the following information:
InformationDescriptionEncrypted Tablespace Name Multiple encrypted tablespaces can be created under a tenant, with each having a unique name. The name must start with a letter, can contain letters, numbers, and underscores, and be 2 to 30 characters long. Encryption Algorithm The encryption algorithm cannot be modified or converted after selection. Note that supported algorithms may vary by OceanBase version. Choose an appropriate algorithm based on the official documentation. Enter the encrypted tablespace name, select the encryption algorithm, and click Create.
After enabling TDE and creating an encrypted tablespace, you need to perform the DDL operation to create an encrypted table for data encryption. The DDL statement is as follows:
CREATE TABLE t1 (id int,id2 int) TABLESPACE sectest_ts1;Note
After adding historical tables to the encrypted tablespace, perform a full compaction to persist the encryption. Otherwise, historical table data cannot be encrypted.
Click the name of the encrypted table to view its details in the right-side panel, including information such as the tenant to which it belongs, the encrypted table name, encryption status, and encryption progress. The encryption progress indicates the percentage of data blocks in the current table that have been encrypted.
