Created 02-08-2017 01:11 PM
Dears, I'm trying to configure shiro to authenticate users from AD and to limit access to login to webui for specific group.
Here's my shiro.ini config:
activeDirectoryRealm = org.apache.zeppelin.server.ActiveDirectoryGroupRealm activeDirectoryRealm.systemUsername = someuser activeDirectoryRealm.systemPassword = somepassword activeDirectoryRealm.searchBase = "OU=x,OU=y,OU=z,DC=,DC=x,DC=x" activeDirectoryRealm.url = ldaps://ldap.domain.com:636 activeDirectoryRealm.groupRolesMap = "CN=HADOOP_GROUP,OU=x,OU=y,OU=z,OU=x,DC=x,DC=x,DC=x":"role1" activeDirectoryRealm.authorizationCachingEnabled = false [roles] role1 = * /api/version = anon #/** = anon /** = authc
Currently, authentication works for every user who is in search base, so everyone from search base can login. What I want to achieve is to limit access to specific group so only user which has this group can log in. For testing purposes I created two users. First belongs to group which is listed in groupRolesMap where role1 = * is applied, and the second user belongs to another group, which is not listed in shiro.ini. The problem is that both users can log in, because these users are in the same search base.
Is there any way to limit such access? What am I missing?
I'll appreciate your help. Kind regards,
Created 03-08-2017 12:31 PM
You can assign access control filters to the shiro urls to restrict on certain roles, in your case it would look something like this:
[urls] # authentication method and access control filters /api/version = anon /** = authc, roles[role1]
You can even take it a step further limit access to a subset of configuration pages within Zeppelin (i.e, lock down the 'Interpreter' or 'Configurations' page to be used by admins only):
[urls] # authentication method and access control filters /api/version = anon /api/interpreter/** = authc, roles[admin] /api/configurations/** = authc, roles[admin] /api/credential/** = authc, roles[admin] #/** = anon /** = authc
See the following documentation for an example Zeppelin shiro config that does this:
Created 05-12-2017 02:35 PM
This does not work (Zep-0.7). The /login call gets stuck in a recursive loop in this scenario.
Created 04-26-2017 12:35 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:39 AM
@Michał Kabocik @Sohaib Iftikhar
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 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 07-24-2017 01:17 PM
This what I was looking for, Its perfect. Just one question, I would like to also configure ldapADGCRealm.rolesByGroup so that I can give proper authorization. Do you have any updates ?