Oracle : Network access denied by access control list - oracle

I'm running Oracle 18c XE
I'm trying to connect to the following URL :
URL := 'https://domain.example.com/api'
apex_web_service.make_rest_request(p_url => URL, p_http_method => GetOrPost, p_body => RequestBody);
I'm getting the error :
ORA-29273: HTTP request failed
ORA-06512: at "APEX_190200.WWV_FLOW_WEB_SERVICES", line 1283
ORA-06512: at "APEX_190200.WWV_FLOW_WEB_SERVICES", line 924
ORA-24247: network access denied by access control list (ACL)
I tried to create an ACL for that
exec DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(acl => 'MyACL.xml', description => 'MyACL', principal => 'Schema', is_grant => true, privilege => 'connect');
exec DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl => 'MyACL.xml', principal => 'Schema', is_grant => true, privilege => 'resolve');
exec DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL(acl => 'MyACL.xml', host => '*', lower_port => 443, upper_port => 443);
tried several assigns :
exec DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL(acl => 'MyACL.xml', host => 'domain.example.com/api', lower_port => 443, upper_port => 443);
exec DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL(acl => 'MyACL.xml', host => 'domain.example.com/api');
None is working.
Can someone help please ?
Thanks.
Cheers

Related

ACL for Sending e-Mail with APEX Oracle 11.2

I'm trying to send e-Mail as a simple Send e-Mail process with Oracle APEX 11.2, and I can't figure out how the correct ACL has to be set. I tried this, but no success, still getting: ORA-24247: network access denied by access control list (ACL). What am I doing wrong?
SELECT * FROM dba_network_acl_privileges shows that all rules are granted and also select * from dba_network_acls shows both rules.
Thanks in Advance!
BEGIN
DBMS_NETWORK_ACL_ADMIN.DROP_ACL (acl => 'send_mail.xml' );
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('send_mail.xml','Allow mail to be send', 'APEX_050100', TRUE, 'connect');
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE('send_mail.xml','APEX_050100',TRUE, 'connect');
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE('send_mail.xml','APEX_050100',TRUE, 'resolve');
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL (acl => 'send_mail.xml',host => '*',lower_port => null, upper_port => null);
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL (acl => 'send_mail.xml',host => 'smtp.google.com',lower_port => null, upper_port => null);
commit;
END;
BEGIN
DBMS_NETWORK_ACL_ADMIN.DROP_ACL (acl => 'utl_smtp.xml' );
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('utl_smtp.xml','Allow mail to be send', 'APEX_050100', TRUE, 'connect');
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE('utl_smtp.xml','APEX_050100',TRUE, 'connect');
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE('utl_smtp.xml','APEX_050100',TRUE, 'resolve');
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL (acl => 'utl_smtp.xml',host => '*',lower_port => null, upper_port => null);
END;
This is how I do it.
-- Drop ACL ====================================================================
BEGIN
DBMS_NETWORK_ACL_ADMIN.drop_acl (acl => 'mydba.xml');
END;
/
-- Create ACL ==================================================================
BEGIN
DBMS_NETWORK_ACL_ADMIN.create_acl (
acl => 'mydba.xml',
description => 'SMTP, MAIL, HTTP Access',
principal => 'LITTLEFOOT',
is_grant => TRUE,
privilege => 'connect',
start_date => NULL,
end_date => NULL);
END;
/
-- Assign ACL ==================================================================
BEGIN
DBMS_NETWORK_ACL_ADMIN.assign_acl (acl => 'mydba.xml',
HOST => '*',
lower_port => NULL,
upper_port => NULL);
END;
/
-- Add privilege ===============================================================
BEGIN
-- LITTLEFOOT
DBMS_NETWORK_ACL_ADMIN.add_privilege (acl => 'mydba.xml',
principal => 'LITTLEFOOT',
is_grant => TRUE,
privilege => 'connect',
start_date => NULL,
end_date => NULL);
DBMS_NETWORK_ACL_ADMIN.add_privilege (acl => 'mydba.xml',
principal => 'LITTLEFOOT',
is_grant => TRUE,
privilege => 'resolve',
start_date => NULL,
end_date => NULL);
END;
/
COMMIT;
When new users require privileges, I just copy/paste LITTLEFOOT's data from the "Add privilege" procedure and change principal's name (currently, there are dozen of users in my script).

ORA-24247: network access denied by access control list (ACL)?

I would like to connect to a certain URL from PL/SQL:
I did the following steps
Created an ACL
Granted both connect and resolve privileges to my schema
Assigned the URL to the ACL
BEGIN
-- Create new acl
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(acl => 'NiceACL', description => 'My ACL', principal => 'JOHN',is_grant => true, privilege => 'connect');
-- Connect privilege
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl => 'NiceACL', principal => 'JOHN', is_grant => true, privilege => 'connect');
-- Resolve privilege
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl => 'NiceACL', principal => 'JOHN', is_grant => true, privilege => 'resolve');
-- Assign host
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL(acl => 'NiceACL', host => 'domain.com');
COMMIT;
END;
After these steps, I run the following query and I can see the ACL Created and granted to the schema, and the host associated to the ACL
SELECT acl,
u.username,
host,
DECODE(DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE_ACLID(aclid, u.username, 'connect'), 1, 'GRANTED', 0, 'DENIED', null) conn_privilege,
DECODE(DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE_ACLID(aclid, u.username, 'resolve'), 1, 'GRANTED', 0, 'DENIED', null) res_privilege
FROM
dba_network_acls a,
dba_users u
where
u.username = 'JOHN';
But When opening a connect (via the schema John) I'm getting the error : ORA-24247: network access denied by access control list (ACL)
UTL_TCP.OPEN_CONNECTION(REMOTE_HOST => 'domain.com', REMOTE_PORT => 8080, TX_TIMEOUT => 10);
Can anyone help please ?
Thanks

Upload file FTP with Filesystem Laravel error

I try to upload a video file to my download server with FTP file system in laravel but I have a this error:
League\Flysystem\ConnectionRuntimeException: Could not connect to host: myip, port:21 in file /home/test/domains/myhost/laravel/vendor/league/flysystem/src/Adapter/Ftp.php on line 140
in my filesytem.php
'ftp' => [
'driver' => 'ftp',
'host' => 'myip',
'username' => 'myusername',
'password' => 'mypass',
'port' => 21,
],
how to fix this error
FTP port:21 is for pass control information.
Did you try port:20 ?
im using sftp because when i using ftp is error in port too. and don't forget too enable ftp in php.ini
'sftp' => [
'driver' => 'sftp',
'host' => 'xxx.xxx.com',
'username' => 'user',
'password' => 'pass',
'root' => ' xxx' , // for example: /public_html/images
I fix this issue by enabling an FTP extension in my server.

ORACLE APEX_MAIL

I am trying to send mail with apex_mail
Here is my configuration , but i did receive any mails
Is there something missing?
Thanks
Execute this code as sysdba to grant permissions for your DB User to connect to smtp server:
begin
dbms_network_acl_admin.create_acl
(
acl => 'mail.xml',
description => 'Access to smtp server',
principal => 'DBUser', -- DB Schema (grantee)
is_grant => true,
privilege => 'connect',
start_date => null,
end_date => null
);
dbms_network_acl_admin.assign_acl(
acl => 'mail.xml',
host => 'mail.muncipaldata.com', -- SMTP host
lower_port => 1025,
upper_port => 1025
);
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(
acl => 'mail.xml',
principal => 'DBUser', -- DB Schema (grantee)
is_grant => true,
privilege => 'resolve',
start_date => null,
end_date => null
);
end;

Ldap query for Authentication based on AD security group

I've seen a couple of posts here on this topic, but I can't manage to authenticate by users in a group. If I point the path to where a user is, authentication is successful. It's like it "cannot read" inside the group. I'm must be missing something.
my configs are:
$GLOBALS['ldapdsn'] = array(
// primary server MS AD Server
// port 636 is ldaps and port 389 is ldap
array(
'url' => '172.25.20.3',
'port' => '389',
'version' => '3',
'referral' => 'false',
'basedn' => 'CN=RedcapUsers,OU=RedCap,OU=Srv,DC=mydomain,DC=com',
'binddn' => 'CN=RedcapLdap,OU=RedCap,OU=Srv,DC=mydomain,DC=com',
'bindpw' => 'mypass',
'attributes' => array('sAMAccountName'),
'userattr' => 'sAMAccountName',
'userfilter' => '(objectClass=user)',
), //
RedcapUsers is the AD group.
Binding works fine.
I'm pretty new in code writing.
Filter the AD group ( See last line of code) and issue is resolved !
'url' => 'Active Directory ip',
'port' => '636',
'version' => '3',
'referral' => 'false',
'basedn' => 'OU=Users,DC=Ali,DC=local', // Must be exact OU where users are
'binddn' => 'CN=service_redcap,OU=Users,DC=Ali,DC=local', //-- User who give access to AD
'bindpw' => 'myPassword', // ---Password to above user
'attributes' => array('samAccountName'),
'userattr' => 'samAccountName',
'userfilter' => '(memberOf=CN=REDCAP_GROUP,DC=Ali,DC=local)' //-- Users in this group will loging to Redcap

Resources