配置Apache支持以支持多种验证方式并存

应用场景
吉之特测试组提出的需求,新建mercurial用户,建立虚拟用户,用于版本控制工具认证,执行某个公用操作。

主要配置参数

1
2
3
4
5
AuthType            Authentication type being used. Mostly , it will be set to Basic
AuthName            The authentication realm or name
AuthUserFile    The location of the password file
AuthGroupFile   The location of the group file, if any Require The requirement(s) which must be satisfied in order to grant admission
AuthBasicProvider       Sets the authentication provider(s) for this location.It will be set to  dbm, file, dbd, and ldap.


示范配置
(/etc/httpd/conf/httpd.conf)

1
2
3
4
5
6
7
8
9
10
AllowOverride None
AuthName mercurial
AuthType Basic
AuthBasicProvider ldap file #Enable相关的认证方式
AuthLDAPURL "ldap://dc2008.woobest.com/cn=Users,dc=woobest,dc=com?sAMAccountName?sub?(objectClass=user)"
AuthLDAPBindDN ldap_pub
AuthLDAPBindPassword ******** #LDAP认证相关
Require valid-user
AuthBasicAuthoritative off
AuthUserFile /etc/httpd/virtual.users #文本数据库认证相关

用户名和密码使用htpasswd生成

1
2
3
4
# htpasswd -c /usr/local/apache/passwd/passwords public_hg
New password: mypassword
Re-type new password: mypassword
Adding password for user public_hg

你可能感兴趣的:(apache)