Created 04-26-2017 01:28 PM
Hi,
I am trying to restrict a specific group of ActiveDirectory users to access zeppelin.
My shiro looks something like below, can you please suggest where i have to add the group name or make the changes so that the group of users are not able to login to zeppelin.
Please suggest,
Thanks
Created 05-28-2017 08:36 AM
In Zeppelin 0.7, HDP2.6 we have new LdapRealm, that allows to specify search filter. With the search filter we can restrict login based on groups. Below is one such example I tested in my lab. Please note that this works only in HDP2.6 or zeppelin 0.7 and above.
In HDP2.5 this was not possible because active directory realm was based on UserPrincipalName attribute and there was no way to filter the users based on groups so login cannot be restricted, but with Authorization(as mentioned by @Vipin Rathor you can restrict the users accessing specific urls based on group role map)
[main] ldapADGCRealm = org.apache.zeppelin.realm.LdapRealm ldapADGCRealm.contextFactory.systemUsername = hadoopadmin@lab.hortonworks.net ldapADGCRealm.contextFactory.systemPassword = <Password> ldapADGCRealm.searchBase = "dc=lab,dc=hortonworks,dc=net" ldapADGCRealm.userSearchBase = "dc=lab,dc=hortonworks,dc=net" ldapADGCRealm.userSearchFilter=(&(objectclass=user)(sAMAccountName={0})(|(memberOf=CN=hr,OU=CorpUsers,DC=lab,DC=hortonworks,DC=net)(memberOf=CN=hadoop-admins,OU=CorpUsers,DC=lab,DC=hortonworks,DC=net)(memberOf=CN=sales,OU=CorpUsers,DC=lab,DC=hortonworks,DC=net))) ldapADGCRealm.contextFactory.url = ldap://LdapServer:389 #ldapADGCRealm.userSearchAttributeName = sAMAccountName ldapADGCRealm.contextFactory.authenticationMechanism = simple #ldapADGCRealm.userObjectClass = user ldapADGCRealm.groupObjectClass = group ldapADGCRealm.memberAttribute = member sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager securityManager.sessionManager = $sessionManager securityManager.sessionManager.globalSessionTimeout = 86400000 shiro.loginUrl = /api/login
Created 04-26-2017 06:46 PM
Hello @Haaris Khan,
The following applied to HDP 2.5.3.0 and above. You can restrict AD groups to access different components of Zeppelin (interpreter, configurations, credentials) like this:
1. Add all your AD groups against some role(s). To do this, you have the following in the [main] section:
activeDirectoryRealm.groupRolesMap = "cn=hr,ou=CorpUsers,dc=lab,dc=hortonworks,dc=net":"endusers","cn=legal,ou=CorpUsers,dc=lab,dc=hortonworks,dc=net":"admin","cn=sales,ou=CorpUsers,dc=lab,dc=hortonworks,dc=net":"readonly"
Note: You can create roles with any name that you like.
2. Next, define the access for these roles in the [urls] section:
[urls] /api/version = anon /api/interpreter/** = authc, roles[endusers,readonly] /api/configurations/** = authc, roles[readonly] /api/credential/** = authc, roles[admin] /** = authc #/** = anon
With these two, your LDAP group should be authorized to access the only the specific URLs.
Hope this helps.
Created 05-28-2017 08:36 AM
In Zeppelin 0.7, HDP2.6 we have new LdapRealm, that allows to specify search filter. With the search filter we can restrict login based on groups. Below is one such example I tested in my lab. Please note that this works only in HDP2.6 or zeppelin 0.7 and above.
In HDP2.5 this was not possible because active directory realm was based on UserPrincipalName attribute and there was no way to filter the users based on groups so login cannot be restricted, but with Authorization(as mentioned by @Vipin Rathor you can restrict the users accessing specific urls based on group role map)
[main] ldapADGCRealm = org.apache.zeppelin.realm.LdapRealm ldapADGCRealm.contextFactory.systemUsername = hadoopadmin@lab.hortonworks.net ldapADGCRealm.contextFactory.systemPassword = <Password> ldapADGCRealm.searchBase = "dc=lab,dc=hortonworks,dc=net" ldapADGCRealm.userSearchBase = "dc=lab,dc=hortonworks,dc=net" ldapADGCRealm.userSearchFilter=(&(objectclass=user)(sAMAccountName={0})(|(memberOf=CN=hr,OU=CorpUsers,DC=lab,DC=hortonworks,DC=net)(memberOf=CN=hadoop-admins,OU=CorpUsers,DC=lab,DC=hortonworks,DC=net)(memberOf=CN=sales,OU=CorpUsers,DC=lab,DC=hortonworks,DC=net))) ldapADGCRealm.contextFactory.url = ldap://LdapServer:389 #ldapADGCRealm.userSearchAttributeName = sAMAccountName ldapADGCRealm.contextFactory.authenticationMechanism = simple #ldapADGCRealm.userObjectClass = user ldapADGCRealm.groupObjectClass = group ldapADGCRealm.memberAttribute = member sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager securityManager.sessionManager = $sessionManager securityManager.sessionManager.globalSessionTimeout = 86400000 shiro.loginUrl = /api/login
Created 05-28-2017 11:52 AM
Thanks @rguruvannagari for the mention. That pushed me to write my pending article. I cover the new LDAP/AD options available in Apache Zeppelin 0.7.0 / HDP 2.6 in this article. Please check.
Created 06-19-2017 07:43 AM
Thanks @rguruvannagari, your suggestion works perfectly fine for me in HDP2.6 - zeppelin 0.7