Database Vault Getting Started Guide
Database Vault Getting Started Guide
23ai
F97756-02
December 2024
Oracle Database Vault Database Vault Getting Started Guide, 23ai
F97756-02
This software and related documentation are provided under a license agreement containing restrictions on use and
disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or
allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit,
perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation
of this software, unless required by law for interoperability, is prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If you find
any errors, please report them to us in writing.
If this is software, software documentation, data (as defined in the Federal Acquisition Regulation), or related
documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then
the following notice is applicable:
U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software, any
programs embedded, installed, or activated on delivered hardware, and modifications of such programs) and Oracle
computer documentation or other Oracle data delivered to or accessed by U.S. Government end users are "commercial
computer software," "commercial computer software documentation," or "limited rights data" pursuant to the applicable
Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, reproduction,
duplication, release, display, disclosure, modification, preparation of derivative works, and/or adaptation of i) Oracle
programs (including any operating system, integrated software, any programs embedded, installed, or activated on
delivered hardware, and modifications of such programs), ii) Oracle computer documentation and/or iii) other Oracle
data, is subject to the rights and limitations specified in the license contained in the applicable contract. The terms
governing the U.S. Government's use of Oracle cloud services are defined by the applicable contract for such services.
No other rights are granted to the U.S. Government.
This software or hardware is developed for general use in a variety of information management applications. It is not
developed or intended for use in any inherently dangerous applications, including applications that may create a risk of
personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all
appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its
affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications.
Oracle®, Java, MySQL, and NetSuite are registered trademarks of Oracle and/or its affiliates. Other names may be
trademarks of their respective owners.
Intel and Intel Inside are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used
under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Epyc, and the AMD logo
are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open
Group.
This software or hardware and documentation may provide access to or information about content, products, and
services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all
warranties of any kind with respect to third-party content, products, and services unless otherwise set forth in an
applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not be responsible for any loss,
costs, or damages incurred due to your access to or use of third-party content, products, or services, except as set forth
in an applicable agreement between you and Oracle.
Contents
Preface
Documentation Accessibility v
Related Documents v
Conventions v
5 Command Rules
5.1 Creating a Command Rule to Prevent Destructive Actions 5-1
5.2 Creating a Command Rule That Allows Actions from Specified IP Addresses Only 5-2
5.3 Creating a Command Rule to Control Application Authentication 5-4
iii
6 Creating Unified Audit Policies and Accessing Audit Records
Index
iv
Preface
This quick start guide will help you configure Oracle Database Vault on a single instance
database.
For more advanced configurations, such as those using Oracle Real Application Clusters or
Oracle Data Guard, see the Oracle Database Vault Administrator’s Guide.
Documentation Accessibility
For information about Oracle's commitment to accessibility, visit the Oracle Accessibility
Program website at http://www.oracle.com/pls/topic/lookup?ctx=acc&id=docacc.
Related Documents
The following documents contain information that may be of use when getting started with
Database Vault
• Oracle Database Vault Administrator’s Guide
• Oracle Database Security Guide
• Oracle Label Security Administrator’s Guide
• Oracle Database Administrator’s Guide
• Oracle Database SQL Language Reference
• Oracle Multitenant Administrator's Guide
Conventions
The following text conventions are used in this document:
Convention Meaning
boldface Boldface type indicates graphical user interface elements associated with an
action, or terms defined in text or the glossary.
italic Italic type indicates book titles, emphasis, or placeholder variables for which
you supply particular values.
monospace Monospace type indicates commands within a paragraph, URLs, code in
examples, text that appears on the screen, or text that you enter.
v
1
Overview of Oracle Database Vault
Oracle Database Vault offers data security controls within an Oracle database to restrict
access to application data by privileged users.
Database Vault can help you reduce the risk of insider and outside threats, address
compliance requirements, including separation of duties, as well as minimize the potential of
human error on application data and objects. Database Vault is built into the kernel of the
Oracle database, thus ensuring you are implementing your security controls as close to the
data as possible.
In this quick start guide, you will learn how to configure and enable Oracle Database Vault, how
to use Database Vault realms and command rules to protect data in the sample schema HR,
and how to prevent the use of destructive commands, such as DROP TABLE on HR objects. This
guide will also show you how to configure Unified Audit policies to audit violations of your
realms and command rules.
Oracle Database Vault can do much more than the examples this quick guide describes. For
more information of Oracle Database Vault, refer to the Oracle Database Vault Administrator’s
Guide.
1-1
2
Configuring and Enabling Oracle Database
Vault
To get started with Oracle Database Vault, you must configure it, enable it, and then restart the
Oracle database. In an Oracle multitenant environment, you complete this on the container
database (CDB) and then each of the pluggable databases (PDB).
Oracle recommends creating four accounts to manage key roles within Oracle Database Vault.
Two are primary accounts and two are backup accounts. Store the passwords for these
accounts in a safe place so that you do not lose or forget them. The accounts with the
DV_OWNER role, specifically, become your most critical accounts to never lock and never lose the
passwords to. To minimize the risk of locking the accounts, Oracle recommends creating
specific database profiles to assign to these four accounts.
connect / as sysdba
3. Oracle recommends creating a profile that will not permanently lock the accounts you
created for Oracle Database Vault. You can adjust these to meet your requirements, but
Oracle recommends using the PASSWORD_LOCK_TIME profile parameter to an acceptable
length to allow the account to be unlocked after a reasonable time has passed. In this
example, the following parameter is set to one minute:
2-1
Chapter 2
Configuring Database Vault on the Container Database
4. Assign the profile to the Oracle Database Vault accounts you created:
connect / as sysdba
BEGIN
CONFIGURE_DV (
dvowner_uname => 'c##dvowner',
dvacctmgr_uname => 'c##dvacctmgr',
force_local_dvowner => FALSE);
END;
/
6. Recompile invalid objects. This step is not required but it's recommended to keep invalid
objects to a minimum.
@$ORACLE_HOME/rdbms/admin/utlrp.sql
CONNECT c##dvowner
EXEC DBMS_MACADM.ENABLE_DV;
8. Restart the Oracle database. If you are in an Oracle Real Application Cluster, you can
minimize the downtime by using Oracle Real Application Clusters to perform a rolling
enablement, but in a single instance environment you must take the downtime.
CONNECT / as sysoper
shutdown immediate;
startup;
9. From the container database, verify Oracle Database Vault is configured and enabled in
the CDB root:
connect / as sysdba
NAME STATUS
------------------- --------------
DV_CONFIGURE_STATUS TRUE
2-2
Chapter 2
Configuring Database Vault on a Pluggable Database
DV_ENABLE_STATUS TRUE
DV_APP_PROTECTION NOT CONFIGURED
10. Grant the backup accounts the appropriate Database Vault roles.
For example, the user who is the backup for Oracle Database Vault Owner has the
DV_OWNER role:
CONNECT c##dvowner
GRANT DV_OWNER TO c##dvowner_backup WITH ADMIN OPTION CONTAINER=ALL;
11. Grant the backup accounts the appropriate Database Vault roles.
For example, the user who is the backup for Oracle Database Vault Account Manager has
the DV_ACCTMGR role:
CONNECT c##dvacctmgr
GRANT DV_ACCTMGR TO c##dvacctmgr_backup WITH ADMIN OPTION CONTAINER=ALL;
12. To verify the Database Vault related users have the appropriate roles, query the role
privileges view as a user who has the DBA role:
connect / as sysdba
2-3
Chapter 2
Configuring Database Vault on a Pluggable Database
BEGIN
CONFIGURE_DV (
dvowner_uname => 'c##dvowner',
dvacctmgr_uname => 'c##dvacctmgr');
END;
/
2. Recompile invalid objects. This step is not required but it's recommended to keep invalid
objects to a minimum.
$ORACLE_HOME/rdbms/admin/utlrp.sql
CONNECT c##dvowner@pdb_name
EXEC DBMS_MACADM.ENABLE_DV;
4. As a user with the SYSOPER role, restart the Oracle pluggable database. If you are in an
Oracle Real Application Cluster, you can minimize the downtime by performing rolling
enablement, but in a single instance environment you must take the downtime.
connect / as sysoper
5. If you wish to check the status of Oracle Database Vault in all container and pluggable
databases, you can run the following command from the container database. Now,
Database Vault should be enabled on the container and pluggable databases.
connect / as sysdba
The output should look like the following. Notice the red highlighted rows, demonstrating
both the container and pluggable database have Oracle Database Vault enabled:
Alternatively, if you want to see the container name instead of the container ID, run the
following query:
2-4
Chapter 2
Configuring Database Vault on a Pluggable Database
For more information on the CON_ID_TO_CON_NAME function, review the Oracle Database
SQL Language Reference
2-5
3
Managing Database Users
Oracle recommends using named accounts instead of the generic SYS and SYSTEM accounts.
This section explains how to create database users and separate duties through roles, realms,
command rules, and authorizations.
Once Oracle Database Vault is enabled, separation of duties is enforced through roles, realms,
command rules, and authorizations. For example:
• To create a user, you must have the DV_ACCTMGR role which is granted the CREATE USER
system privilege.
• To protect a schema from database users granted SELECT ANY TABLE system privilege,
create a realm to limit access to only authorized users.
• To stop a user with the DROP TABLE privilege from performing this action, create a
command rule on DROP TABLE.
• To perform an Oracle Data Pump import of a table that is protected by a Database Vault
realm or command rule, you must have the ability to import with Oracle Data Pump and be
granted the Database Vault authorization.
For more information on these controls, see the Oracle Database Vault Administrator’s Guide.
After you have enabled Oracle Database Vault, you will see that SYS is no longer able to
perform certain actions. This is intentional because SYS should not be an account used except
for patching, upgrading, and special circumstances. The SYSTEM account is also an account
that should not be used unless necessary. SYSTEM is a highly privileged account that is difficult
to assign to a single user. Oracle recommends using named accounts (for example, jsmith,
cmack, gkramer, and so on) instead of shared, or generic, accounts.
For example, named accounts can be set up like those in the following table to ensure
separation of duties. You will learn how to set up these accounts in the following topic.
Oracle Database Vault attempts to protect database user accounts from being misused or
abused by privileged users. Once you have configured and enabled Oracle Database Vault,
3-1
Chapter 3
Creating Named Database Accounts
you must have the Oracle Database Vault role DV_ACCTMGR to create a user. This applies to the
ALTER USER and the DROP USER system privileges as well as PROFILE management system
privileges.
Prerequisites
Have an account that has been granted the DV_ACCTMGR role, such as the C##DVACCTMGR user
that you created during Configuring Database Vault on the Container Database. This user
should have the privileges to create accounts and grant the DV_ACCTMGR role to other users.
connect c##dvacctmgr
2. Create a named user account, C##JSMITH and grant them the DV_ACCTMGR role:
connect c##dvowner
4. Grant JSMITH the role of DV_ADMIN with the ability to pass the role on to other users:
Granting DV_ADMIN WITH ADMIN OPTION will allow JSMITH to create, manage and delete
policies, realms, command rules, rules and rule sets but not disable Oracle Database
Vault. These privileges are a subset of the privileges granted to DV_OWNER.
Granting this role to a named account should allow you to securely store the shared
accounts (C##DVOWNER, C##DVOWNER_BACKUP, C##DVACCTMGR, C##DVACCTMGR_BACKUP) and
only use them for emergencies. Day-to-day operations should be completed by database
users who are using their own named credentials.
5. Connect as SYSDBA user:
connect / as sysdba
6. Grant the DBA role to C##JSMITH and include WITH ADMIN OPTION so the user can forward-
grant privileges to other database users:
3-2
Chapter 3
Creating Named Database Accounts
Note:
Oracle recommends creating a subset of system and object privileges in a
custom role, rather than using the DBA role.
3-3
4
Oracle Database Vault Realms
Oracle Database Vault Realms restrict what actions users can take on the database.
In addition to Oracle Database Vault's goal to protect your sensitive data, reduce human error,
and limit insider threats, Oracle Database Vault protects components of the Oracle Database
dictionary and its own dictionary objects.
There are times when, to access certain objects, perform certain administrative tasks, or grant
certain Oracle database roles, you must be authorized by Database Vault to do so.
Oracle Database Vault provides two types of realms: traditional and mandatory. Both realm
types can protect either an entire schema, individual database roles or crucial objects within a
schema selectively, such as tables and indexes.
Traditional realms will respect database users using their direct-object grants.
Mandatory realms require the grant, either direct or granted through a role, and the Database
Vault realm authorization.
In this example, you will authorize C##JSMITH to forward-grant the resource role they have
been granted. To do so, you must add C##JSMITH to a Database Vault default realm.
connect c##jsmith
4-1
Chapter 4
Traditional Realms
connect c##jsmith
REALM_NAME OBJECT_NAME
____________________________________________________ ______________
Oracle System Privilege and Role Management Realm RESOURCE
3. Identify which database users are authorized to access the realm protected objects and,
more specifically, which users have the OWNER realm authorization which will allow them to
forward-grant privileges on objects they hold WITH ADMIN OPTION privileges:
GRANTEE AUTH_OPTIONS
_____________ _______________
SYS Owner
You should not use SYS unless it is necessary. Instead, you should authorize C##JSMITH to the
Oracle System Privilege and Role Management Realm as an owner, thus allowing C##JSMITH
to grant the resource role to other database users.
You have completed the steps to authorize C##JSMITH to the Oracle System Privilege and Role
Management Realm as an owner, thus allowing C##JSMITH to grant the resource role to other
database users.
4-2
Chapter 4
Traditional Realms
• On a Container Database
• On a Pluggable Database
On a Container Database
1. Connect as C##JSMITH:
connect c##jsmith
BEGIN DVSYS.DBMS_MACADM.ADD_AUTH_TO_REALM (
realm_name => 'Oracle System Privilege and Role Management Realm'
,grantee => 'C##JSMITH'
,rule_set_name => null
,auth_options => DBMS_MACUTL.G_REALM_AUTH_OWNER);
END;
/
GRANTEE AUTH_OPTIONS
_____________ _______________
C##JSMITH Owner
SYS Owner
On a Pluggable Database
1. Connect as C##JSMITH on the PDB:
connect c##jsmith@pdb_name
BEGIN DVSYS.DBMS_MACADM.ADD_AUTH_TO_REALM (
realm_name => 'Oracle System Privilege and Role Management Realm'
,grantee => 'C##JSMITH'
,rule_set_name => null
,auth_options => DBMS_MACUTL.G_REALM_AUTH_OWNER
,auth_scope => DBMS_MACUTL.G_SCOPE_LOCAL);
END;
/
4-3
Chapter 4
Traditional Realms
GRANTEE AUTH_OPTIONS
_____________ _______________
C##JSMITH Owner
SYS Owner
Tip:
An advanced configuration would be to create a common role and add that role to the
realm authorized owners list instead of individual database usernames.
For example, create C##ACME_DBA role and add it to Oracle System Privilege and
Role Management Realm as an authorized owner. You can then create a Database
Vault realm to protect who can grant the C##ACME_DBA role.
1. Connect as C##JSMITH:
connect c##jsmith
4. Use the C##JSMITH database user to grant several system privileges to GRKAMER:
GRANT SELECT ANY TABLE, UPDATE ANY TABLE, CREATE ANY TABLE, DROP ANY TABLE
TO GKRAMER;
4-4
Chapter 4
Mandatory Realms
For additional information on default realms and command rules, refer to the Oracle Database
Vault Administrator’s Guide.
connect <user>
4-5
Chapter 4
Mandatory Realms
If your results be different from the table, verify you have configured and enabled Oracle
Database Vault in the container database and created the users and granted the appropriate
privileges.
Notice the Database Vault related accounts C##DVOWNER and C##DVACCTMGR do not have the
system or object privileges required to access the HR.EMPLOYEES table. These accounts are
not intended to access data, only perform Database Vault administrative activities
Prerequisites
Have an account that has been granted the DV_ACCTMGR or DV_OWNERrole, such as the
C##JSMITH user that you created during Creating Named Database Accounts.
4-6
Chapter 4
Mandatory Realms
connect c##jsmith@pdb_name
BEGIN
DVSYS.DBMS_MACADM.CREATE_REALM(
realm_name => 'Protect HR tables'
,description => 'Mandatory realm to protect HR tables'
,enabled => dbms_macutl.g_yes
,audit_options => null
,realm_type => dbms_macadm.mandatory_realm);
END;
/
Note:
If you are using Oracle Database 19c or earlier, and traditional auditing, you can
specify a value for audit_options instead of null. For more information, see the
Oracle Database Vault Administrator’s Guide for Oracle Database 19c.
3. Add the objects you wish to protect with the new realm. You could specify a wildcard (%)
for the OBJECT_TYPE parameter and protect all existing and new objects in a schema.
In this example, you will separate TABLES and VIEWS into a single realm, and INDEXES into a
separate realm in the following example.
BEGIN
DVSYS.DBMS_MACADM.ADD_OBJECT_TO_REALM(
realm_name => 'Protect HR tables'
,object_owner => 'HR'
,object_name => '%'
,object_type => 'TABLE');
END;
/
BEGIN
DVSYS.DBMS_MACADM.ADD_OBJECT_TO_REALM(
realm_name => 'Protect HR tables'
,object_owner => 'HR'
,object_name => '%'
,object_type => 'VIEW');
END;
/
4. Authorize the users to access the realm-protected tables and views. In a mandatory realm
you will also authorize the object owner.
In this example, you will authorize HR to access its own objects.
BEGIN
DVSYS.DBMS_MACADM.ADD_AUTH_TO_REALM(
realm_name => 'Protect HR tables'
,grantee => 'HR'
4-7
Chapter 4
Mandatory Realms
BEGIN
DVSYS.DBMS_MACADM.UPDATE_REALM(
realm_name => 'Protect HR tables'
,description => 'Mandatory realm to protect HR tables'
,enabled => dbms_macutl.g_simulation
,audit_options => null
,realm_type => dbms_macadm.mandatory_realm);
END;
/
• Enforcement mode: Oracle Database Vault enforcement mode means the mandatory
realm will enforce the controls on the objects it is protecting and allow database users
access if they maintain the appropriate system or object privileges and authorization to
the realm.
Set the ENABLED parameter to DBMS_MACUTL.G_YES
BEGIN
DVSYS.DBMS_MACADM.UPDATE_REALM(
realm_name => 'Protect HR tables'
,description => 'Mandatory realm to protect HR tables'
,enabled => dbms_macutl.g_yes
,audit_options => null
,realm_type => dbms_macadm.mandatory_realm);
END;
/
For more information on Oracle Database Vault simulation mode, see the Troubleshooting and
Tracing Errors section in the Oracle Database Vault Administrator’s Guide.
connect c##jsmith
4-8
Chapter 4
Mandatory Realms
BEGIN
DVSYS.DBMS_MACADM.CREATE_REALM(
realm_name => 'Protect HR indexes'
,description => 'Mandatory realm to protect HR indexes'
,enabled => dbms_macutl.g_yes
,audit_options => null
,realm_type => dbms_macadm.mandatory_realm);
END;
/
Note:
If you are using Oracle Database 19c or earlier, and traditional auditing, you can
specify a value for audit_options instead of null. For more information, see the
Oracle Database Vault Administrator’s Guide.
BEGIN
DBMS_MACADM.ADD_OBJECT_TO_REALM(
realm_name => 'Protect HR indexes'
,object_owner => 'HR'
,object_name => '%'
,object_type => 'INDEX');
END;
/
BEGIN
DVSYS.DBMS_MACADM.ADD_AUTH_TO_REALM(
realm_name => 'Protect HR indexes'
,grantee => 'HR'
,rule_set_name => null
,auth_options => dbms_macutl.g_realm_auth_owner);
END;
/
5. Add the DBA, in this case GKRAMER, as a realm-authorized owner so that they can perform
index creation, deletion, and updates:
BEGIN
DVSYS.DBMS_MACADM.ADD_AUTH_TO_REALM(
realm_name => 'Protect HR indexes'
,grantee => 'GKRAMER'
,rule_set_name => null
,auth_options => dbms_macutl.g_realm_auth_owner);
END;
/
4-9
5
Command Rules
A command rule protects Oracle Database SQL statements that affect one or more database
objects. These statements can include SELECT, ALTER SYSTEM, database definition language
(DDL), and data manipulation language (DML) statements. To customize and enforce the
command rule, you associate it with a rule set, which is a collection of one or more rules. The
command rule is enforced at run time. Command rules affect anyone who tries to use the SQL
statements it protects, regardless of the realm in which the object exists.
1. Connect as C##JSMITH:
connect c##jsmith
BEGIN
DVSYS.DBMS_MACADM.CREATE_COMMAND_RULE(
command => 'DROP TABLE'
,object_owner => 'HR'
,object_name => '%'
,rule_set_name => 'Disabled'
,enabled => dbms_macutl.g_yes);
END;
/
As a result of this command rule, all users who perform the DROP TABLE command on HR
schema objects will be considered in violation of the Database Vault command rule as the
rule set specifies the command should be Disabled.
Because the result of the Disabled rule set will always return false, the command rule will
disable DROP TABLE commands on the HR schema for all database users, including the HR
database schema itself.
The rule_set_name of Disabled may appear counterintuitive because neither the
Database Vault command rule nor the rule set are disabled. Instead, the Disabled rule set
contains a rule with a rule expression that will always returns false, never allowing the
command associated with the rule set to run.
5-1
Chapter 5
Creating a Command Rule That Allows Actions from Specified IP Addresses Only
You can view the rule expression SQL using the following:
RULE_NAME RULE_EXPR
-------------------- --------------------
False 1=0
If you do not want to disable DROP TABLE commands on the HR schema in all situations, you
can use a custom Database Vault rule set to identify when the command can be used.
3. If you want to switch the command rule to be in simulation mode, instead of enforced, set
the ENABLED parameter to DBMS_MACUTL.G_SIMULATION instead of DBMS_MACUTL.G_YES:
BEGIN
DVSYS.DBMS_MACADM.UPDATE_COMMAND_RULE(
command => 'DROP TABLE'
,object_owner => 'HR'
,object_name => '%'
,rule_set_name => 'Disabled'
,enabled => dbms_macutl.g_simulation);
END;
/
Simulation (non-enforcement) mode: Oracle Database Vault simulation mode allows you to
identify which users are accessing data you want to protect with an Oracle Database Vault
realm. Only violations of the Database Vault realm authorization list will be recorded.
4. To identify the users who violated the command rule, query the
DVSYS.DBA_DV_SIMULATION_LOG view.
For more information on Oracle Database Vault simulation mode, see the Troubleshooting and
Tracing Errors section in the Oracle Database Vault Administrator’s Guide.
connect c##jsmith
5-2
Chapter 5
Creating a Command Rule That Allows Actions from Specified IP Addresses Only
BEGIN
DBMS_MACADM.CREATE_RULE(
rule_name => 'Trusted IP Address'
,rule_expr => 'sys_context(''userenv'',''ip_address'') = ''<IP
Address>'' ');
END;
/
The rule will return TRUE only if the IP address of the connected user's session equals the
IP address in the rule expression. This could be an IN list or a not equals. You could
compare a hostname instead or a portion of a hostname.
3. Create a rule set:
BEGIN
DVSYS.DBMS_MACADM.CREATE_RULE_SET(
rule_set_name => 'Trusted Rule Set'
,description => 'A rule set for controlling access by IP
address'
,enabled => 'Y'
,eval_options => dbms_macutl.g_ruleset_eval_any
,audit_options => null
,fail_options => dbms_macutl.g_ruleset_fail_show
,fail_message => 'Access is blocked. Contact the IT helpdesk.'
,fail_code => '-20000'
,handler_options => dbms_macutl.g_ruleset_handler_off
,handler => null
,is_static => true);
END;
/
Rule sets have the option of returning the general error message or a custom error
message. In the example below, you provide a detailed error message to the end user that
tells them to speak to their security team.
4. Add the rule from step two to the rule set:
BEGIN
DVSYS.DBMS_MACADM.ADD_RULE_TO_RULE_SET(
rule_set_name => 'Trusted Rule Set'
,rule_name => 'Trusted IP Address');
END;
/
Rule sets can consist of multiple rules that all must be met (true) or at least one rule must
be true. Rules can be used in multiple rule sets. However, if you change the rule then the
changes will apply to all rule sets the rule is used in.
5. Update the existing command rule to use the new rule set:
BEGIN
DVSYS.DBMS_MACADM.UPDATE_COMMAND_RULE(
command => 'DROP TABLE'
5-3
Chapter 5
Creating a Command Rule to Control Application Authentication
connect c##jsmith@pdb_name
BEGIN
DBMS_MACADM.CREATE_RULE(
rule_name => 'Trusted Application IP Address'
,rule_expr => 'sys_context(''userenv'',''ip_address'') = ''<IP
Address>'' ');
END;
/
BEGIN
DBMS_MACADM.CREATE_RULE(
rule_name => 'Trusted Application Hostname'
,rule_expr => 'sys_context(''userenv'',''host'') = ''appserver''
');
END;
/
BEGIN
DBMS_MACADM.CREATE_RULE(
rule_name => 'Trusted Application OS USer'
,rule_expr => 'sys_context(''userenv'',''os_user'') = ''appuser''
');
5-4
Chapter 5
Creating a Command Rule to Control Application Authentication
END;
/
BEGIN
DBMS_MACADM.CREATE_RULE(
rule_name => 'Trusted Application Program'
,rule_expr => 'sys_context(''userenv'',''client_program_name'') =
''<client program name>'' ');
END;
/
BEGIN
DVSYS.DBMS_MACADM.CREATE_RULE_SET(
rule_set_name => 'Trusted Application Path'
,description => 'Controlling access to the application'
,enabled => 'Y'
,eval_options => dbms_macutl.g_ruleset_eval_all
,audit_options => null
,fail_options => dbms_macutl.g_ruleset_fail_show
,fail_message => 'Unauthorized application usage. Contact the
IT helpdesk.'
,fail_code => '-20000'
,handler_options => dbms_macutl.g_ruleset_handler_off
,handler => null
,is_static => true);
END;
/
By setting the EVAL_OPTIONS parameter to ALL, all rules must evaluate to true for this rule
set to evaluate to true.
4. Add each of the rules from step to the rule set:
• BEGIN
DVSYS.DBMS_MACADM.ADD_RULE_TO_RULE_SET(
rule_set_name => 'Trusted Application Path'
,rule_name => 'Trusted Application IP Address');
END;
/
• BEGIN
DVSYS.DBMS_MACADM.ADD_RULE_TO_RULE_SET(
rule_set_name => 'Trusted Application Path'
,rule_name => 'Trusted Application Hostname');
END;
/
• BEGIN
DVSYS.DBMS_MACADM.ADD_RULE_TO_RULE_SET(
rule_set_name => 'Trusted Application Path'
,rule_name => 'Trusted Application OS User');
5-5
Chapter 5
Creating a Command Rule to Control Application Authentication
END;
/
• BEGIN
DVSYS.DBMS_MACADM.ADD_RULE_TO_RULE_SET(
rule_set_name => 'Trusted Application Path'
,rule_name => 'Trusted Application Program);
END;
/
5. Create a command rule that will evaluate the Trusted Application Path rule set when HR
attempts to connect:
BEGIN
DVSYS.DBMS_MACADM.CREATE_CONNECT_COMMAND_RULE(
user_name => 'HR'
,rule_set_name => 'Trusted Application Path'
,enabled => dbms_macutl.g_yes);
END;
/
connect hr@pdb_name
7. Disable the command rule you just created to continue with other examples in this guide:
a. Connect as C##JSMITH:
connect c##jsmith@pdb_name
BEGIN
DVSYS.DBMS_MACADM.UPDATE_CONNECT_COMMAND_RULE(
user_name => 'HR'
,rule_set_name => 'Trusted Application Path'
,enabled => dbms_macutl.g_no);
END;
/
5-6
Chapter 5
Creating a Command Rule to Control Application Authentication
ENABLED
__________
N
5-7
6
Creating Unified Audit Policies and Accessing
Audit Records
In Oracle Database Vault 23ai, the unified audit trail is protected and not accessible unless the
proper Oracle Database Vault authorization is given. This protection extends to privileged
users, such as SYS and SYSTEM, users with DBA role, and users with AUDIT_VIEWER or
AUDIT_ADMIN roles.
To perform this task in Oracle Database 23ai, you will do the following:
1. Grant the AUDIT_ADMIN role WITH ADMIN OPTION
2. Use the DV_OWNER role to authorize AUDIT_ADMIN for the user
Because you are enforcing separation of duties, you will use two distinct database users to
create this new database user. For example:
1. Connect as C##JSMITH:
connect c##jsmith
connect c##jsmith@pdb_name
connect c##cmack@pdb_name
The expected outcome for both users, on Oracle Database 23ai, is ORA-1031,
insufficient privileges.
6-1
Chapter 6
4. Authorize C##CMACK to use their AUDIT_ADMIN role on the container database and each
pluggable database:
connect c##jsmith
EXEC DBMS_MACADM.AUTHORIZE_AUDIT_ADMIN('C##CMACK');
connect c##jsmith@pdb_name
EXEC DBMS_MACADM.AUTHORIZE_AUDIT_ADMIN('C##CMACK');
C##CMACK can now query and managed the unified auditing operations in both the
container database and each pluggable database. However, C##JSMITH still can't.
Caution:
C##JSMITH could grant themselves authorization to AUTHORIZE_AUDIT_ADMIN. This
is a simple example with minimal separation of duties. To fully protect C##JSMITH
from granting themselves the authorization, the user should not have both
AUDIT_ADMIN and DV_ADMIN roles granted to them. To minimize the risk and
enforce separation of duties, you would designate a separate user to grant the
AUDIT_ADMIN role.
connect c##cmack@pdb_name
connect c##cmack@pdb_name
6-2
Chapter 6
SELECT POLICY_NAME
FROM AUDIT_UNIFIED_ENABLED_POLICIES
WHERE POLICY_NAME LIKE 'AUD%'
ORDER BY 1;
POLICY_NAME
_________________________________
AUD_PROTECT_HR_INDEXES
AUD_PROTECT_HR_TABLES
AUD_PROTECT_RULE_SET_TRS
4. To generate audit events, query the HR.EMPLOYEES table as each of the following user:
• SYS
• SYSTEM
• C##DVOWNER
• C##DVACCTMGR
• C##JSMITH
• C##CMACK
• GKRAMER
• HR
a. Connect as <user>:
connect <user>
6-3
Chapter 6
5. As C##CMACK, query the Unified Audit view to identify Database Vault related records and
compare the results to the table below:
6-4
Chapter 6
6-5
7
Authorizing DDL on a Different Schema
In an Oracle Database Vault environment, when a schema is protected by a realm or has
access to realm protected objects, through realm authorization or object privileges, then the
schema automatically has DDL controls applied to it to prevent a malicious actor from
performing DDL modifications.
The only unexpected failure from the previous test is GKRAMER should be authorized to perform
index creation in the HR schema.
For example, if a malicious user had privileges to modify a procedure in the HR schema, then
they could insert malicious code into the procedure, and it would be trusted by the Database
Vault realm. To avoid this situation, Oracle Database Vault enforces controls on DDL
statements.
To allow GKRAMER to perform CREATE INDEX for HR objects, you must authorize GKRAMER to
perform DDL:
1. Connect as C##JSMITH to the pluggable database:
connect c##jsmith@pdb_name
EXEC DBMS_MACADM.AUTHORIZE_DDL('GKRAMER','HR');
3. Since you only changed the DDL authorization for GKRAMER, you will only retest the
commands for GRKAMER:
a. Connect as GRKAMER:
connect GRKAMER
c. As C##CMACK, query the Unified Audit view to identify Database Vault related records
and compare the results to the table below:
7-1
Chapter 7
You will also see GKRAMER cannot drop the index they created. This is because of the
Database Vault command rule you created preventing DROP INDEX commands on the
HR schema.
7-2
Chapter 7
Note:
If you have upgraded from an earlier Oracle Database release, you may see
(%,%) in the DBA_DV_DDL_AUTH view. As this authorization was added in a
later release, Oracle chose to allow the existing DDL-allowed behavior to
continue. If you are performing a new installation of Oracle Database 19c or
later, you will not have the (%,%) authorization.
7-3
8
Performing a Data Pump Export of an
Application Schema
When you want to export data that is protected by Oracle Database Vault realms or command
rules, you must authorize the user to perform the task. Because Database Vault is enforcing a
mandatory access control policy, only having the system privileges to perform an Oracle Data
Pump export is not enough.
If the user is expected to perform Oracle Data Pump full database export, import into another
schema, or transportable tablespace operations, then they must have additional authorizations
and configuration. For more information on these scenarios, please see DBA Operations in an
Oracle Database Vault Environment in the Oracle Database Vault Administrator's Guide.
This quick start guide will focus on two types of Oracle Data Pump exports:
1. Full-schema exports
2. Table-only exports
If you are not exporting the schema or table as the schema owner, then you must have the
appropriate Oracle Database system roles to perform an export. You will create a dedicated
database user to perform these two export operations.
1. As C##JSMITH, create a PDB database user named DP_MGR:
a. Connect as C##JSMITH to the pluggable database:
connect c##jsmith@pdb_name
You will encounter the following error for each of the table data objects you are attempting
to export. This is because the objects are protected by the Database Vault realm, Protect
HR tables.
3. Identify the database users who have system privileges to perform Data Pump exports or
imports:
8-1
Chapter 8
connect c##jsmith@pdb_name
4. Authorize DP_MGR to only export a single table based on their database privileges.
With Oracle Database Vault enabled on the pluggable database, it is necessary to
authorize users to use their privileges. System privileges are not enough to perform the
Data Pump export.
You will find the HR.EMPLOYEES table has been exported but you will still receive ORA-31693
errors for all other schema tables and views.
7. To perform the Data Pump Export, without the Database Vault violations, you must specify
the HR.EMPLOYEES table for export:
8. To authorize DP_MGR to export a schema, based on their database privileges, revoke the
table-specific authorization, and authorize the schema export:
8-2
Chapter 8
9. Review the Oracle Database Vault Data Pump authorizations. Only HR schema exports by
DP_MGR should be authorized:
10. Authorize DP_MGR to export schema, based on their database privileges, run the following
command:
Note:
This does not include performing a full Oracle Data Pump export. To perform a
full export, the DP_MGR requires the DV_OWNER role. It is recommended to be more
specific than full Data Pump exports. Export specific schemas or objects based
on your requirements rather than the full database.
11. Review the Oracle Database Vault Data Pump authorizations for DP_MGR:
Now, your DP_MGR user can perform a Data Pump export like this example:
12. To revoke the authorizations for DP_MGR to use their database privileges, run the following
command:
exec dbms_macadm.unauthorize_datapump_user('DP_MGR');
The query to review your Data Pump authorizations should return no row:
8-3
9
Separating Container Administrators from
application data
Beginning with Oracle Database Vault 19c, operations control allows you to separate
containers administrators (C## users) from the non-Oracle-maintained data in pluggable
databases.
For example, C##JSMITH would not be able to query the HR.EMPLOYEES table in the PDB1
pluggable database.
After you have configured and enabled Oracle Database Vault in the container database, it is
easy to enable operations control.
connect / as sysdba
connect c##dvowner
EXEC DBMS_MACADM.ENABLE_APP_PROTECTION;
9-1
Chapter 9
connect / as sysdba
9-2
10
Cleaning Up After the Quick Start Guide
If you've completed the tasks in this Quick Start Guide in your databases then there are a
number of changes that should be reverted.
As a user with the DV_OWNER or DV_ADMIN role, perform the following:
connect c##dvowner
EXEC DBMS_MACADM.DISABLE_APP_PROTECTION;
connect / as sysdba
2. Delete the command rules, realms, and associated rules and rule sets
connect c##jsmith@pdb_name
BEGIN
DBMS_MACADM.DELETE_COMMAND_RULE(
command => 'DROP TABLE'
,object_owner => 'HR'
,object_name => '%'
,scope => DBMS_MACUTL.G_SCOPE_LOCAL);
END;
/
BEGIN
DBMS_MACAM.DELETE_RULE_SET(
rule_set_name => 'Trusted Rule Set');
END;
/
BEGIN
DBMS_MACAM.DELETE_RULE(
rule_name => 'Trusted IP Address');
END;
/
BEGIN
DVSYS.DBMS_MACADM.DELETE_REALM_CASCADE(realm_name => 'Protect HR
10-1
Chapter 10
tables');
END;
/
BEGIN
DVSYS.DBMS_MACADM.DELETE_REALM_CASCADE(realm_name => 'Protect HR
indexes');
END;
/
3. As a user who has the privileges to administer unified audit policies, delete the unified
audit policies:
connect c##cmack@pdb_name
4. To drop the users in this example, perform the following as a user with the DV_ACCTMGR
role:
connect c##dvacctmgr
5. Before you can drop JSMITH, you must revoke DV_ADMIN. This is a mechanism to prevent
the accidental, or intentional, destruction of privileged Database Vault users:
connect c##dvowner
connect c##dvacctmgr
6. Disable Oracle Database Vault on the pluggable and container databases. You will perform
the disablement in reverse order of the enablement. To enable, you started with the
10-2
Chapter 10
container database and moved to the pluggable databases. To disable, you will start on the
pluggable databases then move to the container database.
a. In the pluggable database, as a user with the DV_OWNER role, perform the following:
CONNECT c##dvowner@pdb_name
connect / as sysdba
CONNECT c##dvowner
EXEC DBMS_MACADM.DISABLE_DV;
connect / as sysdba
SHUTDOWN IMMEDIATE;
STARTUP;
10-3
Chapter 10
10-4
11
Applying Oracle Database Patches
You can upgrade or apply patches to the Oracle database while Database Vault is enabled by
granting a special role to SYS. As a user with the DV_OWNER role, grant DV_PATCH_ADMIN to SYS
for all pluggable databases.
From the container database:
1. Connect as a user with the DV_OWNER role:
connect c##dvowner
connect c##dvowner
b. Revoke DV_PATCH_ADMIN:
11-1
12
Troubleshooting and Tracing Errors
Occasionally, you will need to troubleshoot authorizations or the lack of authorization to
application objects, database system privileges or roles, or other activities. Here are some
steps you can follow to help you identify the problem.
connect c##jsmith@pdb_name
SELECT VIEW_NAME
FROM DBA_VIEWS
WHERE VIEW_NAME LIKE 'DBA_DV_%'
ORDER BY 1;
The most common views you will work with are as follows:
12-1
Chapter 12
Most Common Database Vault Views
DV_OWNERDV_ADMINDV_SECANALYST
connect c##jsmith@pdb_name
SELECT * FROM (
SELECT REALM_NAME, 'PROTECTED OBJECTS' COL2, OWNER COL3, OBJECT_TYPE
COL4 ,OBJECT_NAME COL5
FROM DVSYS.DBA_DV_REALM_OBJECT
UNION
SELECT REALM_NAME, 'AUTHORIZATIONS' COL2, GRANTEE COL3,
AUTH_RULE_SET_NAME COL4, AUTH_OPTIONS COL5
FROM DVSYS.DBA_DV_REALM_AUTH)
WHERE REALM_NAME IN (SELECT NAME FROM DBA_DV_REALM WHERE ORACLE_SUPPLIED
= 'NO')
ORDER BY REALM_NAME ASC, COL2 DESC;
If you followed the examples in this quick start guide, you would end up with results like this:
To view user-defined Database Vault command rules, and their associates rule set and rules,
you could use a query like this:
12-2
Chapter 12
Realm and Command Rule Enforcement Simulation
If you followed the examples in this quick start guide, you would end up with results like this:
For more detailed scripts to collect Oracle Database Vault information, refer to to My Oracle
Support Doc ID 1352556.1, Script To List The Database Vault Realms, Command Rules And
Rule Sets.
connect c##jsmith@pdb_name
BEGIN
DVSYS.DBMS_MACADM.UPDATE_REALM(
realm_name => 'Protect HR tables'
,description => 'Mandatory realm to protect HR tables'
,enabled => dbms_macutl.g_simulation
,audit_options => null
,realm_type => dbms_macadm.mandatory_realm);
END;
/
ENABLED
__________
S
12-3
Chapter 12
Realm and Command Rule Enforcement Simulation
connect gkramer@pdb_name
5. Once you complete your activity, you should review the simulation log to see what would
have been prevented by the realm if it was still in enforcement mode:
connect c##jsmith@pdb_name
Note:
Simulation mode does not create records for activity that would be authorized by
the realm or command rule. Only activity that would have been denied is
recorded in the simulation log.
6. After you have completed your simulation exercise, Oracle recommends deleting all rows
from the simulation log table to not confuse yourself if you perform the action again. As a
user with the DV_OWNER role, run the following commands:
connect c##jsmith@pdb_name
BEGIN
DVSYS.DBMS_MACADM.UPDATE_REALM(
realm_name => 'Protect HR tables'
,description => 'Mandatory realm to protect HR tables'
,enabled => dbms_macutl.g_yes
,audit_options => null
,realm_type => dbms_macadm.mandatory_realm);
END;
/
12-4
Chapter 12
Tracing Database Vault Activity
ENABLED
__________
Y
To enable tracing:
1. Connect as C##JSMITH on the pluggable database:
connect c##jsmith@pdb_name
2. Enable tracing:
3. Run a command that will fail and show up in the trace log:
a. Connect as GKRAMER on the pluggable database:
connect gkramer@pdb_name
cd $ORACLE_BASE/diag
12-5
Chapter 12
Tracing Database Vault Activity
./rdbms/free/FREE/trace/FREE_ora_225318_QS_DV_trace.trc
vi ./rdbms/free/FREE/trace/FREE_ora_225318_QS_DV_trace.trc
In the trace file, you will see the result of the command and the specific realm that is
protecting the object. Protect HR Tables is the realm protecting the HR.EMPLOYEES table:
5. When you are finished, you will disable the tracing event and, if appropriate, revoke the
DV_ADMIN role.
You should not revoke DV_ADMIN from C##JSMITH in this example.
a. Connect as C##JSMITH on the pluggable database:
connect c##jsmith@pdb_name
b. Disable tracing:
If the advice in this section does not help you resolve your issues, submit a Support Request
and include the relevant information about your environment and Database Vault settings.
Uploading the results of MOS 1352556.1 Script To List The Database Vault Realms, Command
Rules And Rule Sets, will help your support engineer identify your issue more effectively.
12-6
Glossary
Glossary-1
Index
Index-1