Pages

Friday, September 13, 2013

send e-mail configuration using Access list to Network Services in Oracle Database 11g

•acl - The name of the access control list XML file, generated relative to the "/sys/acls" directory in the XML DB Repository.
•description - A description of the ACL.
•principal - The first user account or role being granted or denied permissions. The text is case sensitive.
•is_grant - TRUE to grant, FALSE to deny the privilege.
•privilege - Use 'connect' for UTL_TCP, UTL_SMTP, UTL_MAIL and UTL_HTTP access. Use 'resolve' for UTL_INADDR name/IP resolution. The text is case sensitive.
•start_date - Default value NULL. When specified, the ACL will only be active on or after the specified date.
•end_date - An optional end date for the ACL.


CONN sys/password@db11g AS SYSDBA

CREATE USER test1 IDENTIFIED BY test1;
GRANT CONNECT TO test1;

CREATE USER test2 IDENTIFIED BY test2;
GRANT CONNECT TO test2;

BEGIN
  DBMS_NETWORK_ACL_ADMIN.create_acl (
    acl          => 'test_acl_file.xml',
    description  => 'A test of the ACL functionality',
    principal    => 'TEST1',
    is_grant     => TRUE,
    privilege    => 'connect',
    start_date   => SYSTIMESTAMP,
    end_date     => NULL);

  COMMIT;
END;
/

BEGIN
  DBMS_NETWORK_ACL_ADMIN.add_privilege (
    acl         => 'test_acl_file.xml',
    principal   => 'TEST2',
    is_grant    => FALSE,
    privilege   => 'connect',
    position    => NULL,
    start_date  => NULL,
    end_date    => NULL);

  COMMIT;
END;
/

BEGIN
  DBMS_NETWORK_ACL_ADMIN.delete_privilege (
    acl         => 'test_acl_file.xml',
    principal   => 'TEST2',
    is_grant    => FALSE,
    privilege   => 'connect');

  COMMIT;
END;
/

BEGIN
  DBMS_NETWORK_ACL_ADMIN.drop_acl (
    acl         => 'test_acl_file.xml');

  COMMIT;
END;
/


•acl - The name of the access control list XML file.
•host - The hostname, domain, IP address or subnet to be assigned. Hostnames are case sensitive, and wildcards are allowed for IP addresses and domains.
•lower_port - Defaults to NULL. Specifies the lower port range for the 'connect' privilege.
•upper_port - Defaults to NULL. If the lower_port is specified, and the upper_port is NULL, it is assumed the upper_port matches the lower_port.

BEGIN
  DBMS_NETWORK_ACL_ADMIN.assign_acl (
    acl         => 'test_acl_file.xml',
    host        => '192.168.2.3',
    lower_port  => 80,
    upper_port  => NULL);

  DBMS_NETWORK_ACL_ADMIN.assign_acl (
    acl         => 'test_acl_file.xml',
    host        => '10.1.10.*',
    lower_port  => NULL,
    upper_port  => NULL);

  COMMIT;
END;
/

No comments:

Post a Comment