Community Articles
Find and share helpful community-sourced technical articles
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Security/Governance/GDPR Demo on CDP-DC 7.x


This article explains how to quickly setup Cloudera Security/Governance/GDPR (Worldwide Bank) demo using Cloudera Data Platform Data Center (CDP-DC). It can be deployed either on AWS using AMI or on your own setup via provided script

What's included

  • Single node CDP 7.1.1 including:
    • Cloudera Manager (60-day trial license included) - for managing the services
    • Kerberos - for authentication (via local MIT KDC)
    • Ranger - for authorization (via both resource/tag-based policies for access and masking)
    • Atlas - for governance (classification/lineage/search)
    • Zeppelin - for running/visualizing Hive queries
    • Impala/Hive 3 - for Sql access and ACID capabilities
    • Spark/HiveWarehouseConnector - for running secure SparkSQL queries
  • Worldwide Bank artifacts
    • Demo hive tables
    • Demo tags/attributes and lineage in Atlas
    • Demo Zeppelin notebooks to walk through a demo scenario
  • Ranger policies across HDFS, Hive/Impala, Hbase, Kafka, SparkSQL to showcase:
    • Tag-based policies across HDP components
    • Row-level filtering in Hive columns
    • Dynamic tag-based masking in Hive/Impala columns
    • Hive UDF execution authorization
    • Atlas capabilities like 
      • Classifications (tags) and attributes
      • Tag propagation
      • Data lineage
      • Business glossary: categories and terms
    • GDPR Scenarios around consent and data erasure via Hive ACID
    • Hive ACID / MERGE labs


Option 1: Steps to deploy on your own setup


  1. Launch a vanilla Centos 7 VM and set up a single node CDP cluster using this Github. Instead of "base" CM template choose the "wwbank_krb.json" template:
    yum install -y git 
    #setup KDC 
    curl -sSL | sudo -E sh
    git clone
    cd SingleNodeCDPCluster
    ./ gcp templates/wwbank_krb.json
    #Setup worldwide bank demo using script
    curl -sSL | sudo -E bash
  2. Once the script completes, restart Zeppelin once (via CM) for it to pick up the demo notebooks

Option 2: Steps to launch prebuilt AMI on AWS

  1. Login into the AWS EC2 console using your credentials
  2. Select the AMI from ‘N. California’ region by clicking one the links below:
    1. CDP-DC 7.1.1 here (public)
    2. CDP-DC 7.0.3 here (public) 
  3. Now choose instance type: select m4.4xlarge and click Next:
    Note: if you choose a smaller instance type from the above recommendation, not all services may come up.
  4. In Configure Instance Details, ensure Auto-assign Public IP is enabled and click Next:
  5. In Add storage, use at least 100 GB and click Next:
  6. In Add Tags, add tags needed to prevent instances from being terminated. Click Next:abajwa_66-1591227291401.png
  7. In Configure Security Group, create a new security group and select All traffic and open all ports to only your IP. The below image displays my IP address: abajwa_67-1591227291383.png
  8. In Review Instance Launch, review your settings and click Launch:
  9. Create and download a new key pair (or choose an existing one). Then click Launch instances:abajwa_69-1591227291422.png
  10. Click the shown link under Your instances are now launching:
  11. This opens the EC2 dashboard that shows the details of your launched instance:abajwa_71-1591227291409.jpeg
  12. Make note of your instance’s Public IP (which will be used to access your cluster). If the Public IP is blank, wait for a couple of minutes for this to be populated.
  13. After five to ten minutes, open the below URL in your browser to access Cloudera Manager (CM) console: http://<PUBLIC IP>:7180.
  14. Login as admin/admin:
  15. At this point, CM may still be in the process of starting all the services. You can tell by the presence of the blue operation notification near the bottom left of the page. If so, just wait until it is done:abajwa_73-1591227291386.png
    (Optional) You can also monitor the startup using the log as below:
    1. Open SSH session into the VM using your key and the public IP e.g. from OSX:
      ssh -i ~/.ssh/mykey.pem centos@<publicIP>​
    2. Tail the startup log:
      tail -f /var/log/cdp_startup.log
    3. Once you see “cluster is ready!” you can proceed. 
  16. Once the blue operation notification disappears and all the services show a green checkmark, the cluster is fully up.abajwa_74-1591227291474.png
  17. If any services fail to start, use the hamburger icon next to SingleNodeCluster > Start button to start.

Accessing cluster resources

CDP urls

  • Access CM at :7180 as admin/admin
  • Access Ranger at :6080. Ranger login is admin/BadPass#1
  • Access Atlas at :31000. Atlas login is admin/BadPass#1
  • Access Zeppelin at :8885. Zeppelin users logins are:
    • joe_analyst = BadPass#1
    • ivanna_eu_hr = BadPass#1
    • etl_user = BadPass#1

Demo walkthrough

Run queries as joe_analyst
  1. Open Zeppelin and login as joe_analyst. Find his notebook by searching for "worldwide" using the text field under the Notebook section. Select the notebook called Worldwide Bank - Joe Analyst:
  2. On the first launch of the notebook, you will be prompted to choose interpreters. You can keep the defaults. Ensure to click the Save button:abajwa_76-1591227291355.png
  3. Run through the notebook. This notebook shows the following: 
    1. MRN/password masked via tag policy. The following shows the Ranger policy that enables this:abajwa_77-1591227291359.png
    2. In the Dynamic Column Level Masking, address, nationalID, credit card numbers are masked via Hive column policies specified in Ranger. Notice that Birthday and age columns are masked using the custom mask:abajwa_78-1591227291384.png
    3. It also shows a prohibition policy where zipcode, insuranceID, and blood type cannot be combined in a query:abajwa_79-1591227291373.png
    4. It shows tag-based policies. 
    5. Attempts to access an object tagged with EXPIRES_ON accessed after the expiry date will be denied. As we will show later, the fed_tax column of tax_2015 table is tagged in Atlas as EXPIRED_ON with an expiry date of 2016. Hence, it should not be allowed to be queried:abajwa_80-1591227291466.png
    6. Also attempts to access object tagged with PII will be denied as per policy. Only HR is allowed. As we will show later, the SSN column of tax_2015 table is tagged as PII in Atlas:abajwa_81-1591227291418.png
    7. Attempts to access cost_savings.claim_savings table as an analyst will fail because there is a policy that a minimum of 60% data quality score is required for analysts. As we will see, this table is tagged in Atlas as having a score of 51%:abajwa_82-1591227291392.png
    8. The same queries can also be run via SparkSQL via spark-shell (as described above). The following is the sample query for joe_analyst:
      hive.execute("SELECT surname, streetaddress, country, age, password, nationalid, ccnumber, mrn, birthday FROM worldwidebank.us_customers").show(10)
      hive.execute("select zipcode, insuranceid, bloodtype from worldwidebank.ww_customers").show(10)
      hive.execute("select * from cost_savings.claim_savings").show(10)​
  4. Confirm using Ranger audits that the queries ran as joe_analyst. Also notice that column names, masking types, IPs, and policy IDs were captured. Also notice tags (such as DATA_QUALITY or PII) are captured along with their attributes. Also, notice that these audits were captured for operations across Hive, Hbase, Kafka, and HDFS:abajwa_84-1591227291412.png
Run queries as ivanna_eu_hr
  1. Once services are up, open Ranger UI and also log in to Zeppelin as ivanna_eu_hr. 
  2. Find her notebook by searching for hortonia using the text field under the Notebook section.
  3. Select the notebook called Worldwide Bank - Ivana EU HR:abajwa_85-1591227291399.png
  4. On the first launch of the notebook, you may be prompted to choose interpreters. You can keep the defaults, make sure you click Save button:abajwa_86-1591227291357.png
  5. Run through the notebook cells using Play button at the top right of each cell (or Shift-Enter):abajwa_87-1591227291439.png
  6. This notebook highlights the following:
    1. Row level filtering: As Ivana can only see data for European customers who have given consent (even though she is querying ww_customers table which contains both US and EU customers). The following is the Ranger Hive policy that enables this feature:abajwa_88-1591227291394.png
    2. It also shows that since Ivana is part of the HR group, there are no policies that limit her access. Hence, so she can see raw passwords, nationalIDs, credit card numbers, MRN #, birthdays, etc.
    3. The last cells show that tag-based policies.
  7. Once you successfully run the notebook, you can open the Ranger Audits to show the policies and that the queries ran as her and that row filtering occurred (notice ROW_FILTER access type):abajwa_89-1591227291389.png
Run queries as etl_user

Similarly, you can log in to Zeppelin as etl_user and run his notebook as wellabajwa_90-1591227291419.png

This notebook shows how an admin would handle GDPR scenarios like the following using Hive ACID capabilities:

  • when a customer withdraws consent (so they no longer appear in searches)
  • when a customer requests their data to be erased
Run Hive/Impala queries from Hue

Alternatively, you can log in to Hue as joe_analyst and select Query > Editor > Hive and click Saved queries to run Joe's sample queries via Hive: 





You can also switch the editor to Impala to run Joe's sample queries via Impala to show tag-based access policy working for Impala: 


In CDP 7.1.1, Impala also supports column-based masking:


Alternatively, you can log in to Hue as ivanna_eu_hr and click Saved queries to run Ivanna's sample queries via Hive:



Run SparkSQL queries via Hive Warehouse Connector (HWC)

To run secure SparkSQL queries (using Hive Warehouse Connector):

  1. Connect to instance via SSH using your keypair
  2. Authenticate as the user you want to run queries as via keytabs:
    kinit -kt /etc/security/keytabs/joe_analyst.keytab joe_analyst/$(hostname -f)@CLOUDERA.COM
  3. Start SparkSql using HiveWarehouseConnector:
    spark-shell --jars /opt/cloudera/parcels/CDH/jars/hive-warehouse-connector-assembly*.jar     --conf spark.sql.hive.hiveserver2.jdbc.url="jdbc:hive2://$(hostname -f):10000/default;"    --conf "spark.sql.hive.hiveserver2.jdbc.url.principal=hive/$(hostname -f)@CLOUDERA.COM"    --conf
  4. Import HWC classes and start the session.
  5. Import com.hortonworks.hwc.HiveWarehouseSession:
    import com.hortonworks.hwc.HiveWarehouseSession._
    val hive = HiveWarehouseSession.session(spark).build()
  6. Run queries using hive.execute() e.g:
    hive.execute("select * from cost_savings.claim_savings").show(10)
  7. The following is a sample script to automate above for joe_analyst here:

Troubleshooting Zeppelin

In case you encounter Thrift Exception like the following, it's likely the session was expired:


Just scroll to the top and click the gears icon (near top right) to display the interpreters and restart the JDBC one:



Atlas walkthrough

  1. Log in to Atlas and show the Hive columns tagged as EXPIRES_ON:abajwa_98-1591227291507.png
  2. To see the table name, you can select Table in the Column dropdown:abajwa_99-1591227291512.png
  3. Now, notice the table name is also displayed:abajwa_100-1591227291516.png
  4. Select the fed_tax column and open the Classifications tab to view the attributes of the tag (expiry_date) and value:abajwa_101-1591227291500.png
  5. To save this search, click the Save As button near the bottom left. Provide a Name and click Create to save:abajwa_102-1591227291502.png
  6. Similarly, you can query for Hive tables tagged with DATA_QUALITY:abajwa_103-1591227291539.png
  7. Click on claim_savings to see that the quality score associated with this table is less than 60%:abajwa_104-1591227291518.png
  8. Click back, and select the claims_view table instead.
  9. Click the Lineage tab. This shows that this table was derived from the claims_saving table:abajwa_105-1591227291565.png
  10. Click on the Classifications tab and notice that because the table claims_view table was derived from (claims_savings) and had a DATA_QUALITY tag, the tag was automatically propagated to claims_view table itself (i.e. no one had to manually tag it):abajwa_106-1591227291524.png
  11. Use Atlas to query for hive_tables and pick provider_summary to show lineage and impact:abajwa_107-1591227291543.pngabajwa_108-1591227291555.png
  12. You can use the Audits tab to see audits on this table:abajwa_109-1591227291550.png
  13. You can use the Schema tab to inspect the table schema:abajwa_110-1591227291574.png
  14. Navigate to the Classification tab to see how you can easily see all entities tagged with a certain classification (across Hive, Hbase, Kafka, HDFS etc):abajwa_111-1591227291542.pngabajwa_112-1591227291559.png
  15. Navigate to the Glossary tab to see how you can define Glossary categories and terms, as well as search for any entities associated with those terms:abajwa_113-1591227291568.png
  16. Navigate to Atlas home page and notice the option to create a new entity:abajwa_114-1591227291551.png
  17. The following is a sample out of the box entity types that you can create:abajwa_115-1591227291563.png
  18. Selecting an entity type (e.g. hdfs_path) displays the required and optional fields that you need to manually create the new entity: abajwa_116-1591227291548.png


Hive ACID/Merge walkthrough

  1. In Zeppelin, there are two Hive related notebooks provided to demonstrate Hive ACID and MERGE capabilities. Login to Zeppelin as etl_user to be able to run these:abajwa_117-1591227291564.png
  2. The notebooks contain tutorials that walk through some of the theory and concepts before going through some basic examples:abajwa_118-1591227291581.pngabajwa_119-1591227291579.png


The following are some older AMI links (for HDP releases):

  • For HDP 3.1.4: click here
  • For HDP 3.1 with Knox SSO: click here
  • For HDP 2.6.5 with Knox SSO: click here
  • For HDP 2.6.5: click here
Don't have an account?
Coming from Hortonworks? Activate your account here
Version history
Revision #:
8 of 8
Last update:
‎06-11-2020 04:42 AM
Updated by:
Top Kudoed Authors