设定Linux下Apache在集成AD认证失败时直接转到网页认证而不是基本认证

在企业应用中,经常会配置Apache集成AD认证.
但实际应用中,我们会遇到没有加入域或外部电脑访问的情况,此时的默认配置会让网页弹出Base Auth,界面很不友好.
在这里插入图片描述
我们的目的是直接跳转到网页认证页面,经过测试,配置如下可达成目的

<Directory "/var/www/html/">
    Options +Includes -Indexes
    AllowOverride All
    AuthType Kerberos #指定验证类型
    AuthName "HHH"
    KrbMethodK5Passwd Off  #关闭Krb5 Base Auth,这个默认是On
    KrbAuthRealms YOUNGOPTICS.COM
    Krb5KeyTab /etc/httpd/ksyoweb02.keytab
    KrbServiceName HTTP
    require valid-user
    ErrorDocument 401 /logon.php #指定401时跳转网页
    <Files "logon.php"> #设定此网页无需认证
        Require all granted
    </Files>
</Directory>

文档中相应参数说明:
KrbMethodK5Passwd on | off
(set to on by default)
To enable or disable the use of password based authentication for Kerberos v5.
KrbMethodK4Passwd on | off
(set to on by default)
To enable or disable the use of password based authentication for Kerberos v4.
ErrorDocument Directive
Description: What the server will return to the client in case of an error
Syntax: ErrorDocument error-code document
Context: server config, virtual host, directory, .htaccess
Override: FileInfo
Status: Core
Module: core
In the event of a problem or error, Apache httpd can be configured to do one of four things,

output a simple hardcoded error message
output a customized message
internally redirect to a local URL-path to handle the problem/error
redirect to an external URL to handle the problem/error

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值