Skip to content

Instantly share code, notes, and snippets.

@mortenbra
Last active October 30, 2015 13:45
Show Gist options
  • Save mortenbra/7b1a3fcadf6dfcd72a3f to your computer and use it in GitHub Desktop.
Save mortenbra/7b1a3fcadf6dfcd72a3f to your computer and use it in GitHub Desktop.
Oracle Network ACL configuration
-- to be run as user SYS
-- to avoid ORA-30992 and ORA-01858 due to invalid date format when calling create_acl
alter session set nls_language = AMERICAN;
alter session set nls_territory = AMERICA;
BEGIN
DBMS_NETWORK_ACL_ADMIN.create_acl (
acl => 'apex.xml',
description => 'Access Control List for APEX',
principal => 'APEX_050000',
is_grant => TRUE,
privilege => 'connect',
start_date => SYSTIMESTAMP,
end_date => NULL);
COMMIT;
END;
/
-- for outgoing mail via local mail server
BEGIN
DBMS_NETWORK_ACL_ADMIN.assign_acl (
acl => 'apex.xml',
host => 'localhost',
lower_port => 25,
upper_port => 25);
COMMIT;
END;
/
-- for integration to PayPal (also requires Oracle Wallet with SSL certificate)
BEGIN
DBMS_NETWORK_ACL_ADMIN.assign_acl (
acl => 'apex.xml',
host => '*.paypal.com',
lower_port => 443,
upper_port => 443);
COMMIT;
END;
/
-- for integration with Amazon S3 (use port 443 if using SSL)
BEGIN
DBMS_NETWORK_ACL_ADMIN.assign_acl (
acl => 'apex.xml',
host => '*.amazonaws.com',
lower_port => 80,
upper_port => 80);
COMMIT;
END;
/
/*
-- add another user/schema to already existing ACL
BEGIN
DBMS_NETWORK_ACL_ADMIN.add_privilege (
acl => 'apex.xml',
principal => 'YOUR_SCHEMA_NAME',
is_grant => TRUE,
privilege => 'connect',
position => NULL,
start_date => NULL,
end_date => NULL);
COMMIT;
END;
/
*/
-- to verify settings:
select host, lower_port, upper_port, acl
from dba_network_acls;
select *
from dba_network_acl_privileges;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment