You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

LAMP环境通过GSSAPI/Kerberos实现Windows AD直通认证时遇登录弹窗问题求助

LAMP环境通过GSSAPI/Kerberos实现Windows AD直通认证时遇登录弹窗问题求助

大家好,我现在在Windows AD环境下搭建LAMP服务器,想实现Kerberos直通认证(SSO),遇到了一个棘手的问题:明明认证本身是有效的,但Chrome浏览器始终会弹出登录提示框,没法自动用当前登录AD的用户凭证完成认证。先把我的环境和已做的配置跟大家说下:

环境信息

  • AD域林/域功能级别:2012R2
  • LAMP服务器:Debian 11.8,Apache已安装mod_auth_gssapi,没有安装Samba,也没有加入AD域(不确定这是不是必要条件)
  • 特殊情况:LAMP服务器主机名和对外访问URL不一致——主机名是intranethost.mspca.org,访问URL是https://testintranet.mspca.org

已完成的配置步骤

  1. 生成Keytab文件:在Windows DC上用ktpass命令生成对应SPN的keytab:
ktpass -princ HTTPS/testintranet.mspca.org@MSPCA.ORG -mapuser adconnect@MSPCA.ORG -pass ******** -ptype KRB5_NT_PRINCIPAL -out testintranet-spn.keytab
  1. Kerberos基础配置:krb5.cnf里已正确配置Realm,在LAMP服务器上执行kinit验证完全正常
  2. Apache虚拟主机配置:
<IfModule !mod_auth_gssapi.c>
LoadModule auth_gssapi_module /usr/lib64/httpd/modules/mod_auth_gssapi.so
</IfModule>

<VirtualHost *:80>
ServerName testintranet.mspca.org
#       Redirect permanent / https://testintranet.mspca.org/
</VirtualHost>

<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /etc/ssl/certs/star_mspca_org.crt
SSLCertificateKeyFile /etc/ssl/private/star_mspca_org.key
ServerAdmin jsinclair@mspca.org
ServerName testintranet.mspca.org
DocumentRoot /var/www/html/wordpress/

<Directory "/var/www/html/wordpress/">
AllowOverride All
AuthType GSSAPI
AuthName "GSSAPI Single Sign On Login"
GssapiSSLonly On
GssapiAllowedMech krb5
GssapiBasicAuth On
GssapiCredStore keytab:/etc/apache2/testintranet-spn.keytab
GssapiLocalName On
BrowserMatch Windows gssapi-no-negotiate
Require valid-user
GssapiNegotiateOnce on
</Directory>

ErrorLog ${APACHE_LOG_DIR}/wordpress.error.log
CustomLog ${APACHE_LOG_DIR}/wordpress.access.log combined
LogLevel info auth_gssapi:debug ssl:warn
</VirtualHost>

遇到的问题

目前认证功能本身是正常的——输入AD账号密码后可以正常登录,但就是没法实现自动SSO,Chrome总会弹出登录对话框。我已经把该网站的各种地址组合(http/https、短名称、FQDN)都加到了GPO的Intranet安全区域里,但Chrome还是不自动传递凭证。

Apache日志里唯一的相关提示就是:NO AUTH DATA Client did not send any authentication headers

另外我试过把GssapiBasicAuth设为OFF,这时候弹窗倒是没了,但直接返回401 Unauthorized,看起来服务器根本没收到客户端传递的认证头。

想请教下大家有没有遇到过类似情况?或者有什么排查方向可以给我参考?

备注:内容来源于stack exchange,提问作者SkipSinclair

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.21 10:19:36