Forums » Development »
[Solved] mod auth with /etc/passwd as backend
Added by mt3o almost 15 years ago
Hello, I'm running lighty on freebsd.
I have a webapp with authentication based on mod_auth. I want to set the things up, so that users log in to application with their credentials stored in /etc/passwd. As far as i'm concerned, there is no way to achive this in a simple way, am i wrong?
The best way for me to achive the goal, would be an /etc/passwd backend for mod_auth, or some other custom mod_auth backend (maybe websocket based?). :)
Is this possible without editing and recompiling mod_auth source code? Sadly, editing the webapp is not an option...
Replies (4)
RE: mod auth with /etc/passwd as backend - Added by penma almost 15 years ago
Backend for /etc/passwd doesn't exist yet. It will have to be written.
Actually you would need to write a backend for /etc/master.passwd or /etc/shadow or something else, since many systems do not store any password information in /etc/passwd anymore.
I don't know how possible it would really be to implement this backend, maybe you should store the data in LDAP instead or something.
RE: mod auth with /etc/passwd as backend - Added by tai almost 15 years ago
I have just uploaded new module "mod_auth_cookie", and I think it can solve the problem.
Replace mod_auth with mod_auth_cookie, and just verify user account at external logon page.
Calling checkpassword(8) in check.php (script included in demo/ tree) should do.
RE: mod auth with /etc/passwd as backend - Added by lennartack almost 15 years ago
I think the only easiest for your problem (when not being able to change the webapp) is to create a script that translates the /etc/passwd format into htpasswd format. htpasswd supports the crypt hash function (which is most commonly used by linux distro's), so it would be a matter of finding out how the hash functions are used by htpasswd and how they are stored in a htpasswd file (salts and encoding). In case it is significantly different from the /etc/passwd file (like using the salt in a different way) it is impossible to translate the /etc/passwd file to htpasswd.
You could use the include_shell function of the lighttpd config to run this script every time lighttpd loads.
RE: [Solved] mod auth with /etc/passwd as backend - Added by gstrauss over 4 years ago
Use mod_authn_pam. See mod_auth documentation.