Skip to content

Unclear message when DNS resolution is failing during a test on LDAP source #7684

Open
@nqb

Description

@nqb

Describe the bug
If you test an AD source and DNS resolution doesn't work inside pfperl-api container, you got a message like this:

Can't connect to server or bind with '[email protected]' on :389

Related code:

return ($FALSE, "Can't connect to server or bind with '$binddn' on $LDAPServer:$LDAPServerPort");

To Reproduce
Steps to reproduce the behavior:

  1. Configure an AD source with host equals to a FQDN (not an IP) which is not resolvable by pfperl-api container
  2. Click on Test button inside AD source

=> You received a message from API but you don't know that DNS resolution failed

Expected behavior
API must return a message to explain that DNS resolution has failed.

Additional context
The API already handles this error because we can see this message in packetfence.log:

Jun  1 06:53:13 pfel8dev pfperl-api-docker-wrapper[14153]: pfperl-api(14) ERROR: [mac:[undef]] Unable to resolve ad.example.lan (pf::util::resolve)

I think there is a missing check here to ensure we don't add undefined value in @LDAPServers

# Lookup the server hostnames to IPs so they can be shuffled better and to improve the failure detection
my @LDAPServers = map { valid_ip($_) ? $_ : @{resolve($_) // []} } @{$self->{'host'} // []};

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions