configurationApache和mod_auth_sspi的问题

我已经能够使用Apache 2.0.55和XAMP Apache 2.2.14使用XAMP而没有任何问题。

但是,当我尝试configuration我们的Intranet服务器(Apache 2.0.59)时,我得不到相同的结果。

结果是,以下variables包含所需的信息:$ _SERVER [“REMOTE_USER”] AND $ _SERVER [“PHP_AUTH_USER”]。 在这种情况下,它们是空白的。 我期待“域/用户名”。

configuration文件的东西:

<Directory "/xxx/xampp/htdocs/"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # #Options Indexes FollowSymLinks Includes ExecCGI Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # #AllowOverride All AllowOverride None # # Controls who can get stuff from this server. # #Order allow,deny #Allow from all Order allow,deny Allow from all #NT Domain Login AuthName "Intranet" AuthType SSPI SSPIAuth On SSPIAuthoritative On SSPIDomain "xxxx" SSPIOfferBasic Off SSPIPerRequestAuth On SSPIOmitDomain Off # keep domain name in userid string SSPIUsernameCase lower Require valid-user </Directory> 

我想指出,我已经修改了path来反映Intranet环境。

我正在使用以下模块: http : //sourceforge.net/projects/mod-auth-sspi/

一旦安装了模块并修改了conf文件,Intranet环境的服务器范围就不会填充预期的variables。

编辑#1

 <Directory "/path_here"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # #Options Indexes FollowSymLinks Includes ExecCGI Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # #AllowOverride All AllowOverride None # # Controls who can get stuff from this server. # #Order allow,deny #Allow from all Order allow,deny Allow from all #NT Domain Login AuthName "Intranet" AuthType SSPI SSPIAuth On SSPIAuthoritative On SSPIDomain "domain_here" SSPIOfferBasic On SSPIPerRequestAuth On SSPIOmitDomain Off # keep domain name in userid string SSPIUsernameCase lower Require valid-user </Directory> 

我一直在那里,绊倒那些问题…

疯狂的猜测,您的内部网是在代理?

这是我的SSPI conf,我看到的唯一区别是我使用LocationMatch而不是Directory

 <LocationMatch ^/$> AuthType SSPI AuthName "TECHNO" SSPIAuth On SSPIAuthoritative On SSPIOfferBasic On Require valid-user </LocationMatch> 

为了SSPI使用PHP,我必须使用LDAP(PHP的ext)。 没有更多的信息,我无法帮助你。

菲尔

发生了什么我猜你正在使用FQDN或IP访问内部网服务器,而你使用“localhost”之类的东西来访问你的开发环境。

这里的问题是你的networking浏览器看到的是FQDN,并假设你正在访问一个外部网站; 虽然我们知道这是不正确的,但出于安全原因,这是假设的。 因此,浏览器将会提示用户进行login。 但是这不会发生,因为您将“SSPIOfferBasic”设置为closures。

解决的第一步是启用SSPIOfferBasic,以便我们可以testing以确保NTLM身份validation可以在给定用户名和密码的情况下工作。

如果上一步启用了一个popup窗口询问您的用户名和密码并填写这些信息,然后将您的信息传递给您的PHP脚本,那么我们知道这是浏览器不会自动传递NTLM信息的问题。 如果没有,那么你有另一个问题,可能会或可能不会被解决的下一步。

为了告诉浏览器这个站点是一个Intranet站点,可以发送authentication信息,我们需要将它添加到Internet属性 – >安全 – >本地Intranet – >站点 – >高级 – >网站列表。 谷歌是你的朋友访问这个窗口,因为它是不同的每个浏览器; 但是它是一个中央Windows构造,因此它将适用于所有利用其设置的浏览器。 在一个较大的公司,这可以很容易地推送到所有计算机通过组策略。

**注意事项**一些浏览器必须在互联网政策面板(IE)更改之间重新启动,而其他浏览器则不必重新启动(Chrome); 为了以防万一,最好的办法就是重新启动浏览器。

有时NTLM身份validation通过popup式身份validation失败,或者由于某些未知的原因,会要求您多次validation,然后抛出一个错误。 我不知道这个问题的来源,但我发现,每次询问然后input用户名/密码,然后简单刷新将产生一个工作页面。 这只适用于将站点添加到本地Intranet区域之前的testing。

尝试使用mod_rewrite添加提供的用户名(有或没有)的域如下所示:

 # add username RewriteEngine on RewriteCond %{IS_SUBREQ} ^false$ RewriteCond %{LA-U:REMOTE_USER} (.+) RewriteRule .* - [E=PROXY_USER:%{LA-U:REMOTE_USER}] RequestHeader set Remote-User %{PROXY_USER}e 

检查正在发送到PHP的标题 – 我不知道在PHP中的function,但将有一些“转储所有标题”可调用(或可调用的组合),这将显示你。

这可能是因为用户名没有被传递给PHP,或者标题关键字的名称与PHP所期望的不同(REMOTE_USER或PHP_AUTH_USER); 你可以改变PHP来适应或使用mod_rewrite。

有些人会build议避免mod_rewrite …