Hi,
the recursion depth check looks misplaced. Care to try the modifications
below?
Cheers,
Marc
--- a/mavis/perl/
mavis_tacplus-ng_ldap.pl
+++ b/mavis/perl/
mavis_tacplus-ng_ldap.pl
@@ -206,7 +206,6 @@ sub expand_groupOfNames($) {
sub expand_memberof($) {
sub expand_memberof_sub($$$) {
my $depth = $_[2];
- return if defined($LDAP_NESTED_GROUP_DEPTH) &&
$LDAP_NESTED_GROUP_DEPTH <= $depth;
sub get_memberof($) {
my $mesg = $ldap->search(base => $_[0],
scope=>'base', filter=>'(objectclass=*)', attrs=>['memberOf']);
if ($mesg->code){
@@ -223,11 +222,13 @@ sub expand_memberof($) {
foreach my $m (@$a) {
unless (exists $H->{$m}) {
$H->{$m} = 1;
+ if (defined($LDAP_NESTED_GROUP_DEPTH) &&
$LDAP_NESTED_GROUP_DEPTH <= $depth) {
my $g = get_memberof($m);
expand_memberof_sub($g, $H, $depth + 1);
+}
}
}
}
my %H;
expand_memberof_sub($_[0], \%H, 0);
On 05.02.2025 17:15, Vitaly N. wrote:
>
> Hi Marc!
> Apologies for bumping an old thread, I can make a new one if that's
> better. I am trying to troubleshoot the exact same issue with latency
> because of numerous queries.
> I can see all the queries in the LDAP server logging, and setting
> LDAP_NESTED_GROUP_DEPTH = -1fixes the latency issue, but then
> authentication by group no longer works (probably because of the regex
> issue Petr pointed out)
> I've attached our current very simplistic configuration.
>
> Here is I think the relevant bit:
>
> id = tac_plus-ng {
> mavis module = external {
> setenv LDAP_SERVER_TYPE = "generic"
> setenv LDAP_HOSTS = "ldaps://duo1:12346"
> setenv LDAP_BASE = "cn=users,cn=accounts,dc=company,dc=net"
> setenv LDAP_BASE_GROUP = "cn=groups,cn=accounts,dc=company,dc=net"
> setenv LDAP_USER =
> "uid=tacacsuser,cn=users,cn=accounts,dc=company,dc=net"
> setenv LDAP_PASSWD = "bind_password"
> setenv LDAP_MEMBEROF_REGEX = "^cn=(tacacs[^,]+),.*"
> setenv LDAP_NESTED_GROUP_DEPTH = 0
> exec = /tacacs/lib/mavis/
mavis_tacplus-ng_ldap.pl
> }
>
> Thanks for any insight!
> On Monday, May 13, 2024 at 5:35:58 AM UTC-4 Petr Issakov wrote:
>
> Hi Marc!
> Thank you!
> I've tested latest
mavis_tacplus-ng_ldap.pl
> <
http://mavis_tacplus-ng_ldap.pl/> with LDAP_NESTED_GROUP_DEPTH
> I expect that LDAP_NESTED_GROUP_DEPTH = 0 config should disable
> expanding nested groups but I noticed that if I configure
> setenv LDAP_NESTED_GROUP_DEPTH = 0 - recursively groups
> expanding work anymore
> Then I try set LDAP_NESTED_GROUP_DEPTH = -1 and in this case
> backend stopping expanding groups but filtering group by
> LDAP_MEMBEROF_REGEX not work.
>
> воскресенье, 21 апреля 2024 г. в 13:27:20 UTC+6, Marc Huber:
>
> Hi Petr,
>
> the latest commit adds support for a LDAP_NESTED_GROUP_DEPTH
> environment
> variable.
>
> setenv LDAP_NESTED_GROUP_DEPTH = <n> # limit to <n> levels
>
> This should work with ldapmavis-mt,
mavis_tacplus-ng_ldap.pl
> <
http://mavis_tacplus-ng_ldap.pl> and
> mavis_tacplus_ldap.py.
>
> Cheers,
>
> Marc
>
>
> On 17.04.2024 18:28, Marc Huber wrote:
> > Hi Petr,
> >
> > thanks again for testing and evaluating the recent code!
> >
> > I need a bit more time to think about the memberOf
> recursions, as
> > those should be covered by the Perl, Python, any C backends,
> similary.
> > I'll possibly add some kind of "recursion depth" parameter
> to cope
> > with this issue. Not sure about that one right now.
> >
> > Thanks,
> >
> > Marc
> >
> >
>
>
> This message (including any attachments) contains confidential
> information intended for a specific individual and purpose, and is
> protected by law. If you are not the intended recipient, you should
> delete this message and are hereby notified that any disclosure,
> copying, or distribution of this message, or the taking of any action
> based on it, is strictly prohibited. --
> You received this message because you are subscribed to the Google
> Groups "Event-Driven Servers" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
event-driven-ser...@googlegroups.com.
> To view this discussion visit
>
https://groups.google.com/d/msgid/event-driven-servers/82c59bcd-8509-4781-aeb4-bb9c37b255c0n%40googlegroups.com
> <
https://groups.google.com/d/msgid/event-driven-servers/82c59bcd-8509-4781-aeb4-bb9c37b255c0n%40googlegroups.com?utm_medium=email&utm_source=footer>.