Bug 1406835 - memberOf fixup task does not validate args
Summary: memberOf fixup task does not validate args
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: 389-ds-base
Version: 6.9
Hardware: All
OS: All
unspecified
high
Target Milestone: rc
: ---
Assignee: mreynolds
QA Contact: Viktor Ashirov
Marc Muehlfeld
URL:
Whiteboard:
Depends On:
Blocks: 1406838
TreeView+ depends on / blocked
 
Reported: 2016-12-21 15:28 UTC by mreynolds
Modified: 2017-03-21 10:24 UTC (History)
6 users (show)

Fixed In Version: 389-ds-base-1.2.11.15-87.el6
Doc Type: Bug Fix
Doc Text:
The "memberOf" fix-up task now verifies arguments Previously, if an invalid filter or "basedn" parameter was provided in the "memberOf" fix-up task, and the task failed, no information was logged. A patch has been applied and now, if a problem occurs, an error is logged and the task status is updated. As a result, the administrator is now able to identify if a task failed.
Clone Of:
: 1406838 (view as bug list)
Environment:
Last Closed: 2017-03-21 10:24:23 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:0667 normal SHIPPED_LIVE 389-ds-base bug fix update 2017-03-21 12:35:05 UTC

Description mreynolds 2016-12-21 15:28:01 UTC
Description of problem:

The filter and basedn of the memberOf fixup task are not validated.  If there is a problem it silently fails, and it's not obvious in the logs that the task failed.

How reproducible:

Run the memberOf fixup task using an invalid filter:

    '(objectclass=person'


Actual results:

The errors log shows that the task finished, but in fact it failed


Expected results:

The errors log, and task log, show that the task failed to run.


Upstream ticket:

https://fedorahosted.org/389/ticket/49072

Comment 1 mreynolds 2016-12-21 15:43:53 UTC
Fixed upstream

Comment 5 Sankar Ramalingam 2017-01-11 11:33:05 UTC
I ran fixup-memberof.pl script to check if it throws error for invalid filters. No errors printed in the DS error logs. It seems like the issue is still present with the latest build of 389-ds-base-1.2.11.15-86.

[root@cypher 389ds-replica]# /usr/lib64/dirsrv/slapd-Inst1/fixup-memberof.pl -D "cn=Directory Manager" -w Secret123 -b "dc=xample,dc=com"  -f '(|(objectclass=inetuser)(objec'
adding new entry "cn=memberOf_fixup_2017_1_11_6_24_8, cn=memberOf task, cn=tasks, cn=config"

[root@cypher 389ds-replica]# /usr/lib64/dirsrv/slapd-Inst1/fixup-memberof.pl -D "cn=Directory Manager" -w Secret123 -b "dc=xample,dc=com"  -f '(objectclass=person'
adding new entry "cn=memberOf_fixup_2017_1_11_6_25_44, cn=memberOf task, cn=tasks, cn=config"

[root@cypher export]# tail -f /var/log/dirsrv/slapd-Inst1/errors /var/log/dirsrv/slapd-Inst1/access
[11/Jan/2017:06:24:08 -0500] conn=81 op=0 RESULT err=0 tag=97 nentries=0 etime=0 dn="cn=directory manager"
[11/Jan/2017:06:24:08 -0500] conn=81 op=1 ADD dn="cn=memberOf_fixup_2017_1_11_6_24_8,cn=memberOf task,cn=tasks,cn=config"
[11/Jan/2017:06:24:08 -0500] conn=81 op=1 RESULT err=0 tag=105 nentries=0 etime=0
[11/Jan/2017:06:24:08 -0500] conn=81 op=2 UNBIND
[11/Jan/2017:06:24:08 -0500] conn=81 op=2 fd=110 closed - U1
[11/Jan/2017:06:25:44 -0500] conn=82 fd=80 slot=80 connection from 10.19.34.88 to 10.19.34.88
[11/Jan/2017:06:25:44 -0500] conn=82 op=0 BIND dn="cn=Directory Manager" method=128 version=3
[11/Jan/2017:06:25:44 -0500] conn=82 op=0 RESULT err=0 tag=97 nentries=0 etime=0 dn="cn=directory manager"

[11/Jan/2017:06:25:44 -0500] conn=82 op=1 ADD dn="cn=memberOf_fixup_2017_1_11_6_25_44,cn=memberOf task,cn=tasks,cn=config"
[11/Jan/2017:06:25:44 -0500] conn=82 op=1 RESULT err=0 tag=105 nentries=0 etime=0
[11/Jan/2017:06:25:44 -0500] conn=82 op=2 UNBIND
[11/Jan/2017:06:25:44 -0500] conn=82 op=2 fd=80 closed - U1

[root@cypher export]# rpm -qa |grep -i 389-ds
389-ds-base-libs-1.2.11.15-86.el6.x86_64
389-ds-base-1.2.11.15-86.el6.x86_64

Comment 6 mreynolds 2017-01-11 17:13:59 UTC
This works for me on master branch.  

Note that task will still get successfully added, but it fails afterwards.  This is only evident in the errors log:


fixup-memberof.pl -D "cn=Directory Manager" -w Secret123 -b "dc=xample,dc=com"  -f '(|(objectclass=inetuser)(objec'


[11/Jan/2017:12:07:40.015817247 -0500] - INFO - memberof-plugin - memberof_fixup_task_thread - Memberof task starts (filter: "(|(objectclass=inetuser)(objec") ...
[11/Jan/2017:12:07:40.018272570 -0500] - ERR - memberof-plugin - memberof_fixup_task_thread - Failed to get be backend from (dc=xample,dc=com)

I need to get a beaker box to test 1.2.11...

Comment 7 Noriko Hosoi 2017-01-11 18:05:45 UTC
(In reply to mreynolds from comment #6)
> This works for me on master branch.  
> 
> Note that task will still get successfully added, but it fails afterwards. 
> This is only evident in the errors log:
> 
> 
> fixup-memberof.pl -D "cn=Directory Manager" -w Secret123 -b
> "dc=xample,dc=com"  -f '(|(objectclass=inetuser)(objec'
> 
> 
> [11/Jan/2017:12:07:40.015817247 -0500] - INFO - memberof-plugin -
> memberof_fixup_task_thread - Memberof task starts (filter:
> "(|(objectclass=inetuser)(objec") ...
> [11/Jan/2017:12:07:40.018272570 -0500] - ERR - memberof-plugin -
> memberof_fixup_task_thread - Failed to get be backend from (dc=xample,dc=com)
> 
> I need to get a beaker box to test 1.2.11...

Thanks for taking care of the issue, Mark.  Just in case, I'm attaching 49072 patches used in the 389-ds-base-1.2.11.15-86.el6 build to this bug.  Hopefully, it'd help your investigation...

Comment 11 mreynolds 2017-01-13 14:45:52 UTC
The filter evaluation works correctly on 1.2.11.15-86


# /usr/lib64/dirsrv/slapd-localhost/fixup-memberof.pl -D "cn=Directory Manager" -w Secret123 -b "dc=xample,dc=com"  -f '(objectclass=person'
adding new entry "cn=memberOf_fixup_2017_1_13_9_37_35, cn=memberOf task, cn=tasks, cn=config"

[root@hp-dl2x170g6-02 ~]# tail /var/log/dirsrv/slapd-localhost/errors
[13/Jan/2017:09:37:03 -0500] - 389-Directory/1.2.11.15 B2017.010.016 starting up
[13/Jan/2017:09:37:03 -0500] - slapd started.  Listening on All Interfaces port 389 for LDAP requests
[13/Jan/2017:09:37:34 -0500] memberof-plugin - Memberof task starts (filter: "(objectclass=person") ...
[13/Jan/2017:09:37:34 -0500] memberof-plugin - memberof_fix_memberof - Failed (Bad search filter)
[13/Jan/2017:09:37:34 -0500] memberof-plugin - Memberof task finished (filter: (objectclass=person) result: -1


But I found another bug.  The basedn on 1.2.11 is not being validated.  I will look into this...

Comment 12 mreynolds 2017-01-13 20:50:26 UTC
Base dn validation fixed upstream

Comment 13 Sankar Ramalingam 2017-01-18 08:24:03 UTC
[0 root@qeos-87 upstream]# /usr/lib64/dirsrv/slapd-qeos-87/fixup-memberof.pl -D "cn=Directory Manager" -w Secret123 -b "dc=lab,dc=eng,dc=rdu2,dc=redhat,dc=com"  -f '(objectclass=person'
adding new entry "cn=memberOf_fixup_2017_1_18_3_21_17, cn=memberOf task, cn=tasks, cn=config"

[0 root@qeos-87 ~]# tail -18f /var/log/dirsrv/slapd-qeos-87/errors
[18/Jan/2017:03:21:16 -0500] memberof-plugin - Memberof task starts (filter: "(objectclass=person") ...
[18/Jan/2017:03:21:16 -0500] memberof-plugin - memberof_fix_memberof - Failed (Bad search filter)
[18/Jan/2017:03:21:16 -0500] memberof-plugin - Memberof task finished (filter: (objectclass=person) result: -1

[0 root@qeos-87 upstream]# /usr/lib64/dirsrv/slapd-qeos-87/fixup-memberof.pl -D "cn=Directory Manager" -w Secret123 -b "dc=example,dc=com"  -f objectclass=person
adding new entry "cn=memberOf_fixup_2017_1_18_3_21_28, cn=memberOf task, cn=tasks, cn=config"

[0 root@qeos-87 ~]# tail -18f /var/log/dirsrv/slapd-qeos-87/errors
[18/Jan/2017:03:21:27 -0500] memberof-plugin - Memberof task starts (filter: "objectclass=person") ...
[18/Jan/2017:03:21:27 -0500] memberof-plugin - memberof_fixup_task_thread - Failed to get be backend from (dc=example,dc=com)
[18/Jan/2017:03:21:27 -0500] memberof-plugin - Memberof task finished (filter: objectclass=person) result: -1


fixup-memberof.pl script validates both BaseDN as well as the filter. Hence, marking the bug as Verified.

[0 root@qeos-87 upstream]# rpm -qa |grep -i 389-ds-
389-ds-base-1.2.11.15-87.el6.x86_64
389-ds-base-libs-1.2.11.15-87.el6.x86_64

Comment 17 errata-xmlrpc 2017-03-21 10:24:23 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/RHBA-2017-0667.html


Note You need to log in before you can comment on or make changes to this bug.