Apache的认证模型
Apache的认证模块分成三个部分:认证类型模块,认证支持模块,认证授权模块。
认证类型模块(auth):
mod_auth_basic
mod_auth_digest
认证支持模块(authn):
mod_authn_alias
mod_authn_anon
mod_authn_file
mod_authn_dbd
mod_authn_dbm
mod_authn_default
mod_authnz_ldap
认证授权模块(authz):
mod_authnz_ldap
mod_authz_dbm
mod_authz_default
mod_authz_user
mod_authz_groupfile
mod_authz_owner
注意:
mod_authnz_ldap模块即包含认证功能也提供授权功能。mod_authn_alias本身并实现认证功能,但是允许其它认证支持模块以更灵活的方式进行配置。
mod_authz_host 模块提供基于主机名、IP地址、请求特征的访问控制,但并不属于认证支持系统。
一般常用的AuthType 是”Basic/Digest”,这个认证需要用到认证模块mod_auth_basic/mod_auth_digest,和认证支持模块mod_authn_file和认证授权模块mod_authz_user。
就是说,最常用的认证组合方式是:
mod_auth_basic/mod_auth_digest
+
mod_authn_file
+
mod_authz_user
即是说,一个使用认证以及访问控制(支持Order Allow,Deny ,Allow from all这样的指令)Apache系统,至少要用到下面四或者五个模块:
mod_auth_basic/mod_auth_digest
+
mod_authn_file
+
mod_authz_user
+
mod_authz_host
不太熟悉Apache认证的管理员,为了优化Apache占用的内存,往往会注释掉一些用不到的模块,而又因为不明白认证模块之间的关系,而导致认证总是不能成功,而apache(目前我使用的版本:2.2.3)的语法检查检查不出来mod_authz_user模块的缺失,故常常使管理员困惑。
重要提醒:
Basic认证类型不加密来自用户浏览器的密码,因此不应该用于保护敏感数据。对于敏感的数据,应使用Digest方式来进行认证(比较老的浏览器不支持,不过时至今日,应该已经不是问题了)。
参考:http://www.bsdmap.com/UNIX_html/ApacheMenu_zh_CN/howto/auth.html
On this day..
- 修改Apache的Max open files限制 - 2010
- 快速了解Apache环境 - 2010