dslreports logo
    All Forums Hot Topics Gallery


how-to block ads

Search Topic:
share rss forum feed


North Brunswick, NJ

LDAP Authentication


My system is a QNAP TS - 469L at work. I have enabled LDAP, and have some users. I have created a landing page for access from the internet. I want to create a login page that authenticates users against the existing LDAP database. Any thoughts on how to go about doing this? I have created some basic codes in html for username and password fields, but I am lost as to how to link the submit button to the LDAP server.

As you can see, I am a newbie to this, and would appreciate any help I can get.

Thanks, and much appreciated.

Shelton, CT
The authentication would be handled by the backend server. The approach highly depends on what you are running.. php? .net?


North Brunswick, NJ
Not sure what you mean by backend server - it is a single NAS box (model QNAP TS 469L) running Linux. All the apps and DB are on this box. I am running php. I have enabled LDAP and have some users on it as well. I have created some basic fields for username and password on the landing page. which is also hosted on the same NAS. I want to authenticate users against their LDAP credentials. I realize I somehow have to link the submit button to this LDAP DB, but do not know how to make this happen.

I am not a programmer, and am trying to learn.

Thanks again.

Shelton, CT
reply to cowboyro
Sorry to break your enthusiasm, but it's not exactly trivial... it will take some programming skills to make it work properly.
Your php script will have to handle authentication for the page.
You can use an existing library such as pear:net_ldap2 »pear.php.net/manual/en/package.n···dap2.php to handle authentication.


Trenton, NJ
reply to mukland
You will need to learn PHP programming, essentially how to take the form input and then use that data to authenticate against your LDAP within your PHP code.

Sorry, I don't know PHP, I am a .NET guy.


North Brunswick, NJ
Thank you.

I created the following apache config file -

LogLevel debug
CustomLog "logs/access_log" combined
ErrorLog "logs/error_log"
LoadModule ldap_module modules/mod_ldap.so
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
ServerName MyServer
LDAPTrustedMode NONE
LDAPVerifyServerCert Off

SetHandler server-status
Order Deny,Allow
Deny from all
AuthType Basic
AuthName "MyServer"
AuthBasicProvider ldap
AuthLDAPBindDN cn=admin,dc=myserver,dc=com
AuthLDAPBindPassword serverPW
AuthLDAPCompareDNOnServer Off
ldap://MyServer:389/ou=people,dc=MyServer,dc=comuid,ou=people,dc=MyServer,dc=com?sub NONE
AuthzLDAPAuthoritative off
AuthUserFile /dev/null
Require valid-user
Satisfy any

I get a login window. When I enter my LDAP login and password, I get thrown out of the system with the error:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, admin@NAS and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Any thought of errors in the code or what I am doing wrong is greatly appreciated.