AWS Database Blog
Secure data at rest on Amazon RDS Custom for Oracle with TDE – Part 2: Multi-tenant environments
In Part 1 of this series, we discussed implementing Oracle Transparent Database Encryption (TDE) in Amazon Relational Database Service (Amazon RDS) Custom for Oracle with the local auto-login option in a database with the multi-tenant option disabled. In this post, we focus on outlining the implementation steps of TDE in an Oracle database with the multi-tenant option enabled.
TDE is used to secure the database at rest and also encrypt the database backups. Due to compliance requirements and increasing security threats, security of the database layer has become more important than ever before. Encryption of data at rest and encrypting the backups of databases is an effective way of enforcing strong security controls. Amazon RDS Custom for Oracle natively encrypts the underlying storage as well as the Amazon RDS-managed backups. In some scenarios, you may wish to use Oracle Database managed encryption of the Oracle datafiles using Oracle Database TDE. Oracle TDE encrypts complete datafiles if tied to a tablespace or encrypts the column content if tied to a table. You can also use TDE to make sure that Oracle datafiles contain encrypted data when copied or backed up using user-managed means.
Solution overview
The multi-tenant architecture enables the Oracle database to function as a container database (CDB) with zero, one, or more pluggable databases (PDBs). The following diagram illustrates this configuration.
A container is a collection of schemas, objects, and related structures, and a CDB includes zero, one, or many customer-created PDBs and application containers. A PDB is a portable collection of schemas, schema objects, and non-schema objects that appears to an Oracle Net client as a separate database. The main purpose of PDBs is to consolidate PDBs into a single CDB to achieve economies of scale, while maintaining greater isolation between PDBs for improved security and governance. Oracle databases before Oracle Database version 12c are defined non-CDBs, and starting from version 12c, the non-CDB database mode is deprecated. With the general availability of the Oracle Database version 21c, the multi-tenant architecture is the only supported database mode.
Configure TDE in a multi-tenant architecture
When securing data at rest with Oracle TDE in a multi-tenant environment, there are two approaches for keystore management:
- United mode – This is the default mode. It enables the creation of a common keystore for the CDB and PDBs. In united mode, the keys for PDBs can be created from the CDB root or from the PDB itself. This design allows you to have a single keystore to manage the entire database. The primary encryption keys for the CDB and the PDBs reside in the shared keystore.
- Isolated Mode – In this mode, the pluggable database has its own keystore and its primary encryption keys can be managed from the PDB only. It’s possible to enable isolated mode in a specific PDB even if the CDB is configured for united mode. Similar to united mode, you must first configure a PDB to use isolated mode by setting the WALLET_ROOT and TDE_CONFIGURATION parameters.
Depending on your organizations requirement’s, you can use a mixture of united mode and isolated mode for the TDE configuration in a multi-tenant environment. The following table summarizes some differences between united and isolated mode PDB configuration.
Factor | United Mode | Isolated Mode |
Ease of keystore management or administration | Simple as a single keystore. | Multiple keystores in CDB and PDB introduces management overhead. |
Portability of PDB | More complex compared to isolated mode because with united mode, keys are stored in a central location. | Ease of portability because key management is self-managed within the PDB and the keystore is not shared. |
Flexibility of PDB configuration | PDBs in united mode have the same key store type. | Isolated mode PDBs can have different types of keystore (for example, software keystore or external HSM). |
Rekey Operations of PDB databases | Slower because there are many databases together in united mode. | Improves the performance of rekey operations in the PDB as compared to the rekey performance in united mode when there are a large number of encrypted PDBs. |
Implement TDE in a pluggable database in united mode
The high-level steps to implement TDE in united mode are:
- In the CDB root, configure the database to use united mode by setting the WALLET_ROOT and TDE_CONFIGURATION parameters:
WALLET_ROOT
sets the location for the wallet directory.TDE_CONFIGURATION
sets the type of keystore to use.
- Pause the automation framework and restart the database so that these settings take effect.
- In the CDB root, create and open the keystore, then create the TDE primary encryption key.
- In each PDB, perform TDE primary encryption key tasks such as opening the keystore locally in the PDB and creating the TDE primary encryption key for the PDB. Remember that the keystore is managed by the CDB root, but must contain a TDE primary encryption key that is specific to the PDB for the PDB to be able to use TDE.
- Convert the password-protected software keystore to auto-login.
- Restart the database for the configuration to take effect.
- Perform a backup of the keystore.
Let’s look at the implementation steps in more detail with code snippets:
- Configure the CDB root container to use united mode by setting the TDE parameters:
- Pause the automation framework and restart the database to configure the wallet keystore:
- Resume the automation and create a password-protected software keystore:
- Complete the TDE configuration for the pluggable database:
- Convert the password-protected software keystore to auto-login:
- Pause the automation framework and restart the database for the configuration to take effect:
- Perform a backup of the keystore:
Implement TDE in a pluggable database in isolated mode
The high-level steps to implement TDE in isolated mode are the following:
- In the CDB root, configure the database to use united mode by setting the WALLET_ROOT and TDE_CONFIGURATION parameters:
WALLET_ROOT
sets the location for the wallet directory.TDE_CONFIGURATION
sets the type of keystore to use.
- Pause the automation framework and restart the database so that these settings take effect.
- In the CDB root, create and open the keystore, then create the TDE primary encryption key.
- In the PDB, configure the parameter TDE_CONFIGURATION parameters:
- WALLET_ROOT is a prerequisite; it sets the location for the wallet directory.
- TDE_CONFIGURATION sets the type of keystore to use.
- Create and open the PDB keystore, then create the TDE primary encryption key.
- Configure the auto-login option for the PDB keystore.
Let’s explore the implementation steps and code in more detail. The code for Steps 1–3 is the same as in the previous section.
- Configure the CDB root as detailed in the previous section.
- Pause the automation framework as shown in the previous section.
- Create the keystore and TDE primary key in the CDB root as shown in the previous section.
- Configure the keystore of the PDB in isolated mode:
- Create and open the keystore and create a TDE encryption key for the PDB:
- Configure the auto-login option for the PDB keystore:
Verify TDE and Amazon RDS Custom automation
You can proceed with creating encrypted columns and tablespaces in the database to validate that the TDE implementation works as expected. Additionally, pause the automation and restart the database to check if the wallet auto-login works as expected, with encrypted objects being accessible after restart. See the following code:
All of the other operations related to rekeying the primary key, changing the password of the keystore, and taking regular backups of the wallet and auto-login file are the same as in Part 1 of this series.
In Part 1, we listed some maintenance scenarios applicable to Amazon RDS Custom for Oracle and described their impact on the implemented TDE. The same set of scenarios and considerations still apply in the case of the multi-tenant database architecture described in this post.
Conclusion
In this post, we described how you can implement Oracle TDE in Amazon RDS Custom for Oracle with the multi-tenant option enabled. We discussed the steps to enable both united and isolated modes, and how the benefits of following the procedure described in this post are a better and tested integration of Oracle TDE implementation with the Amazon RDS Custom for Oracle service. The database instance configured with the procedure described in this post will be more reliable and robust during its entire lifecycle, considering both planned maintenance activities, such as minor version patching or database restore and unplanned failures. We strongly recommend you to follow the detailed steps described in this post as they can be considered best practice. We welcome your comments.
About the Authors
Domenico di Salvia is a Senior Database Specialist Solutions Architect at AWS. In his role, Domenico works with customers in the EMEA region to provide guidance and technical assistance on database projects, helping them improve the value of their solutions when using or migrating to AWS, designing scalable, secure, performant, sustainable, cost-effective, and robust database architectures in the AWS Cloud.
Prasad Matkar is Database Specialist Solutions Architect at AWS based in the EMEA region. With a focus on relational database engines, he provides technical assistance to customers in migrating and modernizing their database workloads to AWS. He has over 16 years of experience working with Oracle databases.