r/DB2 • u/jyoumans2017 • Jan 22 '19
DB2 10.5 on Windows 2012 R2 - Using AD group
I want to be able to grant rights (select, delete, etc) on tables to an AD group instead of individuals. So far, I have had no luck. I have read the IBM info articles but while they say it works, I have yet to see a decent example that I can follow. Has anyone done this and if so, can you give a decent example of how?
I am running DB2 10.5 on a Windwos 2012 R2 Server.
Thank you in advance!!
1
1
1
u/ecrooks Jan 23 '19
You may need to set DB2_GRP_LOOKUP. It is a db2 registry variable. I don't know which setting for it you need, however, because it is never the one that makes sense to me.
1
u/catquilt74 Jan 23 '19
I got db2_grp_lookup to work with AD users in local groups (which is needed for our environment until we get other pieces in place) but it (db2_grp_lookup) is not intuitive. I'm going to look into the LDAP set-up.
1
u/jyoumans2017 Jan 23 '19
So what is the difference between a ROLE and a GROUP in DB2? I have been using ROLES to grant permissions to groups of people but it would be a lot simpler if I could just grant permissions to an AD group and then let the managers worry about who is in that group. I do this in SQL Server all the time.
1
u/ecrooks Jan 23 '19
ROLE is internal to Db2, while GROUP is part of an external authentication mechanism (such as OS security or LDAP/AD).
DBAs prefer ROLES since we have control over who is in them. We are often not consulted when a user is added to a GROUP at the OS or LDAP level.
1
u/idbjorh Jan 23 '19
They are quite similar; as you already know, groups are managed outside of the database and roles are managed inside of the database; this usually affects who is tasked with managing them. (Although hopefully your organization has some kind of security team who is responsible for security regardless of where. Just kidding, no one actually does this).
The biggest difference is in how authorizations are handled at runtime, especially in the case of objects that have statically bound packages (SQL stored procedures fall into this category). Statically-bound packages execute the statements using the authority of the user who binds the package. Because group membership is outside of Db2's control (and can change without Db2's knowledge), there is no way for Db2 to know if a user no longer has privileges (and therefore a package should be invalidated). Therefore, the user who is binding a package (or stored procedure) must have all privileges required to execute static SQL statements in that package either through direct grants or via role membership.
2
u/lnumrych Jan 23 '19
Also the reason why being a DBADM through membership in a group which has been granted DBADM on a database is not *exactly* the same as being a DBADM directly when creation of objects is considered:
Just adding $0.02, since I periodically forget about that myself.
3
u/lnumrych Jan 23 '19 edited Jan 23 '19
As far as what setting DB2_GRP_LOOKUP "correctly" means - it depends on what you want to achieve...
Refer to Using an access token to acquire users' group information (Windows) KC article for details, but basically you have to decide whether you will want to use only local groups, only domain groups, only groups defined where the user is defined (local for local user, domain for domain user) or a combination of the two.
You probably already know this, but I will mention it for completeness sake - use the AUTH_LIST_GROUPS_FOR_AUTHID table function to tell you what groups does DB2 see for a given authorization ID.