Oracle 11gR1中细粒度拜访搜集效力(4)

作者: 黄永兵 来由:51CTO.com 
 


测试拜访控制列表

用户TEST1和TEST2分辩拥有了答允的和谢绝的拜访控制列表,这就意味着我们可以出手出手颠末比拟对拜访外部搜集效力时它们的相应来测试拜访控制列表的后果,上面的代码赋予了这两个用户都可以实行UTL_HTTP包的权限,然后检讨检讨从每个用户拜访一个web页面。

CONN sys/password@db11g AS SYSDBA
GRANT EXECUTE ON UTL_HTTP TO test1, test2;
CONN test1/test1@db11g
DECLARE
  l_url            VARCHAR2(50) := 'http://192.168.2.3:80';
  l_http_request   UTL_HTTP.req;
  l_http_response  UTL_HTTP.resp;
BEGIN
  -- Make a HTTP request and get the response.
  l_http_request  := UTL_HTTP.begin_request(l_url);
  l_http_response := UTL_HTTP.get_response(l_http_request);
  UTL_HTTP.end_response(l_http_response);
END;
/
PL/SQL procedure successfully completed.
SQL>
CONN test2/test2@db11g
DECLARE
  l_url            VARCHAR2(50) := 'http://192.168.2.3:80';
  l_http_request   UTL_HTTP.req;
  l_http_response  UTL_HTTP.resp;
BEGIN
  -- Make a HTTP request and get the response.
  l_http_request  := UTL_HTTP.begin_request(l_url);
  l_http_response := UTL_HTTP.get_response(l_http_request);
  UTL_HTTP.end_response(l_http_response);
END;
/
DECLARE
*
ERROR at line 1:
ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1029
ORA-24247: network access denied by access control list (ACL)
ORA-06512: at line 7
SQL>

从前去的信息我们欠美不雅观出用户TEST1可以拜访web页面,而用户TEST2被拜访控制列表谢绝了,效力器的默许行为是谢绝拜访外部搜集效力,上面展现了一个新用户的测试情形。

CONN sys/password@db11g AS SYSDBA
CREATE USER test3 IDENTIFIED BY test3;
GRANT CONNECT TO test3;
GRANT EXECUTE ON UTL_HTTP TO test3;
CONN test3/test3@db11g
DECLARE
  l_url            VARCHAR2(50) := 'http://192.168.2.3:80';
  l_http_request   UTL_HTTP.req;
  l_http_response  UTL_HTTP.resp;
BEGIN
  -- Make a HTTP request and get the response.
  l_http_request  := UTL_HTTP.begin_request(l_url);
  l_http_response := UTL_HTTP.get_response(l_http_request);
  UTL_HTTP.end_response(l_http_response);
END;
/
DECLARE
*
ERROR at line 1:
ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1029
ORA-24247: network access denied by access control list (ACL)
ORA-06512: at line 7
SQL>

在从10g晋级到11g时,拜访外部搜集效力时可以会发生一些紊乱,在那种情形下,你需求完成公允的拜访控制列表。

其他和平要素

Pete Finnigan在它的博客上和关于拜访控制列表的和平申报只没有附上详细的递次包,这就意味着颠末UTL_TCP, UTL_SMTP, UTL_MAIL和UTL_HTTP加上connect权限就能在效力器上翻开一个端口。切记这一点并思虑以下事故:

◆细粒度拜访搜集效力的运用不能作为忽略根本的和平评价的设词,如发出与搜集效力有关递次包的不用要的权限。

◆颠末限定对特定端口的拜访控制你的效力是可用的,若是你仅仅需求拜访http 80端口,指定这个端口比在效力器上开放一切端口的拜访要好得多。

◆授权时运用通配符比不运用通配符和平性更差,也更毁伤。

◆你必须维护你的拜访控制列表,若是有人可以点窜它们,由于维护机制题目它们变得毫无用处,阻止间接拜访存储在XML DB 数据库中的拜访控制列表,确保用户不能拜访办理API。




版权声明: 原创作品,答允转载,转载时请务必以超链接方式标明文章 原始来由 、作者信息和本声明。不然将穷究司法责任。

posted @ 2011-03-07 17:07  蓝色的天空III  阅读(160)  评论(0编辑  收藏  举报