Adam, After some additional debugging and changes….i am getting these debug messages…I think the ldap is actually working…but something else is not right…. Can you take a look
LDAP[Connecting to dc3.company.local] × LDAP[Connected] × LDAP[Referrals][Disabled] × LDAP[Version][Set to 3] × LDAP[Bind DN called] × LDAP[Bind][cn=ldap user,cn=Users,dc=company,dc=local] × LDAP[Filter][(&(objectClass=person)(sAMAccountName=testuser))][OU=LNB,dc=company,dc=local] × LDAP[Authenticate][User: testuser][Bind user: CN=Test User,OU=LNB,DC=company,DC=local] × LDAP[Authenticate][Comparing: CN=Domain Admins,CN=Users,dc=company,dc=local][member=CN=Test User,OU=LNB,DC=company,DC=local] × LDAP[Authenticate][Processing group: CN=Domain Admins,CN=Users,dc=company,dc=local][Matched] × LDAP[Bind DN called] × LDAP[UserLevel][UserDN: CN=Test User,OU=LNB,DC=company,DC=local] × LDAP[UserLevel][Processing group: CN=Domain Admins,CN=Users,dc=company,dc=local][Level: 10] × LDAP[UserLevel][Accepted group level as new highest level] × LDAP[Userlevel][Final level: 10] INSERT INTO `authlog` (`user`,`address`,`user_agent`,`result`) VALUES ('testuser','10.40.1.253','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36 Edg/98.0.1108.55','Logged In') × LDAP[Bind DN called] × LDAP[Filter][(&(objectClass=person)(sAMAccountName=testuser))][OU=LNB,dc=company,dc=local] × LDAP[UserID][Converted objectSid S-1-5-21-2500025594-3660327915-2769566259-31843 to user ID 31843] × LDAP[UserID][31843] SELECT * FROM `entity_permissions` WHERE `user_id` = '31843' AND `auth_mechanism` = 'ldap' SELECT * FROM `roles_entity_permissions` LEFT JOIN `roles_users` USING (`role_id`) WHERE `user_id` = '31843' AND `auth_mechanism` = 'ldap' SELECT * FROM `roles_permissions` LEFT JOIN `roles_users` USING (`role_id`) WHERE `user_id` = '31843' AND `auth_mechanism` = 'ldap' SELECT `alert_table_id`, `device_id`, `entity_id`, `entity_type` FROM `alert_table` SELECT `value` FROM `users_prefs` WHERE `user_id` = '31843' AND `pref` = 'atom_key' × Debugging mode has disabled redirect to front page; please click here to continue.
From: Adam Armstrong via observiummailto:observium@observium.org Sent: Wednesday, February 16, 2022 7:29 PM To: 'Observium'mailto:observium@observium.org Cc: Adam Armstrongmailto:adama@observium.org Subject: Re: [Observium] LDAP auth to MS AD with TLS Self Signed Cert
I’ve never used LDAP, so I’m not really sure how this should be done.
You can put the putenv stuff in config.php. So long as the variable is set before LDAP tries to start the connection that should be sufficient.
Observium doesn’t have any configuration related to this itself. You just need to coax whatever conglomeration of PHP and OpenLDAP code exists into talking to your LDAP server.
You might be able to turn of the cert checking by putting “TLS_REQCERT never” into ldap.conf, probably /etc/openldap/ldap.conf or somewhere similar.
Adam.
From: Tony Guadagno tonyg@guadagno.org Sent: 16 February 2022 23:55 To: Observium observium@observium.org Cc: Adam Armstrong adama@observium.org Subject: RE: [Observium] LDAP auth to MS AD with TLS Self Signed Cert
Adam, I have the cert for my AD server, as I said, I am pretty familiar with this process as I use ldap often for application authentication….what I am not very familiar with is php. Other apps have config options to set the paths for the certs etc. What I need help with is where (specifically) to put the config so that Observium will use it. I have the certs, I just need the syntax
You mentioned putenv…where would I put that? It must be somewhere in Observium?
Thanks for your help
Tony
From: Adam Armstrong via observiummailto:observium@observium.org Sent: Wednesday, February 16, 2022 6:42 PM To: 'Observium'mailto:observium@observium.org Cc: Adam Armstrongmailto:adama@observium.org Subject: Re: [Observium] LDAP auth to MS AD with TLS Self Signed Cert
Whoops:
putenv(‘LDAPTLS_CACERT=/path/to/rootca.pem’);
Note that this seems to want the CA’s cert, not your server’s cert.
Our code doesn’t have any consideration for TLS at all as far as I can see, it should all be transparent to Observium if you get PHP/LDAP into the situation where it accepts your cert.
Adam.
From: observium <observium-bounces@observium.orgmailto:observium-bounces@observium.org> On Behalf Of Adam Armstrong via observium Sent: 16 February 2022 23:36 To: 'Observium' <observium@observium.orgmailto:observium@observium.org> Cc: Adam Armstrong <adama@observium.orgmailto:adama@observium.org> Subject: Re: [Observium] LDAP auth to MS AD with TLS Self Signed Cert
Presumably you need to extract your certs in the correct format and direct the commands to them.
The LDAP connection is done by PHP’s LDAP module. You just need to work out how to do it with PHP’s module.
It’s probably that you could override this globally with the php.ini rather than putting it in the config.php, too.
There seems to be half a dozen solutions for making this work, which isn’t uncommon with infrequently used PHP features. There’s also this:
putenv('/path/to/rootca.pem');
Adam.
From: Tony Guadagno <tonyg@guadagno.orgmailto:tonyg@guadagno.org> Sent: 16 February 2022 21:57 To: Observium <observium@observium.orgmailto:observium@observium.org> Cc: Adam Armstrong <adama@observium.orgmailto:adama@observium.org> Subject: RE: [Observium] LDAP auth to MS AD with TLS Self Signed Cert
Adam, sorry for being dense, but do I just add these two lines directly (as is) to the config.php?
ldap_set_option(null, LDAP_OPT_X_TLS_CACERTDIR, '/path/to');
ldap_set_option(null, LDAP_OPT_X_TLS_CACERTFILE, '/path/to/cert.pem');
I tried this with the paths to my certs and it had no affect.
Do I need to wrap those command in some other syntax?
thanks
Tony From: Adam Armstrong via observiummailto:observium@observium.org Sent: Wednesday, February 16, 2022 4:25 PM To: 'Observium'mailto:observium@observium.org Cc: Adam Armstrongmailto:adama@observium.org Subject: Re: [Observium] LDAP auth to MS AD with TLS Self Signed Cert
https://andreas.heigl.org/2020/01/31/handle-self-signed-certificates-with-ph...
I’d assume that getting your cert and putting the two ldap_set_option() commands into config.php should suffice.
This seems like a better solution that turning off cert verification.
Adam.
From: observium <observium-bounces@observium.orgmailto:observium-bounces@observium.org> On Behalf Of Tony Guadagno via observium Sent: 16 February 2022 21:03 To: Observium <observium@observium.orgmailto:observium@observium.org>; Brandon Lund <brandon@kansas.netmailto:brandon@kansas.net> Cc: Tony Guadagno <tonyg@guadagno.orgmailto:tonyg@guadagno.org> Subject: Re: [Observium] LDAP auth to MS AD with TLS Self Signed Cert
I made a packet capture on the Observium server trying to login and if you look, you will see that it is indeed a self signed issue.
How do I tell Observium to either trust the cert OR ignore the fact that it is self signed??
[cid:image001.png@01D82394.5E4064C0]
Tony From: Tony Guadagno via observiummailto:observium@observium.org Sent: Wednesday, February 16, 2022 3:27 PM To: Brandon Lundmailto:brandon@kansas.net; Observiummailto:observium@observium.org Cc: Tony Guadagnomailto:tonyg@guadagno.org Subject: Re: [Observium] LDAP auth to MS AD with TLS Self Signed Cert
Sorry, I should have been more specific…I already have other apps using ldap with tls hitting the server and they work…so I am confident my AD server is properly configured. I work a lot with ldap and I often find that some apps that integrate with ldap and tls get picky about the cert..thats why I think it might be the fact that I am using a self signed cert (which is common on AD servers).
Usually, there is a way to tell the application “ignore the fact that it is self signed, accept it anyway”
Tony
From: Brandon Lundmailto:brandon@kansas.net Sent: Wednesday, February 16, 2022 3:08 PM To: Observiummailto:observium@observium.org Cc: Tony Guadagnomailto:tonyg@guadagno.org Subject: Re: LDAP auth to MS AD with TLS Self Signed Cert
looks like you need to enable tls for ad to start listing for ldaps
no experience just a quick search.
https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/enable... [Image removed by sender.]https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/enable-ldap-over-ssl-3rd-certification-authority
Enable Lightweight Directory Access Protocol (LDAP) over Secure Sockets Layer (SSL) - Windows Server | Microsoft Docshttps://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/enable-ldap-over-ssl-3rd-certification-authority docs.microsoft.com Describes how to enable LDAP over SSL with a third-party certification authority.
Thanks Brandon Lund KansasNet Internet Services 785-776-1452
From: observium <observium-bounces@observium.orgmailto:observium-bounces@observium.org> on behalf of Tony Guadagno via observium <observium@observium.orgmailto:observium@observium.org> Sent: Wednesday, February 16, 2022 1:49 PM To: Tony Guadagno via observium Cc: Tony Guadagno Subject: [Observium] LDAP auth to MS AD with TLS Self Signed Cert
Hi,
I have ldap auth working mostly, if I set tls to false, I can authenticate. However, I want to be secure and when I enable tls, I get a debug error that says:
Error binding to LDAP server: servername.local: Can’t contact LDAP server
I am guessing the issue is the self signed cert that my server is using.
My question is…how do I configure Observium to accept self signed certs for ldap?
thanks
Tony