denrepo

OracleSecurity & users

CMU step 7: map AD users and groups

Creates database users and roles tied to AD, the way Oracle's 19c guide recommends: users log in through a shared schema mapped to an AD group, which gets minimal privileges, and get everything else from global roles mapped to other AD groups. Access is then granted or removed in AD. Admin privileges can't go through roles, so they go on a shared schema of their own. Replace every DN before running.

Changes data19c

Not yet verified. How scripts are tested

This script changes the database. Check the names and values before you run it.
ora-cmu-map.sql
1-- In the PDB from step 6. Replace each DN with the real one from AD.2 3-- Shared schema: everyone in this AD group logs in to one database user.4-- Keep its privileges minimal. Put an AD user in only one group mapped to a schema.5CREATE USER ad_app_users IDENTIFIED GLOBALLY AS 'CN=Oracle App Users,OU=Groups,DC=corp,DC=example,DC=com';6GRANT CREATE SESSION TO ad_app_users;7 8-- Global role: members of this AD group get the role's privileges when they log in.9-- A session can have at most 150 enabled roles.10CREATE ROLE ad_app_read IDENTIFIED GLOBALLY AS 'CN=Oracle App Readers,OU=Groups,DC=corp,DC=example,DC=com';11GRANT SELECT ON <app_schema>.<table_name> TO ad_app_read;12 13-- Admin privileges can't be granted to roles: use a shared schema per privilege.14-- Needs the admin setup in step 6 first.15-- CREATE USER ad_backup_admins IDENTIFIED GLOBALLY AS 'CN=Oracle Backup Admins,OU=Groups,DC=corp,DC=example,DC=com';16-- GRANT SYSBACKUP TO ad_backup_admins;17 18-- Exclusive schema: one AD user gets their own database user. More upkeep,19-- since joiners and leavers then need changes in every database.20-- CREATE USER jsmith IDENTIFIED GLOBALLY AS 'CN=John Smith,OU=Users,DC=corp,DC=example,DC=com';21-- GRANT CREATE SESSION TO jsmith;

Save it as ora-cmu-map.sql and run it with SQL> @ora-cmu-map.

Open in denrepo

Part of these runbooks

More Oracle scripts: Security & users