




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
UsingFine-GrainedAccessControlObjectivesAftercompletingthislesson,youshouldbeabletodothefollowing:Describehowfine-grainedaccesscontrol(FGAC)andtheVirtualPrivateDatabase(VPD)workImplementFGACortheVPDGrouppoliciesFine-GrainedAccessControl:OverviewLimitsrowaccessUsesapredicateIsreturnedfromafunctionIsassociatedwithatableorviewIsautomaticallyenforcedSELECT*FROMordersWHERE
sales_rep_id
=
406;ORDERSSELECT*FROMorders;SELECT*FROMordersWHEREsales_rep_id=152;SELECT*FROMorders;BenefitsSecurity:FGACisalwaysapplied.Simplicity:DefineonceIndependentofapplicationFlexibility:ApplydifferentaccesstodifferentSQLstatements.Grouppolicies.Highperformance:StaticanddynamicpoliciesActivepoliciesstoredinmemoryVirtualPrivateDatabaseAVirtualPrivateDatabase(VPD)combinesanapplicationcontextandFGACto:EnforcebusinessrulestolimitrowaccessUseasecureapplicationcontexttoprovidehighperformanceresolutionofuserattributes.ExamplesoftheVirtualPrivateDatabaseTheVPDallowsmultiplepoliciesonthesametable:Customerexample:Contextattribute:cust_idPredicate:customer_id=sys_context('oeapp','cust_id')Salesrepresentativeexample:Contextattribute:emp_idPredicate:sales_rep_id=sys_context('oeapp','emp_id')HowFine-GrainedAccessControlWorks1. Theuseraccessesatableorviewwithapolicy.2. Thedataservercallsthepolicyfunction.3. Thepolicyfunctionreturnsapredicate.4. Thedataserveraddsthepredicatetothestatement.5. Thedataserverexecutesthemodifiedstatement.becomesSELECT*FROMordersWHEREcustomer_id=sys_context('oeapp','cust_id');SELECT*FROMorders;ToolsThePL/SQLproceduresandpackages,suchas:SYS_CONTEXTreturnscontextattributesDBMS_SESSIONmanages:-Contexts-GlobalidentifiersDBMS_RLSmanages:-Contexts-Policies-PolicygroupsOraclePolicyManagerisaGUIthat:UsesDBMS_RLSProvidessecuritypolicyadministrationManagestheVPDandOracleLabelSecurityOraclePolicyManagerDBMS_RLSAssociatepolicieswithtablesorviews:ADD_POLICYADD_GROUPED_POLICYEnableanddisablepolicies:ENABLE_POLICYENABLE_GROUPED_POLICYRefreshpolicies:REFRESH_POLICYGrouppolicies:CREATE_POLICY_GROUPManagedrivingcontexts:ADD_POLICY_CONTEXT
DROP_POLICYDROP_GROUPED_POLICY
DISABLE_GROUPED_POLICY
REFRESH_GROUPED_POLICY
DELETE_POLICY_GROUP
DROP_POLICY_CONTEXTColumn-LevelVPDStatementsarenotalwaysrewritten.Example:ApolicyprotectstheSALARYandtheCOMMISSION_PCTcolumnsoftheEMPLOYEEStable.TheFGACis:Notenforcedforthisquery:Enforcedforthesequeries:SQL>SELECTlast_name,salary2FROMemployees;SQL>SELECTlast_nameFROMemployees;SQL>SELECT*FROMemployees;Column-LevelVPD:ExampleBEGIN 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;/PolicyTypes:OverviewThepolicytypesspecifyhowoftenapolicyfunctionshouldbereevaluated.Thetypesare:DynamicDBMS_RLS.DYNAMIC(Default)StaticDBMS_RLS.STATICDBMS_RLS.SHARED_STATICContextsensitiveDBMS_RLS.CONTEXT_SENSITIVEDBMS_RLS.SHARED_CONTEXT_SENSITIVEShared:SharedpoliciesallowyoutosharethesamepolicyfunctionwithdifferentobjectsStaticPoliciesThepolicyfunctionisevaluatedonce.Theresultingpolicypredicateiscachedinmemory.Everystatementaccessingprotectedobjectsusesthesamepolicypredicate.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');Context-SensitivePoliciesThepolicyfunctionisevaluatedforeachsessionwhen:ThestatementisfirstparsedThereisarelatedchangeinthelocalapplicationcontextTheresultingpolicypredicateiscachedintheuser’ssessionmemory.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');SharingPolicyFunctionsdepartmentscountriesemp_vemployeesSamepolicy
functionExceptionstoFGACPoliciesPoliciesarenotenforcedfor:DIRECTpathexportUserswithDBAprivileges(AS
SYSDBA)UsersgrantedEXEMPT_ACCESS_POLICYImplementingaVPD1. CreateaPL/SQLpackagethatsetsthecontext.2. Createanapplicationcontext:Isassociatedwiththepackagecreatedinstep1Preventsthecontextfrombeingchanged3. Writethefunctionthatcreatesapredicate:Usetheapplicationcontextcreatedinstep2.ReturnapredicateforaWHEREclause.4.Createapolicy:AssociatesthefunctionwithatableCausesthepredicatetobeaddedtotheWHEREclausesStep3:WritetheFunctionThat
CreatesaPredicateCREATEPACKAGEBODYoe_securityASFUNCTIONcust_order(object_schema VARCHAR2,object_name VARCHAR2)RETURNVARCHAR2ISBEGINRETURN'customer_id=sys_context(''oeapp'',''cust_id'')';ENDcust_order;ENDoe_security;TestingtheSecurityFunctionSQL>SELECToe_security.cust_order('a','b')
FROMdual;OE_SECURITY.CUST_ORDER('A','B')---------------------------------------------customer_id=SYS_CONTEXT('oeapp','cust_id')WritingaFunctionThatReturns
DifferentPredicatesTheownerofthetablehasaccesstoallrows:Salesrepresentativesseeonlytheirorders:Customerscanseeonlytheirownorders:Otherusershavenoaccess:RETURN'sales_rep_id= sys_context(''hrapp'',''emp_id'')';RETURN'customer_id =sys_context(''oeapp'',''cust_id'')';RETURN'1=2';RETURN'1=1';Step4:CreateaPolicyCreatethepolicyasfollows:Argumentsincludethefollowing:Associatedtable:OE.ORDERSPolicyname:OE_POLICYFunction:SECURE.OE_SECURITY.CUST_ORDERAppliesto:SELECTdbms_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')PartitionedFine-GrainedAccessControlApplication-drivensecuritypoliciesDifferentpoliciesapply,dependingontheactivedrivingcontextPoliciescanbedevelopedindependently.Thedefaultpolicyalwaysapplies.UsefulwhenhostingapplicationsDefaultpolicyOrder-entrypolicygroupInventorypolicygroupANDANDOrdersGroupingPolicies1. Determinethedefaultpolicies.2. Setupadrivingcontextforeachtable:a. Createthecontext.b. Createthefunctionthatsetsthecontext.c. Makethecontextthedrivingcontext.3. Createapolicygroupforeachapplication.4. Addeachpolicytotheappropriategroup.DefaultPolicyGroupApredefineddefaultpolicygroupisalwaysapplied.ItisnamedSYS_DEFAULT.Eachobjecthasadefaultgroup.CreatingaDrivingContextCreatethecontext:Createtheprocedurethatsetsthecontext:CREATECONTEXTapp_driverUSINGsecure.apps_cxt_pkg;CREATEORREPLACEPACKAGEBODYsecure.apps_cxt_pkg PROCEDUREset_driver(policy_groupVARCHAR2)...APP_DRIVERSECURE.APPS_CXT_PKGMakingtheContextaDrivingContextAssociatethedrivingcontextwithatable:dbms_rls.add_policy_context(object_schema=>'OE',object_name=>'ORDERS',namespace=>'APP_DRIVER',
attribute=>'ACTIVE_APP')APP_DRIVEROrdersCreatingaPolicyGroupCreatetheOEgroup:CreatetheACgroup:dbms_rls.create_policy_group(object_schema=>'OE',object_name=>'ORDERS',policy_group=>'OE_GRP');dbms_rls.create_policy_group ('OE','ORDERS','AC_GRP');AddingaPolicytoaGroup1. AddtheOE_SECURITYpolicytotheOEgroup:2. AddtheAC_SECURITYpolicytotheACgroup: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');GuidelinesRestrictSELECTandDMLwiththesamepolicy.Ifthereisnocontext,SYS_CONTEXTreturnsNULL.Youcannotselectfromthetablewithinthepolicy.Avoidrecursivecontexts.Lookinthesessiontracefiletoresolveerrors.PerformanceForbestperformance:ConsiderindexingthecolumninthepredicateDonotusesubqueriesinthepredicateDonotuseliteralsinthepredicateUseSTATIC_POLICY=TRUEwhenpossibleUseDBMS_RLS.STATIC_POLICYorSHARED_STATIC_POLICYwhenpossibleExportandImportForexportandimport,considerthefollowingguidelines:
Torestorethepolicies,theusermusthavetheexecuteprivilegeontheDBMS_RLSpackage.Ifauserattemptstoexportatablewithfine-grainedaccesspoliciesenabled,thenonlythoserowsthattheexporterisprivilegedtoreadareexported.OnlySYSoraus
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度車輛抵押給個(gè)人質(zhì)押貸款合同:豪華轎車使用權(quán)協(xié)議
- 2025年度特種車輛拖車與吊裝作業(yè)服務(wù)合同
- 二零二五年度旅游居間協(xié)議合同服務(wù)項(xiàng)目解析
- 二零二五年度泳池安全知識(shí)培訓(xùn)免責(zé)協(xié)議
- 二零二五年度空調(diào)銷售與節(jié)能改造升級(jí)合同
- 二零二五年度餐飲管理公司員工培訓(xùn)與用工合同
- 高速公路排水溝施工合同(2025年度)包含臨時(shí)道路修復(fù)服務(wù)
- 2025年度銷售人員商業(yè)秘密保護(hù)及保密補(bǔ)償協(xié)議
- 二零二五年度傳媒行業(yè)勞動(dòng)合同終止及競(jìng)業(yè)限制協(xié)議范本
- 2025年度道路養(yǎng)護(hù)承包合同解除書(shū)
- 愛(ài)自己是終身浪漫的開(kāi)始 心理課件
- 新房房屋買賣合同
- 地鐵出入口雨棚施工工藝
- 人工智能引論智慧樹(shù)知到課后章節(jié)答案2023年下浙江大學(xué)
- 掘金之旅:金融不良資產(chǎn)處置十八般武藝
- 文獻(xiàn)的載體課件
- 大學(xué)專科《機(jī)電傳動(dòng)控制》課件
- 品管圈QCC質(zhì)量持續(xù)改進(jìn)案例手術(shù)室-優(yōu)化手術(shù)病理標(biāo)本處置流程PDCA
- 基于核心素養(yǎng)的學(xué)習(xí)觀和教學(xué)觀
- 感染性腹瀉及其防控措施
- 《多維度兒童智力診斷量表》MIDSC的編制
評(píng)論
0/150
提交評(píng)論