This action might not be possible to undo. Are you sure you want to continue?
We will start momentarily Phones have been muted for recording purposes
Pressing #5 will un-mute (during Q&A) Pressing #5 again will place line back on mute
Avoid chat sessions during the presentation
Chats may be leveraged at the end of the presentation for Q&A
Please hold questions until the appropriate time
This presentation is being recorded
Submit presentation topics by e-mail to firstname.lastname@example.org
Subject - Topic Submission: <Topic> Include 3-4 line abstract and desired presentation date
<Insert Picture Here>
(System Performance & Architecture Rapid Knowledge Sharing)
Overview of Virtual Private Database
System Performance & Architecture
What is VPD? History of VPD Why use VPD? VPD components Enforcement and Exceptions Examples with Dynamic and Static Policies Benefits of using VPD Drawbacks of using VPD Acknowledgements Review
What is VPD?
directly on tables.What is VPD? Acronym for Virtual Private Database VPD enables you to enforce security. views or synonyms Sometimes referred to as Oracle Row-Level Security (RLS) or Fine Grained Access Control (FGAC) Allows to define which rows users may have access to .
History of VPD .
History of VPD Oracle VPD was introduced in Oracle 8i Version 8.5 as a new solution to enforce granular access control of data at server level Dynamically returns a predicate against a target table This activity is transparent to the user executing the SQL .1.
VPD support for table and view .History of VPD In Oracle8i.Fine grained Access Control .Row Level Security . the VPD provided the following key features: .Application Context .
Oracle Policy Manager .History of VPD Oracle9i expanded the Virtual Private Database features as follows: .Global application context .Partitioned fine-grained access control .VPD support for synonyms .
This feature also leads to more privacy. Rewrites only occur when the statement references relevant columns. Customization . you can customize VPD to always enforce the same predicate with a static policy or you can have VPD predicates that change dynamically with a non-static policy. and therefore reduce administration costs.History of VPD Oracle 10g makes the following three enhancements in Virtual Private Database: major Column-Level Privacy .It increases performance by limiting the number of queries that the database rewrites. Shared Policies .With the introduction of four new types of policies. .You can apply a single VPD policy to multiple objects.
.History of VPD 11g provides integration for Enterprise manager for Row Level Security Policies.
Why use VPD? .
Why use VPD? Protect confidential and secret information Regulations such as HIPAA and SOX You can have one database and control the delivery of the data to the right people VPD inclusive with Enterprise Edition ± no fees .
VPD Components .
VPD Components Application Context PL/SQL Function Security Policies .
set_context .Application Context Holds environmental variables .Application name .Username Gathers information using Dbms_session.
to ensure that the policy can call the function correctly Function returns a value .PL/SQL Function Functions are used to construct and return the Predicates that enforce the row-level security The function must be called in the correct standard.
Security Policies Static Non-Static Dynamic (Default) .
Security Policies (Static) STATIC The policy function is executed once. and the resulting string (the predicate) is stored in the Shared Global Area (SGA). .
.Security Policies (Non-Static) SHARED_STATIC Allows the predicate to be cached across multiple objects that use the same policy function.
Security Policies (Non-Static) CONTEXT_SENSITIVE The server always executes the policy function on statement parsing. . The server will only execute the policy function on statement execution if it detects context changes. This makes it ideal for connection pooling solutions that share a database schema and use application contexts to actually perform the user identity switching.
Security Policies (Non-Static) SHARED_CONTEXT_SENSITIVE The same as CONTEXT_SENSITIVE except that the policy can be shared across multiple objects that use the same policy function. .
Security Policies (Dynamic) DYNAMIC The default. This policy will be invoked every time the SQL statement is parsed or executed . which makes no assumptions about caching.
Enforcement and Exceptions .
are exempt from VPD enforcements Administrators can enforce VPD policies on index maintenance operations by specifying INDEX with the statement_types parameter .Enforcement and Exceptions VPD is not enforced during DIRECT path export VPD policies cannot be applied to objects in the SYS schema Any users with EXEMPT ACCESS POLICY directly or indirectly thru a role.
Examples of Dynamic and Static Policies .
Create user Create user .Example of Dynamic Policy SQL> create user vpd 2 identified by vpd 3 default tablespace users 4 temporary tablespace temp 5/ User created. SQL> create user pattani 2 identified by pattani 3 default tablespace users 4 temporary tablespace temp 5/ User created.
Grant succeeded. .resource to vpd. SQL> grant select on scott.vpd.pattani. Grant succeeded.Example of Dynamic Policy SQL> grant connect. SQL> grant execute on dbms_rls to vpd.emp to pattani. Grant succeeded.
ENAME DEPTNO ---------. SQL> select * from vpd_ply.---------SMITH 20 ALLEN 30. SQL> create table vpd_ply as select ename. .deptno from scott. Table created.emp.Example of Dynamic Policy SQL> connect vpd/vpd Connected.
SQL> create or replace function fun_vpd_emp 2( 3 p_schema in varchar2. 1 row created.Example of Dynamic Policy SQL> insert into vpd_ply values('PATTANI'. 4 p_table in varchar2 5) 6 return varchar2 7 as 8 l_retstr varchar2(2000). SQL> commit.30). . Commit complete.
20 end loop. 12 else 13 for user_rec in 14 ( 15 select deptno 16 from vpd_ply 17 where ename = user 18 ) loop 19 l_retstr := l_retstr||'.Example of Dynamic Policy 9 begin 10 if (p_schema = user) then 11 l_retstr := null.deptno. .'||user_rec.
'. 22 if (l_retstr is null) then 23 l_retstr := '0=1'.'). 27 end if. 29 end. 28 return l_retstr. Grant succeeded. . SQL> grant execute on fun_vpd_emp to public. 24 else 25 l_retstr := 'DEPTNO IN ('||l_retstr||')'.Example of Dynamic Policy 21 l_retstr := ltrim(l_retstr. 26 end if. 30 / Function created.
4 object_name => 'EMP'. 11/ . 7 policy_function => 'FUN_VPD_EMP'.Example of Dynamic Policy SQL> connect vpd/vpd SQL> begin 2 dbms_rls. 5 policy_name => 'EMP_DEPTNO_PLY_1'. 6 function_schema => 'VPD'.add_policy ( 3 object_schema => 'SCOTT'. 10 end. 8 statement_types => 'SELECT' 9 ).
5 policy_name => 'EMP_DEPTNO_PLY_2'.add_policy ( 3 object_schema => 'SCOTT'. 11 end. 4 object_name => 'EMP'. 6 function_schema => 'VPD'. DELETE'. UPDATE. 12 / .Example of Dynamic Policy SQL> begin 2 dbms_rls. 8 statement_types => 'INSERT. 9 update_check => TRUE 10 ). 7 policy_function => 'FUN_VPD_EMP'.
COUNT(*) ---------6 SQL> delete from scott. 6 rows updated.emp where deptno<>30. 0 rows deleted.emp set sal=sal+100. SQL> update scott. .Example of Dynamic Policy Login as Scott user SQL> select count(*) from emp.emp. COUNT(*) ---------14 Login as pattani user SQL> select count(*) from scott.
'VPD'. insert into scott.'VPD'.emp(empno.emp(empno.deptno) values(9999.deptno) values (9999.10).ename.ename.Example of Dynamic Policy SQL> insert into scott.10) * ERROR at line 1: ORA-28115: policy with check option violation .
begin return 'empno = 7934'. / . / CREATE OR REPLACE FUNCTION myUpper (var in VARCHAR2) RETURN VARCHAR2 DETERMINISTIC AS BEGIN RETURN UPPER(var).Example with Static Policy As Scott user CREATE OR REPLACE function pol_func (objowner in varchar2. END. end. objname in varchar2) return varchar2 as deptno number.
20)) * ERROR at line 1: ORA-28133: full table access is restricted by fine-grained security .update_check => true).policy_name => 'pol1'.object_name => 'EMP'.1.Example with Static Policy As System or sys user exec dbms_rls.policy_function => 'pol_func'. As scott user when trying to create an index when index is also part of statement_type following error is raised.add_policy (object_schema => 'SCOTT'. CREATE INDEX emp_i ON scott.statement_types => 'select.function_schema => 'SCOTT'.20)) .1.emp (SUBSTR(myupper(ename).emp (SUBSTR(myupper(ename). index'. SQL> CREATE INDEX emp_i ON scott.
Benefits of using VPD .
as well as stack them on other base polices. No backdoors Users can no longer bypass security polices embedded in applications. as they are attached to the data .Benefits of using VPD Dynamic Security No need to maintain complex roles and grants Multiple Security You can place more than one policy on each object.
Drawbacks of using VPD .
Drawbacks of using VPD Requires Oracle User ID VPD requires that an Oracle user Id be defined to every person who connects to the database. This adds maintenance and overhead Hard to audit It is hard to write an audit script that defines the exact access for each user .
VPD Summary .
view-. another for INSERT statements. Flexibility You can have one security policy for SELECT statements. or synonym means that you make the addition only once. and still others for UPDATE and DELETE statements. rather than repeatedly adding it to each of your table-. or synonym-based applications. or synonyms. Simplicity Adding the security policy to the table. . view. no matter how a user accesses the data.VPD Summary Security By attaching security policies to tables. views. finegrained access control ensures that the same security is in force.
Review VPD Evolution Various VPD Components Pros and Cons of VPD .
Acknowledgements Avadhani Yanamandra Peter Shi Sameer Mehta Winston Shirley .
htm (Oracle security papers) .Evolution of Fine Grain Access Control FGAC Feature From 8i to 10g and it has lots of links to FGA http://asktom.oracle.com http://www.1 .petefinnigan.10G: Policy Enforced Only When the Relevant Column is Queried in Any Way Metalink article 281829.References Oracle® Database Security Guide Documentation VPD White Papers Metalink article 250795.com/orasec.1 .
Visit us at http://my.oracle.com/SPARKS for additional details and archived presentations .