Oracle 11gR1中细粒度访问网络服务(4)

王朝other·作者佚名  2008-05-21
窄屏简体版  字體: |||超大  

测试访问控制列表

用户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。

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航