windows 使用 PHP 和 Apache 进行 NTLM 登录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8658953/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
NTLM Login using PHP and Apache
提问by user1119698
I would like to login into my system using ntlm protocol. I found module for apache - mod_auth_sspi, but i need multi platform solution.
我想使用 ntlm 协议登录我的系统。我找到了 apache 模块 - mod_auth_sspi,但我需要多平台解决方案。
My application have to run on windows and linux (on both is installed php>=5.3 and apache>2.0). Using mod_auth_sspi i am able to login via ntlm, but only if I set a:
我的应用程序必须在 windows 和 linux 上运行(两者都安装了 php>=5.3 和 apache>2.0)。使用 mod_auth_sspi 我可以通过 ntlm 登录,但前提是我设置了:
required user-valid
必需的用户有效
in htaccess or http.conf. If I don't set this value I can't retrieve USER_REMOTE and I don't know how can I implement solution that I need:
在 htaccess 或 http.conf 中。如果我不设置这个值,我将无法检索 USER_REMOTE 并且我不知道如何实现我需要的解决方案:
I'm looking for solution that allow me show to user form with login/password (ntlm) or if user cancelled this form the system should redirect him to alternative login form (data will retrieve from database). I need to login into the system in 2 ways: via NTLM and traditional (database). How Can I do this?
我正在寻找允许我使用登录名/密码 (ntlm) 向用户表单显示的解决方案,或者如果用户取消此表单,系统应将他重定向到替代登录表单(数据将从数据库中检索)。我需要通过两种方式登录系统:通过 NTLM 和传统(数据库)。我怎样才能做到这一点?
Thx.
谢谢。
回答by Sam Bloomberg
You could use mod_auth_sspi for windows, and http://modntlm.sourceforge.net/for linux. I know it isn't the best solution, but it should work (i guess you will have to check what OS the script is running on and choose the mod appropriately since I doubt the APIs are the same).
你可以在 windows 上使用 mod_auth_sspi,在 linux 上使用http://modntlm.sourceforge.net/。我知道这不是最好的解决方案,但它应该可以工作(我想你必须检查脚本运行的操作系统并适当地选择 mod,因为我怀疑 API 是相同的)。
EDIT:
编辑:
For multiple login providers, see this:
对于多个登录提供程序,请参阅:
http://httpd.apache.org/docs/2.3/howto/auth.html#multprovider
http://httpd.apache.org/docs/2.3/howto/auth.html#multprovider
回答by beginner_
I know old question but might be useful for future users landing here from Google. A cross-platform (I have it running on Windows and Ubuntu) solution would be PyAuthenNTLM2:
我知道老问题,但可能对未来从 Google 登陆这里的用户有用。跨平台(我在 Windows 和 Ubuntu 上运行)解决方案是 PyAuthenNTLM2:
https://github.com/Legrandin/PyAuthenNTLM2
https://github.com/Legrandin/PyAuthenNTLM2
An important additional advantage of this module compared to others is that it supports NTLM version 2 (NTLMv2) protocol which is a bit more "secure". It is important that Windows 7 (and AFAIK Vista too) use NTLMv2 only per default (it can be switched in registry) and hence you won't force the windows admins in your company to change this setting.
与其他模块相比,该模块的另一个重要优势是它支持更“安全”的 NTLM 版本 2 (NTLMv2) 协议。Windows 7(和 AFAIK Vista 也是如此)默认仅使用 NTLMv2(它可以在注册表中切换)很重要,因此您不会强制您公司的 Windows 管理员更改此设置。