Oracle英文版培訓(xùn)課件之Security:L12-fgac_第1頁(yè)
Oracle英文版培訓(xùn)課件之Security:L12-fgac_第2頁(yè)
Oracle英文版培訓(xùn)課件之Security:L12-fgac_第3頁(yè)
Oracle英文版培訓(xùn)課件之Security:L12-fgac_第4頁(yè)
Oracle英文版培訓(xùn)課件之Security:L12-fgac_第5頁(yè)
已閱讀5頁(yè),還剩30頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(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ì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論