{"id":159,"date":"2012-08-22T12:05:21","date_gmt":"2012-08-22T16:05:21","guid":{"rendered":"http:\/\/dbtricks.com\/?p=159"},"modified":"2012-08-22T12:05:21","modified_gmt":"2012-08-22T16:05:21","slug":"how-to-resolve-ora-24247-network-access-denied-by-access-control-list-acl","status":"publish","type":"post","link":"https:\/\/dbtricks.com\/?p=159","title":{"rendered":"How to resolve ORA-24247: network access denied by access control list (ACL)"},"content":{"rendered":"<p>If you are trying to use oracle to invoke a web service or to connect to a smtp service and you get the following error:<\/p>\n<p><strong>ORA-24247: network access denied by access control list (ACL)<\/strong><\/p>\n<p>The cause according to oracle is that<\/p>\n<p>&#8220;No access control list (ACL) has been assigned to the target host or the privilege necessary to access the target host has not been granted to the user in the access control list.&#8221;<\/p>\n<p>This error is common after an upgrade to Oracle 11. before oracle 11, using network resources via  packages like utl_tcp, utl_smtp, utl_mail, utl_http, and utl_inaddr exposed the database to a serious security threat because once the user is granted with permission to use those packages there was no other limitation to connect to any computer.<\/p>\n<p>Since Oracle 11, oracle introduced a fine grained access to network services using access control lists (ACL).<\/p>\n<p>This new feature gave the DBA a better  control on  which user can connect to which computer<\/p>\n<p>In order to solve ORA-24247 you will need to:<\/p>\n<p>1)  <strong> Create an acl <\/strong>(if it is not already created)<\/p>\n<p>2)   <strong>Add privileges <\/strong> to the user using the network resources<\/p>\n<p>3)  <strong> Assign the acl <\/strong>to a specific address<\/p>\n<p><strong> 1)<\/strong> run the following query to check if an ACL exists<\/p>\n<p><code> SELECT *<\/code><\/p>\n<p><code> <\/code><\/p>\n<p><code> FROM   dba_network_acls;<\/code><\/p>\n<p>If the computer you are trying to connect to is not listed under host, you will need to <strong>create an acl<\/strong>:<\/p>\n<p><code><br \/>\nbegin<\/code><\/p>\n<p><code>dbms_network_acl_admin.create_acl (<\/p>\n<p>acl         =&gt; 'http_permissions.xml',  -- or any other name<\/p>\n<p>description =&gt; 'HTTP Access',<\/p>\n<p>principal   =&gt; 'SCOTT',   -- the user name trying to access the network resource<\/p>\n<p>is_grant    =&gt; TRUE,<\/p>\n<p>privilege   =&gt; 'connect',<\/p>\n<p>start_date  =&gt; null,<\/p>\n<p>end_date    =&gt; null<\/p>\n<p>);<\/p>\n<p>end;<\/p>\n<p>\/<\/p>\n<p><\/code><\/p>\n<p><code>commit;<\/code><\/p>\n<p>This will create the acl and grant SCOTT the connect privilege.<\/p>\n<p><strong>2)<\/strong> IF the acl exists run the following query to verify the user is granted with the appropriate privilege<\/p>\n<p><code> SELECT *<\/code><\/p>\n<p><code>FROM   dba_network_acl_privileges<\/p>\n<p><\/code><\/p>\n<p><code> where principal='SCOTT';<\/code><\/p>\n<p>In order to use UTL_TCP, UTL_HTTP, UTL_SMTP, and UTL_MAIL the user will need the connect privilege<\/p>\n<p><code> begin<\/code><\/p>\n<p><code>DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl       =&gt; 'http_permissions.xml',<\/p>\n<p>principal =&gt; 'SCOTT',<\/p>\n<p>is_grant  =&gt; true,<\/p>\n<p>privilege =&gt; 'connect');<\/p>\n<p>end;<\/p>\n<p>\/<\/p>\n<p><\/code><\/p>\n<p><code> commit;<\/code><\/p>\n<p>If you need to resolve a host name from a host IP you will need the resolve grant as well.<\/p>\n<p><code> begin<\/code><\/p>\n<p><code>DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl       =&gt; 'http_permissions.xml',<\/p>\n<p>principal =&gt; 'SCOTT',<\/p>\n<p>is_grant  =&gt; true,<\/p>\n<p>privilege =&gt; 'resolve');<\/p>\n<p>end;<\/p>\n<p>\/<\/p>\n<p>commit;<\/p>\n<p><\/code><\/p>\n<p><code> <\/code><\/p>\n<p><strong>3) <\/strong> The final step is to <strong>assign the acl<\/strong> to a specific target<\/p>\n<p><code> BEGIN<\/code><\/p>\n<p><code>dbms_network_acl_admin.assign_acl (<\/p>\n<p>acl        =&gt; 'http_permissions.xml',<\/p>\n<p>host       =&gt; 'NETWORK ADDRESS', \/*can be computer name or IP , wildcards are accepted as well for example - '*.us.oracle.com'*\/<\/p>\n<p>lower_port =&gt; 80,<\/p>\n<p>upper_port =&gt; 80<\/p>\n<p>);<\/p>\n<p>END;<\/p>\n<p><\/code><\/p>\n<p><code> <\/code><\/p>\n<p>It is important to note that only one ACL can be assigned to any host computer. If you assign a new acl to a target the old acl gets unassigned.<\/p>\n<p>However, the old acl is not dropped. So, this could cause confusion because even if the acl was already assigned, it is possible that a new assignment overrode it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are trying to use oracle to invoke a web service or to connect to a smtp service and you get the following error: ORA-24247: network access denied by access control list (ACL) The cause according to oracle is that &#8220;No access control list (ACL) has been assigned to the target host or the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[66,65,107],"class_list":["post-159","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-acl","tag-ora-24247-oracle-11","tag-oracle"],"_links":{"self":[{"href":"https:\/\/dbtricks.com\/index.php?rest_route=\/wp\/v2\/posts\/159","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dbtricks.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dbtricks.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dbtricks.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dbtricks.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=159"}],"version-history":[{"count":2,"href":"https:\/\/dbtricks.com\/index.php?rest_route=\/wp\/v2\/posts\/159\/revisions"}],"predecessor-version":[{"id":161,"href":"https:\/\/dbtricks.com\/index.php?rest_route=\/wp\/v2\/posts\/159\/revisions\/161"}],"wp:attachment":[{"href":"https:\/\/dbtricks.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dbtricks.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dbtricks.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}