Entrust KeyControl

Entrust KeyControl is a proprietary KMS which KES supports using for storing secrets.

K E S C l i e n t K E S S e r v e r E n t r u s t K e y C o n t r o l

Prerequisites

This procedure was written and tested against Entrust KeyControl v10.1. The provided instructions may work against other KeyControl versions. This procedure assumes you have prior experience with Entrust products and have followed their documentation, best practices, and other published materials in deploying the KeyControl service.

For instructions to set up an Entrust KeyControl cluster, refer to the Entrust documentation:

Set up Entrust KeyControl

Before setting up the KES Server, complete the following sections in KeyControl to add a new Vault, a Box, and one or more Users.

Create a new Vault

Log in to your KeyControl cluster with a user that has root-level permissions (for example, secroot) and create a new PASM vault.

Make entries similar to the following:

  • Type: PASM

  • Name: minio

  • Description: Optional additional information for the vault, or leave blank.

  • Admin Name: User name to to manage the vault.

    Note: This user has complete access to the Vault.

  • Admin Email: Email address for the vault administrator

    Note: KeyControl sends a one-time password to this email address to access the vault. You need this password in the next step.

Make other required entries as per KeyControl or your own guidelines. You can set the Name and Description to be more specific to your MinIO deployment or according to your own guidelines.

Access the new Vault

  1. Access the Vault URL.

    This URL should be in the email with the one-time password. You can also find the URL from the Vault tab in KeyControl.

  2. Use the admin user name and the one-time password sent by email to access the Vault.

Create a new Box

KeyControl stores secrets in a Box inside the Vault. Add a Box to store your secrets.

Follow the prompts and make entries similar to the following:

  • Name: A descriptive name for the box, such as the MinIO Tenant name.
  • Description: Optional additional information about the secrets in the box.
  • Secret Expiration: leave blank.
  • Secret Checkout Duration: leave blank.
  • Secret Rotation Duration: leave blank.

Make other required entries as per KeyControl or your own guidelines.

Attach the ‘Vault User’ role policy

KeyControl uses Role-Based Access Control. Add a policy with the Vault User role and attach the policy to the user account used by KES.

Follow the prompts and make entries similar to the following:

  • Name: KES Service.
  • Description: Optional longer description for the policy.
  • Role: Vault User Role.
  • Users: The KeyControl account KES uses to access keys.
  • Box: Select the box you added in the previous step from the dropdown.
  • Secrets: All Secrets.

Make other required entries as per KeyControl or your own guidelines.

KES Server Setup

After creating a new vault, box inside the vault, and the user access policy in KeyControl, you can set up the KES server.

Generate KES server private key & certificate

Generate a TLS private key and certificate for your KES server. If you already have either a TLS certificate you want to use for your KES server or a working KES server, you can skip this step.

The following command generates a new TLS private key (private.key) and a self-signed X.509 certificate (public.crt) issued for the IP 127.0.0.1 and DNS name localhost.

kes identity new --key private.key --cert public.crt --ip "127.0.0.1" --dns localhost

The output resembles the following:

Your API key:

   kes:v1:APvbt/zbiewXNB+EwciOT+I21peq0odFYCwkJX8mMCxM

This is the only time it is shown. Keep it secret and secure!

Your Identity:

   1d1f89ad528a3bbb8fd64252d443c993f5a4d679b074d5bad49785e02ec38199

The identity is not a secret. It can be shared. Any peer
needs this identity in order to verify your API key.

The generated TLS private key is stored at: private.key
The generated TLS certificate is stored at: public.crt

The identity can be computed again via:

    kes identity of kes:v1:APvbt/zbiewXNB+EwciOT+I21peq0odFYCwkJX8mMCxM
    kes identity of public.crt

Generate a new API key

The client application requires credentials in order to access the KES server. The following command generates a new API key.

kes identity new

The resulting key resembles:

Your API key:

   kes:v1:AOlQZJRMYZeOioGk0ubYBMSFt1w6Hh1QZl3zG4PQxK/g

This is the only time it is shown. Keep it secret and secure!

Your Identity:

   eb559798a2fbcc3efbf036bed11108116e63f293324abdfe7574249ef5e56b36

The identity is not a secret. It can be shared. Any peer
needs this identity in order to verify your API key.

The identity can be computed again via:

    kes identity of kes:v1:AOlQZJRMYZeOioGk0ubYBMSFt1w6Hh1QZl3zG4PQxK/g

Configure the KES Server

Create the KES server configuration file: config.yml. Make sure that the identity in the policy section matches your API key identity.

address: 0.0.0.0:7373 # Listen on all network interfaces on port 7373

admin:
  identity: disabled  # We disable the admin identity since we don't need it in this guide 
   
tls:
  key: private.key    # The KES server TLS private key
  cert: public.crt    # The KES server TLS certificate
   
policy:
  my-app: 
    allow:
    - /v1/key/create/my-key*
    - /v1/key/generate/my-key*
    - /v1/key/decrypt/my-key*
    identities:
    - eb559798a2fbcc3efbf036bed11108116e63f293324abdfe7574249ef5e56b36 # Use the identity of your API key
   
keystore:
     entrust:
       keycontrol:
         endpoint: "https://keycontrol.my-org.com"    # Use your KeyControl instance endpoint.
         vault_id: ""                                 # The Vault ID - e.g: "e30497c1-bff7-4e81-beb7-fb35c4b7410c".
         box_id:   ""                                 # The Box name or ID - e.g: "tenant-1".
         credentials:
           username: ""                               # KeyControl username - e.g: "kes-tenant-1@my-org.com".
           password: ""                               # Password of KeyControl user

Start the KES Server

Use the YAML file you created to start a KES server instance.

kes server --config config.yml --auth off
Linux Swap Protection:

In Linux environments, KES can use the mlock syscall to prevent the OS from writing in-memory data to disk (swapping). This prevents leaking sensitive data.

Use the following command to allow KES to use the mlock syscall without running with root privileges:

sudo setcap cap_ipc_lock=+ep $(readlink -f $(which kes))

Start a KES server instance with memory protection:

kes server --config config.yml --auth off --mlock

KES CLI Access

  1. Set the KES_SERVER Endpoint.

    The following environment variable specifies the server the KES CLI should talk to:

    $ export KES_SERVER=https://127.0.0.1:7373
    
  2. Define the Client Credentials.

    The following environment variables set the access credentials the client uses to talk to a KES server:

    $ export KES_CLIENT_CERT=client.crt
    
    $ export KES_CLIENT_KEY=client.key
    
  3. Test the Configuration.

    Perform any API operation allowed by the policy defined in the KES server configuration file.

    For example, create a key:

    $ kes key create my-key-1
    

    Use the key to generate a new data encryption key:

    $ kes key dek my-key-1
    {
      plaintext : UGgcVBgyQYwxKzve7UJNV5x8aTiPJFoR+s828reNjh0=
      ciphertext: eyJhZWFkIjoiQUVTLTI1Ni1HQ00tSE1BQy1TSEEtMjU2IiwiaWQiOiIxMTc1ZjJjNDMyMjNjNjNmNjY1MDk5ZDExNmU3Yzc4NCIsIml2IjoiVHBtbHpWTDh5a2t4VVREV1RSTU5Tdz09Iiwibm9uY2UiOiJkeGl0R3A3bFB6S21rTE5HIiwiYnl0ZXMiOiJaaWdobEZrTUFuVVBWSG0wZDhSYUNBY3pnRWRsQzJqWFhCK1YxaWl2MXdnYjhBRytuTWx0Y3BGK0RtV1VoNkZaIn0=
    }
    

Using KES with a MinIO Server

MinIO Server requires KES to enable server-side data encryption.

See the KES for MinIO instruction guide for additional steps needed to use your new KES Server with a MinIO Server.

Configuration References

The following section describes the Key Encryption Service (KES) configuration settings to use Entrust KeyControl as the root KMS to store external keys, such as the keys used for Server-Side Encryption on a MinIO Server.

MinIO Server Requires Expanded Permissions:
Starting with MinIO Server RELEASE.2023-02-17T17-52-43Z, MinIO requires expanded KES permissions for functionality. The example configuration in this section contains all required permissions.

References