测试访问控制列表
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> |
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.

