Bug 921162

Summary: Possible to add nonexistent target to ACI
Product: Red Hat Enterprise Linux 7 Reporter: Ján Rusnačko <jrusnack>
Component: 389-ds-baseAssignee: Rich Megginson <rmeggins>
Status: CLOSED ERRATA QA Contact: Viktor Ashirov <vashirov>
Severity: unspecified Docs Contact:
Priority: low    
Version: 7.0CC: nhosoi, nkinder, sramling
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 389-ds-base-1.3.3.1-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 09:30:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ján Rusnačko 2013-03-13 15:21:15 UTC
Description of problem:
ACI acts as access control mechanism. The "target" part of ACI can be used to specify, to which entry this ACI applies. If the target is not specified, the ACI applies to the entry containing the aci attribute and to the entries below it. 

Currently, it is possible to add non-existent entry as target and ACI is accepted by DS.

Version-Release number of selected component (if applicable):
389-ds-base-1.2.11.15-12.el6_4.i686

How reproducible:
always

Steps to Reproduce:
[jrusnack@dhcp-31-42 /]$ ldapmodify  -h 192.168.122.188 -p 389 -D "cn=directory manager" -w Secret123 <<EOF
dn: dc=example,dc=com
changetype: modify
add: aci
aci: (targetattr != "userPassword") (target = "ldap:///ou=invalid,dc=example,dc=com") (version 3.0;acl "Enable anonymous access";allow (read,compare,search)(userdn = "ldap:///anyone");)
EOF

[jrusnack@dhcp-31-42 /]$ echo $?
0

Actual results:
ACI is accepted.

Expected results:
DS should indicate that ACI applies to non-existent entry.

Comment 1 Nathan Kinder 2013-03-13 17:15:16 UTC
I'm not sure if this is something that we should change.  With the current behavior, one can create an ACI for a target that doesn't exist yet, but they may add the target later.  I don't see much downside to this other then the following:

  - If you make a typo in the target, you might not notice it unless you
    test the new ACI.

  - There is an extra ACI to evaluate that will never match any target.

If we decide to change the behavior, we have a few options:

  - Reject an ACI with a non-existent target, but this would prevent
    someone from pre-creating their ACIs for targets that will be added
    later.

  - Return/log a warning when an ACI is added with a non-existent target,
    but allow the operation to go through.  The problem with this is that
    I'm not sure if most LDAP clients will not display the error message
    since the result code is 0.  It is also not likely that the person
    adding the ACI will then check the errors log.

Comment 3 Sankar Ramalingam 2013-03-14 07:49:28 UTC
(In reply to comment #1)
> I'm not sure if this is something that we should change.  With the current
> behavior, one can create an ACI for a target that doesn't exist yet, but
> they may add the target later.  I don't see much downside to this other then
> the following:
> 
>   - If you make a typo in the target, you might not notice it unless you
>     test the new ACI.
> 
>   - There is an extra ACI to evaluate that will never match any target.
> 
> If we decide to change the behavior, we have a few options:
> 
>   - Reject an ACI with a non-existent target, but this would prevent
>     someone from pre-creating their ACIs for targets that will be added
>     later.
> 
>   - Return/log a warning when an ACI is added with a non-existent target,
>     but allow the operation to go through.  The problem with this is that
>     I'm not sure if most LDAP clients will not display the error message
>     since the result code is 0.  It is also not likely that the person
>     adding the ACI will then check the errors log.

Logging an error/warning message might be helpful when the user finds that one of the ACI is not working. I am sure most of the users/customers will look at the error logs when something stops working or not working as expected. But, I agree that it deoesn't require a validation on the fly considering that the target might be created a later point of time.

Comment 4 Nathan Kinder 2013-03-17 18:55:09 UTC
Upstream ticket:
https://fedorahosted.org/389/ticket/626

Comment 6 Sankar Ramalingam 2014-12-01 04:48:55 UTC
Invalid ACI throws error message in the logs.

[root@vm-idm-035 ~]# ldapmodify -x -p 1189 -h localhost -D "cn=Directory Manager" -w Secret123 << EOF
> dn: dc=example,dc=com
> changetype: modify
> add: aci
> aci: (targetattr != "userPassword") (target = "ldap:///ou=invalid,dc=example,dc=com") (version 3.0;acl "Enable anonymous access";allow (read,compare,search)(userdn = "ldap:///anyone");)
> EOF
modifying entry "dc=example,dc=com"


==> /var/log/dirsrv/slapd-M1/errors <==
[01/Dec/2014:10:09:11 +051800] NSACLPlugin - The ACL target ou=invalid,dc=example,dc=com does not exist

Comment 8 errata-xmlrpc 2015-03-05 09:30:21 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-0416.html