標籤

4GL (1) 人才發展 (10) 人物 (3) 太陽能 (4) 心理 (3) 心靈 (10) 文學 (31) 生活常識 (14) 光學 (1) 名句 (10) 即時通訊軟體 (2) 奇狐 (2) 音樂 (2) 產業 (5) 郭語錄 (3) 無聊 (3) 統計 (4) 新聞 (1) 經濟學 (1) 經營管理 (42) 解析度 (1) 遊戲 (5) 電學 (1) 網管 (10) 廣告 (1) 數學 (1) 機率 (1) 雜趣 (1) 證券 (4) 證券期貨 (1) ABAP (15) AD (1) agentflow (4) AJAX (1) Android (1) AnyChart (1) Apache (14) BASIS (4) BDL (1) C# (1) Church (1) CIE (1) CO (38) Converter (1) cron (1) CSS (23) DMS (1) DVD (1) Eclipse (1) English (1) excel (5) Exchange (4) Failover (1) FI (57) File Transfer (1) Firefox (2) FM (2) fourjs (1) gladiatus (1) google (1) Google Maps API (2) grep (1) Grub (1) HR (2) html (23) HTS (8) IE (1) IE 8 (1) IIS (1) IMAP (3) Internet Explorer (1) java (3) JavaScript (22) jQuery (6) JSON (1) K3b (1) LED (3) Linux (112) Linux Mint (4) Load Balance (1) Microsoft (2) MIS (2) MM (51) MSSQL (1) MySQL (27) Network (1) NFS (1) Office (1) Oracle (125) Outlook (3) PDF (6) Perl (59) PHP (33) PL/SQL (1) PL/SQL Developer (1) PM (3) Postfix (2) postfwd (1) PostgreSQL (1) PP (50) python (1) QM (1) Red Hat (4) Reporting Service (28) ruby (11) SAP (234) scp (1) SD (16) sed (1) Selenium-WebDriver (5) shell (5) SQL (4) SQL server (8) SQuirreL SQL Client (1) SSH (2) SWOT (3) Symantec (2) T-SQL (7) Tera Term (2) tip (1) tiptop (22) Tomcat (6) Trouble Shooting (1) Tuning (5) Ubuntu (33) ufw (1) utf-8 (1) VIM (11) Virtual Machine (2) vnc (3) Web Service (2) wget (1) Windows (19) Windows (1) WM (6) youtube (1) yum (2)

2011年9月1日 星期四

column level policy

http://yumianfeilong.com/html/2010/12/23/482.html

Oracle VPD是Oracle advance security的一部分,其中的Column level VPD可以隔离应用访问某列数据。Column level VPD有2种模式。
  1. Default behavior: restricts the number of rows returned by a query.
  2. Masking behavior: returns all rows, but returns NULL values for the columns that contain sensitive information.
其中的Masking behavior,当应用程序SQL访问到被VPD约束的列的时候,Oracle将NULL作为列值返回给客户端,但不影响其它的列访问。
(其實based on user,return 1=1 or 1=2 也可以卡住???)
例子如下function oracle.sal_fucntion会返回 return “1=2″; 建立VPD policy,限制所有应用用户不能够查询emp表上的salary信息。
execute dbms_rls.add_policy (object_schema => ‘scott’,
object_name => ‘emp’,
policy_name => ‘my_policy’,
function_schema => ‘oracle’,
policy_function => ‘sal_function’,
sec_relevant_cols=>’salary’,
sec_relevant_cols_opt=>dbms_rls.ALL_ROWS);
用户查询emp表,其他列的数据都正常返回,只有salary列全返回NULL。

SYS@ SQL> conn scott/tiger
Connected.
SCOTT@ SQL> select * from emp;
EMPNO ENAME      JOB              MGR HIREDATE               SAL       COMM     DEPTNO
———- ———- ——— ———- ————— ———- ———- ———-
7369 SMITH      CLERK           7902 17-DEC-80                                     20
7499 ALLEN      SALESMAN        7698 20-FEB-81                         300         30
7521 WARD       SALESMAN        7698 22-FEB-81                         500         30
7566 JONES      MANAGER         7839 02-APR-81                                     20
7654 MARTIN     SALESMAN        7698 28-SEP-81                        1400         30
7698 BLAKE      MANAGER         7839 01-MAY-81                                     30
7782 CLARK      MANAGER         7839 09-JUN-81                                     10
7788 SCOTT      ANALYST         7566 19-APR-87                                     20
7839 KING       PRESIDENT            17-NOV-81                                     10
7844 TURNER     SALESMAN        7698 08-SEP-81                           0         30
7876 ADAMS      CLERK           7788 23-MAY-87                                     20
7900 JAMES      CLERK           7698 03-DEC-81                                     30
7902 FORD       ANALYST         7566 03-DEC-81                                     20
7934 MILLER     CLERK           7782 23-JAN-82                                     10
14 rows selected.
且在emp上建立的view,在 SQL parse的时候也会被基础表上的VPD policy约束。
SCOTT@: SQL> select text from user_views where view_name=’EMP_SEC’;
TEXT
——————————————————————————–
select “EMPNO”,”ENAME”,”JOB”,”MGR”,”HIREDATE”,”SAL”,”COMM”,”DEPTNO” from scott.emp
SCOTT@: SQL> select * from scott.emp_sec where rownum<=3;
EMPNO ENAME JOB         MGR     HIREDATE           SAL    COMM    DEPTNO
———- ———- ——— ———- ————— ———-
7369 SMITH CLERK        7902     17-DEC-80                               20
7499 ALLEN SALESMAN 7698     20-FEB-81                    300      30
7521 WARD SALESMAN 7698      22-FEB-81                    500     30
通过使用 10060 和 10730 event,可以发现Oracle在SQL层次将查询进行了重写。
Logon user     : ORACLE
Table/View     : SCOTT.EMP
Policy name    : my_policy
Policy function: ORACLE.sal_function
RLS view :
SELECT  “EMPNO”,”ENAME”,”JOB”,”MGR”,”HIREDATE”, CASE WHEN (1 = 2) THEN “SAL” ELSE NULL END “SAL”,”COMM”,”DEPTNO” FROM “SCOTT”.”EMP”   “EMP”
改写成了CASE形式。
但是VPD不能够限制SYS用户;SYS用户仍然能够看到Salary的信息。不过结合Oracle其它的安全方案(如TDE),将VPD恰当的应用在服务器端,可以解决一些安全问题,因为它对客户端是完全透明的。


以下為另一篇相關文章
http://ksadba.wordpress.com/2009/04/22/virtual-private-database-vpd-column-masking-simple-example/

Exclude Some Users from Policy

Users who need to see all the data without any masking need to be granted “exempt access policy

Notes:

  • Dropping a table that has a policy will drop the policy but not the function policy.
  • Renaming the table will NOT drop the policy or disable it. The policy will remain active.
  • Export/Import will also export/import the policy along with the table, but will not export/import the function policy.
  • When exporting a table under a policy, make sure the user exporting the table has “exempt access policy” grant, otherwise, the column under the policy will always be null and column data will be lost.

Some Important Views

dba_policies
v$vpd_policy

沒有留言:

張貼留言