• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • Postfix + Courier-IMAP + Cyrus-SASL + MySQL 安裝

    發表于:2007-05-26來源:作者:點擊數: 標簽:
    linux上postfix郵件 服務器 的安裝筆記,不完全 參考文章: Postfix Integrated Solution ?? http://www.9812.net/article/postfix Postfix + Courier-IMAP + Cyrus-SASL + MySQL + IMP 完全指南 王興宇 http://www.cngnu.org/technology/Postfix_II.html REDH

    linux上postfix郵件服務器的安裝筆記,不完全

    參考文章:
    <<Postfix Integrated Solution>> ?? http://www.9812.net/article/postfix
    <<
    Postfix + Courier-IMAP + Cyrus-SASL + MySQL + IMP完全指南>> 王興宇 http://www.cngnu.org/technology/Postfix_II.html
    <<REDHAT + QMAIL + OPENSSL...>> ?? http://www.pipeline.com.au/staff/mbowe/isp/webmail-server.htm

    Postfix + Courier-IMAP + Cyrus-SASL + MySQL INSTALL
    劉雪華

    參考文章:
    <<Postfix Integrated Solution>> ?? http://www.9812.net/article/postfix
    <<
    Postfix + Courier-IMAP + Cyrus-SASL + MySQL + IMP完全指南>> 王興宇 http://www.cngnu.org/technology/Postfix_II.html
    <<REDHAT + QMAIL + OPENSSL...>> ?? http://www.pipeline.com.au/staff/mbowe/isp/webmail-server.htm


    1.查看MYSQL是否已經安裝

    [root@linuxas3 src]# rpm -qa |grep MySQL
    MySQL-Max-4.0.18-0
    MySQL-client-4.0.18-0
    MySQL-bench-4.0.18-0
    MySQL-shared-compat-4.0.18-0
    MySQL-server-4.0.18-0
    MySQL-embedded-4.0.18-0
    MySQL-devel-4.0.18-0
    perl-DBD-MySQL-2.1021-3
    MySQL-shared-4.0.18-0

    postfix 數據庫腳本
    CREATE DATABASE mail;

    GRANT ALL ON mail.* TO mail@localhost IDENTIFIED BY "liuxuehua";

    FLUSH PRIVILEGES;

    USE mail;

    # Database mail running on localhost

    # phpMyAdmin SQL Dump

    # version 2.5.6

    # http://www.phpmyadmin.net

    #

    # Host: localhost

    # Generation Time: Apr 21, 2004 at 03:00 PM

    # Server version: 4.0.18

    # PHP Version: 4.3.2

    #

    # Database : `mail`

    #


    # --------------------------------------------------------
     
    2.pam_mysql-0.5

    tar zxvf pam_mysql-0.5.tar.gz

    cd pam_mysql

    make

    cp pam_mysql.so /lib/security

    cd ..

    rm -rf pam_mysql


    3.Cyrus-SASL安裝配置

    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]#
    #

    # Table structure for table `postfix_aliases`

    #


    DROP TABLE IF EXISTS `postfix_aliases`;

    CREATE TABLE `postfix_aliases` (

    `id` int(32) unsigned NOT NULL auto_increment,

    `alias` varchar(255) NOT NULL default '',

    `rcpt` varchar(255) NOT NULL default '',

    `domain` varchar(255) NOT NULL default '',

    `create_date` datetime NOT NULL default '0000-00-00 00:00:00',

    `change_date` datetime NOT NULL default '0000-00-00 00:00:00',

    `active` tinyint(4) NOT NULL default '1',

    PRIMARY KEY (`id`),

    UNIQUE KEY `aliases_unique` (`id`,`alias`),

    KEY `aliases_index` (`id`,`alias`)

    ) TYPE=MyISAM AUTO_INCREMENT=9 ;


    #

    # Dumping data for table `postfix_aliases`

    #


    INSERT INTO `postfix_aliases` VALUES (3, 'root@example.net', 'postmaster@example.net', 'example.net', '2003-06-26 14:58:46', '2003-06-26 14:58:46', 1);

    INSERT INTO `postfix_aliases` VALUES (8, 'postfix@example.net', 'postmaster@example.net', 'example.net', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1);


    # --------------------------------------------------------


    #

    # Table structure for table `postfix_forward`

    #


    DROP TABLE IF EXISTS `postfix_forward`;

    CREATE TABLE `postfix_forward` (

    `id` int(32) unsigned NOT NULL auto_increment,

    `username` varchar(50) NOT NULL default '',

    `domain` varchar(40) NOT NULL default '',

    `forward_addr` text NOT NULL,

    PRIMARY KEY (`id`)

    ) TYPE=MyISAM AUTO_INCREMENT=1 ;


    #

    # Dumping data for table `postfix_forward`

    #


    # --------------------------------------------------------


    #

    # Table structure for table `postfix_transport`

    #


    DROP TABLE IF EXISTS `postfix_transport`;

    CREATE TABLE `postfix_transport` (

    `id` int(32) unsigned NOT NULL auto_increment,

    `domain` varchar(128) NOT NULL default 'example.net',

    `transport` enum('local:','virtual:','maildrop:') NOT NULL default 'virtual:',

    `description` varchar(255) NOT NULL default '',

    `begin_date` datetime NOT NULL default '0000-00-00 00:00:00',

    `end_date` datetime NOT NULL default '0000-00-00 00:00:00',

    `active` tinyint(4) NOT NULL default '1',

    PRIMARY KEY (`id`),

    UNIQUE KEY `transport_unique` (`domain`),

    KEY `transport_index` (`id`,`domain`)

    ) TYPE=MyISAM AUTO_INCREMENT=3 ;


    #

    # Dumping data for table `postfix_transport`

    #

    INSERT INTO `postfix_transport` VALUES (1, 'example.net', 'virtual:', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1);


    # --------------------------------------------------------

    #

    # Table structure for table `postfix_users`

    #

    CREATE TABLE `postfix_users` (

    `id` int(32) unsigned NOT NULL auto_increment,

    `user` varchar(50) NOT NULL default '',

    `name` varchar(60) NOT NULL default '',

    `passwd` varchar(128) NOT NULL default '',

    `domain` varchar(50) NOT NULL default 'example.net',

    `uid` smallint(5) unsigned NOT NULL default '1010',

    `gid` smallint(5) unsigned NOT NULL default '1010',

    `clearpw` varchar(20) binary NOT NULL default '',

    `home` varchar(100) NOT NULL default '/home/mail/',

    `maildir` varchar(150) NOT NULL default '',

    `imapok` tinyint(3) unsigned NOT NULL default '1',

    `quota` varchar(100) NOT NULL default '200000000s,20000c',

    `create_date` datetime NOT NULL default '0000-00-00 00:00:00',

    `last_aclearcase/" target="_blank" >ccess` int(10) unsigned NOT NULL default '0',

    `status` varchar(5) NOT NULL default 'Y',

    PRIMARY KEY (`id`),

    UNIQUE KEY `mailbox_unique` (`id`,`name`),

    KEY `mailbox_index` (`id`,`name`)

    ) TYPE=MyISAM AUTO_INCREMENT=16 ;


    #

    # Dumping data for table `postfix_users`

    #

    INSERT INTO `postfix_users` VALUES (1, 'chen@example.net', 'chen', 'wPRiQTO$ZXvopyWE2/DNkKTAuXPtM.', 'example.net', 1000, 1000, 'liuxuehua', '/home/mail/', 'example.net/chen/Maildir/', 1, '200000000s,20000c', '0000-00-00 00:00:00', 0, 'Y');

    INSERT INTO `postfix_users` VALUES (2, 'postmaster@example.net', 'postmaster', 'wPRiQTO$ZXvopyWE2/DNkKTAuXPtM.', 'example.net', 1000, 1000, 'liuxuehua', '/home/mail/', 'postmaster/Maildir/', 1, '200000000s,20000c', '0000-00-00 00:00:00', 0, 'Y');

    INSERT INTO `postfix_users` VALUES (3, 'liu@example.net', 'liu', 'wPRiQTO$ZXvopyWE2/DNkKTAuXPtM.', 'example.net', 1000, 1000, 'liuxuehua', '/home/mail/', 'liu/Maildir/', 1, '200000000s,20000c', '0000-00-00 00:00:00', 0, 'Y');
    2.pam_mysql-0.5
     
    tar zxvf pam_mysql-0.5.tar.gz
    cd pam_mysql
    make
    cp pam_mysql.so /lib/security
    cd ..
    rm -rf pam_mysql 
     
    3.Cyrus-SASL安裝配置
    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]# 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-anon --enable-login --enable-ntlm --enable-sql --with-mysql=/usr/local/mysql --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

    4.編譯安裝maildrop
    #groupadd -g 1010 maildrop
    #useradd -g 1010 -u 1010 -c maildrop -M -d/home/mail -s/no/shell maildrop
    tar -xvjf maildrop-1.6.3.tar.bz2
    cd maildrop-1.6.3

    ./configure --prefix=/usr/local/courier-maildrop \
    --enable-sendmail=/usr/sbin/sendmail \
    --enable-maildropmysql --with-mysqlconfig=/etc/postfix/mysql_maildrop.conf \
    --enable-maildirquota --with-trashquota --with-dirsync \
    --enable-trusted-users='root maildrop' \
    --enable-maildrop-uid=1010 --enable-maildrop-gid=1010

    make
    make install
    cp maildropmysql.config /etc/postfix/mysql_maildrop.conf
    vi /etc/postfix/mysql_maildrop.conf

    # The attributes are:
    #
    # mail - The full email address of the user (ie user@yourdomain.com)
    #        This is the primary attribute searched upon by maildrop.
    #
    # maildir - The location (full path including name) of the users
    #           mail directory (Maildir)
    #
    # homedirectory - The location (full path including name) of the
    #                 users home directory.  This may be the same as the
    #                 users maildir.
    #
    # uidnumber - The uid of the user that owns the mail files for
    #             this user.  This may be a specific uid per user,
    #             or a single uid for every user (full 'virtual' user
    #             configuration), or a combination.
    #
    # gidnumber - The gid of the user that owns the mail files for
    #             this user.  This may be a specific gid per user,
    #             or a single gid for every user (full 'virtual' user
    #             configuration), or a combination.
    #
    # quota     - *OPTIONAL* The quota for this user.  If blank, or
    #             non-existent defaults to no quota.
    # mailstatus - account status
    #
    # A sample LDAP entry is given at the end of this file.
    #
    # --- Actual configuration begins here -----------------------------

    # hostname - host name of your ldap server
    hostname    localhost
    port        3306
    socket        /var/lib/mysql/mysql.sock
    database    mail
    dbuser        mail
    dbpw        liuxuehua
    dbtable        postfix_users

    #not used now
    #timeout        5

    # default_uid - default uid (number only) to use incase uidnumber attribute not
    # found in users mysql entry
    default_uidnumber    1010

    # default_gid - default gid (number only) to use incase gidnumber attribute not
    # found in users ldap entry
    default_gidnumber    1010

    # MySQL Field definitions
    #
    # This section allows you to specify the actual attributes you
    # use in your Mysql record
    #
    # The example attribute mapping shown below is also the default
    # mapping used by maildrop in the case that any are missing

    # UID_FIELD - MySQL attribute which contains the users name (w or w/o domain)
    uid_field        user

    # UIDNUMBER_FIELD - MySQL attribute which contains the system uid to deliver
    # mail as
    uidnumber_field        uid

    # GIDNUMBER_FIELD - MySQL attribute which contains the system gid to deliver
    # mail as
    gidnumber_field        gid

    # MAILDIR_FIELD - MySQL attribute which contains the path to the users
    # custom maildir
    maildir_field        maildir

    # HOMEDIRECTORY_FIELD - MySQL attribute which contains the path to the users
    # home directory
    homedirectory_field    home

    # QUOTA_FIELD - MySQL attribute which contains the users quota
    quota_field        quota

    # MYSQL_DEFAULT_STATUS_FIELD - MySQL attribute which could be created in the
    # MySQL entry to set whether or not the user is allowed to receive email on
    # this box..
    #        -- looks unused for now; but must be valid column ! (2001-11-03)
    mailstatus_field    status

    # MYSQL_DEFAULT_WHERE_CLAUSE - This is optional !
    # It can be set to any fixed string starting with keyword 'AND'.
    # It will then be appended to the WHERE clause of our query.
    where_clause        ""
    #=========== end =============

    5.編譯安裝Postfix
     
    如果你的系統上原來有sendmail,先將其停止并將其文件改名:
    [root@mail src]# /etc/init.d/sendmail stop
    [root@mail src]# chkconfig --level 0123456 sendmail off
    [root@mail src]# mv /usr/bin/newaliases /usr/bin/newaliases.orig
    [root@mail src]# mv /usr/bin/mailq /usr/bin/mailq.orig
    [root@mail src]# mv /usr/sbin/sendmail /usr/sbin/sendmail.orig
     
    添加postfix用戶 
     
    [root@linux src]# groupadd -g 1000 postfix
    [root@linux src]# groupadd -g 1001 postdrop
    [root@linux src]# useradd postfix -u 1000 -g 1000 -d /dev/null -s /bin/false

    給Postfix郵箱空間配額打補丁
     
    [root@linux src]# patch -p0 < postfix-2.0.19.patch
    patching file postfix-2.0.19/src/global/mail_params.h
    patching file postfix-2.0.19/src/util/file_limit.c
    patching file postfix-2.0.19/src/virtual/mailbox.c
    patching file postfix-2.0.19/src/virtual/maildir.c
    patching file postfix-2.0.19/src/virtual/virtual.c
    patching file postfix-2.0.19/src/virtual/virtual.h
                     
     
    編譯安裝
     
    [root@linux src]# cd postfix-2.0.19
    [root@linux postfix-2.0.19]# make tidy
    [root@linux postfix-2.0.19]# make clean
    [root@linux postfix-2.0.19]# make -f Makefile.init makefiles 'CCARGS=-DUSE_SASL_AUTH -DHAS_MYSQL -I/usr/local/mysql/include -I/usr/include/sasl' 'AUXLIBS=-L/usr/local/mysql/lib -L/usr/lib/sasl2 -lmysqlclient -lsasl2 -lz -lm'
    [root@linux postfix-2.0.19]# make
    [root@linux postfix-2.0.19]# make install
                     
    make tidy(如果你之前編譯過Postfix使用此命令)
    make upgrade(升級老版本使用此命令)
    make -f Makefile.init makefiles 'CCARGS=-DHAS_LDAP -I<ldap的include目錄> -DUSE_SASL_AUTH -I/usr/local/include/sasl' 'AUXLIBS=-L<ldap的lib目錄> -llber -lldap -L/usr/local/lib -lsasl2' 
     
    !!!!!!這里切記要指定正確的SASL2的INCLUDE和LIB位置。由于現在很多linux發行版上都已經帶有了sasl,如果不指定的話,很可能會使用了不同版本的頭文件和庫,在這種情況下,每次連接SMTP時,smtpd就會發生致命錯誤“Fatal: SASL per-connection server init...”而崩潰。
     
    配置安裝目錄
    [root@linux postfix]# vi main.cf
    #======= BASE ==============
    #mail_spool_directory = /var/mail/
    myhostname = mail.example.net
    mydomain = example.net
    home_mailbox=Maildir/
    mydestination = $myhostname, $mydomain, $transport_maps
    local_recipient_maps =
    mailbox_transport = maildrop
    fallback_transport = maildrop 
    #mailbox_command= /usr/lib/courier-imap/bin/deliverquota -w 90 ~/Maildir
    #mailbox_command = /usr/local/maildrop/bin/maildrop
    #local_destination_concurrency_limit = 1
    #======= MYSQL =============
    transport_maps = mysql:/etc/postfix/mysql_transport.cf
    virtual_mailbox_base = /home/mail
    virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual.cf
    virtual_maps = mysql:/etc/postfix/mysql_aliases.cf
    #virtual_uid_maps = mysql:/etc/postfix/uids.cf
    #virtual_gid_maps = mysql:/etc/postfix/gids.cf
    virtual_uid_maps = static:1010
    virtual_gid_maps = static:1010
    #======= Quota ============
    #50MB
    virtual_mailbox_limit = 500000000
    #5MB
    message_size_limit = 50000000
    virtual_mailbox_limit_inbox = no
    virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_quota.cf
    virtual_mailbox_limit_override = yes
    virtual_maildir_extended = yes
    virtual_create_maildirsize = yes
    #====== SASL ================
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_security_options = noanonymous
    broken_sasl_auth_clients = yes
    smtpd_recipient_restrictions = permit_sasl_authenticated permit_auth_destination reject
    #smtpd_sasl_local_domain = $mydomain
    smtpd_client_restrictions = permit_sasl_authenticated
    #=========== end ========

    vi /etc/postfix/master.cf
    modify follow two lines:
    maildrop  unix  -       n       n       -       -       pipe
      flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d $
    to:
    maildrop  unix  -       n       n       -       -       pipe
      flags=DRhu user=postfix argv=/usr/local/courier-maildrop/bin/maildrop -d $

    [root@linuxas3 postfix]# cat /etc/postfix/mysql_transport.cf
    #mysql_transport.cf
    hosts = localhost
    user = postfix
    password = 6AJx9Nqv9x8hg
    dbname = postfix
    table = postfix_transport
    select_field = transport
    where_field = domain

    [root@linuxas3 postfix]# cat /etc/postfix/mysql_virtual.cf
    #mysql_virtual.cf
    hosts = localhost
    user = postfix
    password= 6AJx9Nqv9x8hg
    dbname = postfix
    table = postfix_users
    select_field = maildir
    where_field = user

    [root@linuxas3 postfix]# cat /etc/postfix/mysql_aliases.cf
    #mysql.aliases.cf
    hosts = localhost
    user = postfix
    password= 6AJx9Nqv9x8hg
    dbname = postfix
    table = postfix_aliases
    select_field = rcpt
    where_field = alias

    [root@linuxas3 postfix]# cat /etc/postfix/mysql_quota.cf
    #mailboxsize-mysql.cf
    hosts = localhost
    user = postfix
    password = 6AJx9Nqv9x8hg
    dbname = postfix
    table = postfix_users
    select_field = quota
    where_field = user

    [root@linuxas3 postfix]#/usr/sbin/postfix start  //運行,測試
    測試postfix的SMTP的認證:PLAIN認證方式
    [root@linuxas3 src]#perl -MMIME::Base64 -e \
    'print encode_base64("chen\@example.net0chen\@example.net0liuxuehua");'
    Y2hlbkBleGFtcGxlLm5ldABjaGVuQGV4YW1wbGUubmV0AGxpdXh1ZWh1YQ==
    [root@linuxas3 src]# telnet localhost 25
    Trying 127.0.0.1...
    Connected to linuxas3.9812.net (127.0.0.1).
    Escape character is '^]'.
    220 mail.example.net ESMTP Postfix
    EHLO example.net
    250-mail.cngnu.org
    250-PIPELINING
    250-SIZE 10240000
    250-VRFY
    250-ETRN
    250-AUTH LOGIN PLAIN
    250-AUTH=LOGIN PLAIN
    250-XVERP
    250 8BITMIME
    AUTH PLAIN dmlydHVhbHVzZXJAY25nbnUub3JnAHZpcnR1YWx1c2VyQGNuZ251Lm9yZwB0ZXN0cHc==
    235 Authentication successful
    QUIT
    221 Bye
    Connection closed by foreign host.

    卸載Postfix 
    復制下面命令粘貼到CLI上即可。 postfix stop
    rm -rf /usr/libexec/postfix/bounce
    rm -rf /usr/libexec/postfix/cleanup
    rm -rf /usr/libexec/postfix/error
    rm -rf /usr/libexec/postfix/flush
    rm -rf /usr/libexec/postfix/lmtp
    rm -rf /usr/libexec/postfix/local
    rm -rf /usr/libexec/postfix/master
    rm -rf /usr/libexec/postfix/nqmgr
    rm -rf /usr/libexec/postfix/pickup
    rm -rf /usr/libexec/postfix/pipe
    rm -rf /usr/libexec/postfix/proxymap
    rm -rf /usr/libexec/postfix/qmgr
    rm -rf /usr/libexec/postfix/qmqpd
    rm -rf /usr/libexec/postfix/showq
    rm -rf /usr/libexec/postfix/smtp
    rm -rf /usr/libexec/postfix/smtpd
    rm -rf /usr/libexec/postfix/spawn
    rm -rf /usr/libexec/postfix/trivial-rewrite
    rm -rf /usr/libexec/postfix/virtual
    rm -rf /usr/sbin/postalias
    rm -rf /usr/sbin/postcat
    rm -rf /usr/sbin/postconf
    rm -rf /usr/sbin/postfix
    rm -rf /usr/sbin/postkick
    rm -rf /usr/sbin/postlock
    rm -rf /usr/sbin/postlog
    rm -rf /usr/sbin/postmap
    rm -rf /usr/sbin/postsuper
    rm -rf /usr/sbin/postdrop
    rm -rf /usr/sbin/postqueue
    rm -rf /usr/sbin/sendmail
    rm -rf /usr/bin/newaliases
    rm -rf /usr/bin/mailq
    rm -rf /etc/postfix/LICENSE
    rm -rf /etc/postfix/access
    rm -rf /etc/postfix/aliases
    rm -rf /etc/postfix/canonical
    rm -rf /etc/postfix/main.cf
    rm -rf /etc/postfix/main.cf.default
    rm -rf /etc/postfix/master.cf
    rm -rf /etc/postfix/pcre_table
    rm -rf /etc/postfix/postfix-files
    rm -rf /etc/postfix/regexp_table
    rm -rf /etc/postfix/relocated
    rm -rf /etc/postfix/transport
    rm -rf /etc/postfix/virtual
    rm -rf /etc/postfix/postfix-script
    rm -rf /etc/postfix/post-install
    rm -rf /usr/local/man/man1/mailq.1
    rm -rf /usr/local/man/man1/newaliases.1
    rm -rf /usr/local/man/man1/postalias.1
    rm -rf /usr/local/man/man1/postcat.1
    rm -rf /usr/local/man/man1/postconf.1
    rm -rf /usr/local/man/man1/postdrop.1
    rm -rf /usr/local/man/man1/postfix.1
    rm -rf /usr/local/man/man1/postkick.1
    rm -rf /usr/local/man/man1/postlock.1
    rm -rf /usr/local/man/man1/postlog.1
    rm -rf /usr/local/man/man1/postmap.1
    rm -rf /usr/local/man/man1/postqueue.1
    rm -rf /usr/local/man/man1/postsuper.1
    rm -rf /usr/local/man/man1/sendmail.1
    rm -rf /usr/local/man/man5/access.5
    rm -rf /usr/local/man/man5/aliases.5
    rm -rf /usr/local/man/man5/canonical.5
    rm -rf /usr/local/man/man5/pcre_table.5
    rm -rf /usr/local/man/man5/regexp_table.5
    rm -rf /usr/local/man/man5/relocated.5
    rm -rf /usr/local/man/man5/transport.5
    rm -rf /usr/local/man/man5/virtual.5
    rm -rf /usr/local/man/man8/bounce.8
    rm -rf /usr/local/man/man8/cleanup.8
    rm -rf /usr/local/man/man8/defer.8
    rm -rf /usr/local/man/man8/error.8
    rm -rf /usr/local/man/man8/flush.8
    rm -rf /usr/local/man/man8/lmtp.8
    rm -rf /usr/local/man/man8/local.8
    rm -rf /usr/local/man/man8/master.8
    rm -rf /usr/local/man/man8/nqmgr.8
    rm -rf /usr/local/man/man8/pickup.8
    rm -rf /usr/local/man/man8/pipe.8
    rm -rf /usr/local/man/man8/proxymap.8
    rm -rf /usr/local/man/man8/qmgr.8
    rm -rf /usr/local/man/man8/qmqpd.8
    rm -rf /usr/local/man/man8/showq.8
    rm -rf /usr/local/man/man8/smtp.8
    rm -rf /usr/local/man/man8/smtpd.8
    rm -rf /usr/local/man/man8/spawn.8
    rm -rf /usr/local/man/man8/trivial-rewrite.8
    rm -rf /usr/local/man/man8/virtual.8
    rm -rf /etc/postfix/sample-aliases.cf
    rm -rf /etc/postfix/sample-auth.cf
    rm -rf /etc/postfix/sample-canonical.cf
    rm -rf /etc/postfix/sample-compatibility.cf
    rm -rf /etc/postfix/sample-debug.cf
    rm -rf /etc/postfix/sample-filter.cf
    rm -rf /etc/postfix/sample-flush.cf
    rm -rf /etc/postfix/sample-ldap.cf
    rm -rf /etc/postfix/sample-lmtp.cf
    rm -rf /etc/postfix/sample-local.cf
    rm -rf /etc/postfix/sample-mime.cf
    rm -rf /etc/postfix/sample-misc.cf
    rm -rf /etc/postfix/sample-pcre-access.cf
    rm -rf /etc/postfix/sample-pcre-body.cf
    rm -rf /etc/postfix/sample-pcre-header.cf
    rm -rf /etc/postfix/sample-qmqpd.cf
    rm -rf /etc/postfix/sample-rate.cf
    rm -rf /etc/postfix/sample-regexp-access.cf
    rm -rf /etc/postfix/sample-regexp-body.cf
    rm -rf /etc/postfix/sample-regexp-header.cf
    rm -rf /etc/postfix/sample-relocated.cf
    rm -rf /etc/postfix/sample-resource.cf
    rm -rf /etc/postfix/sample-rewrite.cf
    rm -rf /etc/postfix/sample-smtp.cf
    rm -rf /etc/postfix/sample-smtpd.cf
    rm -rf /etc/postfix/sample-transport.cf
    rm -rf /etc/postfix/sample-virtual.cf
    rm -rf /etc/postfix
    rm -rf /usr/libexec/postfix
    rm -rf /var/spool/postfix

    6.Courier IMAP編譯安裝
     
    wget http://optusnet.dl.sourceforge.net/sourceforge/courier/courier-authlib-0.55.tar.bz2
    tar -jxf courier-authlib-0.55.tar.bz2
    cd courier-authlib-0.55
    groupadd -g 1006 courier
    useradd courier -u 1006 -g 1006 -d /dev/null -s /bin/false

    Build the authentication library:

    ./configure \
      --prefix=/usr/local/courier-authlib \
      --without-authpam \
      --without-authldap \
      --without-authpwd \
      --without-authpgsql \
      --without-authshadow \
      --without-authuserdb \
      --without-authcustom \
      --without-authcram \
      --with-mysql-libs=/usr/lib/mysql \
      --with-mysql-includes=/usr/include/mysql \
      --with-mailuser=courier --with-mailgroup=courier \
      --with-redhat

    # note, if you are running redhat/fedora, you may have to add a
    #   --with-redhat
    # to the list of configuration settings above

    make
    make install
    make install-configure

    #vi /usr/local/courier-authlib/etc/authlib/authdaemonrc

    authmodulelist="authmysql"
    authmodulelistorig="authmysql"

    #vi /usr/local/courier-authlib/etc/authlib/authmysqlrc

    ##VERSION: $Id: authmysqlrc,v 1.18 2004/11/14 02:58:16 mrsam Exp $
    #
    # Copyright 2000-2004 Double Precision, Inc.  See COPYING for
    # distribution information.
    #
    # Do not alter lines that begin with ##, they are used when upgrading
    # this configuration.
    #
    # authmysqlrc created from authmysqlrc.dist by sysconftool
    #
    # DO NOT INSTALL THIS FILE with world read permissions.  This file
    # might contain the MySQL admin password!
    #
    # Each line in this file must follow the following format:
    #
    # field[spaces|tabs]value
    #
    # That is, the name of the field, followed by spaces or tabs, followed by
    # field value.  Trailing spaces are prohibited.


    ##NAME: LOCATION:0
    #
    # The server name, userid, and password used to log in.

    MYSQL_SERVER        localhost
    MYSQL_USERNAME        mail
    MYSQL_PASSWORD        liuxuehua

    ##NAME: MYSQL_SOCKET:0
    #
    # MYSQL_SOCKET can be used with MySQL version 3.22 or later, it specifies the
    # filesystem pipe used for the connection
    #
    MYSQL_SOCKET        /var/lib/mysql/mysql.sock

    ##NAME: MYSQL_PORT:0
    #
    # MYSQL_PORT can be used with MySQL version 3.22 or later to specify a port to
    # connect to.

    MYSQL_PORT        3306

    ##NAME: MYSQL_OPT:0
    #
    # Leave MYSQL_OPT as 0, unless you know what you're doing.

    MYSQL_OPT        0

    ##NAME: MYSQL_DATABASE:0
    #
    # The name of the MySQL database we will open:

    MYSQL_DATABASE        mail

    ##NAME: MYSQL_USER_TABLE:0
    #
    # The name of the table containing your user data.  See README.authmysqlrc
    # for the required fields in this table.

    MYSQL_USER_TABLE    postfix_users

    ##NAME: MYSQL_CRYPT_PWFIELD:0
    #
    # Either MYSQL_CRYPT_PWFIELD or MYSQL_CLEAR_PWFIELD must be defined.  Both
    # are OK too. crypted passwords go into MYSQL_CRYPT_PWFIELD, cleartext
    # passwords go into MYSQL_CLEAR_PWFIELD.  Cleartext passwords allow
    # CRAM-MD5 authentication to be implemented.

    #MYSQL_CRYPT_PWFIELD    passwd

    ##NAME: MYSQL_CLEAR_PWFIELD:0
    #
    #
    MYSQL_CLEAR_PWFIELD    clearpw

    ##NAME: MYSQL_DEFAULT_DOMAIN:0
    #
    # If DEFAULT_DOMAIN is defined, and someone tries to log in as 'user',
    # we will look up 'user@DEFAULT_DOMAIN' instead.
    #
    #
    DEFAULT_DOMAIN        example.net

    ##NAME: MYSQL_UID_FIELD:0
    #
    # Other fields in the mysql table:
    #
    # MYSQL_UID_FIELD - contains the numerical userid of the account
    #
    MYSQL_UID_FIELD        uid

    ##NAME: MYSQL_GID_FIELD:0
    #
    # Numerical groupid of the account

    MYSQL_GID_FIELD        gid

    ##NAME: MYSQL_LOGIN_FIELD:0
    #
    # The login id, default is id.  Basically the query is:
    #
    #  SELECT MYSQL_UID_FIELD, MYSQL_GID_FIELD, ... WHERE id='loginid'
    #

    MYSQL_LOGIN_FIELD    user

    ##NAME: MYSQL_HOME_FIELD:0
    #

    MYSQL_HOME_FIELD    home

    ##NAME: MYSQL_NAME_FIELD:0
    #
    # The user's name (optional)

    MYSQL_NAME_FIELD    name

    ##NAME: MYSQL_MAILDIR_FIELD:0
    #
    # This is an optional field, and can be used to specify an arbitrary
    # location of the maildir for the account, which normally defaults to
    # $HOME/Maildir (where $HOME is read from MYSQL_HOME_FIELD).
    #
    # You still need to provide a MYSQL_HOME_FIELD, even if you uncomment this
    # out.
    #
    MYSQL_MAILDIR_FIELD    maildir

    ##NAME: MYSQL_DEFAULTDELIVERY:0
    #
    # Courier mail server only: optional field specifies custom mail delivery
    # instructions for this account (if defined) -- essentially overrides
    # DEFAULTDELIVERY from $/courierd
    #
    # MYSQL_DEFAULTDELIVERY defaultdelivery

    ##NAME: MYSQL_QUOTA_FIELD:0
    #
    # Define MYSQL_QUOTA_FIELD to be the name of the field that can optionally
    # specify a maildir quota.  See README.maildirquota for more information
    #
    MYSQL_QUOTA_FIELD    quota

    ##NAME: MYSQL_AUXOPTIONS:0
    #
    # Auxiliary options.  The MYSQL_AUXOPTIONS field should be a char field that
    # contains a single string consisting of comma-separated "ATTRIBUTE=NAME"
    # pairs.  These names are additional attributes that define various per-account
    # "options", as given in INSTALL's description of the "Account OPTIONS"
    # setting.
    #
    # MYSQL_AUXOPTIONS_FIELD    auxoptions
    #
    # You might want to try something like this, if you'd like to use a bunch
    # of individual fields, instead of a single text blob:
    #
    # MYSQL_AUXOPTIONS_FIELD    CONCAT("disableimap=",disableimap,",disablepop3=",disablepop3,",disablewebmail=",disablewebmail,",sharedgroup=",sharedgroup)
    #
    # This will let you define fields called "disableimap", etc, with the end result
    # being something that the OPTIONS parser understands.


    ##NAME: MYSQL_WHERE_CLAUSE:0
    #
    # This is optional, MYSQL_WHERE_CLAUSE can be basically set to an arbitrary
    # fixed string that is appended to the WHERE clause of our query
    #
    # MYSQL_WHERE_CLAUSE    server='mailhost.example.com'

    ##NAME: MYSQL_SELECT_CLAUSE:0
    #
    # (EXPERIMENTAL)
    # This is optional, MYSQL_SELECT_CLAUSE can be set when you have a database,
    # which is structuraly different from proposed. The fixed string will
    # be used to do a SELECT operation on database, which should return fields
    # in order specified bellow:
    #
    # username, cryptpw, clearpw, uid, gid, home, maildir, quota, fullname, options
    #
    # The username field should include the domain (see example below).
    #
    # Enabling this option causes ignorance of any other field-related
    # options, excluding default domain.
    #
    # There are two variables, which you can use. Substitution will be made
    # for them, so you can put entered username (local part) and domain name
    # in the right place of your query. These variables are:
    #         $(local_part), $(domain), $(service)
    #
    # If a $(domain) is empty (not given by the remote user) the default domain
    # name is used in its place.
    #
    # $(service) will expand out to the service being authenticated: imap, imaps,
    # pop3 or pop3s.  Courier mail server only: service will also expand out to
    # "courier", when searching for local mail account's location.  In this case,
    # if the "maildir" field is not empty it will be used in place of
    # DEFAULTDELIVERY.  Courier mail server will also use esmtp when doing
    # authenticated ESMTP.
    #
    # This example is a little bit modified adaptation of vmail-sql
    # database scheme:
    #
    # MYSQL_SELECT_CLAUSE    SELECT CONCAT(popbox.local_part, '@', popbox.domain_name),            \
    #            CONCAT('', popbox.password_hash),        \
    #            popbox.clearpw,                    \
    #            domain.uid,                    \
    #            domain.gid,                    \
    #            CONCAT(domain.path, '/', popbox.mbox_name),    \
    #            '',                        \
    #            domain.quota,                    \
    #            '',                        \
    #            CONCAT("disableimap=",disableimap,",disablepop3=",    \
    #                              disablepop3,",disablewebmail=",disablewebmail, \
    #                              ",sharedgroup=",sharedgroup)             \
    #            FROM popbox, domain                \
    #            WHERE popbox.local_part = '$(local_part)'    \
    #            AND popbox.domain_name = '$(domain)'        \
    #            AND popbox.domain_name = domain.domain_name


    ##NAME: MYSQL_ENUMERATE_CLAUSE:1
    #
    #
    # Optional custom SQL query used to enumerate accounts for authenumerate,
    # in order to compile a list of accounts for shared folders.  The query
    # should return the following fields: name, uid, gid, homedir, maildir, options
    #
    # Example:
    # MYSQL_ENUMERATE_CLAUSE    SELECT CONCAT(popbox.local_part, '@', popbox.domain_name),            \
    #            domain.uid,                    \
    #            domain.gid,                    \
    #            CONCAT(domain.path, '/', popbox.mbox_name),    \
    #            '',                        \
    #            CONCAT('sharedgroup=', sharedgroup)        \
    #            FROM popbox, domain                \
    #            WHERE popbox.local_part = '$(local_part)'    \
    #            AND popbox.domain_name = '$(domain)'        \
    #            AND popbox.domain_name = domain.domain_name



    ##NAME: MYSQL_CHPASS_CLAUSE:0
    #
    # (EXPERIMENTAL)
    # This is optional, MYSQL_CHPASS_CLAUSE can be set when you have a database,
    # which is structuraly different from proposed. The fixed string will
    # be used to do an UPDATE operation on database. In other words, it is
    # used, when changing password.
    #
    # There are four variables, which you can use. Substitution will be made
    # for them, so you can put entered username (local part) and domain name
    # in the right place of your query. There variables are:
    #     $(local_part) , $(domain) , $(newpass) , $(newpass_crypt)
    #
    # If a $(domain) is empty (not given by the remote user) the default domain
    # name is used in its place.
    # $(newpass) contains plain password
    # $(newpass_crypt) contains its crypted form
    #
    # MYSQL_CHPASS_CLAUSE    UPDATE    popbox                    \
    #            SET    clearpw='$(newpass)',            \
    #                password_hash='$(newpass_crypt)'    \
    #            WHERE    local_part='$(local_part)'        \
    #            AND    domain_name='$(domain)'
    #
    #         ======end=====

    cp courier-authlib.sysvinit /etc/rc.d/init.d/courier-authlib
    chmod 744 /etc/rc.d/init.d/courier-authlib
    chkconfig --add courier-authlib
    /etc/rc.d/init.d/courier-authlib start  //啟動POP,IMAP認證

    wget http://optusnet.dl.sourceforge.net/sourceforge/courier/courier-imap-4.0.2.tar.bz2
    tar -jxf courier-imap-4.0.2.tar.bz2
    cd courier-imap-4.0.2
    # su liu
    [chen@linuxas3 courier-imap-4.0.2]$.COURIERAUTHCONFIG=/usr/local/courier-authlib/bin/courierauthconfig CPPFLAGS=-I/usr/local/courier-authlib/include ./configure --prefix=/usr/local/courier-imap --with-redhat --disable-root-check --enable-unicode=utf-8,iso-8859-1,gb2312,gbk,gb18030 --with-dirsync
    [chen@linuxas3 courier-imap-4.0.2]$ make 
    [chen@linuxas3 courier-imap-4.0.2]$ make check 
    [chen@linuxas3 courier-imap-4.0.2]$ exit
    [root@linuxas3 courier-imap-4.0.2]# make install 
    [root@linuxas3 courier-imap-4.0.2]# make install-configure 
     
    編輯pop3d文件,將POP3DSTART=NO改為POP3DSTART=YES
    [root@linuxas3 courier-imap-4.0.2]# vi /usr/local/courier-imap/etc/pop3d
    POP3DSTART=YES
     
    編輯imapd文件,將IMAPDSTART=NO改為IMAPDSTART=YES
    [root@linuxas3 courier-imap-4.0.2]# vi /usr/local/courier-imap/etc/imapd
    IMAPDSTART=YES

    [root@linuxas3 courier-imap-4.0.2]#cp courier-imap.sysvinit /etc/rc.d/init.d/courier-imap
    [root@linuxas3 courier-imap-4.0.2]#chmod 744 /etc/rc.d/init.d/courier-imap
    [root@linuxas3 courier-imap-4.0.2]#chkconfig --add courier-imap
    現在創建郵箱:
    mkdir -p /home/mail
    chown postfix:postfix /home/mail
    su -s/bin/bash postfix
    bash-2.05b$ cd /home/mail
    bash-2.05b$ mkdir -p example.net/chen
    bash-2.05b$ /usr/local/courier-imap/bin/maildirmake example.net/chen/Maildir
    啟動POP,IMAP
    [root@linuxas3 courier-imap-4.0.2]#/etc/rc.d/init.d/courier-imap start

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>