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。




版权声明: 原创作品,承诺转载,转载时请务必以超链接体例标明文章 原始情由 、作者信息和本声明。否则将深究轨则责任。

原文地址:https://www.cnblogs.com/zgqjymx/p/1974644.html