postfix之maildrop详解

maildrop

    安装:
        0.安装依赖库、头文件、库文件
             # ln -sv /usr/local/courier-authlib/bin/courierauthconfig   /usr/bin
             # ln -sv /usr/local/courier-authlib/include/*   /usr/include
             # yum -y install pcre-devel

        1.添加vmail用户和组,id大于1000:
             # groupadd -g 1001 vmail
             # useradd -g vmail -u 1001 -M -s /sbin/nologin vmail

        2.编译安装:
             # tar xf maildrop-xxx.tar.bz2
             # cd maildrop-xxx
             # ./configure \
                 --enable-sendmail=/usr/sbin/sendmail \
                 --enable-trusted-users='root vmail' \
                 --enable-syslog=1 --enable-maildirquota \
                 --enable-maildrop-uid=1001 \
                 --enable-maildrop-gid=1001 \
                 --with-trashquota --with-dirsync
             # make
             # make install

            编译选项详解:
                --enable-sendmail=/usr/sbin/sendmail
                --enable-trusted-users='root vmail' 启用信任用户为root和vmail
                --enable-syslog=1 启用日志
                --enable-maildirquota  启用邮件地址队列
                --enable-maildrop-uid=1001 启用maildrop的组id,即vmail
                --enable-maildrop-gid=1001 启用maildrop的用户id,即vmail
                --with-trashquota 启动传输队列
                --with-dirsync 启动目录同步


        3.检查安装结果,请确保有"Courier Authentication Library extension enabled."一句出现:
            # maildrop -v
            maildrop 2.6.0 Copyright 1998-2005 Double Precision, Inc.
            GDBM/DB extensions enabled.
            Courier Authentication Library extension enabled.
            Maildir quota extension are now always enabled.
            This program is distributed under the terms of the GNU General Public
            License. See COPYING for additional information.

        配置文件:
            /etc/maildroprc

             # vim /etc/maildroprc
                logfile "/var/log/maildrop.log" 指定日志文件

             # touch /var/log/maildrop.log
             # chown vmail.vmail /var/log/maildrop.log

    配置Postfix支持maildrop
        1.编辑master.cf
            # vim /etc/postfix/master.cf
                maildrop  unix  -       n       n       -       -       pipe
                    flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}

            注意:定义transport的时候,即如上两行中的第二行,其参数行必须以空格开头,否则会出错。
     

        2.编辑main.cf,将投递代理由vitrual改为maildrop
             #vim /etc/postfix/main.cf
                virtual_transport = maildrop
                virtual_uid_maps = static:1001
                virtual_gid_maps = static:1001


        3.编辑/etc/authmysqlrc,更改mysql连接的用户
            #vim /etc/authmysqrc
                MYSQL_UID_FIELD  '1001'
                MYSQL_GID_FIELD  '1001'

            注意:没有此处的修改,maildrop可能会报告 “signal 0x06”的错误报告。

    配置extman和extmail支持maildrop:
        1.编辑/etc/httpd/httpd.conf,修改extmail和extman的用户身份。推荐第一种
            #vim /etc/httpd/extra/httpd-vhosts.conf
                SuexecUserGroup vmail vmail

            或:

            #vim/etc/httpd/httpd.conf
                User vmail
                Group vmail



        2.将用户邮件所在的目录/var/mailbox和extman的临时目录/tmp/extman的属主和属组指定为vmail
            #chown -R vmail.vmail /var/mailbox
            #chown -R vmail.vmail /tmp/extman

        3.修改extman的主配置文件中的默认用户ID和组ID,确保其为类似如下内容
            #vim /var/www/extsuite/extman/webman.cf
                SYS_DEFAULT_UID = 1001
                SYS_DEFAULT_GID = 1001

        4.验正配置:
            接下来重新启动postfix和apache,进行发信测试后,如果日志中的记录类同以下项,则安装成功

            Apr 15 15:33:54 localhost postfix/pipe[11964]: 04B92147CE9: to=<[email protected]>, relay=maildrop, delay=0.16, delays=0.07/0.03/0/0.07, dsn=2.0.0, status=sent (delivered via maildrop service)

你可能感兴趣的:(linux,postfix,maildrop)