服务器 频道

Postfix邮件系统安装手册

  6.安装cyrus-sasl (注意版本不要高于2.1.15,后期版本不支持lbdm,好像是这个名字)

  1)安装cyrus-sasl-2.1.12

  hawk# tar -zxvf cyrus-sasl-2.1.12.tar.gz

  hawk# cd cyrus-sasl-2.1.12

  hawk# ./configure --disable-sample --disable-pwcheck --disable-cram
  --disable-digest --disable-krb4 --disable-gssapi --disable-anon
  --with-saslauthd=/var/run/saslauthd --enable-plain --enable-login

  hawk# make

  hawk# make install

  hawk# ln -s /usr/local/lib/sasl2 /usr/lib/sasl2

  2)配置sasl的lib库

  hawk# edit /etc/defaults/rc.conf

  (在ldconfig_paths="/usr/loca/lib后面加上/usr/local/lib/sasl2")

  hawk# shutdown -r now(使其生效)

  3)运行saslauthd(如果使用pam直接认证,则该步骤可以省略)

  示例saslauthd.sh

  #!/bin/sh

  case "$1" in

  start)

  if [ -x /usr/local/sbin/saslauthd ]; then

  /usr/local/sbin/saslauthd -a pam > /dev/null && echo -n '' saslauthd''

  fi

  ;;

  stop)

  /usr/bin/killall saslauthd > /dev/null 2>&1 && echo -n '' saslauthd''

  ;;

  *)

  echo ""

  echo "Usage: `basename $0` { start | stop }"

  echo ""

  exit 64

  ;;

  Esac

  hawk# mkdir /var/run/saslauthd

  hawk# edit /usr/local/etc/rc.d/saslauthd.sh

  hawk# chmod 755 /usr/local/etc/rc.d/saslauthd.sh

  4)准备postfix认证的配置文件

  A)使用pam直接认证:

  hawk# echo pwcheck_method: pam > /usr/local/lib/sasl2/smtpd.conf

  B)使用saslauthd调用pam认证:(个人觉得还是使用这个比较好)

  hawk# echo pwcheck_method: saslauthd > /usr/lib/sasl2/smtpd.conf

  7. 安装 pam_mysql

  安装 pam_mysql-0.5 (由于采用源码安装编译不能通过,故使用freebsd4.9 ports安装)

  1)安装

  hawk# pkg_add –r gmake (pam_mysql需要gmake)

  hawk# cd /usr/ports/security/pam-mysql/

  hawk# cp /usr/local/lib/pam_mysql.so /usr/lib/

  2)配置pam.conf调用mysql支持sasl认证

  hawk# edit /etc/pam.conf(将pop3 和imap的前面加上#)添加下列代码:

  smtp auth sufficient pam_mysql.so user=postfix passwd=hawk host=localhost db=mail table=virtual_users usercolumn=id passwdcolumn=password crypt=1

  smtp account required pam_mysql.so user=postfix passwd=hawk
  host=localhost db=mail table=virtual_users usercolumn=id passwdcolumn
  =password crypt=1

  (注:密码使用crypt加密,如果使用明文密码cyrpt=0,如果使用password()加密crypt=2)

  以上没有什么可以说的了

0
相关文章