Encrypt Portworx Volumes using IBM Key Protect
You can use one of the following methods to encrypt Portworx volumes with IBM Key Protect, depending on how you provide the secret password to Portworx:
Encrypt volumes using per volume secrets
Use per-volume secrets to encrypt each volume with a unique encryption key. With this approach, every volume uses its own passphrase, improving security isolation between volumes.
Portworx uses IBM Key Protect APIs to generate a unique 256-bit passphrase.
Run the pxctl volume create command with the --secure flag to create an encrypted volume:
pxctl volume create --secure enc_vol
This example creates an encrypted volume named enc_vol.
Encrypt volumes using a cluster-wide secret
-
Set the cluster-wide secret key.
Enter the followingpxctl secrets set-cluster-keycommand specifying the--secretparameter with your secret passphrase (this example usesmysecretpassphrase):pxctl secrets set-cluster-key --secret mysecretpassphraseSuccessfully set cluster secret key!noteYou must set the cluster-wide secret only once. If you overwrite the cluster-wide secret, the volumes encrypted with the old secret will become unusable.
If you've specified your cluster-wide secret key in the
config.jsonfile, thepxctl secrets set-cluster-keycommand will overwrite it. Even if you restart your cluster, Portworx will use the key you passed as an argument to thepxctl secrets set-cluster-keycommand. -
Create a new encrypted volume.
Enter thepxctl volume createcommand, specifying the following arguments:--secure--secret-keywith thedefaultvalue- the name of the encrypted volume (this example uses
enc_vol)
pxctl volume create --secure --secret_key default enc_volVolume successfully created: 374663852714325215 -
Enter the
pxctl volume listcommand to list your volumes:pxctl volume listID NAME SIZE HA SHARED ENCRYPTED IO_PRIORITY SCALE STATUS
822124500500459627 enc_vol 10 GiB 1 no yes LOW 1 up - detached -
Attach your volume by entering the
pxctl host attachcommand with the following arguments:- The name of your encrypted volume (this example uses
enc_vol) - The
--secret-keyflag with thedefaultvalue
pxctl host attach enc_vol --secret_key defaultVolume successfully attached at: /dev/mapper/pxd-enc822124500500459627 - The name of your encrypted volume (this example uses
-
Mount the volume by entering the
pxctl host mountcommand with the following parameters:- The name of your encrypted volume (this example uses
enc_vol) - The mount point (this example uses
mnt)
pxctl host mount enc_vol /mntVolume enc_vol successfully mounted at /mnt - The name of your encrypted volume (this example uses
If you want to migrate encrypted volumes created through this method between two different Portworx clusters, then you must:
- Create a secret with the same name. You can use the
--secret-idflag to specify the name of your secret, as shown in step 1. - Make sure you provide the same passphrase while generating the secret.