2

We are using Apache mod_authnz_ldap to authenticate users to Nagios using our LDAP Active Directory. Right now it is working with using SamAccountName. However, Nagios is using the SamAccountName as the name of the user logged in. This is causing a small problem with Author comments and such (we don't have user IDs memorized).

Is there a way to have mod_authnz_ldap authenticate using SamAccountName, but return DisplayName or Name instead? This way Author comments would show the user's real name.

Here's my nagios.conf for httpd:

<Directory "/usr/lib64/nagios/cgi-bin/">
#  SSLRequireSSL
   Options ExecCGI
   Options FollowSymLinks
   AllowOverride None
   AuthBasicProvider ldap
   AuthType Basic
   AuthzLDAPAuthoritative off
   AuthName "Active Directory Login"
   AuthLDAPURL "ldap://my.ldap.server:389/dc=my_dc,dc=my_dc,dc=net?sAMAccountName?sub" NONE
   Require valid-user
</Directory>

Alias /nagios "/usr/share/nagios/html"

<Directory "/usr/share/nagios/html">
#  SSLRequireSSL
   Options ExecCGI
   Options FollowSymLinks
   AllowOverride None
   AuthBasicProvider ldap
   AuthType Basic
   AuthzLDAPAuthoritative off
   AuthName "Active Directory Login"
   AuthLDAPURL "ldap://my.ldap.server:389/dc=my_dc,dc=my_dc,dc=net?sAMAccountName?sub" NONE
   Require valid-user
</Directory>

migrated from stackoverflow.com Oct 13 '14 at 12:34

This question came from our site for professional and enthusiast programmers.

  • 2
    I popped a moderator flag in to say this should get moved to serverfault as it is 100% in scope for that site. – Peter Grace Oct 7 '14 at 19:41
  • @PeterGrace Oops, you're right. Sorry about that! – Pat Oct 7 '14 at 19:41
4

Figured it out. I had to add "cn" to the AuthLDAPURL as well as add in a AuthLDAPRemoteUserAttribute.

Now Nagios (well Apache) will see the REMOTE_USER environment variable as the cn

AuthLDAPURL "ldap://my.ldap.server:389/dc=my_dc,dc=my_dc,dc=net?sAMAccountName,cn?sub" NONE
AuthLDAPRemoteUserAttribute cn

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.