- 论坛徽章:
- 0
|
【引用】
jobesky 2011-03-18 10:11 NEW
版主 你好
再次打扰到你确实不好意思,不过最近项目确实碰到几个棘手的问题?
我想问一下courier-authlib和sasl2认证到底有什么不一样呢?
为什么有必须有mysql又必须有ldap,到底分别是做什么的认证呢?
一个CUer的提问,回答提问的同时顺便跟大家分享。
第一问:
The Courier Authentication Library is a generic authentication API that encapsulates the process of validating account passwords. In addition to reading the traditional account passwords from /etc/passwd, the account information can alternatively be obtained from an LDAP directory; a MySQL or a PostgreSQL database; or a GDBM or a DB file. The Courier authentication library must be installed before building any Courier packages that needs direct access to mailboxes .
简单的说是给Courier mail server 提供好了验证API接口,能允许访问/etc/passwd,Mysql,LDAP等数据库。
详细说,可以看这个
- /tmp/courier-authlib-0.63.0$ ls *.c
- authcustom.c authldaplib.c authpgsql.c authsaslclientcrammd5.c authsasltobase64.c checkpasswordsha1.c preauthpgsql.c
- authdaemon.c authmksock.c authpgsqllib.c authsaslclientcramsha1.c authshadow.c cramlib.c preauthpwd.c
- authdaemond.c authmoduser2.c authpipe.c authsaslclientexternal.c authsyschangepwd.c cryptpassword.c preauthshadow.c
- authdaemonlib.c authmoduser3.c authpipelib.c authsaslclientlogin.c authsyscommon.c debug.c preauthuserdb.c
- authdaemontest.c authmysql.c authpwd.c authsaslclientplain.c authtest.c preauthcustom.c preauthuserdbcommon.c
- authenumerate.c authmysqllib.c authpwdenumerate.c authsaslcram.c authuserdb.c preauthdaemon.c
- authinfo.c authoption.c authsasl.c authsaslfrombase64.c authuserdbpwd.c preauthldap.c
- authldap.c authpam.c authsaslclient.c authsasllogin.c checkpassword.c preauthmysql.c
- authldapescape.c authpasswd.c authsaslclientcram.c authsaslplain.c checkpasswordmd5.c preauthpam.c
复制代码 这些都是C源码文件,以这几个 authmysql.c authmysql.h authmysqllib.c 为例,他们主要作用就是访问MYSQL数据库中账户资料。那其它的有 authpam.c authpgsql.c authsasl.c等等这些有访问pam 、pgsql 、sasl ,有的是数据库,有的是本地数据文件,有的验证应用接口。好比你买了一个手机万能冲,对不同电池要更换不同接口。这里可以看到SASL也是接口之一。
SASL is the Simple Authentication and Security Layer, a method for adding authentication support to connection-based protocols. To use SASL, a protocol includes a command for identifying and authenticating a user to a server and for optionally negotiating protection of subsequent protocol interactions. If its use is negotiated, a security layer is inserted between the protocol and the connection.
简单的说SASL使用一个协议,其作用提供验证支持。- #ls /var/run/saslauthd/* -l
- srwxrwxrwx 1 root root 0 Mar 22 19:00 /var/run/saslauthd/mux
- -rw------- 1 root root 0 Mar 22 19:00 /var/run/saslauthd/mux.accept
- -rw------- 1 root root 5 Mar 22 19:00 /var/run/saslauthd/saslauthd.pid
复制代码- #saslauthd -v
- saslauthd 2.1.22
- authentication mechanisms: getpwent kerberos5 pam rimap shadow ldap
复制代码 先说点别的,有一个老板想看电影,叫秘书去买票,秘书买票的时候可以有很多选择,例如网购、电话订购、影院排队等。最后老板拿到两张票,但是丝毫不关心票是怎么买的。
通过这个小故事你不难发现,老板<---->秘书是很简单关系。秘书->(网购、电话订购、影院排队)复杂了一些。
正题拓扑关系:
Client -------用户密码请求-------> Service App (老板)
| ^
v |
---SASL----/var/run/saslauthd/mux (秘书)
------------- /etc/init.d/saslauthd
| ^
v |
getpwent kerberos5 pam rimap shadow ldap (网购、电话订购、影院排队)
没什么多说的,应该看的明白。Service App 不知道用户密码真伪,把验证的事情交给saslauthd,而saslauthd又着其它机制来验证这个用户密码。
第二个问题
选择那一个都可以,不是必须两都具备。
PS:以上如有错误,欢迎大家指正。 |
|