presto icon indicating copy to clipboard operation
presto copied to clipboard

Presto ranger integration error

Open bb786112 opened this issue 5 years ago • 23 comments

HI All,

I am working to integrate ranger and presto and following this URL but ended with error and integration is not successful.

Steps:

  1. Created a ranger-${RANGER_VERSION}-presto-plugin.tar.gz file.
  2. Extracted tar file to ranger-presto-plugin
  3. Changed install.properies file.
  4. Run ./enable-presto-plugin.sh

It was successful run but It did not create access-control.properties & rules.json file. And I created these files manually in /etc/presto. Now presto is not starting and failed with the below error.

2019-06-21T04:59:21.731Z ERROR main com.facebook.presto.server.PrestoServer Access control ranger is not registered java.lang.IllegalStateException: Access control ranger is not registered at com.google.common.base.Preconditions.checkState(Preconditions.java:585) at com.facebook.presto.security.AccessControlManager.setSystemAccessControl(AccessControlManager.java:136) at com.facebook.presto.security.AccessControlManager.loadSystemAccessControl(AccessControlManager.java:118) at com.facebook.presto.server.PrestoServer.run(PrestoServer.java:142) at com.facebook.presto.server.PrestoServer.main(PrestoServer.java:73)


Do we need to use ranger-servicedef-presto.json anywhere because its not mentioned in ranger presto integration URL.

OR any another link which I can follow which is having all information.

Thanks Bharat Bhushan

bb786112 avatar Jun 21 '19 05:06 bb786112

Though I'm not familiar with Ranger, I guess you would also need to make sure the plugin contains systemAccessControlFactories per my understanding here: https://github.com/prestodb/presto/blob/6796a1eeaffb76f8e2afd042915bf415aace4920/presto-main/src/main/java/com/facebook/presto/server/PluginManager.java#L223-L226

See if https://prestodb.github.io/docs/current/develop/system-access-control.html helps

shixuan-fan avatar Jun 21 '19 17:06 shixuan-fan

Yes, I have created access-control.properties in pestro etc directory manually. But I am not sure what should be the name of access-control.name=<What Name>. And how I can configure control name while installing ranger plugin.

Do we need to do anything else after executing ./enable-presto-plugin.sh to enable ranger plugin with presto?

I am not sure if I need to do any changes in ranger UI (port 6080) for presto?

Thanks in Advance

bb786112 avatar Jun 22 '19 10:06 bb786112

it works for me, u need to build ranger from source (master branch) as ranger-admin jar will change and .sh will change in ranger, then u will see presto in Ranger UI. don't manually create any rules.json, the enable-presto-plugin.sh will create files in plugins subfolder of presto's install folder. Note that it works for prestosql not prestodb.

tooptoop4 avatar Jun 23 '19 14:06 tooptoop4

do you mean prestodb does not support ranger integration at all?

bb786112 avatar Jun 24 '19 11:06 bb786112

@bb786112 you can change references from prestosql.io to com.facebook.presto... in ranger master branch, worked for me

tooptoop4 avatar Jun 24 '19 18:06 tooptoop4

@tooptoop4 I have the same issue to install ranger plugin as describe by @bb786112 . I built ranger admin from master branch that includes presto plugin change, and run the steps described by URL. Could you please detail what's your step and configuration? Like presto version(is using prestodb or prestosql),any changes need to take care?

bradhill99 avatar Jul 10 '19 03:07 bradhill99

@bradhill99 i'm using prestodb 0.220, needed to change all prestosql references. see https://github.com/apache/ranger/pull/36 it has discussion with my folder structure

tooptoop4 avatar Jul 10 '19 18:07 tooptoop4

I have PrestoSQL-326 to configure it with Ranger and following these steps: https://cwiki.apache.org/confluence/display/RANGER/Presto+Plugin

But I am getting below error:

io.prestosql.server.PrestoServer        Access control 'ranger' is not registered
java.lang.IllegalStateException: Access control 'ranger' is not registered
        at com.google.common.base.Preconditions.checkState(Preconditions.java:588)
        at io.prestosql.security.AccessControlManager.setSystemAccessControl(AccessControlManager.java:148)
        at io.prestosql.security.AccessControlManager.loadSystemAccessControl(AccessControlManager.java:135)
        at io.prestosql.server.PrestoServer.run(PrestoServer.java:141)
        at io.prestosql.$gen.Presto_326____20191205_190712_1.run(Unknown Source)
        at io.prestosql.server.PrestoServer.main(PrestoServer.java:73)

Can someone help me through this issue?

rushidmarne avatar Dec 05 '19 19:12 rushidmarne

@rushidmarne echo ranger > etc/access-control.properties

tooptoop4 avatar Dec 05 '19 21:12 tooptoop4

I have PrestoSQL-326 to configure it with Ranger and following these steps: https://cwiki.apache.org/confluence/display/RANGER/Presto+Plugin

But I am getting below error: ...

Presto 3xx releases are maintained at https://github.com/prestosql/presto. Also, there is the #troubleshooting channel on Presto Community Slack (https://prestosql.io/slack.html)

findepi avatar Dec 05 '19 22:12 findepi

The moment I put file /usr/lib/presto/etc/access-control.properties presto breaks and fails to connect catalogs.

access-control.properties access-control.name=ranger ranger.username=admin ranger.password=admin ranger.hive.security-config-xml=/usr/lib/presto/etc/hive_ranger.xml

hive_ranger.xml <configuration> <property> <name>ranger.plugin.hive.service.name</name> <value>Hive_EDP_Nonprod</value> </property> <property> <name>ranger.plugin.hive.policy.pollIntervalMs</name> <value>5000</value> </property> <property> <name>ranger.service.store.rest.url</name> <value>http://{IP}:6080</value> </property> <property> <name>ranger.plugin.hive.policy.rest.url</name> <value>http://{IP}:6080</value> </property> </configuration>

Seems like presto is not understanding : access-control.name=ranger

Are the contents of access-control.properties file are correct?

rushidmarne avatar Dec 06 '19 17:12 rushidmarne

error msg? access-control.properties should just have access-control.name=ranger

tooptoop4 avatar Dec 06 '19 18:12 tooptoop4

@tooptoop4
This is the error I am getting: io.prestosql.server.PrestoServer Access control 'ranger' is not registered java.lang.IllegalStateException: Access control 'ranger' is not registered at com.google.common.base.Preconditions.checkState(Preconditions.java:588) at io.prestosql.security.AccessControlManager.setSystemAccessControl(AccessControlManager.java:148) at io.prestosql.security.AccessControlManager.loadSystemAccessControl(AccessControlManager.java:135) at io.prestosql.server.PrestoServer.run(PrestoServer.java:141) at io.prestosql.$gen.Presto_326____20191205_190712_1.run(Unknown Source) at io.prestosql.server.PrestoServer.main(PrestoServer.java:73)

rushidmarne avatar Dec 06 '19 19:12 rushidmarne

@tooptoop4 : Thanks, it went ahead when I removed username and password from access-control.properties file.

And now getting other error: Error injecting constructor, java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at org.apache.ranger.authorization.presto.authorizer.RangerSystemAccessControl.<init>(RangerSystemAccessControl.java:40) at org.apache.ranger.authorization.presto.authorizer.RangerSystemAccessControlFactory.lambda$create$0(RangerSystemAccessControlFactory.java:45) while locating org.apache.ranger.authorization.presto.authorizer.RangerSystemAccessControl

Do we need to do any changes at ranger side/server? because I had done all the changes on presto server only.

rushidmarne avatar Dec 06 '19 20:12 rushidmarne

Yeeahhhh....!!! Now I can see the presto plugin in the Ranger. Thanks @tooptoop4 , @findepi

I had to add below few additional jars to : ranger-presto-plugin commons-codec commons-codec-1.12 com.kstruct gethostname4j-0.0.3 com.sun jna-3.0.9.jar

rushidmarne avatar Dec 06 '19 20:12 rushidmarne

Presto-Ranger integration is done, I am seeing Presto plugin in Ranger but whenever I am trying to access hive schema I am getting error : "Access Denied: Cannot access catalog hive".

I tried configuring Ranger service with Hive driver: 'org.apache.hive.jdbc.HiveDriver' and also with Presto driver 'io.prestosql.jdbc.PrestoDriver' but still getting access denied error.

Any idea what I am missing?

rushidmarne avatar Jan 14 '20 20:01 rushidmarne

and also with Presto driver 'io.prestosql.jdbc.PrestoDriver'

@rushidmarne If you're using prestosql, you should report bugs at https://github.com/prestosql/presto. Also, there is the #troubleshooting channel on Presto Community Slack (https://trino.io/slack.html)

findepi avatar Jan 15 '20 11:01 findepi

Presto-Ranger integration is done, I am seeing Presto plugin in Ranger but whenever I am trying to access hive schema I am getting error : "Access Denied: Cannot access catalog hive".

I tried configuring Ranger service with Hive driver: 'org.apache.hive.jdbc.HiveDriver' and also with Presto driver 'io.prestosql.jdbc.PrestoDriver' but still getting access denied error.

Any idea what I am missing?

I am still getting this same problem any solution for this?

AvianshKumar avatar Aug 30 '20 09:08 AvianshKumar

What is the solution?

2021-01-18T18:39:02.459+0800 ERROR main com.facebook.presto.server.PrestoServer Access control ranger is not registered java.lang.IllegalStateException: Access control ranger is not registered at com.google.common.base.Preconditions.checkState(Preconditions.java:588) at com.facebook.presto.security.AccessControlManager.setSystemAccessControl(AccessControlManager.java:148) at com.facebook.presto.security.AccessControlManager.loadSystemAccessControl(AccessControlManager.java:134) at com.facebook.presto.security.AccessControlManager.loadSystemAccessControl(AccessControlManager.java:121) at com.facebook.presto.server.PrestoServer.run(PrestoServer.java:155) at com.facebook.presto.server.PrestoServer.main(PrestoServer.java:79)

SessionBest avatar Jan 18 '21 10:01 SessionBest

I have the same problem too. @rushidmarne How did you fix it? just added som jars?

java.lang.IllegalStateException: Access control ranger is not registered
        at com.google.common.base.Preconditions.checkState(Preconditions.java:588)
        at com.facebook.presto.security.AccessControlManager.setSystemAccessControl(AccessControlManager.java:148)
        at com.facebook.presto.security.AccessControlManager.loadSystemAccessControl(AccessControlManager.java:134)
        at com.facebook.presto.security.AccessControlManager.loadSystemAccessControl(AccessControlManager.java:121)
        at com.facebook.presto.server.PrestoServer.run(PrestoServer.java:155)
        at com.facebook.presto.server.PrestoServer.main(PrestoServer.java:79)

yechangyao avatar Jan 29 '21 05:01 yechangyao

I am also facing the same problem. @rushidmarne how did you resolve it? Screenshot 2021-07-14 at 3 55 01 AM

sanchibansal123 avatar Jul 13 '21 22:07 sanchibansal123

@rushidmarne +1 The same problem (

Sanikadze avatar Jan 20 '22 11:01 Sanikadze

Yeeahhhh....!!! Now I can see the presto plugin in the Ranger. Thanks @tooptoop4 , @findepi

I had to add below few additional jars to : ranger-presto-plugin commons-codec commons-codec-1.12 com.kstruct gethostname4j-0.0.3 com.sun jna-3.0.9.jar

@rushidmarne Would you please tell me all the full names of those jars?

I installed presto 0.276.1, and still encountered ranger-presto-plugin integration problem: 2022-09-18T23:10:37.102+0800 INFO main com.facebook.presto.security.AccessControlManager -- Loading system access control -- 2022-09-18T23:10:37.103+0800 ERROR main com.facebook.presto.server.PrestoServer Access control ranger is not registered java.lang.IllegalStateException: Access control ranger is not registered at com.google.common.base.Preconditions.checkState(Preconditions.java:588) at com.facebook.presto.security.AccessControlManager.setSystemAccessControl(AccessControlManager.java:150) at com.facebook.presto.security.AccessControlManager.loadSystemAccessControl(AccessControlManager.java:136) at com.facebook.presto.security.AccessControlManager.loadSystemAccessControl(AccessControlManager.java:123) at com.facebook.presto.server.PrestoServer.run(PrestoServer.java:169) at com.facebook.presto.server.PrestoServer.main(PrestoServer.java:85)

drummerglen avatar Sep 18 '22 15:09 drummerglen