Consider the following scenario:
- There is a Unix user named
gaius
on the Oracle server with external authentication, so in Oracle there is a corresponding user called ops$gaius
. When logged into a shell, I can also log straight into my Oracle schema, and my cron jobs don't need a password embedded in script either.
- Remote OS authentication is permitted, on the assumption that the LAN is 100% secure and the clients can be trusted (same as
rlogin
/rsh
used to be normally allowed)
- An attacker gets his or her laptop onto the LAN by whatever means, knows that I work there, and creates a local user on their laptop called
gaius
and runs SQL*Plus as that user
- Oracle sees (i.e.
OSUSER
in V$SESSION
) is gaius
and logs that remote user in as ops$gaius
That's not only laughably easy to spoof, but putting on my cynic's hat, Oracle can't make any more money selling you their fancy single sign-on product... Which by the way does fulfill all the points you raise as advantages of OS-level auth. Two passwords better than one is entirely spurious; most people will set them to be the same anyway (there's no mechanism in Oracle to prevent this).
The general principle is that it is extremely difficult to defend in software when an attacker has physical access. And never trust the client.
The application I maintain does something similar that is database OS independent for around 100 users but in a much simpler fashion. Users are authenticated by the application and authorized from the database. Here are the details:
- a table for users including their email and enabled/disabled status
- a table of all AD groups that have a specific prefix to indicate that they are application groups (eg: APP_ADMINS, APP_USERS)
- a table with group/user links
The next part is synchronizing the information. In our organization if new users are added or permissions for existing users are changed IT does the job in the morning. The application typically has a window of low usage overnight (ie: not 24 hours a day/usage).
On the application web server we have a windows service which syncs the groups and users.
On the database at night I run a scheduled job which truncates the group-user links and recreates them by a direct query to Active Directory using DBMS_LDAP.
For your purposes you would want to write a more sophisticated package that has a database package running three LDAP queries to synchronize groups, users and group users instead of my truncate solution.
I found DBMS_LDAP to be powerful but poorly documented. If the IT department should happen to change the OU that users are in you don't get a lot of useful information from the Oracle end.
Tim's site was very useful with this article and here has the code I reused.
Edit: There are two parts to using an application:
- who are you? (authentication) if you do not supply a name and password listed in Active Directory you are not allowed past the log in page.
- what are you allowed to do? (authorization) Here is where the granularity of permissions has a wide range. We have limited ourselves to a basic set of operations on a portion of a unit of work: Read, Update, Assign other users, Unassign other users. Our permissions are not so granular so they can be worded as "User X has select on this table". They can be better said as "User X
can update this portion of the file if they are assigned".
In part this is driven by the application. It creates a pooled connection to the database as required. Users log onto the application but connect to the database as a shared user who has all the permissions required.
To go into a more detailed example:
User X logs in. They have a username and password that matches what is in Active Directory.
After authentication they are taken to the main page. During that time the application queries the database for what permissions this user has and caches them in memory.
The main page loads each sub work area. Each area asks the cached permissions:
- "Do you have authority to see this area?". If so show the work area.
- " Do you have permission to edit this area?" If so show an edit/create link.
Edit2:
The original poster comments that
We are trying to replicate the user permissions onto application to DB
permissions onto database objects.
This sounds like a square peg/round hole problem to me. Your business logic may be defined as User X needs select on this table but if you ask the user they are working with the application. They need to be able to work with whatever the application is displaying. It is common to group tables and views and custom filters to show what the user needs in the application. This is why some applications find it easier to enforce authorization at the application level.
What is it about your application that requires database permissions to be replicated in Active Directory?
Best Answer
If you have the proper permissions, you can change anyone's password. Of course, if you want to keep the password the same, just "changing" it so that it gets upgraded to new standards, you will need to know the current value.
And you don't have to expire it first. Expiring the password simply forces the user to set a "new" password the next time they log in. And even that depends on what client they are using. Some do not trap and handle expired passwords, and simply fail the logon.
Exactly which oracle doc were you quoting? (Never quote a source without full citation.)