0
0
Hadoopdata~10 mins

Apache Ranger for authorization in Hadoop - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start the Apache Ranger service.

Hadoop
sudo systemctl [1] ranger-admin
Drag options to blanks, or click blank then click option'
Astop
Bstatus
Cstart
Drestart
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'stop' instead of 'start' will shut down the service.
Using 'status' only checks if the service is running.
2fill in blank
medium

Complete the code to list all Ranger policies using the REST API with curl.

Hadoop
curl -u admin:admin123 -X GET http://localhost:[1]/service/public/v2/api/policy
Drag options to blanks, or click blank then click option'
A6080
B8080
C9090
D7070
Attempts:
3 left
💡 Hint
Common Mistakes
Using port 8080 or 9090 will fail to connect to Ranger admin.
Port 7070 is not the default for Ranger REST API.
3fill in blank
hard

Fix the error in the Ranger policy JSON to allow access to the 'data_lake' resource.

Hadoop
{
  "policyName": "AccessDataLake",
  "service": "hdfs",
  "resources": {
    "path": {
      "values": ["[1]"],
      "isExcludes": false,
      "isRecursive": true
    }
  },
  "policyItems": []
}
Drag options to blanks, or click blank then click option'
Adata_lake
B/data_lake
C/data-lake
Ddata-lake
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the leading slash causes the policy to not match the resource.
Using dashes instead of underscores changes the path name.
4fill in blank
hard

Fill both blanks to create a Ranger policy that grants 'read' access to user 'alice' on the '/reports' path.

Hadoop
{
  "policyName": "ReadReports",
  "service": "hdfs",
  "resources": {
    "path": {
      "values": ["[1]"],
      "isExcludes": false,
      "isRecursive": false
    }
  },
  "policyItems": [
    {
      "users": ["[2]"],
      "accesses": [
        {"type": "read", "isAllowed": true}
      ]
    }
  ]
}
Drag options to blanks, or click blank then click option'
A/reports
Balice
Cbob
D/data
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect path names or user names will cause the policy to not apply.
Setting 'isRecursive' to true when not needed may grant unintended access.
5fill in blank
hard

Fill all three blanks to create a Ranger policy dictionary in Python that maps user 'bob' to 'write' access on '/projects'.

Hadoop
policy = {
  '[1]': 'WriteProjects',
  '[2]': 'hdfs',
  'resources': {
    'path': {
      'values': ['/projects'],
      'isExcludes': False,
      'isRecursive': False
    }
  },
  'policyItems': [
    {
      'users': ['[3]'],
      'accesses': [{'type': 'write', 'isAllowed': True}]
    }
  ]
}
Drag options to blanks, or click blank then click option'
ApolicyName
Bservice
Cbob
Dread
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'read' instead of 'write' for access type is incorrect here.
Mixing up keys and values in the dictionary causes errors.