免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2632 | 回复: 0
打印 上一主题 下一主题

[Mail] courier-authlib和sasl2认证不同 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-03-22 19:53 |只看该作者 |倒序浏览
【引用】
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等数据库。
详细说,可以看这个

  1. /tmp/courier-authlib-0.63.0$ ls *.c
  2. authcustom.c      authldaplib.c   authpgsql.c           authsaslclientcrammd5.c   authsasltobase64.c  checkpasswordsha1.c  preauthpgsql.c
  3. authdaemon.c      authmksock.c    authpgsqllib.c        authsaslclientcramsha1.c  authshadow.c        cramlib.c            preauthpwd.c
  4. authdaemond.c     authmoduser2.c  authpipe.c            authsaslclientexternal.c  authsyschangepwd.c  cryptpassword.c      preauthshadow.c
  5. authdaemonlib.c   authmoduser3.c  authpipelib.c         authsaslclientlogin.c     authsyscommon.c     debug.c              preauthuserdb.c
  6. authdaemontest.c  authmysql.c     authpwd.c             authsaslclientplain.c     authtest.c          preauthcustom.c      preauthuserdbcommon.c
  7. authenumerate.c   authmysqllib.c  authpwdenumerate.c    authsaslcram.c            authuserdb.c        preauthdaemon.c
  8. authinfo.c        authoption.c    authsasl.c            authsaslfrombase64.c      authuserdbpwd.c     preauthldap.c
  9. authldap.c        authpam.c       authsaslclient.c      authsasllogin.c           checkpassword.c     preauthmysql.c
  10. 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使用一个协议,其作用提供验证支持。
  1. #ls /var/run/saslauthd/* -l
  2. srwxrwxrwx 1 root root 0 Mar 22 19:00 /var/run/saslauthd/mux
  3. -rw------- 1 root root 0 Mar 22 19:00 /var/run/saslauthd/mux.accept
  4. -rw------- 1 root root 5 Mar 22 19:00 /var/run/saslauthd/saslauthd.pid
复制代码
  1. #saslauthd -v
  2. saslauthd 2.1.22
  3. 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:以上如有错误,欢迎大家指正。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP