Skip to main content

GCP hosted key

To allow root keys to be hosted externally, a number of key providers are supported. One such provider is Google Cloud Platform (GCP) Cloud Key Management. Currently, Antimatter supports two methods for hosting the domain Root Encryption Key via GCP Cloud Key Management:

  • Hold the key in GCP Cloud Key Management and delegate access to the key to the Antimatter account.
  • Hold the key in GCP Cloud Key Management and create a service account for Antimatter to use to access the key.

Both options are covered below. For this guide, we assume that the Antimatter CLI has been installed (see CLI) and that a domain has been created.

Access the key management page.

If using the dashboard, navigate to Domain Configuration -> Encryption Rotation and select the option: "Change Root Encryption Key Configuration"

Dahsboard UI

This will redirect you to the key management modal where the REK source can be selected.

Adding a GCP Root Key

To delegate a key hosted by GCP Cloud Key Management for use by Antimatter, the following operations need to occur:

  • A key must be created if it does not already exist.
  • A label must be added to the key in the form <domain-id>=allow
  • Permission must be given to allow the Antimatter GCP service account the correct role to access the key.

The simplest way to perform the above steps is through the key management UI, however, it is also possible to add a key through the CLI.

From the key management UI, delegating a GCP key is done by first selecting the option; "I want to configure my own externally-held key." and then selecting 'Next'. The user can then select a provider to host the key. For this example, select "Cloud key management" and click 'Next'.

Onboarding UI

You will now be given the option to use either an existing key, or be guided through the process of creating a new one. In both cases, the next step will require access to a terminal with an authenticated gcloud client. The easiest is to use Cloud Shell in the GCP web console. You can find other ways of creating a key in GCP here.

If you wish to use an existing key, then select "I have an existing root key I wish to use for wrapping" and click 'Next'. On the subsequent pane, you will be provided with a script that must be run in a terminal with the gcloud CLI available.

Onboarding UI

note

While this script is intended to be used as-is, it does require two modifications.

  1. You will be required to include the keyring ID that contains the key to be shared with Antimatter on line three.
  2. You will be required to include the key ID to be shared with Antimatter on line four.

The script will perform the following actions:

  1. Fetch the current project ID. It is assumed that this project contains the keyring supplied.
  2. Add the label <domain-id>=allow to the key.
  3. Assign the roles cloudkms.viewer and cloudkms.cryptoKeyEncrypterDecrypter to the Antimatter account.
  4. Print out the full key resource path.

Note, it is important that the key includes the label <domain-id>=allow. This is required so that Antimatter can confirm that the key supplied is intended for the domain id. Removing the label or supplying a key that does not contain it will result in Antimatter being unable to use it as a Root Key. Additionally, note the permissions added to the key. These are the minimal permissions required to allow Antimatter to describe the key and use it to wrap internally generated keys used for encryption.

Once run, the script will return: Key alias (save this for next step): <project-id>/global/<keyring-id>/<key-id>. Note this down for the final step.

After running the generated script, return to the key management page and click 'Next'. On the next pane you will be asked to submit the key path that was printed out after running the script. After pasting, click 'Apply' and wait for the pairing check to complete. Once complete, click 'Done'.