Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. READ MORE

How to get started with the Amazon KMS connector and Qlik's Encryption API using Qlik Application Automation

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
MarkGeurtsen
Support
Support

How to get started with the Amazon KMS connector and Qlik's Encryption API using Qlik Application Automation

Last Update:

Oct 17, 2023 4:22:00 AM

Updated By:

MarkGeurtsen

Created date:

Oct 17, 2023 3:47:08 AM

This article explains how the Amazon KMS connector in Qlik Application Automation and the Encryption API of Qlik Cloud can be used together to manage operations such as key rotations.

This article makes use of the Qlik Cloud connector, however the same actions can be performed with the Qlik Platform Ops connector for OEM use cases.

Table of Contents:

Authentication

AWS Setup

Authentication to Amazon KMS happens through an IAM user. The steps below outline how to create the IAM user, have the correct policy assigned and make a connection in Automations.

  1. Open the AWS console
  2. Navigate to Identity and Access Management (IAM) 
  3. Click Create Policy
  4. In the Policy editor, switch to JSON view

    JSON view.png

  5. Copy in the following JSON document:

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Sid": "VisualEditor0",
                "Effect": "Allow",
                "Action": [
                    "kms:EnableKey",
                    "kms:UntagResource",
                    "kms:PutKeyPolicy",
                    "kms:GetKeyPolicy",
                    "kms:CancelKeyDeletion",
                    "kms:ListResourceTags",
                    "kms:DisableKey",
                    "kms:UpdateAlias",
                    "kms:ListKeys",
                    "kms:TagResource",
                    "kms:ListAliases",
                    "kms:CreateAlias",
                    "kms:DescribeKey",
                    "kms:CreateKey",
                    "kms:DeleteAlias",
                    "kms:scheduleKeyDeletion"
                ],
                "Resource": "*"
            }
        ]
    }

     


    Example:

    Specify Permissions.png

  6. On the review policy page, add a name and a description for the policy. In the example, the name is set to qlik-byok:

    name and description.png

     

  7. After creating the policy, navigate to the Users page in IAM
  8. Click Add Users 
  9. Specify a name for the user.

    There is no need to provide the user access to the AWS console.

    Specify User Details.png

  10. Assign the previously generated permission policy to the user on the Set Permissions Page:

    set permission policy.png

     

  11. Review your user settings in the Review and Create page
  12. Click Create user
  13. Back on the Users page, click on the user that you just created
  14. Navigate to the Security Credentials tab
  15. Click Create Access Key and then navigate to the Security Credentials tab and click Create Access Key:

    Create Access Key.png

  16. For Use Case click Third-party service and follow the recommendations. A description tag is optional.
  17. Click Create Access Key
  18. Copy the Access Key and Secret Access Key values.

    Store them safely. The Secret Access Key will only be shown once. See Access key best practices onscreen. 

    Retrieve access key.png

Qlik Cloud

  1. Open Qlik Cloud
  2. Navigate to My Automations

    my automations.png

  3. Switch to the Connections tab

    add new connection.png

  4. Click Add new connection
  5. Search for Amazon KMS and click Add

    Amazon KMS.png

  6. Provide the access key and secret access key and specify the AWS region in which your KMS is located

    Key management.png

     

Available blocks

The Amazon KMS connector has the following blocks available:

  • Add Tag to Key
  • Cancel Key Deletion
  • Create Alias
  • Create Key
  • Delete Alias
  • Delete Tag from Key
  • Describe Key
  • Disable Key
  • Enable Key
  • List Aliases
  • List Keys
  • List Tags from Keys
  • Put Key Policy
  • Schedule Key Deletion
  • Update Alias

The Qlik Cloud and Qlik Platform Ops connector have the following blocks to make use of the Encryption API:

  • List Key Providers
  • Validate Key Provider
  • Create Key Provider
  • Get Key Provider by Fingerprint
  • Trigger Migration to Key Provider
  • Get Ongoing Key Provider Migration Details
  • Reset a Migration to Qlik Provider

 

Building an automation to encrypt a tenant with a customer-managed key

Now that there's a connection to Amazon KMS, we can configure an automation which generates a new key and sets this key to be the key provider in Qlik Cloud for the entire tenant. Then re-encrypt the whole tenant with the new provided key. Instructions below on how to build this with an Automation:

  1. First, validate which key is currently being used.

    Navigate to https://{tenant_name}.{region}.qlikcloud.com/console/settings/KMS-providers.

    If this is your first time adding a Customer Managed Key, you should see that the tenant is making use of a Qlik-provided key:

    Qlik Provided Key.png

  2. Change to the Automations console using the icon in the top right and click on My Automations

    my automations.png

     

  3. Click on Create Automation in the top right

    Create Automation.png

  4. Choose the Blank Automation template

    Blank Automation.png

  5. Provide a name for the automation and an optional description
  6. Click Save
  7. In the Automation editor, use the left panel to search for the Amazon KMS connector
  8. Locate the Create Key block and drag it into the canvas on the right

    Create the Automation.png

     

  9. Do the same for the Put Key Policy block and drag this underneath the Create Key block.
  10. Click on the Put Key Policy block and provide a key ID in the inputs panel.

    You can make use of the example values from the Create Key block.

    To do so:

    1. click on the Key ID input
    2. Choose Output from Create Key
    3. Find the KeyId field

      create the keyid.png

       

  11. For the Key Policy input field, use the toggle for Raw Input and provide the following JSON document. Modify the values for {account_id} to your AWS account ID and the {tenant_id} to your Qlik Cloud tenant Id. You can use Automations to obtain your tenant ID through the Get Tenant Info block of the Qlik Cloud connector.

    {
        "Version": "2012-10-17",
        "Id": "key-consolepolicy-3",
        "Statement": [
            {
                "Sid": "Enable IAM User Permissions",
                "Effect": "Allow",
                "Principal": {
                    "AWS": "arn:aws:iam::{acoount_id}:root"
                },
                "Action": "kms:*",
                "Resource": "*"
            },
            {
                "Sid": "Enable KMS Key policy for proxy account",
                "Effect": "Allow",
                "Principal": {
                    "AWS": [
                        "arn:aws:iam::338144066592:role/byok-encryption-proxy-role",
                        "arn:aws:iam::338144066592:role/byok-automations-proxy-role",
                        "arn:aws:iam::634246602378:role/byok-encryption-proxy-role",
                        "arn:aws:iam::634246602378:role/byok-automations-proxy-role"
                    ]
                },
                "Action": [
                    "kms:Encrypt",
                    "kms:Decrypt",
                    "kms:GenerateDataKey"
                ],
                "Resource": "*",
                "Condition": {
                    "StringEquals": {
                        "kms:EncryptionContext:TenantId": "{tenant_id}"
                    }
                }
            }
        ]
    }​


    Put Key Policy.png

     

  12. Use the blocks panel to open the Qlik Cloud connector and drag the Create Key Provider block on the canvas. Configure this block with the ARN obtained from the Create Key block, provide a name and set the type to AWS-KMS.

    Create Key Provider.png

     

  13. From the Qlik Cloud connector, drag both the Validate Key Provider and Trigger Migration to Key Provider blocks on the canvas. Configure the inputs for Key ID just like for the earlier blocks. You should have the following automation:

    Add validate key provider and trigger migration to key provider.png

Upon running this automation, the tenant will be re-encrypted using a Customer Managed Key.

Labels (2)
Contributors
Version history
Last update:
‎2023-10-17 04:22 AM
Updated by: