Cloudera Encryption With CTM
Cloudera Encryption With CTM
https://docs.cloudera.com/
Legal Notice
© Cloudera Inc. 2022. All rights reserved.
The documentation is and contains Cloudera proprietary information protected by copyright and other intellectual property
rights. No license under copyright or any other intellectual property right is granted herein.
Unless otherwise noted, scripts and sample code are licensed under the Apache License, Version 2.0.
Copyright information for Cloudera software may be found within the documentation accompanying each component in a
particular release.
Cloudera software includes software from various open source or other third party projects, and may be released under the
Apache Software License 2.0 (“ASLv2”), the Affero General Public License version 3 (AGPLv3), or other license terms.
Other software included may be released under the terms of alternative open source licenses. Please review the license and
notice files accompanying the software for additional licensing information.
Please visit the Cloudera software product page for more information on Cloudera software. For more information on
Cloudera support services, please visit either the Support or Sales page. Feel free to contact us directly to discuss your
specific needs.
Cloudera reserves the right to change any products at any time, and without notice. Cloudera assumes no responsibility nor
liability arising from the use of products, except as expressly agreed to in writing by Cloudera.
Cloudera, Cloudera Altus, HUE, Impala, Cloudera Impala, and other Cloudera marks are registered or unregistered
trademarks in the United States and other countries. All other trademarks are the property of their respective owners.
Disclaimer: EXCEPT AS EXPRESSLY PROVIDED IN A WRITTEN AGREEMENT WITH CLOUDERA,
CLOUDERA DOES NOT MAKE NOR GIVE ANY REPRESENTATION, WARRANTY, NOR COVENANT OF
ANY KIND, WHETHER EXPRESS OR IMPLIED, IN CONNECTION WITH CLOUDERA TECHNOLOGY OR
RELATED SUPPORT PROVIDED IN CONNECTION THEREWITH. CLOUDERA DOES NOT WARRANT THAT
CLOUDERA PRODUCTS NOR SOFTWARE WILL OPERATE UNINTERRUPTED NOR THAT IT WILL BE
FREE FROM DEFECTS NOR ERRORS, THAT IT WILL PROTECT YOUR DATA FROM LOSS, CORRUPTION
NOR UNAVAILABILITY, NOR THAT IT WILL MEET ALL OF CUSTOMER’S BUSINESS REQUIREMENTS.
WITHOUT LIMITING THE FOREGOING, AND TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE
LAW, CLOUDERA EXPRESSLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY, QUALITY, NON-INFRINGEMENT, TITLE, AND
FITNESS FOR A PARTICULAR PURPOSE AND ANY REPRESENTATION, WARRANTY, OR COVENANT BASED
ON COURSE OF DEALING OR USAGE IN TRADE.
Cloudera Manager | Contents | iii
Contents
5
Cloudera Manager Data at Rest Encryption Reference Architecture
To isolate Key Trustee Server from other CDP services, you must deploy Key Trustee Server on dedicated hosts
in a separate cluster in Cloudera Manager. Deploy Ranger KMS on dedicated hosts in the same cluster as the CDP
services that require access to Key Trustee Server. This provides the following benefits:
• You can restart your CDP cluster without restarting Key Trustee Server, avoiding interruption to other clusters or
clients that use the same Key Trustee Server instance.
• You can manage the Key Trustee Server upgrade cycle independently of other cluster components.
• You can limit access to the Key Trustee Server hosts to authorized key administrators only, reducing the attack
surface of the system.
• Resource contention is reduced. Running Key Trustee Server and Key Trustee KMS services on dedicated
hosts prevents other cluster services from reducing available resources (such as CPU and memory) and creating
bottlenecks.
If you are using virtual machines for the Key Trustee Server or Key Trustee KMS hosts, see "Resource Planning for
Data at Rest Encryption".
6
Cloudera Manager Data at Rest Encryption Requirements
Related Information
Resource Planning for Data at Rest Encryption
Overview
Data at rest encryption protection can be applied at a number of levels within Hadoop:
• OS filesystem-level
• Network-level
• HDFS-level (protects both data at rest and in transit)
For more information on the components, concepts, and architecture for encrypting data at rest, see "Encrypting Data
at Rest".
Entropy Requirements
Cryptographic operations require entropy to ensure randomness.
You can check the available entropy on a Linux system by running the following command:
cat /proc/sys/kernel/random/entropy_avail
The output displays the entropy currently available. Check the entropy several times to determine the state of the
entropy pool on the system. If the entropy is consistently low (500 or less), you must increase it by installing rng-tools
and starting the rngd service.
For RHEL 7, run the following commands:
Make sure that the hosts running Key Trustee Server, Ranger KMS, and Navigator Encrypt have sufficient entropy to
perform cryptographic operations.
7
Cloudera Manager Data at Rest Encryption Requirements
• Memory: 8 GB RAM
• Storage: 20 GB on moderate- to high-performance disk drives
For information on the supported Linux distributions, see "Product Compatibility Matrix for Cloudera Navigator
Encryption".
umask Requirements
Key Trustee Server installation requires the default umask of 0022.
Network Requirements
For new Key Trustee Server installations (5.4.0 and higher) and migrated upgrades (see "Cloudera Enterprise
Upgrade Guide"> for more information), Key Trustee Server requires the following TCP ports to be opened for
inbound traffic:
• 11371
Clients connect to this port over HTTPS.
• 11381 (PostgreSQL)
The passive Key Trustee Server connects to this port for database replication.
For upgrades that are not migrated to the CherryPy web server, the pre-upgrade port settings are preserved:
• 80
Clients connect to this port over HTTP to obtain the Key Trustee Server public key.
• 443 (HTTPS)
Clients connect to this port over HTTPS.
• 5432 (PostgreSQL)
The passive Key Trustee Server connects to this port for database replication.
8
Cloudera Manager Data at Rest Encryption Requirements
9
Cloudera Manager Resource Planning for Data at Rest Encryption
Network Requirements
For new Navigator Key Trustee Server (5.4.0 and higher) installations, Navigator Encrypt initiates TCP traffic over
port 11371 (HTTPS) to the Key Trustee Server.
For upgrades and Key Trustee Server versions lower than 5.4.0, Navigator Encrypt initiates TCP traffic over ports 80
(HTTP) and 443 (HTTPS) to the Navigator Key Trustee Server.
Internet Access
You must have an active connection to the Internet to download many package dependencies, unless you have
internal repositories or mirrors containing the dependent packages.
Maintenance Window
Data is not accessible during the encryption process. Plan for system downtime during installation and configuration.
Administrative Access
To enforce a high level of security, all Navigator Encrypt commands require administrative (root) access (including
installation and configuration). If you do not have administrative privileges on your server, contact your system
administrator before proceeding.
Package Dependencies
Navigator Encrypt requires these packages, which are resolved by your distribution package manager during
installation:
• dkms
• keyutils
• ecryptfs-utils
• libkeytrustee
• navencrypt-kernel-module
• openssl
• lsof
• gcc
• cryptsetup
These packages may have other dependencies that are also resolved by your package manager. Installation works with
gcc, gcc3, and gcc4.
Related Information
Product Compatibility Matrix for Cloudera Navigator Encryption
Encrypting Data at Rest
Resource Planning for Data at Rest Encryption
10
Cloudera Manager HDFS Transparent Encryption
11
Cloudera Manager HDFS Transparent Encryption
Other examples include requirements imposed by United States government's Federal Information Security
Management Act (FISMA) and Health Insurance Portability and Accountability Act (HIPAA). Encrypting data stored
in HDFS can help your organization comply with such regulations.
Transparent encryption for HDFS implements transparent, end-to-end encryption of data read from and written
to HDFS blocks across your cluster. Transparent means that end-users are unaware of the encryption/decryption
processes, and end-to-end means that data is encrypted at-rest and in-transit (see the Cloudera Engineering Blog post
for complete details).
Note: HDFS Transparent Encryption is not the same as TLS encryption. Clusters configured TLS/SSL
encrypt network communications throughout the cluster. Depending on the type of services your cluster
supports, you may want to configure both HDFS Transparent Encryption and TLS/SSL for the cluster.
HDFS encryption has these capabilities:
• Only HDFS clients can encrypt or decrypt data.
• Key management is external to HDFS. HDFS cannot access unencrypted data or encryption keys. Administration
of HDFS and administration of keys are separate duties encompassed by distinct user roles (HDFS administrator,
Key Administrator), thus ensuring that no single user has unrestricted access to both data and keys.
• The operating system and HDFS interact using encrypted HDFS data only, mitigating threats at the OS- and file-
system-level.
• HDFS uses the Advanced Encryption Standard-Counter mode (AES-CTR) encryption algorithm. AES-CTR
supports a 128-bit encryption key (default), or can support a 256-bit encryption key when Java Cryptography
Extension (JCE) unlimited strength JCE is installed.
• HDFS encryption has been designed to take advantage of the AES-NI instruction set, a hardware-based encryption
acceleration technique, so your cluster performance should not adversely affected by configuring encryption. (The
AES-NI instruction set can be an order of magnitude faster than software implementations of AES.) However,
you may need to update cryptography libraries on your HDFS and MapReduce client hosts to use the acceleration
mechanism.
Related Information
Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 7 Download
Optimizing Performance for HDFS Transparent Encryption
Setting up Data at Rest Encryption for HDFS
12
Cloudera Manager HDFS Transparent Encryption
While HDFS encryption can be used with a local Java KeyStore for key management, Cloudera does not recommend
this for production environments where a more robust and secure key management solution should be used. Cloudera
offers the following two options for enterprise-grade key management:
• Key Trustee Server is a key store for managing encryption keys. To integrate with the Key Trustee Server,
Cloudera provides Ranger KMS.
• Hardware security modules (HSM) are third-party appliances that provide the highest level of security for keys.
The diagram below illustrates how HDFS clients and the NameNode interact with an enterprise keystore through the
Key Management Server. The keystore can be either the Key Trustee Server or a support HSM.
13
Cloudera Manager HDFS Transparent Encryption
Each encryption zone is associated with a key (EZ Key) specified by the key administrator when the zone is created.
EZ keys are stored on a backing keystore external to HDFS. Each file within an encryption zone has its own
encryption key, called the Data Encryption Key (DEK). These DEKs are encrypted with their respective encryption
zone's EZ key, to form an Encrypted Data Encryption Key (EDEK).
The following diagram illustrates how encryption zone keys (EZ keys), data encryption keys (DEKs), and encrypted
data encryption keys (EDEKs) are used to encrypt and decrypt files.
14
Cloudera Manager HDFS Transparent Encryption
EDEKs are stored persistently on the NameNode as part of each file's metadata, using HDFS extended attributes.
EDEKs can be safely stored and handled by the NameNode because the hdfs user does not have access to the
EDEK's encryption keys (EZ keys). Even if HDFS is compromised (for example, by gaining unauthorized access to a
superuser account), a malicious user only gains access to the encrypted text and EDEKs. EZ keys are controlled by a
separate set of permissions on the KMS and the keystore.
An EZ key can have multiple key versions, where each key version has its own distinct key material (that is, the
portion of the key used during encryption and decryption). Key rotation is achieved by bumping up the version for
an EZ key. Per-file key rotation is then achieved by re-encrypting the file's DEK with the new version of the EZ key
to create new EDEKs. HDFS clients can identify an encryption key either by its key name, which returns the latest
version of the key, or by a specific key version.
Related Information
Managing Encryption Keys and Zones
Extended Attributes in HDFS
15
Cloudera Manager HDFS Transparent Encryption
The diagram above depicts the process of writing a new encrypted file. Note that the EDEK cache on the NameNode
is populated in the background. Since it is the responsibility of KMS to create EDEKs, using a cache avoids having to
call the KMS for each create request. The client can request new EDEKs directly from the NameNode.
To decrypt a file, the NameNode provides the HDFS client with the file's EDEK and the version number of the EZ
key that was used to generate the EDEK. The HDFS client requests the KMS to decrypt the file's EDEK with the
encryption zone's EZ key, which involves checking that the requesting client has permission to access that particular
version of the EZ key. Assuming decryption of the EDEK is successful, the client then uses this DEK to decrypt the
file.
Encryption and decryption of EDEKs takes place entirely on the KMS. More importantly, the client requesting
creation or decryption of an EDEK never handles the EZ key. Only the KMS can use EZ keys to create and decrypt
EDEKs as requested. It is important to note that the KMS does not store any keys, other than temporarily in its cache.
It is up to the enterprise keystore to be the authoritative storage for keys, and to ensure that keys are never lost, as a
lost key is equivalent to introducing a security hole. For production use, Cloudera recommends you deploy two or
more redundant enterprise key stores.
16
Cloudera Manager HDFS Transparent Encryption
wget http://mirror.centos.org/centos/6/os/x86_64/Packages/openssl-1.0.1e
-30.el6.x86_64.rpm
The libcrypto.so file in this package can be used on SLES 11 as well as RHEL/CentOS.
2. Decompress the files in the package, but do not install it:
Debian Wheezy
The installed version of libcrypto.so supports AES-NI, but you need to install the libssl-devel package on all clients:
17
Cloudera Manager HDFS Transparent Encryption
To verify that a client host is ready to use the AES-NI instruction set optimization for HDFS encryption at rest, use
the following command:
hadoop checknative
If you see true in the openssl row, Hadoop has detected the right version of libcrypto.so and optimization will work. If
you see false in this row, you do not have the right version.
Warning: If you are using or plan to use Cloudera Navigator Key HSM in conjunction with Cloudera
Navigator Key Trustee Server, ensure that:
Key names begin with alphanumeric characters and do not use special characters other than hyphen (-), period
(.), or underscore (_). Using other special characters can prevent you from migrating your keys to an HSM.
Important: The Java Keystore KMS default Truststore (for example, org.apache.hadoop.crypto.key.JavaKey
StoreProvider) does not support uppercase key names.
• Create an encryption key for your zone as keyadmin for the user/group (regardless of the application that will be
using the encryption zone):
18
Cloudera Manager HDFS Transparent Encryption
You can verify creation of the new encryption zone by running the -listZones command. You should see the
encryption zone along with its key listed as follows:
Warning: Do not delete an encryption key as long as it is still in use for an encryption zone. This results
in loss of access to data in that zone. Also, do not delete the KMS service, as your encrypted HDFS data
will be inaccessible. To prevent data loss, first copy the encrypted HDFS data to a non-encrypted zone
using the distcp command.
Related Information
Configuring CDP Services for HDFS Encryption
Important: You can delete files or directories that are part of an HDFS encryption zone.
Important: The Key Trustee KMS does not directly run a key deletion (for example, it may perform a
soft delete instead, or delay the actual deletion to prevent mistakes). In these cases, errors may occur when
creating or deleting a key using the same name after it has already been deleted.
19
Cloudera Manager HDFS Transparent Encryption
Procedure
1. Before rolling any keys, log in as HDFS Superuser and verify/identify the encryption zones to which the current
key applies.
This operation also helps clarify the relationship between the EZ key and encryption zones, and, if necessary,
makes it easier to identify more important, high priority zones.
The first column identifies the encryption zone paths; the second column identifies the encryption key name.
2. You can verify that the files inside an encryption zone are encrypted using the hdfs crypto -getFileEncryptionInfo
command.
Note the EZ key version name and value, which you can use for comparison and verification after rolling the EZ
key.
This operation contacts the KMS and rolls the keys there. Note that this can take a considerable amount of time,
depending on the number of key versions residing in the KMS.
20
Cloudera Manager HDFS Transparent Encryption
4. Log out as Key Administrator, and log in as HDFS Superuser. Verify that new files in the encryption zone have a
new EZ key version.
Note: For performance reasons, the NameNode caches EDEKs, so after rolling an encryption key, you
may not be able to see the new version encryption key immediately, or at least until after the EDEK cache
is consumed. Of course, the file decryption and encryption still works with these EDEKs. If you require
that all files' DEKs in an encryption zone are encrypted using the latest version encryption key, please re-
encrypt the EDEKs.
Alternatively, you can use KMS Rest API to view key metadata and key versions. Elements appearing in brackets
should be replaced with your actual values. So in this case, before rolling a key, you can view the key metadata
and versions as follows:
21
Cloudera Manager HDFS Transparent Encryption
Limitations
There are few limitations associated with the re-encryption of EDEKs.
Caution: You cannot perform any rename operations within the encryption zone during re-encryption. If you
attempt to perform a rename operation during EDEK re-encryption, you will receive an IOException error.
EDEK re-encryption does not change EDEKs on snapshots, due to the immutable nature HDFS snapshots. Thus, you
should be aware that after EZ key exposure, the Key Administrator must delete snapshots.
22
Cloudera Manager HDFS Transparent Encryption
Re-encrypting an EDEK
This scenario operates on the assumption that an encryption zone has already been set up for this cluster.
Procedure
1. Navigate to the cluster in which you will be rolling keys and re-encrypting the EDEK.
2. Log in as HDFS Superuser.
3. View all of the options for the hdfs crypto command:
$ hdfs crypto
[-createZone –keyName <keyName> -path <path>]
[-listZones]
[-provisionTrash –path <path>]
[-getFileEncryptionInfo –path <path>]
[-reencryptZone <action> -path <zone>]
[-listReencryptionStatus]
[-help <command-name>]
4. Before rolling any keys, verify/identify the encryption zones to which the current key applies.
This operation also helps clarify the relationship between the EZ key and encryption zones, and, if necessary,
makes it easier to identify more important, high priority zones.
The first column identifies the encryption zone path (/ez); the second column identifies the encryption key name
(key1).
5. Exit from the HDFS Superuser account and log in as Key Administrator.
6. Roll the encryption key (previously identified/confirmed by the HDFS Superuser in step 4).
Here, the <key name> is key1
This operation contacts the KMS and rolls the keys. Note that this can take a considerable amount of time,
depending on the number of key versions.
23
Cloudera Manager HDFS Transparent Encryption
9. After the EZ key has been rolled successfully, re-encrypt the EDEK by running the re-encryption command on the
encryption zone:
The following information appears when the submission is complete. At this point, the NameNode is processing
and re-encrypting all of the EDEKs under the /ez directory.
Depending on the number of files, the re-encryption operation can take a long time. Re-encrypting a 1M EDEK
file typically takes between 2-6 minutes, depending on the NameNode hardware. To check the status of the re-
encryption for the zone:
EZKey Version Name The encryption zone key version name, ZMHfRoGKeXXgf0QzCX8q16NczIw2sq0rWRTOHS3YjCz
which used for re-encryption comparison.
After re-encryption is complete, all files in
the encryption zone are guaranteed to have
an EDEK whose encryption zone key version
is at least equal to this version.
24
Cloudera Manager HDFS Transparent Encryption
10. After the re-encryption completes, you can confirm that the EDEK and EZ Key Version Name values have
changed.
Cancelling Re-encryption
Only users with the HDFS Superuser privilege can cancel the EDEK re-encryption after the operation has started.
To cancel a re-encryption:
25
Cloudera Manager HDFS Transparent Encryption
• Percentage of time the NameNode read-lock should be held by the re-encryption thread
(dfs.namenode.reencrypt.throttle.limit.handler.ratio)
• Percentage of time the NameNode write-lock should be held by the re-encryption thread
(dfs.namenode.reencrypt.throttle.limit.updater.ratio)
You can monitor the HDFS NameNode heap and CPU usage from Cloudera Manager.
Procedure
1. Open the Cloudera Manager Admin Console and go to the KMS service.
2. Click Configuration.
3. Set the Authentication Type property to kerberos.
4. Click Save Changes.
5. Because Cloudera Manager does not automatically create the principal and keytab file for the KMS, you must run
the Generate Credentials command manually.
On the top navigation bar, go to Administration Security Kerberos Credentials and click Generate Missing
Credentials
Note: This does not create a new Kerberos principal if an existing HTTP principal exists for the KMS
host.
Procedure
1. Go to the KMS service.
2. Click Configuration.
26
Cloudera Manager HDFS Transparent Encryption
3. In the Search field, type TLS/SSL to show the KMS TLS/SSL properties (in the Key Management Server Default
Group Security category).
4. Edit the following TLS/SSL properties according to your cluster configuration.
Property Description
Enable TLS/SSL for Key Encrypt communication between clients and Key Management Server using Transport Layer
Management Server Security (TLS) (formerly known as Secure Socket Layer (TLS/SSL)).
Key Management Server TLS/SSL The path to the TLS/SSL keystore file containing the server certificate and private key used for
Server JKS Keystore File Location TLS/SSL. Used when Key Management Server is acting as a TLS/SSL server. The keystore must
be in JKS format.
Key Management Server TLS/SSL The password for the Key Management Server JKS keystore file.
Server JKS Keystore File Password
Key Management Server Proxy TLS/ The location on disk of the truststore, in .jks format, used to confirm the authenticity of TLS/SSL
SSL Certificate Trust Store File servers that Key Management Server Proxy might connect to. This is used when Key Management
Server Proxy is the client in a TLS/SSL connection. This truststore must contain the certificates
used to sign the services connected to. If this parameter is not provided, the default list of well-
known certificate authorities is used instead.
Key Management Server Proxy TLS/ The password for the Key Management Server Proxy TLS/SSL Certificate Trust Store File. This
SSL Certificate Trust Store Password password is not required to access the truststore; this field can be left blank. This password provides
optional integrity checking of the file. The contents of truststores are certificates, and certificates
are public information.
Procedure
1. Stop the Java KeyStore KMS service.
2. Add and configure the Key Trustee KMS service, and configure HDFS to use it for its KMS Service setting.
3. Restart the HDFS service and redeploy client configuration for this to take effect.
a. Home Cluster-wide Deploy Client Configuration
4. Add the following to the Key Management Server Proxy Advanced Configuration Snippet (Safety Valve) for
kms-site.xml ( Key Trustee KMS Service Configuration Category Advanced ):
<property>
<name>hadoop.kms.key.provider.uri</name>
<value>keytrustee://file@/var/lib/kms-keytrustee/keytrustee/.keytrustee/
,jceks://file@/path/to/kms.keystore</value>
<description>URI of the backing KeyProvider for the KMS</description>
</property>
27
Cloudera Manager HDFS Transparent Encryption
<property>
<name>hadoop.security.keystore.java-keystore-provider.password-file</
name>
<value>/tmp/password.txt</value>
<description>Java KeyStore password file</description>
</property>
8. From the host running the Key Trustee KMS service, if you have not configured Kerberos and TLS/SSL, run the
following command:
curl -L -d "trusteeOp=migrate"
"http://kms01.example.com:16000/kms/v1/trustee/key/migrate?user.n
ame=username&trusteeOp=migrate"
If you have configured Kerberos and TLS/SSL, use the following command instead:
In some cases–for example, after upgrading your servers–you may want to migrate a Ranger KMS Server role
instance to a new host. This procedure describes how to move a Ranger KMS role instance from an existing cluster
host to another cluster host.
28
Cloudera Manager HDFS Transparent Encryption
Procedure
1. Add a new Ranger Admin role instance on another node.
Note: If you enabled manual SSL on this cluster, you must update the SSL configs when adding a new
role.
Procedure
1. Add a new Ranger KMS db role instance on another node.
Note: If you enabled manual SSL on this cluster, you must update the SSL configs when adding a new
role.
Procedure
1. Add a new Ranger KMS KTS role instance on another node.
Note: If you enabled manual SSL on this cluster, you must update the SSL configs when adding a new
role.
29
Cloudera Manager HDFS Transparent Encryption
30
Cloudera Manager HDFS Transparent Encryption
1 and 2
The KMS evaluates the hadoop.kms.acl.<OPERATION> and hadoop.kms.blacklist.<OPERATION> classes to
determine whether or not access to a specific KMS feature or function is authorized.
In other words, a user must be allowed by hadoop.kms.acl.<OPERATION>, and not be disallowed by hadoop.kms.b
lacklist.<OPERATION>.
If a user is denied access to a KMS-wide operation, then the flow halts and returns the result Denied.
If a user is allowed access to a KMS-wide operation, then the evaluation flow proceeds.
3
The KMS evaluates the whitelist.key.acl class.
The KMS ACL workflow evaluates the whitelist.key.acl.<OPERATION>, and if the user is allowed access, then it is
granted (Allowed) . If not, then the flow continues with the evaluation.
4 and 5
The KMS evaluates the default.key.acl.<OPERATION> and key.acl.<OPERATION> classes.
The KMS evaluates whether or not there is a key.acl.KEY.<OPERATION> class that matches the action the user is
attempting to perform. If there is, it then evaluates that value to determine whether or not the user can perform the
requested operation.
31
Cloudera Manager HDFS Transparent Encryption
Note: Before evaulating the default.key.acl.<OPERATION> and key.acl.<OPERATION> classes, the flow
logic determines which classes exist. Only one of these can exist and be used at any time (for example, key.
acl.prodkey.READ overrides default.key.acl.READ for prodkey, so the flow logic is configured with it’s own
READ ACLs)
Depending on the result of the Key Trustee ACL evaluation, controls are applied to the key and results (Allowed or
Denied).
32
Cloudera Manager HDFS Transparent Encryption
1
After the request is received, the Deny condition of the Global Override policy is evaluated. If the user is present, the
flow halts and returns the result Deny. If the user is not present, the evaluation flow proceeds.
2
Now, the Allow condition of the Global Override policy is evaluated. If the user is present, the flow halts and returns
the result Allow. If the user is not present, the evaluation flow proceeds.
33
Cloudera Manager HDFS Transparent Encryption
3
If the Key Resource Specific policy is present, the Allow condition of the Key Resource Specific policy is evaluated.
If the user is not present, the flow halts and returns the result Deny. If the user is present, the flow is complete and
returns the result Allow.
4
If the Key Resource Specific policy is not present, the Deny condition of the Default policy, all-keyname, is
evaluated. If the user is present, the flow halts and returns the result Deny. If the user is not present, the evaluation
flow proceeds.
5
Now, the Allow condition of the Default policy, all-keyname, is evaluated. If the user is not present, the flow halts
and returns the result Deny. If the user is present, the flow is complete and returns the result Allow.
hadoop.kms.acl.CREATE
hadoop.kms.acl.DELETE
hadoop.kms.acl.ROLLOVER
hadoop.kms.acl.GET
hadoop.kms.acl.GET_KEYS
hadoop.kms.acl.GET_METADATA
hadoop.kms.acl.SET_KEY_MATERIAL
hadoop.kms.acl.GENERATE_EEK
hadoop.kms.acl.DECRYPT_EEK
• keytrustee.kms.acl.<OPERATION>
The ACLs mentioned below are Key Trustee-specific ACLs. These ACLs are ignored by Ranger KMS because
they are not migrated to the Ranger KMS policy. Also, these ACLs are not supported by Hadoop KMS.
keytrustee.kms.acl.UNDELETE
keytrustee.kms.acl.PURGE
34
Cloudera Manager HDFS Transparent Encryption
Policy Key-resource Priority Key Trustee ACL Ranger Policy Ranger Policy
Condition Permission
• default.key.acl.<operation>
Service : cm_kms
Policy Key-resource Priority Key Trustee ACL Ranger Policy Ranger Policy
Condition Permission
35
Cloudera Manager HDFS Transparent Encryption
Policy Key-resource Priority Key Trustee ACL Ranger Policy Ranger Policy
Condition Permission
Note: In Key Resource Specific policies, DENY ALL OTHER ACCESS flags are set to true.
Note: Ranger audit directories in HDFS are owned by specific service users. In case of HDFS, it will be
the HDFS service user. Typically, HDFS service user is blacklisted for DECRYPT_EEK operation. Hence,
enabling encryption of ranger audit directories in HDFS is not recommended.
Steps
On a cluster without HBase currently installed, create the /hbase directory and make that an encryption zone.
On a cluster with HBase already installed, perform the following steps:
1. Stop the HBase service.
2. Move data from the /hbase directory to /hbase-tmp.
3. Create an empty /hbase directory and make it an encryption zone.
4. Distcp all data from /hbase-tmp to /hbase, preserving user-group permissions and extended attributes.
5. Start the HBase service and verify that it is working as expected.
6. Remove the /hbase-tmp directory.
<property>
<name>key.acl.hbase-key.DECRYPT_EEK</name>
<value>hbase hbase</value>
</description>
</property>
36
Cloudera Manager HDFS Transparent Encryption
37
Cloudera Manager HDFS Transparent Encryption
• If the data to be loaded is already inside a Hive table, you can create a new table with a LOCATION inside
an encryption zone as follows:
The location specified in the CREATE TABLE statement must be inside an encryption zone. Creating a
table pointing LOCATION to an unencrypted directory does not encrypt your source data. You must copy
your data to an encryption zone, and then point LOCATION to that zone.
• Example 2: Loading encrypted data to an encrypted table - If the data is already encrypted, use the CREATE
TABLE statement pointing LOCATION to the encrypted source directory containing the data. This is the
fastest way to create encrypted tables.
CREATE TABLE encrypted_table [STORED AS] LOCATION ... AS SELECT * FROM <
encrypted_source_directory>
• Users reading data from encrypted tables that are read-only must have access to a temporary directory which is
encrypted with at least as strong encryption as the table.
• Temporary data is now written to a directory named .hive-staging in each table or partition
• Previously, an INSERT OVERWRITE on a partitioned table inherited permissions for new data from the existing
partition directory. With encryption enabled, permissions are inherited from the table.
<property>
<name>key.acl.hive-key.READ</name>
<value>hive hive</value>
</property>
If you have restricted access to the GET_METADATA operation, you must grant permission for it to the hive user or
group:
<property>
<name>hadoop.kms.acl.GET_METADATA</name>
<value>hive hive</value>
</property>
If you have disabled HiveServer2 Impersonation, you must configure the KMS ACLs to grant DECRYPT_EEK
permissions to the hive user, as well as any user accessing data in the Hive warehouse.
Cloudera recommends creating a group containing all Hive users, and granting DECRYPT_EEK access to that group.
For example, suppose user jdoe (home directory /user/jdoe) is a Hive user and a member of the group hive-users. The
encryption zone (EZ) key for /user/jdoe is named jdoe-key, and the EZ key for /user/hive is hive-key. The following
ACL example demonstrates the required permissions:
<property>
<name>key.acl.hive-key.DECRYPT_EEK</name>
<value>hive hive-users</value>
</property>
<property>
<name>key.acl.jdoe-key.DECRYPT_EEK</name>
<value>jdoe,hive</value>
</property>
38
Cloudera Manager HDFS Transparent Encryption
If you have enabled HiveServer2 impersonation, data is accessed by the user submitting the query or job, and the
user account (jdoe in this example) may still need to access data in their home directory. In this scenario, the required
permissions are as follows:
<property>
<name>key.acl.hive-key.DECRYPT_EEK</name>
<value>nobody hive-users</value>
</property>
<property>
<name>key.acl.jdoe-key.DECRYPT_EEK</name>
<value>jdoe</value>
</property>
Steps
On a cluster without Hue currently installed, create the /user/hue directory and make it an encryption zone.
On a cluster with Hue already installed:
1. Create an empty /user/hue-tmp directory.
2. Make /user/hue-tmp an encryption zone.
3. DistCp all data from /user/hue into /user/hue-tmp.
4. Remove /user/hue and rename /user/hue-tmp to /user/hue.
<property>
<name>key.acl.hue-key.DECRYPT_EEK</name>
<value>oozie,hue oozie,hue</value>
</property>
Recommendations
• If HDFS encryption is enabled, configure Impala to encrypt data spilled to local disk.
• Limit the rename operations for internal tables once encryption zones are set up. Impala cannot do an ALTER
TABLE RENAME operation to move an internal table from one database to another, if the root directories for
those databases are in different encryption zones. If the encryption zone covers a table directory but not the parent
directory associated with the database, Impala cannot do an ALTER TABLE RENAME operation to rename an
internal table, even within the same database.
• Avoid structuring partitioned tables where different partitions reside in different encryption zones, or where any
partitions reside in an encryption zone that is different from the root directory for the table. Impala cannot do an
INSERT operation into any partition that is not in the same encryption zone as the root directory of the overall
table.
• If the data files for a table or partition are in a different encryption zone than the HDFS trashcan, use the PURGE
keyword at the end of the DROP TABLE or ALTER TABLE DROP PARTITION statement to delete the HDFS
data files immediately. Otherwise, the data files are left behind if they cannot be moved to the trashcan because of
differing encryption zones. This syntax is available in Impala 2.3 and higher.
39
Cloudera Manager HDFS Transparent Encryption
Steps
Start every impalad process with the --disk_spill_encryption=true flag set. This encrypts all spilled data using
AES-256-CFB. Set this flag by selecting the Disk Spill Encryption checkbox in the Impala configuration (Impala
serviceConfigurationCategorySecurity ).
Important: Impala does not selectively encrypt data based on whether the source data is already encrypted
in HDFS. This results in at most 15 percent performance degradation when data is spilled.
Steps
On a cluster with MRv2 (YARN) installed, create the /user/history directory and make that an encryption zone.
If /user/history already exists and is not empty:
1. Create an empty /user/history-tmp directory.
2. Make /user/history-tmp an encryption zone.
3. DistCp all data from /user/history into /user/history-tmp.
4. Remove /user/history and rename /user/history-tmp to /user/history.
Steps
On a cluster without Solr currently installed, create the /solr directory and make that an encryption zone.
On a cluster with Solr already installed:
1. Create an empty /solr-tmp directory.
2. Make /solr-tmp an encryption zone.
3. DistCp all data from /solr into /solr-tmp.
4. Remove /solr, and rename /solr-tmp to /solr.
<property>
<name>key.acl.solr-key.DECRYPT_EEK</name>
40
Cloudera Manager HDFS Transparent Encryption
<value>solr solr</value>
</description>
</property>
Recommendations
• By default, application event logs are stored at /user/spark/applicationHistory, which can be made into an
encryption zone.
• Spark also optionally caches its JAR file at /user/spark/share/lib (by default), but encrypting this directory is not
required.
• Spark does not encrypt shuffle data. To do so, configure the Spark local directory, spark.local.dir (in Standalone
mode), to reside on an encrypted disk. For YARN mode, make the corresponding YARN configuration changes.
<property>
<name>key.acl.spark-key.DECRYPT_EEK</name>
<value>spark spark-users</value>
</property>
Recommendations
• For Hive support: Ensure that you are using Sqoop with the --target-dir parameter set to a directory that is inside
the Hive encryption zone.
• For append/incremental support: Make sure that the sqoop.test.import.rootDir property points to the same
encryption zone as the --target-dir argument.
• For HCatalog support: No special configuration is required.
41
Cloudera Manager HDFS Transparent Encryption
Procedure
Set Up the Luna 7 Client
42
Cloudera Manager HDFS Transparent Encryption
1. Download Luna 7 client on the host where Ranger KMS service resides.
610-013144-006_SW_Client_SDK_SafeNet_HSM_7.3.0_Linux_RevA.tar
cd LunaClient_7.3.0-165_Linux/64/
bash install.sh
cd /usr/safenet/lunaclient/bin
43
Cloudera Manager HDFS Transparent Encryption
scp admin@<LunaBoxHostname>:server.pem
scp [email protected]:server.pem .
(grant permission chmod 777 and chown kms:kms)
The authenticity of host 'elab2.safenet-inc.com (192.43.161.62)' can't be
established.
ECDSA key fingerprint is SHA256:Lz36zjWHh3BMtI9TVHUBGoHffxgA6azFtPSGRBC
kiYU.
ls
server.pem is added
9. As the KMS user, register the server with the client.
su -l kms
./vtl addServer -n <LunaBoxHostname> -c server.pem
vtl (64-bit) v7.3.0-165. Copyright (c) 2018 SafeNet. All rights reserved.
New server elab2.safenet-inc.com successfully added to server list.
10. Generate a client certificate.
vtl (64-bit) v7.3.0-165. Copyright (c) 2018 SafeNet. All rights reserved.
Private Key created and written to: /usr/safenet/lunaclient/cert/client/e02paruser115Key.pem. Certificate created
and written to: /usr/safenet/lunaclient/cert/client/e02paruser115.pem .
(grant permission chmod 777 and chown kms:kms)
11. Copy the client certificate to the server.
44
Cloudera Manager HDFS Transparent Encryption
ssh admin@<lunaboxhostname>
ssh [email protected]
[email protected]'s password: SafeNetPSG95
Last login: Fri Jul 19 03:59:38 2019 from 114.143.87.94
Luna Network HSM Command Line Shell v7.3.0-165.
Copyright (c) 2018 SafeNet. All rights reserved.
[elab2] lunash:>
13. Register the client with the server, then assign the client to a server partition.
ClientID: e02paruser115
Hostname: e02paruser115
Partitions: "elab2par058"
lunash:> exit
45
Cloudera Manager HDFS Transparent Encryption
18. Set the read permissions for the certificate files in the following directories.
Note: Make sure to log in as root user.
cd /usr/safenet/lunaclient/bin/
./vtl verify
20. ./lunacm
./lunacm
Available HSMs:
Slot ID -> 0
Label -> elab2par115
Serial # -> 1254277068842
Model -> LunaSA 7.3.0
Firmware version -> 7.3.0
Configuration -> Luna User Partition with SD (PW) Key Export with Cl
eaning Mode
Slot Description -> Net Token Slot
lunacm:>par con
The 'Crypto Officer' is currently logged in.
Looking for objects accessible to the 'Crypto Officer'.
46
Cloudera Manager HDFS Transparent Encryption
Object List:
Label: RangerKMSKey
Handle: 131
Object Type: Symmentric Key
Object UID: ba8e00002e00000554380800
Number of Objects: 1
# cd /usr/safenet/lunaclient/jsp/lib/
(grant permission chmod 777 and chown kms:kms to all the at this location)
25. Set the file permissions for the JDK library as follows:
vim {JAVA_HOME}/jre/lib/security/java.security
vim /usr/java/jdk1.8.0_232-cloudera/jre/lib/security/java.security
security.provider.6=com.safenetinc.luna.provider.LunaProvider
com.safenetinc.luna.provider.createExtractableKeys=true
47
Cloudera Manager HDFS Transparent Encryption
security.provider.9=org.jcp.xml.dsig.internal.dom.XMLDSigRI
security.provider.10=sun.security.smartcardio.SunPCSC
27. Set the file permissions for the Luna client as follows:
ranger.ks.hsm.type = LunaProvider
ranger.ks.hsm.enabled = true
ranger.ks.hsm.partition.name=elab2par115
ranger.ks.hsm.partition.password=hanuman123
(CM-7.1.1 & CM-7.1.2 password will be in plain text)
Note: For CM-7.1.3 and higher, update the configuration as shown in:
cd /usr/safenet/lunaclient/bin/
./lunacm
role login -n co
48
Cloudera Manager HDFS Transparent Encryption
par con
lunacm:>par con
The 'Crypto Officer' is currently logged in.
Looking for objects accessible to the 'Crypto Officer'.
Object List:
Label: RangerKMSKey
Handle: 131
Object Type: Symmentric Key
Object UID: ba8e00002e00000554380800
Number of Objects: 1
Results
Ranger KMS is successfully started.
What to do next
You can now create Encryption zone keys using hadoop command or from Ranger UI using credentials of keyadmin
user.
Procedure
Set Up the Luna 6 Client
Note: Perform the following steps on both active and passive KTS nodes.
49
Cloudera Manager HDFS Transparent Encryption
cd LunaClient_6.2.2-x_Linux/64/
yes | ./linux/64/install.sh -p sa
Example:
a) At the (y/n) prompt, choose y.
If you select no or n, this product will not be installed.
b) At the Products prompt, choose Luna products to be installed:
• [1]: Luna Network HSM
• [2]: Luna PCIe HSM
• [3]: Luna USB HSM
• [4]: Luna Backup HSM
• [N|n]: Next
• [Q|q]: Quit
Enter selection: 1, then enter selection n.
c) At the Components prompt, choose Luna Components to be installed
• [1]: Luna SDK
• [2]: Luna JSP (Java)
• [3]: Luna JCProv (Java)
• [B|b]: Back to Products selection
• [I|i]: Install
• [Q|q]: Quit
Enter selection: i, then enter selection Q.
Enter selection: 1,2,and 3 then type i.
5. Register the HSM on this client.
a) Retrieve the HSM's public key.
$ scp [email protected]:server.pem .
b) Register the HSM on the client machine.
$ /usr/safenet/lunaclient/bin/vtl list
50
Cloudera Manager HDFS Transparent Encryption
Note: The Luna appliance must be able to connect to the hostname across your network.
7. Send the client's public key created in the step above to the HSM.
$ ssh [email protected]
b) Register the client with a friendly name on the HSM.
$ /usr/safenet/lunaclient/bin/vtl verify
51
Cloudera Manager HDFS Transparent Encryption
0 462309014 par1
13. Move the Key Trustee Server and Key HSM installation directory.
cd /usr/share/keytrustee-server-keyhsm/
52
Cloudera Manager HDFS Transparent Encryption
22. Login Ranger UI using keyadmin user role for creating an encryption zone key.
Validating Keys in Luna HSM
23. Login to Luna HSM machine .
Results
Ranger KMS is successfully started.
What to do next
We can now create Encryption zone keys using hadoop command or from Ranger UI using credentials of keyadmin
user.
53
Cloudera Manager HDFS Transparent Encryption
See related topics for more information about installing Ranger KMS and KTS to store keys.
Procedure
Set Up the Luna 7 Client
Note: Perform the following steps on both active and passive KTS nodes.
cd LunaClient_7.3.0-x_Linux/64/
<LunaHome>/64/install.sh
Example:
a) At the (y/n) prompt, choose y.
If you select no or n, this product will not be installed.
b) At the Products prompt, choose Luna products to be installed:
• [1]: Luna Network HSM
• [2]: Luna PCIe HSM
• [3]: Luna USB HSM
• [4]: Luna Backup HSM
• [N|n]: Next
• [Q|q]: Quit
Enter selection: 1, then enter selection n.
c) At the Components prompt, choose Luna Components to be installed
• [1]: Luna SDK
• [2]: Luna JSP (Java)
• [3]: Luna JCProv (Java)
• [B|b]: Back to Products selection
• [I|i]: Install
• [Q|q]: Quit
Enter selection: i, then enter selection Q.
Enter selection: 1,2,and 3 then type i.
54
Cloudera Manager HDFS Transparent Encryption
$ scp [email protected]:server.pem .
b) Register the HSM on the client machine.
$ /usr/safenet/lunaclient/bin/vtl list
Note: The Luna appliance must be able to connect to the hostname across your network.
7. Send the client's public key created in the previous step to the HSM.
55
Cloudera Manager HDFS Transparent Encryption
$ ssh [email protected]
b) Register the client with a friendly name on the HSM.
$ /usr/safenet/lunaclient/bin/vtl verify
56
Cloudera Manager HDFS Transparent Encryption
13. Move the Key Trustee Server and Key HSM installation directory.
cd /usr/share/keytrustee-server-keyhsm/
Note: For Luna 7, you must add the keyhsm user to the hsmgroup group to provide that user access to
certificates used by the Luna client software.
57
Cloudera Manager HDFS Transparent Encryption
22. Login Ranger UI using keyadmin user role for creating an encryption zone key.
Validating Keys in Luna HSM
23. Login to Luna HSM machine.
Results
Ranger KMS is successfully started.
What to do next
You can now create Encryption zone keys using hadoop command or from Ranger UI using credentials of keyadmin
user. Optionally, you can change the default encryption algoritm for KeyHSM and Luna 7.
Procedure
1. Stop the KeyHSM service.
2. Navigate to the KeyHSM root directory.
3. In the KeyHSM root dir, open the application.properties file.
4. Find the hsm.luna.encryption.algorithm property, with default value=RSA/ECB/PKCS1Padding.
58
Cloudera Manager HDFS Transparent Encryption
5. Edit the application properties file to replace the default value with one of the following ones:
Encryption algorithms supported by KeyHSM/Luna 7.7 HSM:
• RSA/ECB/PKCS1Padding (default)
• RSA
• RSA_ECB_OAEPSHA_224ANDMGF1Padding
• AES_RSA_NONE_OAEPSHA_512ANDMGF1Padding
• AES_CBC_PKCS5Padding
• RSA_NONE_OAEP_WITH_SHA224AndMGF1Padding
• RSA_NONE_OAEP_WITH_SHA256AndMGF1Padding
• RSA_NONE_OAEP_WITH_SHA384AndMGF1Padding
• RSA_NONE_OAEP_WITH_SHA1AndMGF1Padding
Upgrade Scenario:
Note: When upgrading KeyHSM from any version < 7.1.7.1 to 7.1.7.1, zone keys and hdfs encryption
zone(s) will exist. Do not change the encryption algorithms without first creating new encryption keys,
using the following steps:
a. Unlock the encryption zones with existing keys.
b. Backup the zone data.
c. Stop the KeyHSM.
d. Change the algorithm value as described previously.
e. Start the KeyHSM.
f. Create new keys using the new algorithm value.
g. Lock the encryption zone with new keys.
Set up GCP Cloud HSM for Ranger KMS, KTS, and KeyHSM
How to integrate Ranger KMS and KTS with with the Google Cloud Platform (GCP) HSM service.
Procedure
Set Up Google Cloud HSM
1. Login to Google Cloud console using Cloudera account.
2. Create the service account by selecting or creating the Project.
3. Create the key.
4. Download and save the Key in JSON format.
Note: Record the project ID, Location ID and JSON file.
59
Cloudera Manager HDFS Transparent Encryption
This example shows a project gcp-eng-sdx-daily, service account keyhsm, and key ring KeyHSMRing.
Integrate GCP with KeyHSM
Note: Perform the following steps on both active and passive KTS nodes.
6. In your Key HSM root directory, copy the autthentication key (json file) you created in the setup process, and
provided the appropriate access.
cd /usr/share/keytrustee-server-keyhsm/
chown keyhsm:keytrustee <key.filename>.json
keyhsm.management.address=127.0.0.1
keyhsm.server.port=9090
google.cloud.hsm.key.ring=KeyHSMRing
Note: Use the key ring, authentication file, project ID, and location ID strings you created during setup.
60
Cloudera Manager HDFS Transparent Encryption
14. Login to the Ranger UI using keyadmin user role for creating an encryption zone key.
Results
Keys will be created in the Key ring on GCP.
What to do next
Further keys for zone operation can be created using Ranger UI with keyadmin role credentials and also using hadoop
commands.
61
Cloudera Manager HDFS Transparent Encryption
See related topics for more information about installing Ranger KMS, KTS and KeyHSM.
Procedure
Configure NAE port in Thales CipherTrust Manager
1. Log in to Thales CipherTrust Manager.
2. In CipherTrust Manager Admin Settings , select Add Interface.
3. In Type, Select NAE (default).
4. In Network Interface, selectAll.
5. In Port, type a value for the port number.
9000
6. In Mode, select one of the following options to match your environment:
• No TLS, user must supply password.
• TLS, Ignore client cert. user must supply password.
7. Click Add.
8. Create a user.
a) In Access Management Users , click Create New User .
b) In Create a New User, provide a username, password, and any any required information.
c) Click Create.
Setting up a cluster and configuring KeyHSM
Note: Perform the following steps on both active and passive KTS nodes.
9. In your Key HSM root directory, make sure that appropriate versions of KeyHSM files are available with proper
permissions.
cd /usr/share/keytrustee-server-keyhsm/
Note:
Cipher Trust HSM supports two keyhsm versions.
a. If using Ingrian v6.x, then copy all jars into this folder and make sure you have provided proper
permission.
b. If using Ingrian v8.12.x ,then copy all the jars except gson-2.1.jar into this folder and make sure you
have provided proper permission.
10. Only if SSL is enabled on CipherTrust Manager:
Note: Perform this step only if SSL is enabled on Cipher Trust Manager.
62
Cloudera Manager HDFS Transparent Encryption
Use SSL? [Y/n] Y (If TSL is enabled on NAE port then press Y else type n
and hit enter and act accordingly)
org.bouncycastle.cert.X509CertificateHolder@f20f09ff
org.bouncycastle.cert.X509CertificateHolder@ebb30faf
Trust this server? [y/N] y
19. Login to the Ranger UI using keyadmin user role for creating an encryption zone key and do further validation.
Validating Keys in Cipher Trust HSM
20. In Thales Cipher Trust Manager Left Navigation Panel , click Keys.
Results
Keys created in the second to last step should be present, as shown in:
Figure 3: Validating Keys in CipherTrust Manager
63
Cloudera Manager HDFS Transparent Encryption
What to do next
Further keys for zone operation can be created using Ranger UI with keyadmin role credentials and also using hadoop
commands.
Procedure
Set Up Google Cloud HSM
1. Log in to Google Cloud console using Cloudera account.
2. Create the service account by selecting or creating the Project.
3. Create the key.
4. Download and save the key in JSON format.
Note: Record the project ID, Location ID and save the JSON file.
64
Cloudera Manager HDFS Transparent Encryption
This example shows a project gcp-eng-sdx-daily, region Global, and key ring RangerKMSRing.
Results
The key ring is created.
Figure 5: RangerKMSRing created
65
Cloudera Manager HDFS Transparent Encryption
Procedure
1. Stop the KMS service if running.
2. Go to CM Ranger KMS Configuration Search for Ranger KMS Server Advanced Configuration Snippet (Safety
Valve) for conf/dbks-site.xml and click on + icon to add the properties.
3. Add the following properties :
Name Value
ranger.kms.gcp.enabled true
ranger.kms.gcp.cred.file /path/to/downloadedCredFile.json
ranger.kms.gcp.project.id your-project-id
ranger.kms.gcp.location.id project-location-id
66
Cloudera Manager HDFS Transparent Encryption
Name Value
ranger.kms.gcp.masterkey.name YourMasterKeyName
67
Cloudera Manager HDFS Transparent Encryption
What to do next
Once Ranger KMS has started successfully, verify zone key creation, and zone encryption/decryption.
Migrating the Master Key From Ranger KMS Database To Google Cloud HSM
These are the steps required to migrate the Master Key Storage from the KMS database to Google Cloud HSM. These
steps need to be performed when the cluster is ready with all the required services and encryption zone keys are
present in the Ranger KMS DB.
Procedure
Note: These steps are not required if Ranger KMS with GCP is being installed for the first time.
68
Cloudera Manager HDFS Transparent Encryption
cd /var/run/cloudera-scm-agent/process/xxx-ranger_kms-RANGER_KMS_SERVER
d) Open the proc.json file and search for HADOOP_CREDSTORE_PASSWORD.
${RANGER_KMS_HOME}/MigrateMKeyStorageDbToGCP.sh ApacheMasterKey1
my_gcpProjectName my_gcpKeyRingName my_gcpKeyRingLocationName my_pathO
fJsonCredFile.json
Note: Migration of Master Key Storage from Google Cloud HSM To Ranger KMS DB is not supported
as after creation, a key cannot be moved to another location or exported.
Results
Master Key from Ranger KMS DB has been successfully migrated to GCP.
Procedure
Configure NAE port in Thales CipherTrust Manager
1. Log in to Thales CipherTrust Manager.
2. In CipherTrust Manager Admin Settings , select Add Interface.
69
Cloudera Manager HDFS Transparent Encryption
70
Cloudera Manager HDFS Transparent Encryption
7. Click Add.
71
Cloudera Manager HDFS Transparent Encryption
72
Cloudera Manager HDFS Transparent Encryption
8. If selected mode is TLS, ignore client cert, user must supply password while adding interface, then click on Edit
and Download Current Certificate as shown in the images below. Else, skip this step.
73
Cloudera Manager HDFS Transparent Encryption
74
Cloudera Manager HDFS Transparent Encryption
mkdir etc/security/serverKeys
and scp the downloaded certificate to this directory. Ensure that the user has required access to the file
75
Cloudera Manager HDFS Transparent Encryption
76
Cloudera Manager HDFS Transparent Encryption
77
Cloudera Manager HDFS Transparent Encryption
Fresh installation - Configuring Ranger KMS DB to interact with Thales CipherTrust HSM.
These are the steps required to configure Ranger KMS DB to interact with Thales CipherTrust HSM. These steps
need to be performed only when the cluster is ready with all the required services and no encryption zone keys are
present.
Procedure
1. SSH into the Ranger KMS host.
2. Create a directory and copy the files IngrianNAE.properties, libIngPKCS11.so and sunpkcs11.cfg from Thales
CipherTrust Manager to the directory.
mkdir -p /opt/safenetConf/64/8.3.1
and then copy the above mentioned files under this location.
Note: Make sure you have provided read-write access (chmod 775) to Ranger KMS service users (chown
kms:kms) to all the 3 files.
3. Update the IngrianNAE.properties file and initialize the below mentioned properties.
Protocol=tcp (valid values ssl or tcp, should be the same protocol provi
ded on CipherTrust instance)
4. Initialize the following property only when the protocol of the CipherTrust Manager instance is SSL. This is the
location of the certificate downloaded from CipherTrust Manager and copied on Ranger KMS host.
CA_File=/etc/security/serverKeys/Certificate_nae.txt
5. Go to CM Ranger KMS Configuration Search for Ranger KMS Server Advanced Configuration Snippet and
click on + icon to add the properties.
78
Cloudera Manager HDFS Transparent Encryption
IngrianNAE_Properties_Conf_Slot_ID_Max=100
IngrianNAE_Properties_Conf_SessionID_Max=100
NAE_Properties_Conf_Filename=/opt/safenetConf/64/8.3.1/IngrianNAE.proper
ties
7. Save changes.
8. Search for the following properties and set the values as follows:
ranger.kms.keysecure.enabled = true
ranger.kms.keysecure.UserPassword.Authentication = true
ranger.kms.keysecure.masterkey.name = MasterKey1
ranger.kms.keysecure.login.username = keysecure-username
ranger.kms.keysecure.login.password = keysecure-password
ranger.kms.keysecure.masterkey.size = 256
ranger.kms.keysecure.sunpkcs11.cfg.filepath = /opt/safenetConf/64/8.3.1/
sunpkcs11.cfg
9. Save changes.
10. Restart Ranger KMS.
Results
The master key with alias MasterKey1 is created in CipherTrust Manager.
79
Cloudera Manager HDFS Transparent Encryption
Example
What to do next
Once Ranger KMS has started successfully, verify zone key creation, and zone encryption/decryption.
Procedure
1. Stop Ranger KMS service.
2. SSH into the Ranger KMS host.
3. Create a directory and copy the files IngrianNAE.properties, libIngPKCS11.so and sunpkcs11.cfg from Thales
Cipher Trust Manager to the directory.
mkdir -p /opt/safenetConf/64/8.3.1
and then copy the above mentioned files under this location.
Note: Make sure you have provided read-write access (chmod 775) to Ranger KMS service users (chown
kms:kms) to all the 3 files.
4. Update the IngrianNAE.properties file and initialize the below mentioned properties.
Protocol=tcp (valid values ssl or tcp, should be the same protocol provi
ded on CipherTrust instance)
80
Cloudera Manager HDFS Transparent Encryption
5. Initialize the following property only when the protocol of the CipherTrust Manager instance is SSL. This is the
location of the certificate downloaded from Cipher Trust Manager and copied on Ranger KMS host.
CA_File=/etc/security/serverKeys/Certificate_nae.txt
cd /opt/cloudera/parcels/CDH/lib/ranger-kms
7. Export the following variables and ensure the variables are exported successfully using the command env|grep
NAE
export IngrianNAE_Properties_Conf_Slot_ID_Max=100
export IngrianNAE_Properties_Conf_SessionID_Max=100
export NAE_Properties_Conf_Filename=/opt/safenetConf/64/8.3.1/IngrianNAE.p
roperties
Master Key from Ranger KMS DB has been successfully imported into CipherTrust Manager.
10. Go to CM Ranger KMS Configuration. Search for the following properties and set the values.
ranger.kms.keysecure.enabled = true
ranger.kms.keysecure.UserPassword.Authentication = true
ranger.kms.keysecure.masterkey.name = masterkeyname (must be same name u
sed above with migration utility ./DBMKTOKEYSECURE.sh )
ranger.kms.keysecure.login.username = keysecure-username
ranger.kms.keysecure.login.password = keysecure-password (User details
are craeted on KeySecure while adding the user)
ranger.kms.keysecure.masterkey.size = 256
ranger.kms.keysecure.sunpkcs11.cfg.filepath = /opt/safenetConf/64/8.3.1/su
npkcs11.cfg
11. Search for Ranger KMS Service Environment Advanced Configuration Snippet. Click on the + icon and add the
following environment variables.
IngrianNAE_Properties_Conf_Slot_ID_Max=100
IngrianNAE_Properties_Conf_SessionID_Max=100
NAE_Properties_Conf_Filename=/opt/safenetConf/64/8.3.1/IngrianNAE.properti
es
81
Cloudera Manager HDFS Transparent Encryption
Results
Master Key from Ranger KMS DB has been successfully migrated to CipherTrust Manager.
What to do next
Once Ranger KMS has started successfully, verify zone key creation, and zone encryption/decryption.
Migrating the Master key from CipherTrust Manger HSM to Ranger KMS DB
How to migrate the Master key from CipherTrust HSM to Ranger KMS DB. These steps need to be performed when
the cluster is ready with all the required services and encryption zone keys are present in the Ranger KMS DB.
Procedure
1. Find the KMS current process directory.
4. If the Ranger KMS DB table contains any old master key, then delete the entry from ranger_masterkey table
manually and proceed to the next step.
5. Run the ./KEYSECUREMKTOKMSDB script by passing the master key password.
./KEYSECUREMKTOKMSDB masterKeyPassword
6. Once the script runs successfully, go to CM Ranger KMS Configuration. Search for dbks-site.xml and update the
value of ranger.kms.keysecure.enabled to false.
7. Search for ranger.db.encrypt.key.password and set its value to the master-key password which you used above
while invoking the migration script.
8. Restart Ranger KMS.
What to do next
Once Ranger KMS has started successfully, verify zone key creation, and zone encryption/decryption.
82
Cloudera Manager HDFS Transparent Encryption
5. Save changes.
83
Cloudera Manager HDFS Transparent Encryption
3. Enter the required details and select Self-signed Root CA as the Certificate Authority Type.
4. Click on Create.
The Local CA is visble.
84
Cloudera Manager HDFS Transparent Encryption
85
Cloudera Manager HDFS Transparent Encryption
5. Copy the text of the certificate request. The copied text must include the header (-----BEGIN CERTIFICATE
REQUEST-----) and footer (-----END CERTIFICATE REQUEST-----).
6. Navigate to the Security Tab -> Device, CAs & SSL Certificates section.
7. Click on the Local CAs link and select the CA name from the given list.
8. Click Sign Request to access the Sign Certificate Request section.
86
Cloudera Manager HDFS Transparent Encryption
11. Paste all text copied from the server certificate request, including the header and footer in Certificate Request.
12. Click Sign Request. This will take you to the CA Certificate Information section.
13. Copy the actual (e.g KSCAN) certificate text. The copied text must include the header (-----BEGIN
CERTIFICATE-----) and footer (-----END CERTIFICATE-----).
14. Navigate back to the Certificate List section (Device, CAs & SSL Certificates )and click on SSL Certificates.
15. Select your certificate request and click on properties.
16. Click Install Certificate.
87
Cloudera Manager HDFS Transparent Encryption
88
Cloudera Manager HDFS Transparent Encryption
Procedure
1. SSH into the Ranger KMS host.
2. Create a directory and copy the files IngrianNAE.properties, libIngPKCS11.so and sunpkcs11.cfg from Gemalto
SafeNet KeySecure to the directory.
mkdir -p /opt/safenetConf/64/8.3.1
and then copy the above mentioned files under this location.
Note: Make sure you have provided read-write access (chmod 775) to Ranger KMS service users (chown
kms:kms) to all the 3 files.
3. If SSL is enabled on KeySecure ,then download the CA certificate file (e.g. KSCAN.crt) created on key secure
cluster while configuring SSL on keysecure instance.
a) Log in to KeySecure.
b) Click on Security tab and then go to Device CAs and SSL Certificates section
c) Click on Local CA’s link
d) Select the appropriate certificate and click on download as shown in the below image.
e) Once the certificate is downloaded, copy/scp it to the Ranger KMS host at location “/etc/security/serverKeys/”.
Make sure the Ranger KMS user has read-write access to the file.
4. Update the IngrianNAE.properties file and initialize the below mentioned properties.
Protocol=tcp (valid values ssl or tcp, should be the same protocol provi
ded on KeySecure instance)
5. Initialize the following property only when the protocol of the KeySecure instance is SSL. This is the location of
the certificate downloaded from KeySecure and copied on Ranger KMS host.
CA_File=/etc/security/serverKeys/KSCAN.crt
89
Cloudera Manager HDFS Transparent Encryption
6. Go to CM Ranger KMS Configuration Search for Ranger KMS Server Advanced Configuration Snippet and
click on + icon to add the properties.
7. Add the following properties:
IngrianNAE_Properties_Conf_Slot_ID_Max=100
IngrianNAE_Properties_Conf_SessionID_Max=100
NAE_Properties_Conf_Filename=/opt/safenetConf/64/8.3.1/IngrianNAE.proper
ties
8. Save changes.
9. Search for the following properties and set the values as follows:
ranger.kms.keysecure.enabled = true
ranger.kms.keysecure.UserPassword.Authentication = true
ranger.kms.keysecure.masterkey.name = MasterKey1
ranger.kms.keysecure.login.username = keysecure-username
ranger.kms.keysecure.login.password = keysecure-password
ranger.kms.keysecure.masterkey.size = 256
ranger.kms.keysecure.sunpkcs11.cfg.filepath = /opt/safenetConf/64/8.3.1/s
unpkcs11.cfg
Results
The master key with alias MasterKey1 is created in KeySecure.
What to do next
Once Ranger KMS has started successfully, verify zone key creation, and zone encryption/decryption.
90
Cloudera Manager HDFS Transparent Encryption
Procedure
1. Once Ranger KMS is installed and running, note down the KMS current running process directory.
2. Stop the Ranger KMS service.
3. If SSL is enabled on KeySecure ,then download the CA certificate file (e.g. KSCAN.crt) created on key secure
cluster while configuring SSL on keysecure instance.
a) Log in to KeySecure.
b) Click on Security tab and then go to Device CAs and SSL Certificates section
c) Click on Local CA’s link
d) Select the appropriate certificate and click on download as shown in the below image.
e) Once the certificate is downloaded, copy/scp it to the Ranger KMS host at location “/etc/security/serverKeys/”.
Make sure the Ranger KMS user has read-write access to the file.
4. Create a directory and copy the files IngrianNAE.properties, libIngPKCS11.so and sunpkcs11.cfg from Gemalto
SafeNet KeySecure to the directory.
mkdir -p /opt/safenetConf/64/8.3.1
and then copy the above mentioned files under this location.
Note: Make sure you have provided read-write access (chmod 775) to Ranger KMS service users (chown
kms:kms) to all the 3 files.
5. Update the IngrianNAE.properties file and initialize the below mentioned properties.
Protocol=tcp (valid values ssl or tcp, should be the same protocol provi
ded on KeySecure instance)
6. Initialize the following property only when the protocol of the KeySecure instance is SSL. This is the location of
the certificate downloaded from KeySecure and copied on Ranger KMS host.
CA_File=/etc/security/serverKeys/KSCAN.crt
91
Cloudera Manager HDFS Transparent Encryption
7. Go to CM Ranger KMS Configuration Search for Ranger KMS Server Advanced Configuration Snippet and
click on + icon to add the properties.
8. Add the following properties:
IngrianNAE_Properties_Conf_Slot_ID_Max=100
IngrianNAE_Properties_Conf_SessionID_Max=100
NAE_Properties_Conf_Filename=/opt/safenetConf/64/8.3.1/IngrianNAE.proper
ties
9. Save changes.
10. Go to Ranger KMS home directory and export the environment variables.
export JAVA_HOME=/usr/java/jdk1.8.0_232-cloudera
export RANGER_KMS_HOME=/opt/cloudera/parcels/CDH/lib/ranger-kms
export RANGER_KMS_CONF=/var/run/cloudera-scm-agent/process/current_proc
sess_dir-RANGER_KMS_SERVER/conf
export SQL_CONNECTOR_JAR=/path/to/SQL-Connector.jar
export HADOOP_CREDSTORE_PASSWORD=hadoop_cred_store_password
ranger.kms.keysecure.enabled = true
ranger.kms.keysecure.UserPassword.Authentication = true
ranger.kms.keysecure.masterkey.name = masterkeyname (must be the same name
used above with migration utility ./DBMKTOKEYSECURE.sh )
ranger.kms.keysecure.login.username = keysecure-username
ranger.kms.keysecure.login.password = keysecure-password
ranger.kms.keysecure.masterkey.size=256
92
Cloudera Manager HDFS Transparent Encryption
ranger.kms.keysecure.sunpkcs11.cfg.filepath=/opt/safenetConf/64/8.3.1/s
unpkcs11.cfg
Results
Master Key from Ranger KMS DB has been successfully migrated to CipherTrust Manager.
What to do next
Once Ranger KMS has started successfully, verify zone key creation, and zone encryption/decryption.
Procedure
1. Ensure Ranger KMS is running.
2. Find the KMS current process directory.
./KEYSECUREMKTOKMSDB masterKeyPassword
Master Key from Key Secure has been successfully imported into Ranger KMS DB.
6. Once the script runs successfully, go to CM Ranger KMS Configuration. Search for dbks-site.xml and update the
value of ranger.kms.keysecure.enabled to false.
7. Search for ranger.db.encrypt.key.password and set its value to the master-key password which you used above
while invoking the migration script.
8. Restart Ranger KMS.
Note: While restarting KMS service, if seeing this error “[op=KeyNameQuery] [] Unsupported
custom attribute type for key names query” in the keysecure log , then SSH to KMS host , edit
IngrianNAE.properties file , and set the value of Product_Code=HNWs to empty i.e. - Product_Code=
What to do next
Once Ranger KMS has started successfully, verify zone key creation, and zone encryption/decryption.
Connecting KeySecure HSM to CipherTrust Manager after migration from Key Secure
HSM
How to configure the KeySecure HSM to connect to CipherTrust.
93
Cloudera Manager HDFS Transparent Encryption
Procedure
1. Stop the Key HSM service.
Use SSL? [Y/n] (As per the configuration done on CipherTrust Manager)
94
Cloudera Manager HDFS Transparent Encryption
Note: Perform the next two steps once above steps are successfully done on both Active and Passive KTS
nodes.
Role Separation
Ranger uses separate admin users for Ranger and Ranger KMS.
• The Ranger admin user manages Ranger access policies.
• The Ranger KMS admin user (keyadmin by default) manages access policies and keys for Ranger KMS, and has
access to a different set of UI features than the Ranger admin user.
Using separate administrator accounts for Ranger and Ranger KMS separates encryption work (encryption keys and
policies) from cluster management and access policy management.
Note:
For more information about creating, deleting, listing, and rolling over existing keys using Ranger REST
APIs, see https://ranger.apache.org/apidocs/resource_XKeyREST.html.
95
Cloudera Manager HDFS Transparent Encryption
96
Cloudera Manager HDFS Transparent Encryption
97
Cloudera Manager HDFS Transparent Encryption
To edit Ranger KMS repository properties, click the Edit icon for the service and update the settings on the Edit
Service page.
98
Cloudera Manager HDFS Transparent Encryption
99
Cloudera Manager HDFS Transparent Encryption
100
Cloudera Manager HDFS Transparent Encryption
101
Cloudera Manager HDFS Transparent Encryption
102
Cloudera Manager HDFS Transparent Encryption
103
Cloudera Manager HDFS Transparent Encryption
Procedure
1. Log in to Ranger as the Ranger KMS admin user, click Encryption in the top menu, then select a Ranger KMS
service.
104
Cloudera Manager HDFS Transparent Encryption
2. To rotate a key, click the Rollover icon for the key in the Action column.
105
Cloudera Manager HDFS Transparent Encryption
106
Cloudera Manager HDFS Transparent Encryption
107
Cloudera Manager HDFS Transparent Encryption
Delete a Key
How to delete a Ranger KMS key.
Procedure
1. Log in to Ranger as the Ranger KMS admin user, click Encryption in the top menu, then select a Ranger KMS
service.
2. Click on the Delete icon for the key in the Action column.
3. Click OK on the confirmation pop-up.
108