Created 09-18-2017 05:39 PM
Hi Team,
I use the following command to extract ranger policies:
curl -iv -u admin:admin -H "Content-type:application/json" -X GET http://sandbox.com:6080/service/public/api/policy > /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.
Thanks
Created 09-18-2017 06:07 PM
Hi - you need to provide authentication to ranger for the API call.
Created 09-18-2017 06:10 PM
Can not automate the ranger admin curl command wherein it doesn't ask for username and passwd for ranger credentials
Created 09-18-2017 06:17 PM
@sudi ts Please try:
curl -iv -u admin:admin -H "Content-type:application/json" -X GET http://sandbox.com:6080/service/public/v2/api/policy
Created 09-18-2017 06:23 PM
I have the same command: curl -iv -u admin:admin -H "Content-type:application/json" -X GET http://sandbox.com:6080/service/public/v2/api/policy
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
Created 09-19-2017 05:53 PM
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 http://sandbox.com:6080/service/public/v2/api/policy
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....
Created 09-19-2017 06:28 PM
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 http://sandbox.com:6080/service/public/v2/api/policy
Thanks!