Support Questions

Find answers, ask questions, and share your expertise

Automation of Ranger Policy

Hi Team,

I use the following command to extract ranger policies:

curl -iv -u admin:admin -H "Content-type:application/json" -X GET > /tmp

Is there anyway wherein I can automate the above script such that there is no need to key-in admin username & passwd

I am planning to schedule a cron job such that every 6 hrs it should extract policy and dump the o/p in a path.



Hi - you need to provide authentication to ranger for the API call.

Can not automate the ranger admin curl command wherein it doesn't ask for username and passwd for ranger credentials

Cloudera Employee

@sudi ts Please try:

curl -iv -u admin:admin -H "Content-type:application/json" -X GET

I have the same command: curl -iv -u admin:admin -H "Content-type:application/json" -X GET

My question: Is it possible to automate the above command such that it doesn't ask for ranger admin user name and password and it authenticates via kerboros authentication

Hi Can anyone please let me know how to proceed with the request??

I can extract ranger policies via the following command: curl -iv -u username:passwd -H "Content-type:application/json" -X GET

I need the automate the script such that it there is no need to enter the username and passwd... is it possible ??

is there any API from which i can test it....

Cloudera Employee

@sudi ts

If your cluster is kerberized, then first kinit with a principal with admin privilege in Ranger, and then use

curl --negotiate -vk -u : -H "Content-type:application/json" -X GET