17_Vault_Concept_In_OCI - Nirvan-Pandey/OCI_DOC GitHub Wiki

17_1: Concept of Vault

Oracle Cloud Infrastructure (OCI) Vault is a service that securely stores and manages sensitive information like passwords, API keys, and encryption keys. It helps you keep this information safe by using strong encryption and strict access controls. With OCI Vault, you can easily manage who has access to your secrets, ensuring your applications and data remain secure and compliant.

You can assign vault and keys to both block volumes and boot volumes in the same way. The primary advantage of assigning vault and keys to block volumes is to protect user and application data. While you can also assign vault and keys to boot volumes, which contain the operating system, it may not provide as much benefit since the primary concern is usually the security of user and application data.

17_2: Using Custom Encryption Keys with OCI Vault

By default, block volumes in Oracle Cloud Infrastructure are encrypted using Oracle-managed keys. However, if client need to use your own encryption keys to protect user and application data residing on these volumes, OCI Vault provides a solution. OCI Vault allows you to create and manage your own encryption keys, giving you greater control over the security of your data.

image

17_3: Vault Creation

Below are the steps to create a Vault.

Step1: Navigate to Identity & Security -->Key Management & Secret Management-->Vault

image

Step2: Click on Create Vault.

image

Step3: Choose the compartment and name for the vault and click create.

image

Step4: Vault is created.

image

17_4: Creating a Key.

Now once the vault is created then we have to create a key.

Step1: Click on the Create Key.

image

Step2: Choose the desired variables and create key.

When creating a key in OCI Vault, you have two options for the protection mode:

HSM (Hardware Security Module): Keys are stored and processed in a dedicated hardware security module, providing the highest level of security.

Software: Keys are stored and processed in software, offering flexibility and ease of use.

image

Additionally, you have three options for the key shape, but the most commonly used is AES (Advanced Encryption Standard)

image

Step3: Key is generated.

image

17_5: Rotate the keys.

Rotate keys every quarter or every 6 months. This allows the New data to get encrypted with the new version of the keys. so the data will get more security and reliant.

Step1: Navigate to the vault. Go to the vault and key and click on three dots at the right end of the keys. Here click on the option to rotate keys.

image

Step2: Click on rotate.

image

Step3: Keys have been rotated successfully.

image

Step4: View the key deatils.

image

Step5: The old and new keys are displayed.

image

17_6: Assign the Key to a Block Volume.

Now we have to attach the new key created by us to the block volume.

Step1: Go to our existing block volume and click on assign.

image

Step2: Now select the vault which we created and the key and assign it.

image

Step3: Error received.

We have got an error which clearly states that either we do not find kms key or lacks permission. But we have chosen the key which is created by us. This suggests that we are missing permission. To achieve this, we need to create a policy.

image

17_7: Creating a Policy for Permission to attach the key to Block Volume.

Step1: Navigate to policy.

Now we have to go to Identity and Security --> Policy --> Create Policy.

image

Step2: Create the policy.

image

Step3: Fill the desired and we will manully create policy builder.

image

Oracle Generic Policy

Allow service blockstorage, objectstorage-<region_name>, oke, streaming to use keys in compartment ABC where target.key.id = '<key_OCID>'

Our Edited Policy

Allow service blockstorage to use keys in compartment NP_Compute_Compartment

image

Step4: Policy has been successfully created.

image

Step5: Once the policy is created, now we have to try to assign the key to the block volume.

image

Step6: Keys have been successfully assigned to Block Volume.

image

⚠️ **GitHub.com Fallback** ⚠️