Centos6.x x64 安装postfix+extmail


配置yum源

使用EMOS-1.6.ISO光盘制作本地 yum 仓库;
wget http://mirror.extmail.org/iso/emos/EMOS_1.6_x86_64.iso
此外,我们假设本次安装默认域是extmail.org,主机名为:mail.extmail.org.安装完成后可以在web界面删除该域重新创建.
yum install createrepo
#加载ISO的方法
mkdir /mnt/EMOS
mount -o loop /path/EMOS_1.6_x86_64.iso /mnt/EMOS
cd /mnt
createrepo .
#创建客户端 yum 的定义文件
cd /etc/yum.repos.d

vi EMOS.repo (增加)

[EMOS]
name=EMOS
baseurl=file:///mnt/
enabled=1
gpgcheck=0
yum clean all
yum list



md5-2619ee0e98c429deb2a3eaf9400f4900



yum install postfix
rpm -e sendmail
postconf -n > /etc/postfix/main2.cf
mv /etc/postfix/main.cf /etc/postfix/main.cf.old
mv /etc/postfix/main2.cf /etc/postfix/main.cf



md5-a53ec7314bd3ec3c38624ee57661d02b



# hostname
mynetworks = 127.0.0.1
myhostname = gateares.com
mydestination = $mynetworks $myhostname
# banner
mail_name = Postfix - by gateares.com
smtpd_banner = $myhostname ESMTP $mail_name
# response immediately
smtpd_error_sleep_time = 0s
# Message and return code control
message_size_limit = 5242880
mailbox_size_limit = 5242880
show_user_unknown_table_name = no
# Queue lifetime control
bounce_queue_lifetime = 1d
maximal_queue_lifetime = 1d



md5-867116362a13fd9f645cde0e746f715e



chkconfig postfix on



md5-2b73946065079d8d3c9108de568058ea



yum install courier-authlib
yum install courier-authlib-mysql



md5-2f8f9a4ab549ce4e9f8c6375c402ee44



MYSQL_SERVER            localhost
MYSQL_USERNAME          extmail
MYSQL_PASSWORD          extmail
MYSQL_SOCKET            /var/lib/mysql/mysql.sock
MYSQL_PORT              3306
MYSQL_OPT               0
MYSQL_DATABASE          extmail
MYSQL_USER_TABLE        mailbox
MYSQL_CRYPT_PWFIELD     password
MYSQL_UID_FIELD         uidnumber
MYSQL_GID_FIELD         gidnumber
MYSQL_LOGIN_FIELD       username
MYSQL_HOME_FIELD        homedir
MYSQL_NAME_FIELD        name
MYSQL_MAILDIR_FIELD     maildir
MYSQL_QUOTA_FIELD       quota
MYSQL_SELECT_CLAUSE     SELECT username,password,"",uidnumber,gidnumber,\\
                        CONCAT('/home/domains/',homedir),               \\
                        CONCAT('/home/domains/',maildir),               \\
                        quota,                                          \\
                        name                                            \\
                        FROM mailbox                                    \\
                        WHERE username = '$(local_part)@$(domain)'



md5-83aae63ced416aea173f6f3a2da6dd1d



authmodulelist="authmysql"
authmodulelistorig="authmysql"



md5-867116362a13fd9f645cde0e746f715e



service courier-authlib start



md5-c772348d510380557d4b8765204b24f7



yum install maildrop



md5-faa85029abe3aafb5be2ee78ea51276c



maildrop   unix        -       n        n        -        -        pipe
flags=DRhu user=vuser argv=maildrop -w 90 -d ${user}@${nexthop} ${recipient} ${user} ${extension} {nexthop}



md5-cdec76d33d64c7f1bea97dda92972728



maildrop_destination_recipient_limit = 1



md5-3ccb3bde60ea0f20c8f28fd47230b12d



maildrop -v



md5-bdc86e81de9ce5cd71b25e546241a6ae



NameVirtualHost *:50080
    # VirtualHost for ExtMail Solution
    <VirtualHost *:50080>
    ServerName gateares.com
    DocumentRoot /var/www/extsuite/extmail/html/
    ScriptAlias /extmail/cgi/ /var/www/extsuite/extmail/cgi/
    Alias /extmail /var/www/extsuite/extmail/html/
    ScriptAlias /extman/cgi/ /var/www/extsuite/extman/cgi/
    Alias /extman /var/www/extsuite/extman/html/
    # Suexec config
    SuexecUserGroup vuser vgroup
    </VirtualHost>



md5-627a3e4ed7f97dcb995320cbc09edf94



chkconfig httpd on



md5-fc07bc633f6aa691559dd5474179336e



yum install extsuite-webmail
cd /var/www/extsuite/extmail
cp webmail.cf.default webmail.cf



md5-610200dd862ea08aebde506cd182534e



SYS_MYSQL_USER = extmail
SYS_MYSQL_PASS = extmail
SYS_MYSQL_DB = extmail



md5-efb337ddb355c9e0921e98ed6d4e7112



yum install extsuite-webman



md5-dc12a89875e65dbbc1c1e52dfbfe2ca2



chown -R vuser:vgroup /var/www/extsuite/extman/cgi/



md5-bc50ac7bfb4f946e82826f407acfb3be



mkdir /tmp/extman
chown -R vuser:vgroup /tmp/extman



md5-5cfb636d90e8e416bba0d702a8bd248c



mysql -uroot -pd8yq5id3bao < /var/www/extsuite/extman/docs/extmail.sql
mysql -uroot -pd8yq5id3bao < /var/www/extsuite/extman/docs/init.sql



md5-389349c07aa2fb4588ec79ba61b8219e



sed -i 's/TYPE=MyISAM/ENGINE=MyISAM/g' /usr/local/www/extman/docs/extmail.sql



md5-24651e083ee899cee8201f41f60963e3



cd /var/www/extsuite/extman/docs
cp mysql_virtual_alias_maps.cf /etc/postfix/
cp mysql_virtual_domains_maps.cf /etc/postfix/
cp mysql_virtual_mailbox_maps.cf /etc/postfix/
cp mysql_virtual_sender_maps.cf /etc/postfix/



md5-6111aaf7032c8f670be1476a331d816f



# extmail config here
    virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
    virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
    virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
    virtual_transport = maildrop:



md5-867116362a13fd9f645cde0e746f715e



service postfix restart



md5-1d05f01dc94e5010b2e767bfa8d93df2



cd /var/www/extsuite/extman/tools
./maildirmake.pl /home/domains/extmail.org/postmaster/Maildir
chown -R vuser:vgroup /home/domains/extmail.org
/usr/sbin/authtest -s login postmaster@extmail.org extmail



md5-fee9e8f32c4e595395ae25e1af1898b5



/usr/local/mailgraph_ext/mailgraph-init start



md5-e85e0faab6eae368a6ce77ee59b66cbf



/var/www/extsuite/extman/daemon/cmdserver --daemon
echo "/usr/local/mailgraph_ext/mailgraph-init start" >> /etc/rc.d/rc.local
echo "/var/www/extsuite/extman/daemon/cmdserver -v -d" >> /etc/rc.d/rc.local



md5-7f17fdbdc24f3a5cee932f6f8f2b1cda



0 4 * * * /var/www/extsuite/extman/tools/expireusers.pl -all postmaster@extmail.org
30 4 * * * /var/www/extsuite/extman/tools/reportusage.pl -all /home/domains postmaster@extmail.org



md5-7c28effcba4f8caa4017a8fcc86eb8c2



yum install cyrus-sasl



md5-5d76732b6ff84de36f488fc6596338e7



# smtpd related config
smtpd_recipient_restrictions =
        permit_mynetworks,
        permit_sasl_authenticated,
        reject_non_fqdn_hostname,
        reject_non_fqdn_sender,
        reject_non_fqdn_recipient,
        reject_unauth_destination,
        reject_unauth_pipelining,
        reject_invalid_hostname,
# SMTP sender login matching config
smtpd_sender_restrictions =
        permit_mynetworks,
        reject_sender_login_mismatch,
        reject_authenticated_sender_login_mismatch,
        reject_unauthenticated_sender_login_mismatch
smtpd_sender_login_maps =
        mysql:/etc/postfix/mysql_virtual_sender_maps.cf,
        mysql:/etc/postfix/mysql_virtual_alias_maps.cf
# SMTP AUTH config here
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous



md5-a2e3ef0988cab902ecb25c24468b02d2



pwcheck_method: authdaemond
log_level: 3
mech_list: PLAIN LOGIN
authdaemond_path:/var/spool/authdaemon/socket



md5-99fe5cfb8d972376304b226e011f38e9



perl -e 'use MIME::Base64; print encode_base64("postmaster\\@extmail.org")'
内容如下:cG9zdG1hc3RlckBleHRtYWlsLm9yZw==



md5-867116362a13fd9f645cde0e746f715e



perl -e 'use MIME::Base64; print encode_base64("extmail")'
内容如下:ZXh0bWFpbA==



md5-867116362a13fd9f645cde0e746f715e



然后本机测试:telnet localhost 25
  其过程如下:
    Trying 127.0.0.1...
    Connected to localhost.localdomain (127.0.0.1).
    Escape character is '^]'.
    220 mail.extmail.org ESMTP Postfix - by extmail.org
    ehlo demo.domain.tld     << 输入内容
    250-mail.extmail.org
    250-PIPELINING
    250-SIZE 10240000
    250-VRFY
    250-ETRN
    250-AUTH LOGIN PLAIN
    250-AUTH=LOGIN PLAIN
    250-ENHANCEDSTATUSCODES
    250-8BITMIME
    250 DSN
    auth login     << 输入内容
    334 VXNlcm5hbWU6
    cG9zdG1hc3RlckBleHRtYWlsLm9yZw==     << 输入内容
    334 UGFzc3dvcmQ6
    ZXh0bWFpbA==     << 输入内容
    235 2.0.0 Authentication successful
    quit     << 输入内容
    221 2.0.0 Bye
  最后出现235 Authentication Successful 表明认证成功了。



md5-6f1e5ddeb30f9d1ccc513ce66121388b



yum install courier-imap



md5-20a22680f56debeadfdd4dfa19d19eba



vi /usr/lib/courier-imap/etc/imapd
  修改内容如下:IMAPDSTART=NO
vi /usr/lib/courier-imap/etc/imapd-ssl
  修改内容如下:IMAPDSSLSTART=NO
service courier-imap restart



md5-0b0581bf1d680050976685072edc86bd



telnet localhost 110
    其过程如下:
      Trying 127.0.0.1...
      Connected to localhost.localdomain (127.0.0.1).
      Escape character is '^]'.
      +OK Hello there.
      user test@extmail.org     << 输入内容
      +OK Password required.
      pass extmail     << 输入内容
      +OK logged in.
      list     << 输入内容
      +OK POP3 clients that break here, they violate STD53.
      .
      quit     << 输入内容
      +OK Bye-bye.
      Connection closed by foreign host.

注意:创建域名的时候如果报错:for column 'cansignup' at row 1
修改/var/www/extsuite/extman/libs/Ext/MgrApp/Domain.pm文件 198行 can
sign改成can_signup

mutt+msmtp发件无响应,查看日志:tail -200f /var/log/maillog 。

报错:fatal: open database /etc/aliases.db: No such file or directory,执行:newaliases 即可。