7 Configuring Factors
Factors allow you to create and use complex attributes through PL/SQL to make Oracle Database Vault authorization decisions.
- What Are Factors?
A factor is a named variable or attribute, such as a database IP address, that Oracle Database Vault can recognize. - Default Factors
Oracle Database Vault provides a set of default factors. - Creating a Factor
In general, to create a factor, you first create the factor itself, and then you edit the factor to include its identity. - Adding an Identity to a Factor
After you create a new factor, you optionally can add an identity to it. - Modifying a Factor
You can use theDBMS_MACADM.UPDATE_FACTOR
procedure to modify the definition of a factor. - Deleting a Factor
Before you delete a factor, you must remove references to the factor. - How Factors Work
Oracle Database Vault processes factors when a session is established. - Tutorial: Preventing Ad Hoc Tool Access to the Database
This tutorial demonstrates how to use factors to prevent ad hoc tools (such as SQL*Plus) from accessing the database. - Guidelines for Designing Factors
Oracle provides guidelines for designing factors. - How Factors Affect Performance
The complexity of factors affects the performance of your Oracle database instance. - Factor Related Reports and Data Dictionary Views
Oracle Database Vault provides reports and data dictionary views that display information about factors and their identities.
What Are Factors?
A factor is a named variable or attribute, such as a database IP address, that Oracle Database Vault can recognize.
You can use factors for activities such as authorizing database accounts to connect to the database or creating filtering logic to restrict the visibility and manageability of data.
Oracle Database Vault provides a selection of factors that lets you set controls on such components as the domain for your site, IP addresses, databases, and so on. You also can create custom factors, using your own PL/SQL retrieval methods. However, for the vast majority of cases, you can use the SYS_CONTEXT
PL/SQL function to create rules on the most commonly used factors that are readily available in the database. Such factors as Session_User
, Proxy_User
, Network_Protocol
, and Module
are available through the SYS_CONTEXT
function.
Factors have powerful capabilities that are used in conjunction with Oracle Label Security and for other database attributes that are not already available through context parameters. Commonly available factors are listed in this section, but Oracle recommends that you use the SYS_CONTEXT
function in the rule definitions for these factors. Only create and use factors that are not already available through SYS_CONTEXT
.
Note the following:
-
You can use factors in combination with rules in rule sets. The
DVF
factor functions are factor-specific functions that you can use in rule expressions. -
Factors have values (identities) and are further categorized by their factor types.
-
You also can integrate factors with Oracle Label Security labels.
-
You can run reports on the factors that you create in Oracle Database Vault.
-
You only can create factors in a PDB, not in the CDB root or the application root.
Default Factors
Oracle Database Vault provides a set of default factors.
For each of these factors, there is an associated function that retrieves the value of the factor.
You can create custom factors by using your own PL/SQL retrieval methods. A useful PL/SQL function you can use (which is used for many of the default factors) is the SYS_CONTEXT
SQL function, which retrieves data about the user session. For example, you can use the CLIENT_PROGRAM_NAME
attribute of SYS_CONTEXT
to find the name of the program used for the database session. After you create the custom factor, you can query its values similar to the functions used to query the default factors.
You can use the default factors in your own security configurations. If you do not need them, you can remove them. (That is, they are not needed for internal use by Oracle Database Vault.)
The default factors are as follows:
-
Authentication_Method
is the method of authentication. In the list that follows, the type of user is followed by the method returned:-
Password-authenticated enterprise user, local database user, user with the
SYSDBA
orSYSOPER
administrative privilege using the password file; proxy with user name using password:PASSWORD
-
Kerberos-authenticated enterprise user or external user (with no administrative privileges):
KERBEROS
-
Kerberos-authenticated enterprise user (with administrative privileges):
KERBEROS_GLOBAL
-
Kerberos-authenticated external user (with administrative privileges):
KERBEROS_EXTERNAL
-
SSL-authenticated enterprise or external user (with no administrative privileges):
SSL
-
SSL-authenticated enterprise user (with administrative privileges):
SSL_GLOBAL
-
SSL-authenticated external user (with administrative privileges):
SSL_EXTERNAL
-
Radius-authenticated external user:
RADIUS
-
OS-authenticated external user, or user with the
SYSDBA
orSYSOPER
administrative privilege:OS
-
Proxy with certificate, DN, or username without using password:
NONE
-
Background process (job queue slave process):
JOB
-
Parallel Query Slave process:
PQ_SLAVE
For non-administrative connections, you can use the Identification_Type factor to distinguish between external and enterprise users when the authentication method is
PASSWORD
,KERBEROS
, orSSL
. For administrative connections, the Authentication_Method factor is sufficient for thePASSWORD
,SSL_EXTERNAL
, andSSL_GLOBAL
authentication methods. -
-
Client Identifier
is an identifier that is set by the application through theDBMS_SESSION.SET_IDENTIFIER
procedure, the Oracle Call Interface (OCI) attributeOCI_ATTR_CLIENT_IDENTIFIER
, or Oracle Dynamic Monitoring Service (DMS). Various Oracle Database components use this attribute to identify lightweight application users who authenticate as the same database user. -
Client_IP
is the IP address of the machine from which the client is connected. -
Database_Domain
is the domain of the database as specified in theDB_DOMAIN
initialization parameter. -
Database_Hostname
is the host name of the computer on which the instance is running. -
Database_Instance
is the instance identification number of the current instance. -
Database_IP
is the IP address of the computer on which the instance is running. -
Database_Name
is the name of the database as specified in theDB_NAME
initialization parameter. -
DBlink_Info
is the source of a database link session. The string has this form:SOURCE_GLOBAL_NAME=dblink_src_global_name,
DBLINK_NAME=dblink_name,
SOURCE_AUDIT_SESSIONID=dblink_src_audit_sessionid
In this specification:
-
dblink_src_global_name
is the unique global name of the source database -
dblink_name
is the name of the database link on the source database -
dblink_src_audit_sessionid
source database that initiated source database that initiated the connection to the remote database usingdblink_name
-
-
Domain
is a named collection of physical, configuration, or implementation-specific factors in the run-time environment (for example, a networked IT environment or subset of it) that operates at a specific sensitivity level. You can identify a domain using factors such as host name, IP address, and database instance names of the Database Vault nodes in a secure access path to the database. Each domain can be uniquely determined using a combination of the factor identifiers that identify the domain. You can use these identifying factors and possibly additional factors to define the Maximum Security Label within the domain. This restricts data access and commands, depending on the physical factors about the Database Vault session. Example domains of interest may be Corporate Sensitive, Internal Public, Partners, and Customers. -
Enterprise_Identity
is the enterprise-wide identity for the user:-
For enterprise users: the Oracle Internet Directory-distinguished name (DN).
-
For external users: the external identity (Kerberos principal name, Radius and DCE schema names, operating system user name, certificate DN).
-
For local users and
SYSDBA
andSYSOPER
logins: NULL.
The value of the attribute differs by proxy method:
-
For a proxy with DN: the Oracle Internet Directory DN of the client.
-
For a proxy with certificate: the certificate DN of the client for external users; the Oracle Internet Directory DN for global users.
-
For a proxy with user names: the Oracle Internet Directory DN if the client is an enterprise user; NULL if the client is a local database user.
-
-
Identification_Type
is the way the user schema was created in the database. Specifically, it reflects theIDENTIFIED
clause in theCREATE USER
andALTER USER
syntax. In the list that follows, the syntax used during schema creation is followed by the identification type returned:-
IDENTIFIED BY
password
:LOCAL
-
IDENTIFIED EXTERNALLY
:EXTERNAL
-
IDENTIFIED GLOBALLY
:GLOBAL SHARED
-
IDENTIFIED GLOBALLY
AS DN
:GLOBAL PRIVATE
-
GLOBAL EXCLUSIVE
for exclusive global user mapping -
GLOBAL SHARED
for shared user mapping -
NONE
when the schema is created with no authentication
-
-
Lang
is the ISO abbreviation for the language name, a shorter form than the existingLANGUAGE
parameter. -
Language
is the language and territory your session currently uses, along with the database character set, in the following form:language_territory.characterset
For example:
AMERICAN_AMERICA.WE8MSWIN1252
-
Machine
is the host name for the database client that established the current session. If you must find out whether the computer was used for a client or server session, then you can compare this setting with theDatabase_Hostname
factor to make the determination. -
Module
is the application name (module) that is set through theDBMS_APPLICATION_INFO
PL/SQL package or OCI. -
Network_Protocol
is the network protocol being used for communication, as specified in thePROTOCOL=protocol
portion of the connect string. -
Proxy_Enterprise_Identity
is the Oracle Internet Directory DN when the proxy user is an enterprise user. -
Proxy_User
is the name of the database user who opened the current session on behalf ofSESSION_USER
. -
Session_User
is the database user name by which the current user is authenticated. This value remains the same throughout the session.
Creating a Factor
In general, to create a factor, you first create the factor itself, and then you edit the factor to include its identity.
Adding an Identity to a Factor
After you create a new factor, you optionally can add an identity to it.
- About Factor Identities
An identity is the actual value of a factor, such an IP_Address factor identity being 192.0.2.4. - How Factor Identities Work
A factor identity is the actual value of a factor (for example, the IP address for a factor that uses the IP_Address type). - About Trust Levels
Trust levels enable you to assign a numeric value to indicate the measure of trust allowed. - About Label Identities
You can assign You Oracle Label Security (OLS) labels to factor identities. - Creating and Configuring a Factor Identity
You can create and configure a factor identity for an existing factor. - Using Identity Mapping to Configure an Identity to Use Other Factors
You can use identity mapping to use a group of factors to manage identity values. - Modifying a Factor Identity
You can use theDBMS_MACADM.UPDATE_IDENTITY
procedure to modify a factor identity. - Deleting a Factor Identity
Before delete a factor identity, you must remove references to it.
Parent topic: Configuring Factors
About Factor Identities
An identity is the actual value of a factor, such an IP_Address factor identity being 192.0.2.4.
A factor identity for a given database session is assigned at run time using the get_expr
parameter (to retrieve the identity of a factor) and the identify_by
parameter (to determine the identify of the factor) in the DBMS_MACADM.CREATE_FACTOR
procedure. You can further configure the identity for the following reasons:
-
To define the known identities for a factor
-
To add a trust level to a factor identity
-
To add an Oracle Label Security label to a factor identity
-
To resolve a factor identity through its child factors, by using identity mapping
Parent topic: Adding an Identity to a Factor
How Factor Identities Work
A factor identity is the actual value of a factor (for example, the IP address for a factor that uses the IP_Address type).
A factor can have several identities depending on its retrieval method or its identity mapping logic. For example, a factor such as Database_Hostname
could have multiple identities in an Oracle Real Application Clusters environment; a factor such as Client_IP
can have multiple identities in any database environment. The retrieval method for these types of factors may return different values because the retrieval method is based on the database session. Several reports allow you to track the factor identity configuration.
You can configure the assignment of a factor in the following ways:
-
Assign the factor at the time a database session is established.
-
Configure individual requests to retrieve the identity of the factor.
With the Oracle Label Security integration, you can label identities with an Oracle Label Security label. You can also assign an identity trust levels, which are numbers that indicate the magnitude of trust relative to other identities for the same factor. In general, the higher the trust level number is set, the greater the trust. Negative trust levels are not trusted.
Within a database session, a factor assigned identity is available to Oracle Database Vault and any application with a publicly accessible PL/SQL function that exists in the DVF
schema (which contains functions that retrieve factor values) as follows:
dvf.f$
factor_name
This allows the identifier for a factor to be accessed globally from within the Oracle database (using PL/SQL, SQL, Oracle Virtual Private Database, triggers, and so on). For example, in SQL*Plus:
CONNECT leo_dvowner
Enter password: password
SELECT DVF.F$DATABASE_IP FROM DUAL;
Output similar to the following appears:
SELECT DVF.F$DATABASE_IP FROM DUAL; F$DATABASE_IP ------------------------------------------------------------- 192.0.2.1
You can also use the GET_FACTOR
function to find the identity of a factor that is made available for public access. For example:
SELECT GET_FACTOR('DATABASE_IP') FROM DUAL;
The following output appears:
GET_FACTOR('DATABASE_IP') ------------------------------------------------------------- 192.0.2.1
Parent topic: Adding an Identity to a Factor
About Trust Levels
Trust levels enable you to assign a numeric value to indicate the measure of trust allowed.
A trust value of 1 signifies some trust. A higher value indicates a higher level of trust. A negative value or zero indicates distrust. When the factor identity returned from a factor retrieval method is not defined in the identity, Oracle Database Vault automatically assigns the identity a negative trust level.
To determine the trust level of a factor identity at run time, you can use the GET_TRUST_LEVEL
and GET_TRUST_LEVEL_FOR_IDENTITY
functions in the DVSYS
schema.
For example, suppose you have created a factor named Network
. You can create the following identities for the Network factor:
-
Intranet, with a trust level of
10
-
VPN (virtual private network), with a trust level of
5
-
Public, with a trust level of
1
You then can create rule expressions (or custom application code) that base policy decisions on the trust level. For example, you can use the GET_TRUST_LEVEL
function to find trust levels greater than 5
:
GET_TRUST_LEVEL('Network') > 5
Or, you can use a SELECT
statement on the DBA_DV_IDENTITY
data dictionary view to find trust levels for the Network factor greater than or equal to 5
:
SELECT VALUE, TRUST_LEVEL FROM DBA_DV_IDENTITY WHERE TRUST_LEVEL >= 5 AND FACTOR_NAME='Network'
Output similar to the following appears:
F$NETWORK GET_TRUST_LEVEL('NETWORK') ------------------------------------ VPN 5 INTRANET 10
In the preceding example, the Network
factor identity for VPN is trusted (value equals 5
), and the identity for the INTRANET
domain is 10
, which implies a greater trust.
Related Topics
Parent topic: Adding an Identity to a Factor
About Label Identities
You can assign You Oracle Label Security (OLS) labels to factor identities.
In brief, a label acts as an identifier for a database table row to assign privileges to the row. In the DBMS_MACADM.CREATE_FACTOR
or DBMS_MACADM.UPDATE_FACTOR
procedure, the labeled_by
parameter setting determines whether a factor is labeled DBMS_MACUTL.G_LABELED_BY_SELF
or DBMS_MACUTL.G_LABELED_BY_FACTORS
. If you set labeled_by
to DBMS_MACUTL.G_LABELED_BY_SELF
, then you can associate OLS labels with the factor identities. If you set labeled_by
to DBMS_MACUTL.G_LABELED_BY_FACTORS
, then Oracle Database Vault derives the factor identity labels from the labeling of child factor identities. When there are multiple child factor identities with labels, Oracle Database Vault merges the labels using the OLS algorithm associated with the applicable factor Oracle Label Security policy.
Related Topics
Parent topic: Adding an Identity to a Factor
Creating and Configuring a Factor Identity
You can create and configure a factor identity for an existing factor.
Parent topic: Adding an Identity to a Factor
Using Identity Mapping to Configure an Identity to Use Other Factors
You can use identity mapping to use a group of factors to manage identity values.
- About Identity Mapping
While you are creating a factory identity, you can map it. - Mapping an Identity to a Factor
You can map an identity to a factor by creating a parent-child relationship with two factors. - Deleting an Identity Map
To remove the parent-child relationship between two factors, you must delete the identity map.
Parent topic: Adding an Identity to a Factor
About Identity Mapping
While you are creating a factory identity, you can map it.
Identity mapping is the process of identifying a factor by using other (child) factors. This is a way to transform combinations of factors into logical identities for a factor or to transform continuous identity values (for example, temperature) or large discrete identity values (for example, IP address ranges) into logical sets. To check configuration issues in the mapping for an identity, you can run the Identity Configuration Issues report.
You can map different identities of a parent factor to different identities of the contributing factor. For example, an INTRANET
identity maps to an IP address range of 192.0.2.1 to 192.0.2.24. A REMOTE
identity can map to an IP address range that excludes the address range 192.0.2.1 to 192.0.2.24.
Based on identity mapping, you can create a security policy. For example, you can define a reduced set of privileges for an employee connecting over VPN (with REMOTE
), as opposed to an employee connecting from within the corporate network (with INTRANET).
If you need to change the identity mapping, you must delete and then recreate the identity map.
Mapping an Identity to a Factor
You can map an identity to a factor by creating a parent-child relationship with two factors.
Modifying a Factor Identity
You can use the DBMS_MACADM.UPDATE_IDENTITY
procedure to modify a factor identity.
Related Topics
Parent topic: Adding an Identity to a Factor
Deleting a Factor Identity
Before delete a factor identity, you must remove references to it.
Related Topics
Parent topic: Adding an Identity to a Factor
Modifying a Factor
You can use the DBMS_MACADM.UPDATE_FACTOR
procedure to modify the definition of a factor.
Related Topics
Parent topic: Configuring Factors
Deleting a Factor
Before you delete a factor, you must remove references to the factor.
Related Topics
Parent topic: Configuring Factors
How Factors Work
Oracle Database Vault processes factors when a session is established.
- How Factors Are Processed When a Session Is Established
Oracle Database Vault evaluates the factors based on when a session begins. - How Retrieval Methods Work
The Retrieval Method identifies factors where the factor identification is by method or constant. - How Factors Are Retrieved
You can retrieve a factor in a database session at any time by using theDVF
factor function or theGET_FACTOR
function. - How Factors Are Set
You can assign a factor identity at any time during a database session, but only if the factor assignment rule set evaluates to true. - How Factor Auditing Works
Whether you have unified auditing enabled affects how auditing is handled for factors.
Parent topic: Configuring Factors
How Factors Are Processed When a Session Is Established
Oracle Database Vault evaluates the factors based on when a session begins.
When a database session is established, the following actions occur:
-
At the start of each database session, Oracle Database Vault begins to evaluate all default and user-created factors in the database instance.
This evaluation occurs after the normal database authentication of the session and the initialization of the Oracle Label Security session information, if applicable.
-
In the factor evaluation stage, the factor initialization process executes the retrieval method for all factors that are identified by methods or constants, to resolve the factor identity for the session.
The factor error options setting has no effect on the factor initialization process.
-
If a factor has a validation method defined, Oracle Database Vault validates the identity (value) of the factor by executing this validation method. If the validation method fails or returns false, the identity of the factor is undefined (
NULL
). -
If a factor has any identities defined for it, Oracle Database Vault resolves the trust level of the factor based on the identities defined. If an identity of the factor is defined in this list of defined identities, then Oracle Database Vault assigns the trust level as configured; otherwise it sets it to
-1
. If there are no identities defined for the factor, the trust level is undefined (NULL
). -
Depending on the outcome of this factor evaluation, factor validation, and trust level resolution, Database Vault audits the details of the evaluation as dictated by the factor audit configuration.
-
When the evaluation of all factors that are identified by method or constant completes, Oracle Database Vault resolves the factors that are identified by other factors by using the identity maps that are defined for the factor configured identities.
The evaluation order of the factor-configured identities is by ASCII sort on the identity values: Oracle Database Vault uses the first alphabetically sorted identity mapping that it evaluates. For example, suppose factor
TEST
has identitiesX
andY
. Furthermore, identitiesX
andY
have identity maps that are dependent on identities for factorsA
,B
, andC
. The following mapping occurs:-
X
is mapped whenA
=1
andB
=1
. -
Y
is mapped whenA
=1
,B
=1
, andC
=2
.
In this case, the first one evaluated is
X
.Y
is not evaluated, but what if itsC
mapping meets the criteria that is needed for theTEST
factor's success? You would need to reverse the mapping, that is, mapY
beforeX
so thatA
,B
, andC
can be evaluated first. To reverse the mapping, renameY
toV
(or some alphabetic value that sorts beforeX
) so that it can be correctly resolved.This algorithm works if the ASCII sort ordering is correct and the identities map the same number factors at some level.
-
-
When the factor initialization completes, the Oracle Database Vault integration with Oracle Label Security occurs.
After this process completes, Oracle Database Vault checks to see if a command rule is associated with the CONNECT
event. If a rule set associated with the CONNECT
event, then Oracle Database Vault evaluates the rule set. If the rule set evaluates to false or results in an error, then the session is terminated. Oracle Database Vault executes any auditing or call handlers associated with the rule set before the session is terminated.
Note:
Be careful about associating command rules with the CONNECT
event, because you can inadvertently lock out other users from of the database. In general, if you create a command rule for CONNECT
, set its evaluation option of the associated rule set to Any True
.
If you do inadvertently lock out users, then you should temporarily disable Oracle Database Vault, disable the CONNECT
command rule, re-enable Oracle Database Vault, and then fix the factor code that is causing the problem. If the Test Fails provides an example of how to accomplish this.
Parent topic: How Factors Work
How Retrieval Methods Work
The Retrieval Method identifies factors where the factor identification is by method or constant.
If the factor identification is by factors, Oracle Database Vault identifies it by its identity mappings. You can create your own PL/SQL retrieval methods, or use the functions supplied with Oracle Database Vault. Oracle Database Vault provides factor-specific and general utility functions that you can use to build the retrieval method.
See also the default factors provided with Oracle Database Vault for examples of retrieval methods.
The get_expr
parameter is mandatory if you have selected the following DBMS_MACADM.CREATE_FACTOR
or DBMS_MACADM.CREATE_UPDATE
settings for the identify_by
parameter:
-
DBMS_MACUTL.G_IDENTIFY_BY_METHOD
: Enter a method for theget_expr
parameter. -
DBMS_MACUTL.G_IDENTIFY_BY_CONSTANT
: Enter a constant for theget_expr
parameter.
The value returned as the factor identity must be a VARCHAR2
string or otherwise convertible to one.
You can include any package function or standalone function in the expression. Ensure that the expression is a fully qualified function, such as schema
.function_name
. Do not include complete SQL statements. If you are using application packages or functions, you must provide DVSYS
with the EXECUTE
privilege on the object.
Write the function signature using the following format:
FUNCTION GET_FACTOR RETURN VARCHAR2
How Factors Are Retrieved
You can retrieve a factor in a database session at any time by using the DVF
factor function or the GET_FACTOR
function.
To find a listing of available factors, query the DBA_DV_FACTOR
data dictionary view, described in .
Example 7-1 shows an example of using the GET_FACTOR
function.
Example 7-1 Using GET_FACTOR to Retrieve a Factor
SELECT GET_FACTOR('client_ip') FROM DUAL;
You can use the factor values retrieved from the DVF
factor function or the GET_FACTOR
in the following ways:
-
Oracle Database Vault rule expressions
-
Custom application code that is available to all database sessions in an Oracle Database Vault environment
If you had set the DBMS_MACADM.CREATE_FACTOR
or DBMS_MACADM.UPDATE_FACTOR
eval_options
parameter to factor evaluation to DBMS_MACUTL.G_EVAL_ON_SESSION
, then Oracle Database Vault retrieves the value from the session context established, as described under How Factors Are Processed When a Session Is Established.
If you had set the factor evaluation to DBMS_MACUTL.G_EVAL_ON_ACCESS
, then Oracle Database Vault performs Step 2 through Step 5 (or Step 6), as described under How Factors Are Processed When a Session Is Established, whenever the factor is retrieved.
If you had defined error options for the factor and if an error occurs, then Oracle Database Vault displays the error message.
Parent topic: How Factors Work
How Factors Are Set
You can assign a factor identity at any time during a database session, but only if the factor assignment rule set evaluates to true.
You can do this in the application code by using the SET_FACTOR
function. In Java code, you can use the JDBC class java.sql.CallableStatement
to set this value. For example:
java.sql.Connection connection ; ... java.sql.CallableStatement statement = connection.prepareCall("{call SET_FACTOR('FACTOR_X', ?)}"); statement.setString(1, "MyValue"); boolean result = statement.execute(); ...
Applications that can execute Oracle PL/SQL functions can use this procedure (for example, applications written using Oracle Data Provider for .NET (ODP.NET)).
This concept is similar to the standard Oracle DBMS_SESSION.SET_IDENTIFIER
procedure with an added feature that a rule set controls when a factor value can be set. If the rule set evaluates to true, Steps 2 through 5 under How Factors Are Processed When a Session Is Established occur.
If you have not associated a assignment rule set for the factor or if the rule set returns false (or returns errors), then Oracle Database Vault sends an error message if you attempt to set the factor using the SET_FACTOR
function.
Parent topic: How Factors Work
How Factor Auditing Works
Whether you have unified auditing enabled affects how auditing is handled for factors.
In a traditional, non-unified auditing environment, Oracle Database Vault writes the audit trail to the DVSYS.AUDIT_TRAIL$
table. Be aware that traditional auditing is deprecated starting with Oracle Database release 21c.
If you have enabled unified auditing, then this setting does not capture audit records. Instead, you can create unified audit policies to capture this information.
You can use the Factor Audit Report to display the generated audit records. In addition, you can select multiple audit options at a time. Each option is converted to a bit mask and added to determine the aggregate behavior. Note that there is little performance impact in auditing, unless the factor has errors.
Related Topics
Parent topic: How Factors Work
Tutorial: Preventing Ad Hoc Tool Access to the Database
This tutorial demonstrates how to use factors to prevent ad hoc tools (such as SQL*Plus) from accessing the database.
- About This Tutorial
Many database applications contain features to explicitly control the actions of a user. - Step 1: Enable the HR and OE User Accounts
You must use theHR
andOE
accounts later on when you test the Oracle Database Vault components for this tutorial. - Step 2: Create the Factor
After you have ensured that theHR
andOE
accounts are active, you can create a factor. - Step 3: Create the Rule Set and Rules
After you have created the factor, you can create a rule set and rules to work with the factor. - Step 4: Create the CONNECT Command Rule
The CONNECT command rule controls theCONNECT
SQL statement. - Step 5: Test the Ad Hoc Tool Access Restriction
You do not need to restart your SQL*Plus session for the Oracle Database Vault changes to take effect. - Step 6: Remove the Components for This Tutorial
You can remove the components that you created for this tutorial if you no longer need them.
Parent topic: Configuring Factors
About This Tutorial
Many database applications contain features to explicitly control the actions of a user.
However, an ad hoc query tool, such as SQL*Plus, may not have these controls. As a result, a user could use an ad hoc tool to perform actions in the database that he or she would normally be prevented from performing in a database application. You can use a combination of Oracle Database Vault factors, rule sets, and command rules to prevent unauthorized access to the database by ad hoc query tools.
In the following tutorial, you prevent users HR and OE from using SQL*Plus. To accomplish this, you must create a factor to find the applications on your system and a rule and rule set to limit SQL*Plus to these four users. Then you create a command rule for the CONNECT
SQL statement, which is associated with the rule set. This factor, Client_Prog_Name, uses the CLIENT_PROGRAM_NAME
attribute of the SYS_CONTEXT
SQL function USERENV
namespace to find the names of the applications that are used to access the current instance of Oracle Database. The SYS_CONTEXT
SQL function provides many useful methods for finding the state of a user session. SYS_CONTEXT
is a valuable tool for creating custom factors.
Related Topics
Parent topic: Tutorial: Preventing Ad Hoc Tool Access to the Database
Step 1: Enable the HR and OE User Accounts
You must use the HR
and OE
accounts later on when you test the Oracle Database Vault components for this tutorial.
Related Topics
Parent topic: Tutorial: Preventing Ad Hoc Tool Access to the Database
Step 2: Create the Factor
After you have ensured that the HR
and OE
accounts are active, you can create a factor.
Parent topic: Tutorial: Preventing Ad Hoc Tool Access to the Database
Step 3: Create the Rule Set and Rules
After you have created the factor, you can create a rule set and rules to work with the factor.
Parent topic: Tutorial: Preventing Ad Hoc Tool Access to the Database
Step 4: Create the CONNECT Command Rule
The CONNECT command rule controls the CONNECT
SQL statement.
This command rule also applies to logging into SQL*Plus from the command line or other tools your site may use to access SQL*Plus.
-
Create the CONNECT command rule as follows:
BEGIN DBMS_MACADM.CREATE_COMMAND_RULE( command => 'CONNECT', rule_set_name => 'Limit SQL*Plus Access', object_owner => '%', object_name => '%', enabled => DBMS_MACUTL.G_YES); END; /
In this specification:
-
rule_set_name
associates the Limit SQL*Plus Access rule set with the CONNECT command rule. -
object_owner
is set to%
so that the command rule applies to all users. -
object_name
is set to%
so that the command rule applies to all objects. -
enabled
enables the command rule so that it can be used right away.
Parent topic: Tutorial: Preventing Ad Hoc Tool Access to the Database
Step 5: Test the Ad Hoc Tool Access Restriction
You do not need to restart your SQL*Plus session for the Oracle Database Vault changes to take effect.
-
In SQL*Plus, try to connect to the PDB as user
HR
:CONNECT HR@pdb_name Enter password: password
The following output should appear:
ERROR: ORA-47306: 20461: Limit SQL*Plus Access rule set failed
User
HR
should be prevented from using SQL*Plus. -
Next, try to connect as user
OE
:CONNECT OE@pdb_name Enter password: password
The following output should appear:
ERROR: ORA-47306: 20461: Limit SQL*Plus Access rule set failed
User
OE
also should be prevented from using SQL*Plus. -
Now try to connect as user
SYSTEM
:CONNECT SYSTEM@pdb_name Enter password: password Connected.
User
SYSTEM
should be able to log in to the database instance. So shouldSYS
, the Database Vault Owner account, and the Database Vault Account Manager account.
If the Test Fails
If you cannot log in to the database instance as SYSTEM
(or as any of the other administrative users listed in your rule expression), then you are prevented from using SQL*Plus.
You can remedy the problem as follows:
Parent topic: Tutorial: Preventing Ad Hoc Tool Access to the Database
Step 6: Remove the Components for This Tutorial
You can remove the components that you created for this tutorial if you no longer need them.
Parent topic: Tutorial: Preventing Ad Hoc Tool Access to the Database
Guidelines for Designing Factors
Oracle provides guidelines for designing factors.
-
You can use the Oracle utility packages such as
UTL_TCP
,UTL_HTTP
,DBMS_LDAP
, andDBMS_PIPE
to integrate security or other contextual information about the session from external systems. -
Do not specify a retrieval method (using the
get_expr
parameter inDBMS_MACADM.CREATE_FACTOR
orDBMS_MACADM.UPDATE_FACTOR
) if theidentify_by
parameter is set toDBMS_MACUTL.G_IDENTIFY_BY_FACTOR
. Retrieval methods are only needed if you set the factor toDBMS_MACUTL.G_IDENTIFY_BY_CONSTANT
orDBMS_MACUTL.G_IDENTIFY_BY_METHOD
. -
Consider using a validation method if a factor has an assignment rule set. Doing so helps to verify that invalid identities are not submitted.
-
Use the client-supplied factors such as Program, OS User, and others with caution, because the values that are supplied can only be trusted when the client software is trusted and the communications channel from the client software is known to be secure.
-
Only specify an evaluation option
eval_options
) ofDBMS_MACUTL.G_EVAL_ON_ACCESS
if the value returned by the retrieval method could change from one invocation to the next in the same session (for example, time-based factors). -
Optimize the internal logic of a function used for the factor retrieval method using traditional SQL and PL/SQL optimization techniques.
-
If the discrete values returned by the retrieval method are known, be sure to define identities for each value so that you can assign trust levels for them. Trust levels add value to factors as you also can use the trust level in application logic based on factors.
-
A security policy based on more factors is generally considered stronger than one based on fewer factors. You can create a new factor that is identified by other factors to store combinations of factors into logical grouping using identity maps. This also makes it easier to label the parent factor when you integrate the factors with the Oracle Label Security labels.
-
It is generally easier to configure and debug a factor whose
labeled_by
parameter is set toDBMS_MACUTL.G_LABELED_BY_SELF
than one labeledDBMS_MACUTL.G_LABELED_BY_FACTORS
when integrating the Oracle Label Security. -
You can design a database client application to pass one or more security, end-user, or environmental attributes so that they are available to an associated database session. To do this, create a single factor for each attribute and then use an assignment rule set to control when these attributes can be assigned (for example only when using a specific Web application on specified named application server computers). Oracle Database Vault factors used in this fashion are very much like the Oracle procedure
DBMS_SESSION.SET_IDENTIFIER
but also include a capability to control when they can be set.
Related Topics
Parent topic: Configuring Factors
How Factors Affect Performance
The complexity of factors affects the performance of your Oracle database instance.
Each factor has elements that are processed, such as its validation method, trust level, and so on. For factors that are evaluated by the session, such as Database_Hostname and Proxy_User
, Oracle Database Vault performs this processing during session initialization, and then caches the results for subsequent requests for that value.
The default factors are cached because they are likely candidates for a typical security policy. However, if you only use five factors (for example, in rule sets or other components), then the other factors consume resources that could otherwise be used elsewhere. In this case, you should remove the unnecessary factors by deleting them. (Oracle Database Vault does not use any of these factors internally, so you can remove them if you do not need them.)
If you have a large number of users or if your application server frequently must create and destroy connections, the resources used can affect system performance. You can delete the unnecessary factors.
You can check system performance by running tools such as Oracle Enterprise Manager (including Oracle Enterprise Manager Cloud Control, which is installed by default with Oracle Database), Automatic Workload Repository (AWR), and TKPROF
.
Related Topics
Parent topic: Configuring Factors
Factor Related Reports and Data Dictionary Views
Oracle Database Vault provides reports and data dictionary views that display information about factors and their identities.
Table 7-1 lists the Oracle Database Vault reports.
Table 7-1 Reports Related to Factors and Their Identities
Report | Description |
---|---|
Factor Audit Report |
Audits factors (for example, to find factors that failed to be evaluated) |
Factor Configuration Issues Report |
Lists configuration issues, such as disabled or incomplete rule sets, or to audit issues that may affect the factor |
Factor Without Identities Report |
Lists factors that have had no identities assigned yet |
Identity Configuration Issues Report |
Lists factors that have invalid label identities or no map for the identity |
Rule Set Configuration Issues Report |
Lists rule sets that have no rules defined or enabled, which may affect the factors that use them |
Table 7-2 lists data dictionary views that provide information about existing factors and factor identities.
Table 7-2 Data Dictionary Views Used for Factors and Factor Identities
Data Dictionary View | Description |
---|---|
|
Lists the existing factors in the current database instance |
|
Shows the relationships of each factor whose identity is determined by the association of child factors |
|
Lists the names and descriptions of factor types used in the system |
|
Lists the identities for each factor |
|
Lists the mappings for each factor identity |
Parent topic: Configuring Factors