RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2014768 - Log the Auto Member invalid regex rules in the LDAP errors log. [rhel-7.9.z]
Summary: Log the Auto Member invalid regex rules in the LDAP errors log. [rhel-7.9.z]
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: 389-ds-base
Version: 7.9
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: 7.9
Assignee: mreynolds
QA Contact: RHDS QE
URL:
Whiteboard: sync-to-jira
Depends On:
Blocks: 2015996 2015998
TreeView+ depends on / blocked
 
Reported: 2021-10-16 14:24 UTC by Têko Mihinto
Modified: 2022-06-28 09:55 UTC (History)
9 users (show)

Fixed In Version: 389-ds-base-1.3.10.2-16.el7_9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2015996 (view as bug list)
Environment:
Last Closed: 2022-06-28 09:54:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github 389ds 389-ds-base issues 4956 0 None closed Automember allows invalid regex, and does not log proper error 2021-11-03 14:46:49 UTC
Red Hat Issue Tracker IDMDS-1731 0 None None None 2021-10-20 11:53:52 UTC
Red Hat Issue Tracker IDMDS-2299 0 None None None 2022-05-30 09:30:02 UTC
Red Hat Issue Tracker RHELPLAN-100044 0 None None None 2021-10-16 14:25:08 UTC
Red Hat Product Errata RHSA-2022:5239 0 None None None 2022-06-28 09:54:40 UTC

Description Têko Mihinto 2021-10-16 14:24:38 UTC
Description of problem:
When logging an error message about invalid Auto Member rules, it would be useful to add also the name of the rule and the invalid regular expression.

Version-Release number of selected component (if applicable):
# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.9 (Maipo)
#
# rpm -qa | grep ipa-server
ipa-server-common-4.6.8-5.el7.noarch
ipa-server-4.6.8-5.el7.x86_64
#

How reproducible:
Always.

Steps to Reproduce:
1. Add an invalid regex to a rule.
2. Check in the LDAP errors log. The related message doesn't contain the actual invalid regex:
# grep automember_parse_regex_rule /var/log/dirsrv/slapd-<INSTANCE>/errors
[15/Oct/2021:21:44:12.657912921 +0200] - ERR - auto-membership-plugin - automember_parse_regex_rule - Unable to parse regex rule (invalid regex).  Error "nothing to repeat".
#

It would be helpful to get such information to quickly find the invalid expression(s).
Especially when there are many of them:
$ grep -c  automember_parse_regex_rule <SOS_REPORT>/var/log/dirsrv/slapd-<INSTANCE_NAME>/errors
72
$

Actual results:
Not enough additional information.

Expected results:
Log the invalid regexes.

Additional info:

Comment 3 Florence Blanc-Renaud 2021-10-19 09:15:19 UTC
I am moving this BZ to 389ds component, as the automember plugin belongs there.

Comment 4 mreynolds 2021-10-20 11:51:21 UTC
The reason that we do not log with rule and regex is invalid is becuase oif a bug where we do not return a error code when things go wrong.

diff --git a/ldap/servers/plugins/automember/automember.c b/ldap/servers/plugins/automember/automember.c
index 39350ad53..b92b89bd5 100644
--- a/ldap/servers/plugins/automember/automember.c
+++ b/ldap/servers/plugins/automember/automember.c
@@ -1217,6 +1217,7 @@ automember_parse_regex_rule(char *rule_string)
                       "automember_parse_regex_rule - Unable to parse "
                       "regex rule (invalid regex).  Error \"%s\".\n",
                       recomp_result ? recomp_result : "unknown");
+        goto bail;
     }
 
     /* Validation has passed, so create the regex rule struct and fill it in.

Comment 5 thierry bordaz 2021-11-03 14:48:34 UTC
Fix pushed upstream -> POST

Comment 6 thierry bordaz 2021-12-08 17:00:50 UTC
I was wrong, it is not pushed in 1.3.10 => NEW

Comment 15 Akshay Adhikari 2022-06-17 16:58:31 UTC
============================================================================ test session starts ============================================================================
platform linux -- Python 3.6.8, pytest-7.0.1, pluggy-1.0.0 -- /usr/bin/python3
cachedir: .pytest_cache
metadata: {'Python': '3.6.8', 'Platform': 'Linux-3.10.0-1160.68.1.el7.x86_64-x86_64-with-redhat-7.9-Maipo', 'Packages': {'pytest': '7.0.1', 'py': '1.11.0', 'pluggy': '1.0.0'}, 'Plugins': {'metadata': '1.11.0', 'html': '3.1.1', 'libfaketime': '0.1.2', 'flaky': '3.7.0'}}
389-ds-base: 1.3.10.2-16.el7_9
nss: 3.67.0-4.el7_9
nspr: 4.32.0-1.el7_9
openldap: 2.4.44-25.el7_9
cyrus-sasl: 2.1.26-24.el7_9
FIPS: 0

rootdir: /mnt/tests/rhds/tests/upstream/ds
plugins: metadata-1.11.0, html-3.1.1, libfaketime-0.1.2, flaky-3.7.0
collected 1 item                                                                                                                                                            

dirsrvtests/tests/suites/automember_plugin/configuration_test.py::test_invalid_regex PASSED                                                                           [100%]

====================================================================== 1 passed, 3 warnings in 20.12s =======================================================================

Marking as VERIFIED.

Comment 23 errata-xmlrpc 2022-06-28 09:54: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 (Moderate: 389-ds-base security, bug fix, and enhancement update), 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://access.redhat.com/errata/RHSA-2022:5239


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