SlideShare uma empresa Scribd logo
1 de 35
Baixar para ler offline
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Using Fine-Grained Access Control
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Objectives
After completing this lesson, you should be able to do
the following:
• Describe how fine-grained access control (FGAC)
and the Virtual Private Database (VPD) work
• Implement FGAC or the VPD
• Group policies
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Fine-Grained Access Control: Overview
• Limits row access
• Uses a predicate
• Is returned from a
function
• Is associated with a
table or view
• Is automatically
enforced
SELECT * FROM orders
WHERE sales_rep_id = 406;
ORDERS
SELECT * FROM orders;
SELECT * FROM orders
WHERE sales_rep_id = 152;
SELECT * FROM orders;
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Benefits
• Security: FGAC is always applied.
• Simplicity:
– Define once
– Independent of application
• Flexibility:
– Apply different access to different SQL statements.
– Group policies.
• High performance:
– Static and dynamic policies
– Active policies stored in memory
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Virtual Private Database
A Virtual Private Database (VPD) combines an
application context and FGAC to:
• Enforce business rules to limit row access
• Use a secure application context to provide high
performance resolution of user attributes.
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Examples of the Virtual Private Database
The VPD allows multiple policies on the same table:
• Customer example:
– Context attribute: cust_id
– Predicate: customer_id =
sys_context ('oeapp', 'cust_id')
• Sales representative example:
– Context attribute: emp_id
– Predicate: sales_rep_id =
sys_context ('oeapp', 'emp_id')
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
How Fine-Grained Access Control Works
1. The user accesses a table or view with a policy.
2. The database calls the policy function.
3. The policy function returns a predicate.
4. The database adds the predicate to the statement.
5. The data server executes the modified statement.
becomes
SELECT *
FROM orders
WHERE customer_id =
sys_context
('oeapp', 'cust_id');
SELECT *
FROM orders;
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Tools
• The PL/SQL procedures and packages, such as:
– SYS_CONTEXT returns context attributes
– DBMS_SESSION manages:
- Contexts
- Global identifiers
– DBMS_RLS manages:
- Contexts
- Policies
- Policy groups
• Oracle Policy Manager is a GUI that:
– Uses DBMS_RLS
– Provides security policy administration
– Manages the VPD and Oracle Label Security
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Oracle Policy Manager
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
DBMS_RLS
• Associate policies with tables or views:
– ADD_POLICY
– ADD_GROUPED_POLICY
• Enable and disable policies:
– ENABLE_POLICY
– ENABLE_GROUPED_POLICY
• Refresh policies:
– REFRESH_POLICY
• Group policies:
– CREATE_POLICY_GROUP
• Manage driving contexts:
– ADD_POLICY_CONTEXT
– DROP_POLICY
– DROP_GROUPED_POLICY
– DISABLE_GROUPED_POLICY
– REFRESH_GROUPED_POLICY
– DELETE_POLICY_GROUP
– DROP_POLICY_CONTEXT
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Column-Level VPD
• Statements are not always rewritten.
• Example: A policy protects the SALARY and the
COMMISSION_PCT columns of the EMPLOYEES table.
The FGAC is:
– Not enforced for this query:
– Enforced for these queries:
SQL> SELECT last_name, salary
2 FROM employees;
SQL> SELECT last_name FROM employees;
SQL> SELECT * FROM employees;
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Column-Level VPD: Example
BEGIN
dbms_rls.add_policy(object_schema => 'hr',
object_name => 'employees',
policy_name => 'hr_policy',
function_schema =>'hr',
policy_function => 'hrsec',
statement_types =>'select,insert',
sec_relevant_cols=>'salary,commission_pct'
sec_relevant_col_opts=> dbms_rls.ALL_ROWS);
END;
/
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Policy Types: Overview
The policy types specify how often a policy function
should be reevaluated. The types are:
• Dynamic
– DBMS_RLS.DYNAMIC (Default)
• Static
– DBMS_RLS.STATIC
– DBMS_RLS.SHARED_STATIC
• Context sensitive
– DBMS_RLS.CONTEXT_SENSITIVE
– DBMS_RLS.SHARED_CONTEXT_SENSITIVE
• Shared: Shared policies allow you to share the
same policy function with different objects
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Static Policies
• The policy function is evaluated once.
• The resulting policy predicate is cached in
memory.
• Every statement accessing protected objects uses
the same policy predicate.
exec dbms_rls.add_policy(
object_schema =>'hr', object_name => 'employees', -
policy_name => 'hr_policy' , -
function_schema =>'hr',policy_function=>'hrsec' , -
statement_types => 'select,insert' , -
policy_type => dbms_rls.static , -
sec_relevant_cols =>'salary,commission_pct');
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Context-Sensitive Policies
• The policy function is evaluated for each session
when:
– The statement is first parsed
– There is a related change in the local application
context
• The resulting policy predicate is cached in the
user’s session memory.
exec dbms_rls.add_policy(
object_schema =>'hr', object_name =>'employees2', -
policy_name => 'hr_policy2' , -
function_schema =>'hr',policy_function=>'hrsec2', -
statement_types => 'select,insert' , -
policy_type => dbms_rls.context_sensitive , -
sec_relevant_cols =>'salary,commission_pct');
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Sharing Policy Functions
departments
countries
emp_v
employees
Same policy
function
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Exceptions to FGAC Policies
Policies are not enforced for:
• DIRECT path export
• Users with DBA privileges ( AS SYSDBA )
• Users granted EXEMPT_ACCESS_POLICY
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Implementing a VPD
1. Create a PL/SQL package that sets the context.
2. Create an application context:
– Is associated with the package created in step 1
– Prevents the context from being changed
3. Write the function that creates a predicate:
– Use the application context created in step 2.
– Return a predicate for a WHERE clause.
4. Create a policy:
– Associates the function with a table
– Causes the predicate to be added to the WHERE
clauses
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Step 3: Write the Function That
Creates a Predicate
CREATE PACKAGE BODY oe_security AS
FUNCTION cust_order (
object_schema VARCHAR2,
object_name VARCHAR2 )
RETURN VARCHAR2
IS
BEGIN
RETURN 'customer_id =
sys_context(''oeapp'', ''cust_id'')';
END cust_order;
END oe_security;
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Testing the Security Function
SQL> SELECT oe_security.cust_order('a', 'b')
FROM dual;
OE_SECURITY.CUST_ORDER('A','B')
---------------------------------------------
customer_id = SYS_CONTEXT('oeapp', 'cust_id')
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Writing a Function That Returns
Different Predicates
• The owner of the table has access to all rows:
• Sales representatives see only their orders:
• Customers can see only their own orders:
• Other users have no access:
RETURN 'sales_rep_id =
sys_context(''hrapp'', ''emp_id'')';
RETURN 'customer_id
= sys_context(''oeapp'', ''cust_id'')';
RETURN '1=2';
RETURN '1=1';
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Step 4: Create a Policy
• Create the policy as follows:
• Arguments include the following:
– Associated table: OE.ORDERS
– Policy name: OE_POLICY
– Function: SECURE.OE_SECURITY.CUST_ORDER
– Applies to: SELECT
dbms_rls.add_policy (
object_schema =>'oe', object_name => 'orders',
policy_name => 'oe_policy',
function_schema =>'secure',
policy_function =>'oe_security.cust_order',
statement_types =>'select')
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Partitioned Fine-Grained Access Control
• Application-driven
security policies
• Different policies apply,
depending on the
active driving context
• Policies can be
developed
independently.
• The default policy
always applies.
Default policy
Order-entry
policy group
Inventory
policy group
AN
D
AN
D
Orders
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Grouping Policies
1. Determine the default policies.
2. Set up a driving context for each table:
a. Create the context.
b. Create the function that sets the context.
c. Make the context the driving context.
3. Create a policy group for each application.
4. Add each policy to the appropriate group.
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Default Policy Group
• A predefined default policy group is always
applied.
• It is named SYS_DEFAULT.
• Each object has a default group.
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Creating a Driving Context
• Create the context:
• Create the procedure that sets the context:
CREATE CONTEXT app_driver
USING oe.pkg_apps_cxt;
CREATE OR REPLACE PACKAGE BODY oe.pkg_apps_cxt
PROCEDURE set_driver( policy_group VARCHAR2)...
APP_ DRIVER
OE.PKG_APPS_CXT
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Making the Context a Driving Context
Associate the driving context with a table:
dbms_rls.add_policy_context(
object_schema =>'OE',
object_name => 'ORDERS' ,
namespace => 'APP_DRIVER',
attribute => 'ACTIVE_APP')
APP_ DRIVER Orders
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Creating a Policy Group
• Create the OE group:
• Create the AC group:
dbms_rls.create_policy_group(
object_schema =>'OE',
object_name => 'ORDERS',
policy_group => 'OE_GRP' );
dbms_rls.create_policy_group
( 'OE', 'ORDERS', 'AC_GRP' );
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Adding a Policy to a Group
1. Add the OE_SECURITY policy to the OE group:
2. Add the AC_SECURITY policy to the AC group:
dbms_rls.add_grouped_policy (
object_schema=>'oe', object_name=>'orders',
policy_group =>'oe_grp',
policy_name => 'oe_security',
function_schema =>'secure',
policy_function => 'oe_context');
dbms_rls.add_grouped_policy (
'oe', 'orders', 'ac_grp', 'ac_security',
'secure', 'ac_context');
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Performance
For best performance:
• Consider indexing the column in the predicate
• Do not use subqueries in the predicate
• Do not use literals in the predicate
• Use STATIC_POLICY=TRUE when possible
• Use DBMS_RLS.STATIC_POLICY or
SHARED_STATIC_POLICY when possible
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Export and Import
• For export and import, consider the following
guidelines:
– To restore the policies, the user must have the
execute privilege on the DBMS_RLS package.
– If a user attempts to export a table with fine-grained
access policies enabled, then only those rows that
the exporter is privileged to read are exported.
– Only SYS or a user with the
EXPORT_FULL_DATABASE role enabled can perform
DIRECT path export.
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Policy Views
• Policy views list security policies: *_POLICIES
• Policy context views list driving contexts:
*_POLICY_CONTEXTS
• Policy group views list policy groups:
*_POLICY_GROUPS
• Dynamic performance views list active policies:
– V$VPD_POLICY
– GV$VPD_POLICY
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Checking for Policies Applied
to SQL Statements
SQL> SELECT distinct policy, predicate, sql_text
2 FROM v$vpd_policy p, v$sql s
3 WHERE s.child_address = p.address;
POLICY PREDICATE
------------ ---------------------------------------
SQL_TEXT
--------------------------------------------------------
OE_POLICY 1=1
select * from oe.orders
OE_POLICY sales_rep_id = SYS_CONTEXT('hrapp', 'id')
select * from oe.orders
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Summary
In this lesson, you should have learned how to:
• Describe how FGAC and the VPD work
• Implement FGAC or the VPD by using the
DBMS_RLS package
• Group policies:
– Using the DBMS_RLS package to group policies
– Setting up a driving application context by using
DBMS_RLS
云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com
Q&A

Mais conteúdo relacionado

Mais de Zhaoyang Wang

海通证券金融云思考与实践(数据技术嘉年华2017)
海通证券金融云思考与实践(数据技术嘉年华2017)海通证券金融云思考与实践(数据技术嘉年华2017)
海通证券金融云思考与实践(数据技术嘉年华2017)Zhaoyang Wang
 
云管理平台助力海通金融云建设
云管理平台助力海通金融云建设云管理平台助力海通金融云建设
云管理平台助力海通金融云建设Zhaoyang Wang
 
海通证券数据库备份恢复云平台实践(OTN Tour Shanghai 2017)
海通证券数据库备份恢复云平台实践(OTN Tour Shanghai 2017)海通证券数据库备份恢复云平台实践(OTN Tour Shanghai 2017)
海通证券数据库备份恢复云平台实践(OTN Tour Shanghai 2017)Zhaoyang Wang
 
Oracle Compute Cloud Service快速实践
Oracle Compute Cloud Service快速实践Oracle Compute Cloud Service快速实践
Oracle Compute Cloud Service快速实践Zhaoyang Wang
 
Oracle Compute Cloud Service介绍
Oracle Compute Cloud Service介绍Oracle Compute Cloud Service介绍
Oracle Compute Cloud Service介绍Zhaoyang Wang
 
Oracle cloud 使用云市场快速搭建小型电商网站
Oracle cloud 使用云市场快速搭建小型电商网站Oracle cloud 使用云市场快速搭建小型电商网站
Oracle cloud 使用云市场快速搭建小型电商网站Zhaoyang Wang
 
Oracle cloud ravello介绍及测试账户申请
Oracle cloud ravello介绍及测试账户申请Oracle cloud ravello介绍及测试账户申请
Oracle cloud ravello介绍及测试账户申请Zhaoyang Wang
 
Oracle cloud 云介绍及测试账户申请
Oracle cloud 云介绍及测试账户申请Oracle cloud 云介绍及测试账户申请
Oracle cloud 云介绍及测试账户申请Zhaoyang Wang
 
New awesome features in MySQL 5.7
New awesome features in MySQL 5.7New awesome features in MySQL 5.7
New awesome features in MySQL 5.7Zhaoyang Wang
 
Performance Tuning Tool01-Statspack
Performance Tuning Tool01-StatspackPerformance Tuning Tool01-Statspack
Performance Tuning Tool01-StatspackZhaoyang Wang
 
SQL Tuning02-Intorduction to the CBO Optimizer
SQL Tuning02-Intorduction to the CBO OptimizerSQL Tuning02-Intorduction to the CBO Optimizer
SQL Tuning02-Intorduction to the CBO OptimizerZhaoyang Wang
 
SQL Tuning04-Interpreting Execution Plans
SQL Tuning04-Interpreting Execution PlansSQL Tuning04-Interpreting Execution Plans
SQL Tuning04-Interpreting Execution PlansZhaoyang Wang
 
SQL Tuning01-Introduction to SQL Tuning
SQL Tuning01-Introduction to SQL TuningSQL Tuning01-Introduction to SQL Tuning
SQL Tuning01-Introduction to SQL TuningZhaoyang Wang
 
MySQL Fulltext Search Tutorial
MySQL Fulltext Search TutorialMySQL Fulltext Search Tutorial
MySQL Fulltext Search TutorialZhaoyang Wang
 
Data Organization in InnoDB
Data Organization in InnoDBData Organization in InnoDB
Data Organization in InnoDBZhaoyang Wang
 
Oracle enterprise manager cloud control 12c release 5 installation on oracle ...
Oracle enterprise manager cloud control 12c release 5 installation on oracle ...Oracle enterprise manager cloud control 12c release 5 installation on oracle ...
Oracle enterprise manager cloud control 12c release 5 installation on oracle ...Zhaoyang Wang
 
Oracle enterprise manager cloud control 12c r5 agent installation
Oracle enterprise manager cloud control 12c r5 agent installationOracle enterprise manager cloud control 12c r5 agent installation
Oracle enterprise manager cloud control 12c r5 agent installationZhaoyang Wang
 
MYSQLCLONE Introduction
MYSQLCLONE IntroductionMYSQLCLONE Introduction
MYSQLCLONE IntroductionZhaoyang Wang
 
Interpreting execution plans
Interpreting execution plansInterpreting execution plans
Interpreting execution plansZhaoyang Wang
 

Mais de Zhaoyang Wang (20)

海通证券金融云思考与实践(数据技术嘉年华2017)
海通证券金融云思考与实践(数据技术嘉年华2017)海通证券金融云思考与实践(数据技术嘉年华2017)
海通证券金融云思考与实践(数据技术嘉年华2017)
 
云管理平台助力海通金融云建设
云管理平台助力海通金融云建设云管理平台助力海通金融云建设
云管理平台助力海通金融云建设
 
海通证券数据库备份恢复云平台实践(OTN Tour Shanghai 2017)
海通证券数据库备份恢复云平台实践(OTN Tour Shanghai 2017)海通证券数据库备份恢复云平台实践(OTN Tour Shanghai 2017)
海通证券数据库备份恢复云平台实践(OTN Tour Shanghai 2017)
 
Oracle Compute Cloud Service快速实践
Oracle Compute Cloud Service快速实践Oracle Compute Cloud Service快速实践
Oracle Compute Cloud Service快速实践
 
Oracle Compute Cloud Service介绍
Oracle Compute Cloud Service介绍Oracle Compute Cloud Service介绍
Oracle Compute Cloud Service介绍
 
Oracle cloud 使用云市场快速搭建小型电商网站
Oracle cloud 使用云市场快速搭建小型电商网站Oracle cloud 使用云市场快速搭建小型电商网站
Oracle cloud 使用云市场快速搭建小型电商网站
 
Oracle cloud ravello介绍及测试账户申请
Oracle cloud ravello介绍及测试账户申请Oracle cloud ravello介绍及测试账户申请
Oracle cloud ravello介绍及测试账户申请
 
Oracle cloud 云介绍及测试账户申请
Oracle cloud 云介绍及测试账户申请Oracle cloud 云介绍及测试账户申请
Oracle cloud 云介绍及测试账户申请
 
New awesome features in MySQL 5.7
New awesome features in MySQL 5.7New awesome features in MySQL 5.7
New awesome features in MySQL 5.7
 
Performance Tuning Tool01-Statspack
Performance Tuning Tool01-StatspackPerformance Tuning Tool01-Statspack
Performance Tuning Tool01-Statspack
 
SQL Tuning02-Intorduction to the CBO Optimizer
SQL Tuning02-Intorduction to the CBO OptimizerSQL Tuning02-Intorduction to the CBO Optimizer
SQL Tuning02-Intorduction to the CBO Optimizer
 
SQL Tuning04-Interpreting Execution Plans
SQL Tuning04-Interpreting Execution PlansSQL Tuning04-Interpreting Execution Plans
SQL Tuning04-Interpreting Execution Plans
 
SQL Tuning01-Introduction to SQL Tuning
SQL Tuning01-Introduction to SQL TuningSQL Tuning01-Introduction to SQL Tuning
SQL Tuning01-Introduction to SQL Tuning
 
MySQL Fulltext Search Tutorial
MySQL Fulltext Search TutorialMySQL Fulltext Search Tutorial
MySQL Fulltext Search Tutorial
 
Data Organization in InnoDB
Data Organization in InnoDBData Organization in InnoDB
Data Organization in InnoDB
 
Oracle enterprise manager cloud control 12c release 5 installation on oracle ...
Oracle enterprise manager cloud control 12c release 5 installation on oracle ...Oracle enterprise manager cloud control 12c release 5 installation on oracle ...
Oracle enterprise manager cloud control 12c release 5 installation on oracle ...
 
Oracle enterprise manager cloud control 12c r5 agent installation
Oracle enterprise manager cloud control 12c r5 agent installationOracle enterprise manager cloud control 12c r5 agent installation
Oracle enterprise manager cloud control 12c r5 agent installation
 
Why use MySQL
Why use MySQLWhy use MySQL
Why use MySQL
 
MYSQLCLONE Introduction
MYSQLCLONE IntroductionMYSQLCLONE Introduction
MYSQLCLONE Introduction
 
Interpreting execution plans
Interpreting execution plansInterpreting execution plans
Interpreting execution plans
 

Último

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 

Último (20)

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 

Oracle security 05-using fine-grained access control

  • 1. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Using Fine-Grained Access Control
  • 2. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Objectives After completing this lesson, you should be able to do the following: • Describe how fine-grained access control (FGAC) and the Virtual Private Database (VPD) work • Implement FGAC or the VPD • Group policies
  • 3. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Fine-Grained Access Control: Overview • Limits row access • Uses a predicate • Is returned from a function • Is associated with a table or view • Is automatically enforced SELECT * FROM orders WHERE sales_rep_id = 406; ORDERS SELECT * FROM orders; SELECT * FROM orders WHERE sales_rep_id = 152; SELECT * FROM orders;
  • 4. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Benefits • Security: FGAC is always applied. • Simplicity: – Define once – Independent of application • Flexibility: – Apply different access to different SQL statements. – Group policies. • High performance: – Static and dynamic policies – Active policies stored in memory
  • 5. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Virtual Private Database A Virtual Private Database (VPD) combines an application context and FGAC to: • Enforce business rules to limit row access • Use a secure application context to provide high performance resolution of user attributes.
  • 6. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Examples of the Virtual Private Database The VPD allows multiple policies on the same table: • Customer example: – Context attribute: cust_id – Predicate: customer_id = sys_context ('oeapp', 'cust_id') • Sales representative example: – Context attribute: emp_id – Predicate: sales_rep_id = sys_context ('oeapp', 'emp_id')
  • 7. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com How Fine-Grained Access Control Works 1. The user accesses a table or view with a policy. 2. The database calls the policy function. 3. The policy function returns a predicate. 4. The database adds the predicate to the statement. 5. The data server executes the modified statement. becomes SELECT * FROM orders WHERE customer_id = sys_context ('oeapp', 'cust_id'); SELECT * FROM orders;
  • 8. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Tools • The PL/SQL procedures and packages, such as: – SYS_CONTEXT returns context attributes – DBMS_SESSION manages: - Contexts - Global identifiers – DBMS_RLS manages: - Contexts - Policies - Policy groups • Oracle Policy Manager is a GUI that: – Uses DBMS_RLS – Provides security policy administration – Manages the VPD and Oracle Label Security
  • 9. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Oracle Policy Manager
  • 10. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com DBMS_RLS • Associate policies with tables or views: – ADD_POLICY – ADD_GROUPED_POLICY • Enable and disable policies: – ENABLE_POLICY – ENABLE_GROUPED_POLICY • Refresh policies: – REFRESH_POLICY • Group policies: – CREATE_POLICY_GROUP • Manage driving contexts: – ADD_POLICY_CONTEXT – DROP_POLICY – DROP_GROUPED_POLICY – DISABLE_GROUPED_POLICY – REFRESH_GROUPED_POLICY – DELETE_POLICY_GROUP – DROP_POLICY_CONTEXT
  • 11. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Column-Level VPD • Statements are not always rewritten. • Example: A policy protects the SALARY and the COMMISSION_PCT columns of the EMPLOYEES table. The FGAC is: – Not enforced for this query: – Enforced for these queries: SQL> SELECT last_name, salary 2 FROM employees; SQL> SELECT last_name FROM employees; SQL> SELECT * FROM employees;
  • 12. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Column-Level VPD: Example BEGIN dbms_rls.add_policy(object_schema => 'hr', object_name => 'employees', policy_name => 'hr_policy', function_schema =>'hr', policy_function => 'hrsec', statement_types =>'select,insert', sec_relevant_cols=>'salary,commission_pct' sec_relevant_col_opts=> dbms_rls.ALL_ROWS); END; /
  • 13. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Policy Types: Overview The policy types specify how often a policy function should be reevaluated. The types are: • Dynamic – DBMS_RLS.DYNAMIC (Default) • Static – DBMS_RLS.STATIC – DBMS_RLS.SHARED_STATIC • Context sensitive – DBMS_RLS.CONTEXT_SENSITIVE – DBMS_RLS.SHARED_CONTEXT_SENSITIVE • Shared: Shared policies allow you to share the same policy function with different objects
  • 14. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Static Policies • The policy function is evaluated once. • The resulting policy predicate is cached in memory. • Every statement accessing protected objects uses the same policy predicate. exec dbms_rls.add_policy( object_schema =>'hr', object_name => 'employees', - policy_name => 'hr_policy' , - function_schema =>'hr',policy_function=>'hrsec' , - statement_types => 'select,insert' , - policy_type => dbms_rls.static , - sec_relevant_cols =>'salary,commission_pct');
  • 15. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Context-Sensitive Policies • The policy function is evaluated for each session when: – The statement is first parsed – There is a related change in the local application context • The resulting policy predicate is cached in the user’s session memory. exec dbms_rls.add_policy( object_schema =>'hr', object_name =>'employees2', - policy_name => 'hr_policy2' , - function_schema =>'hr',policy_function=>'hrsec2', - statement_types => 'select,insert' , - policy_type => dbms_rls.context_sensitive , - sec_relevant_cols =>'salary,commission_pct');
  • 16. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Sharing Policy Functions departments countries emp_v employees Same policy function
  • 17. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Exceptions to FGAC Policies Policies are not enforced for: • DIRECT path export • Users with DBA privileges ( AS SYSDBA ) • Users granted EXEMPT_ACCESS_POLICY
  • 18. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Implementing a VPD 1. Create a PL/SQL package that sets the context. 2. Create an application context: – Is associated with the package created in step 1 – Prevents the context from being changed 3. Write the function that creates a predicate: – Use the application context created in step 2. – Return a predicate for a WHERE clause. 4. Create a policy: – Associates the function with a table – Causes the predicate to be added to the WHERE clauses
  • 19. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Step 3: Write the Function That Creates a Predicate CREATE PACKAGE BODY oe_security AS FUNCTION cust_order ( object_schema VARCHAR2, object_name VARCHAR2 ) RETURN VARCHAR2 IS BEGIN RETURN 'customer_id = sys_context(''oeapp'', ''cust_id'')'; END cust_order; END oe_security;
  • 20. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Testing the Security Function SQL> SELECT oe_security.cust_order('a', 'b') FROM dual; OE_SECURITY.CUST_ORDER('A','B') --------------------------------------------- customer_id = SYS_CONTEXT('oeapp', 'cust_id')
  • 21. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Writing a Function That Returns Different Predicates • The owner of the table has access to all rows: • Sales representatives see only their orders: • Customers can see only their own orders: • Other users have no access: RETURN 'sales_rep_id = sys_context(''hrapp'', ''emp_id'')'; RETURN 'customer_id = sys_context(''oeapp'', ''cust_id'')'; RETURN '1=2'; RETURN '1=1';
  • 22. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Step 4: Create a Policy • Create the policy as follows: • Arguments include the following: – Associated table: OE.ORDERS – Policy name: OE_POLICY – Function: SECURE.OE_SECURITY.CUST_ORDER – Applies to: SELECT dbms_rls.add_policy ( object_schema =>'oe', object_name => 'orders', policy_name => 'oe_policy', function_schema =>'secure', policy_function =>'oe_security.cust_order', statement_types =>'select')
  • 23. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Partitioned Fine-Grained Access Control • Application-driven security policies • Different policies apply, depending on the active driving context • Policies can be developed independently. • The default policy always applies. Default policy Order-entry policy group Inventory policy group AN D AN D Orders
  • 24. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Grouping Policies 1. Determine the default policies. 2. Set up a driving context for each table: a. Create the context. b. Create the function that sets the context. c. Make the context the driving context. 3. Create a policy group for each application. 4. Add each policy to the appropriate group.
  • 25. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Default Policy Group • A predefined default policy group is always applied. • It is named SYS_DEFAULT. • Each object has a default group.
  • 26. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Creating a Driving Context • Create the context: • Create the procedure that sets the context: CREATE CONTEXT app_driver USING oe.pkg_apps_cxt; CREATE OR REPLACE PACKAGE BODY oe.pkg_apps_cxt PROCEDURE set_driver( policy_group VARCHAR2)... APP_ DRIVER OE.PKG_APPS_CXT
  • 27. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Making the Context a Driving Context Associate the driving context with a table: dbms_rls.add_policy_context( object_schema =>'OE', object_name => 'ORDERS' , namespace => 'APP_DRIVER', attribute => 'ACTIVE_APP') APP_ DRIVER Orders
  • 28. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Creating a Policy Group • Create the OE group: • Create the AC group: dbms_rls.create_policy_group( object_schema =>'OE', object_name => 'ORDERS', policy_group => 'OE_GRP' ); dbms_rls.create_policy_group ( 'OE', 'ORDERS', 'AC_GRP' );
  • 29. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Adding a Policy to a Group 1. Add the OE_SECURITY policy to the OE group: 2. Add the AC_SECURITY policy to the AC group: dbms_rls.add_grouped_policy ( object_schema=>'oe', object_name=>'orders', policy_group =>'oe_grp', policy_name => 'oe_security', function_schema =>'secure', policy_function => 'oe_context'); dbms_rls.add_grouped_policy ( 'oe', 'orders', 'ac_grp', 'ac_security', 'secure', 'ac_context');
  • 30. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Performance For best performance: • Consider indexing the column in the predicate • Do not use subqueries in the predicate • Do not use literals in the predicate • Use STATIC_POLICY=TRUE when possible • Use DBMS_RLS.STATIC_POLICY or SHARED_STATIC_POLICY when possible
  • 31. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Export and Import • For export and import, consider the following guidelines: – To restore the policies, the user must have the execute privilege on the DBMS_RLS package. – If a user attempts to export a table with fine-grained access policies enabled, then only those rows that the exporter is privileged to read are exported. – Only SYS or a user with the EXPORT_FULL_DATABASE role enabled can perform DIRECT path export.
  • 32. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Policy Views • Policy views list security policies: *_POLICIES • Policy context views list driving contexts: *_POLICY_CONTEXTS • Policy group views list policy groups: *_POLICY_GROUPS • Dynamic performance views list active policies: – V$VPD_POLICY – GV$VPD_POLICY
  • 33. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Checking for Policies Applied to SQL Statements SQL> SELECT distinct policy, predicate, sql_text 2 FROM v$vpd_policy p, v$sql s 3 WHERE s.child_address = p.address; POLICY PREDICATE ------------ --------------------------------------- SQL_TEXT -------------------------------------------------------- OE_POLICY 1=1 select * from oe.orders OE_POLICY sales_rep_id = SYS_CONTEXT('hrapp', 'id') select * from oe.orders
  • 34. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Summary In this lesson, you should have learned how to: • Describe how FGAC and the VPD work • Implement FGAC or the VPD by using the DBMS_RLS package • Group policies: – Using the DBMS_RLS package to group policies – Setting up a driving application context by using DBMS_RLS
  • 35. 云和恩墨 成就所托 by 王朝阳 18516271611 sonne.k.wang@gmail.com Q&A