Postfix Integrated Solution | ||
---|---|---|
<<< Previous | 整合電子郵件系統(MYSQL) | Next >>> |
SASL (Simple Authentication Security Layer)簡單認證安全層,在這裡有功能主要是用於SMTP認證。
安裝配置
首先查看系統是否已經安裝了cyrus-sasl
[root@linuxas3 src]# rpm -qa |grep cyrus-sasl cyrus-sasl-plain-2.1.15-3 cyrus-sasl-md5-2.1.15-3 cyrus-sasl-2.1.15-3 cyrus-sasl-gssapi-2.1.15-3 cyrus-sasl-devel-2.1.15-3 [root@linuxas3 src]# |
如果安裝已經,就請卸載它,或使用下面方法關閉它
[root@linuxas3 src]# mv /usr/lib/sasl /usr/lib/sasl.OFF [root@linuxas3 src]# mv /usr/lib/sasl2 /usr/lib/sasl2.OFF |
編譯安裝cyrus-sasl-2.1.18
[root@linux src]# cd cyrus-sasl-2.1.18 [root@linux cyrus-sasl-2.1.18]# make clean [root@linux cyrus-sasl-2.1.18]# ./configure --disable-sample --disable-saslauthd --disable-pwcheck \ --disable-krb4 --disable-gssapi --disable-anon \ --enable-plain --enable-login --enable-cram --enable-digest \ --with-saslauthd=/var/run/saslauthd Configuration Complete. Type 'make' to build. [root@linux cyrus-sasl-2.1.18]# make [root@linux cyrus-sasl-2.1.18]# make install [root@linux cyrus-sasl-2.1.18]# ln -s /usr/local/include/sasl/ /usr/include/sasl [root@linux cyrus-sasl-2.1.18]# ln -s /usr/local/lib/sasl2 /usr/lib/sasl2 [root@linux cyrus-sasl-2.1.18]# echo /usr/local/lib/sasl2 >> /etc/ld.so.conf [root@linux cyrus-sasl-2.1.18]# ldconfig [root@linuxas3 src]# ll -d /usr/lib/sasl2 lrwxrwxrwx 1 root root 20 Apr 19 20:00 /usr/lib/sasl2 -> /usr/local/lib/sasl2 [root@linuxas3 src]# |
設置cyrus-sasl啟用plain、login、cram、digest認證模組,Postfix使用SASL的saslauthd認證守護進程來支持smtp auth認證:
echo MECH=pam > /etc/sysconfig/saslauthd echo pwcheck_method: saslauthd > /usr/lib/sasl2/smtpd.conf echo mech_list: plain login cram digest>> /usr/lib/sasl2/smtpd.conf |
配置PAM
[root@linuxas3 cyrus-sasl-2.1.18]# cd /etc/pam.d/ [root@linuxas3 pam.d]# cat smtp #%PAM-1.0 #auth required pam_stack.so service=system-auth #account required pam_stack.so service=system-auth auth optional pam_mysql.so host=localhost db=postfix user=postfix passwd=6AJx9Nqv9x8hg table=postfix_users usercolumn=user passwdcolumn=passwd crypt=0 account required pam_mysql.so host=localhost db=postfix user=postfix passwd=6AJx9Nqv9x8hg table=postfix_users usercolumn=user passwdcolumn=passwd crypt=0 [root@linuxas3 pam.d]# |
crypt= n
crypt=0: 明文密碼
crypt=1: 使用crpyt()函數(對應SQL數據裡的encrypt(),encrypt()隨機產生salt)
crypt=2: 使用MYSQL中的password()函數加密
crypt=3:表示使用md5的散列方式
啟動SMTP認證進程(Authenticated SMTP)
[root@linuxas3 init.d]# service saslauthd start Starting saslauthd: [ OK ] [root@linuxas3 init.d]# or [root@linuxas3 init.d]# /etc/init.d/saslauthd start |
<<< Previous | Home | Next >>> |
pam_mysql-0.5 | Up | Installing Postfix |