设为首页 收藏本站
查看: 555|回复: 0

[经验分享] Single Sign-On with Apache and Active Directory – Part 2

[复制链接]

尚未签到

发表于 2017-1-10 10:04:40 | 显示全部楼层 |阅读模式
  Back on May 23rd, 2007 I wrote an article titled Single Sign-On with Apache and Active Directory
which I have now made Part 1 of this topic.  In that article I wrote:

  There are 3 major solutions for this which are mod_ntlm,
mod_auth_kerb and Apache2:AuthenNTLM…I tried mod_ntlm which seemed to be
very easy to setup and worked well. But there was one catch…If the
browser did not send the NTLM information or correct NTLM information,
see the footnotes1
below as to why, the user had to login
with the username in the form of DOMAIN\username. In my experience with
applications already in place they did not require this form of
DOMAIN\username. This could be resolved if you could specify the default
domain in mod_ntlm which you cannot.

  Now I will explain why there is a Part 2 to this topic.  I used the
Apache2::AuthenNTLM Apache Perl module in a large environment and
quickly found a serious problem which I could not diagnose or resolve.  
When using the Apache2::AuthenNTLM Perl module Apache would stop
responding to requests to the site after an undetermined number of
requests.  I tried limiting the file types that would be authenticated
but in the end it would still stop reaponding after a while.
  So I finally decided to use the Apache mod_ntlm module to handle the authentication.  And with the article I had written titled Enabling NTLM Authentication (Single Sign-On) in Firefox
, the problem with having to use the username in the form of DOMAIN\username in Firefox can be eliminated.
  This how to is intended for CentOS 4 and RHEL4 but can be easily adapted for other distributions.
  Now for the HowTo:
  1) Start by installing Apache by issuing the following command:
yum install httpd


  2) Next we need to install the mod_ntlm Apache module

wget http
:
//sivel.net/repo/i386/mod_ntlm-2-0.1.el4.sn.i386.rpm

rpm
-
ivh mod_ntlm
-
2
-
0.1
.
el4
.
sn
.
i386
.
rpm


  3) Now we need to configure mod_ntlm

cd
/
etc
/
httpd
/
conf
.
d
vi mod_ntlm
.
conf


  Modify the conf like so (the documentation in the conf pretty much covers it also):

<location
~
"/path/to/dir/to/protect/here)/(.*)"

>

  # NTLMAuth - set to 'on' to activate NTLM authentication here
  NTLMAuth on
  # AuthNTGroups - text file containing (NT) group names and member user IDs
  # NTLMBasicAuth - set to 'on' to allov Basic authentication too
  # NTLMBasicRealm - realm to use for Basic authentication
  # NTLMAuthoritative - set to 'off' to allow access control to be passed along to lower modules if the UserID is not known to this module
  NTLMAuthoritative on
  # NTLMDomain - set to the domain you want users authenticated against for cleartext authentication - if not specified, the local machine, then all trusted domains are checked
  NTLMDomain MYDOMAIN
  # NTLMServer - set to the NT server to contact to authenticate users
  NTLMServer primary.mydomain.com
  # NTLMBackup - set to the alternate NT server to contact to authenticate users
  NTLMBackup secondary.mydomain.com
  # NTLMLockFile - set to the lock file that is used to prevent simutaneous contacts to DC
  NTLMLockfile /tmp/_mod_ntlm.lck
  AuthName NTAuth
  AuthType NTLM
  require valid-user
  Satisfy all

</location>


  4) We need to modify the global conf file now.
vi
/
etc
/
httpd
/
conf
/
httpd
.
conf



Find ‘KeepAlive Off’ and change it to ‘KeepAlive On’
  5) Let’s start Apache
/etc/
init
.
d
/
httpd start


  6) Let’s setup a simple test page that will utilize the server environment variable that mod_ntlm sets.

cd
/
path
/
set
/
in
/
step
/
3
/
in
/
location
/
directive
touch index
.
php
vi index
.
php


  * Insert the following information:

<?
php
echo
"You have logged in as <b>"

.
$_SERVER
[
'REMOTE_USER'
]

.

"</b>"
;


?>


  If you do not have PHP installed you can just place a page in the directory and if you login you should be able to see it.
  If you get a login prompt check the footnotes1
.
  Part 1
| Part 2



  Footnotes



1. Getting a login prompt can be caused by using Firefox with the
default configuration, not being logged on in the domain that you are
attempting to authenticate against, or not having the site listed in the
Local Intranet security zone in Internet Explorer. Or worst of all you
could have mis configured something in step 3

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-326413-1-1.html 上篇帖子: Apache+Tomcat负载平衡设置实例详解 (1) 下篇帖子: Apache+Tomcat负载均衡两种session共享方式的设置
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表