Original intention: During the nagios test, QQ Enterprise Post Office rejected the request directly (only the records can be viewed), and 163 mailbox received the message in time (I thought my nagios configuration was wrong ), to solve the above two problems, I decided to configure a post office system by myself.
[Root @ mail/] # uname-
Linux mail.selmy.org 3.16.5-x86_64-linode46 #1 SMP Mon Oct 13 09:42:16 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
Preparations:
[Root @ mail/] # mkdir/mos
[Root @ mail/] # cd/mos
[Root @ mail mos] # wget http://mirror.extmail.org/iso/emos/EMOS_1.6_x86_64.iso
[Root @ mail mos] # yum install createrepo-y
[Root @ mail mos] # mkdir/mnt/EMOS
[Root @ mail mos] # mount-o loop/mos/EMOS_1.6_x86_64.iso/mnt/EMOS
Mount:/mos/EMOS_1.6_x86_64.iso is write-protected, mounting read-only
[Root @ mail mos] # cd/mnt/
[Root @ mail mnt] # createrepo.
[Root @ mail mnt] # cat/etc/yum. repos. d/EMOS-Base.repo
[EMOS]
Name = EMOS
Baseurl = file: // mnt/
Enabled = 1
Gpgcheck = 0
[Root @ mail mnt] # yum clean all & yum clean metadata & yum clean dbcache & yum makecache & yum list
Install postfix
[Root @ mail mnt] # yum install postfix-y
[Root @ mail mnt] # postconf-n>/etc/postfix/main2.cf
[Root @ mail mnt] # mv/etc/postfix/main. cf/etc/postfix/main. cf. old
[Root @ mail mnt] # mv/etc/postfix/main2.cf/etc/postfix/main. cf
[Root @ mail mnt] # tail-16/etc/postfix/main. cf
# Hostname
Mynetworks = 127.0.0.1
Myhostname = mail.extmail.org
Mydestination = $ mynetworks $ myhostname
# Banner
Mail_name = Postfix-by extmail.org
Smtpd_banner = $ myhostname ESMTP $ mail_name
# Response immediately
Smtpd_error_sleep_time = 0 s
# 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
[Root @ mail mnt] #/etc/init. d/postfix start
Starting postfix: [OK]
[Root @ mail mnt] # netstat-tunlp
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
Tcp 0 0 0.0.0.0: 25 0.0.0.0: * LISTEN 2931/master
Install Courier-Authlib
[Root @ mail mnt] # yum install courier-authlib-y
[Root @ mail mnt] # yum install courier-authlib-mysql-y
[Root @ mail mnt] # cp/etc/authlib/authmysqlrc. $ (date + % F % N)
[Root @ mail mnt] #>/etc/authlib/authmysqlrc
[Root @ mail mnt] # cat/etc/authlib/authmysqlrc
MYSQL_SERVER localhost
MYSQL_USERNAME extmail
MYSQL_PASSWORD extmail
MYSQL_SOCKET/var/lib/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 )'
[Root @ mail mnt] # sed-I's # authmodulelist = "authuserdb authpam authpgsql authldap authmysql authcustom authpipe" # authmodulelist = "authmysql" # g'/etc/authlib/authdaemonrc
[Root @ mail mnt] # sed-I's # authmodulelistorig = "authuserdb authpam authpgsql authldap authmysql authcustom authpipe" # authmodulelistorig = "authmysql" # g'/etc/authlib/authdaemonrc
[Root @ mail mnt] # service courier-authlib start
Starting Courier authentication services: authdaemond # startup successful
[Root @ mail mnt] # chmod 755/var/spool/authdaemon/
Install maildrop
[Root @ mail mnt] # yum install maildrop-y
[Root @ mail mnt] # tail-2/etc/postfix/master. cf
Maildrop unix-n-pipe
Flags = DRhu user = vuser argv = maildrop-w 90-d $ {user }@$ {nexthop }$ {recipient }$ {user }$ {extension} {nexthop}
[Root @ mail mnt] # tail-1/etc/postfix/main. cf
Maildrop_destination_recipient_limit = 1 # because maildrop does not support receiving multiple recipients at a time, you must add this parameter in main. cf.
VM settings
[Root @ mail mnt] # yum install httpd-y
[Root @ mail mnt] # mkdir/etc/httpd/conf/extra
[Root @ mail mnt] # echo "Include conf/extra/*. conf">/etc/httpd/conf/httpd. conf
[Root @ mail mnt] # cat/etc/httpd/conf/extra/vhost_extmail.conf
# VirtualHost for ExtMail Solution
<VirtualHost *: 80>
ServerName mail.selmy.org
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>
Install ExtMail
[Root @ mail mnt] # yum install extsuite-webmail-y
[Root @ Mail mnt] # cp/var/www/extsuite/extmail/webmail. cf. default/var/www/extsuite/extmail/webmail. cf
[Root @ mail extmail] # sed-I's # SYS_MYSQL_USER = db_user # SYS_MYSQL_USER = extmail # g'/var/www/extsuite/extmail/webmail. cf
[Root @ mail extmail] # sed-I's # SYS_MYSQL_PASS = db_pass # SYS_MYSQL_PASS = extmail # g'/var/www/extsuite/extmail/webmail. cf
[Root @ mail extmail] # chown-R vuser: vgroup/var/www/extsuite/extmail/cgi/
Install ExtMan in yum
[Root @ mail extmail] # yum install extsuite-webman-y
[Root @ mail extmail] # chown-R vuser: vgroup/var/www/extsuite/extman/cgi/
[Root @ mail extmail] # mkdir/tmp/extman
[Root @ mail extmail] # chown-R vuser: vgroup/tmp/extman
[Root @ mail extmail] # yum install mysql-server-y
[Root @ mail extmail] #/etc/init. d/mysqld start
[Root @ mail extmail] # mysql-u root-p </var/www/extsuite/extman/docs/extmail. SQL
[Root @ mail extmail] # mysql-u root-p </var/www/extsuite/extman/docs/init. SQL
####
Sed-I's/TYPE = MyISAM/ENGINE = MyISAM/g'/usr/local/www/extman/docs/extmail. SQL # MySQL 5.5.x does not support statements such as TYPE = MyISAM. Run the following script before importing the database.
####
[Root @ mail extmail] # cd/var/www/extsuite/extman/docs
[Root @ mail docs] # cp mysql_virtual_alias_maps.cf/etc/postfix/
[Root @ mail docs] # cp mysql_virtual_domains_maps.cf/etc/postfix/
[Root @ mail docs] # cp mysql_virtual_mailbox_maps.cf/etc/postfix/
[Root @ mail docs] # cp mysql_virtual_sender_maps.cf/etc/postfix/
[Root @ mail docs] # tail-5/etc/postfix/main. cf
# 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:
[Root @ mail docs] #/etc/init. d/postfix restart
[Root @ mail docs] # cd/var/www/extsuite/extman/tools
[Root @ mail tools] #./maildirmake. pl/home/domains/extmail.org/postmaster/Maildir
[Root @ mail tools] # chown-R vuser: vgroup/home/domains/extmail.org
[Root @ mail tools] #/usr/sbin/authtest-s login postmaster@extmail.org extmail
Authentication succeeded.
Authenticated: postmaster@extmail.org (uid 1000, gid 1000)
Home Directory:/home/domains/extmail.org/postmaster
Maildir:/home/domains/extmail.org/postmaster/Maildir/
Quota: 104857600 S
Encrypted Password: $1 $ phz1mRrj $3ok6BjeaoJYWDBsEPZb5C0
Cleartext Password: extmail
Options: (none)
[Root @ mail tools] #/usr/local/mailgraph_ext/mailgraph-init start
Starting mail statistics grapher: mailgraph_ext
Starting queue statistics grapher: qmonitor
[Root @ mail tools] #/var/www/extsuite/extman/daemon/cmdserver -- daemon
Loaded OK
[Root @ mail tools] # echo "/usr/local/mailgraph_ext/mailgraph-init start">/etc/rc. d/rc. local
[Root @ mail tools] # echo "/var/www/extsuite/extman/daemon/cmdserver-v-d">/etc/rc. d/rc. local
[Root @ mail tools] # echo '0 4 ***/var/www/extsuite/extman/tools/expireusers. pl-all postmaster@extmail.org '>/var/spool/cron/root
[Root @ mail tools] # echo '30 4 ***/var/www/extsuite/extman/tools/reportusage. pl-all/home/domains postmaster@extmail.org '>/var/spool/cron/root
###
ExtMan default super administrator account: root@extmail.org, initial password: extmail * 123 *
###
Install cyrus-sasl
[Root @ mail tools] # rpm-e cyrus-sasl -- nodeps
[Root @ mail tools] # yum install cyrus-sasl-y
[Root @ mail tools] # tail-24/etc/postfix/main. cf
# 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
[Root @ mail tools] # cat/usr/lib64/sasl2/smtpd. conf
Pwcheck_method: authdaemond
Log_level: 3
Mech_list: PLAIN LOGIN
Authdaemond_path:/var/spool/authdaemon/socket
[Root @ mail tools] # perl-e 'use MIME: Base64; print encode_base64 ("postmaster@extmail.org ")'
CG9zdG1hc3RlckBleHRtYWlsLm9yZw =
[Root @ mail tools] # perl-e 'use MIME: Base64; print encode_base64 ("extmail ")'
ZXh0bWFpbA =
[Root @ mail tools] # yum install telnet-y
[Root @ mail tools] # telnet localhost 25
Trying: 1...
Telnet: connect to address: 1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.extmail.org ESMTP Postfix-by extmail.org
Ehlo demo. domain. tld <input content
250-mail.extmail.org
250-PIPELINING
250-SIZE 5242880
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH = PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
Auth login <input content
334 VXNlcm5hbWU6
CG9zdG1hc3RlckBleHRtYWlsLm9yZw ==<< input content
334 UGFzc3dvcmQ6
ZXh0bWFpbA ==< <input content
235 2.7.0 Authentication successful
Quit <input content
221 2.0.0 Bye
Connection closed by foreign host.
Install Courier-imap
[Root @ mail tools] # yum install courier-imap-y
[Root @ mail tools] # sed-I's # IMAPDSTART = YES # IMAPDSTART = NO # g'/usr/lib/courier-imap/etc/imapd
[Root @ mail tools] # sed-I's # IMAPDSSLSTART = YES # IMAPDSSLSTART = NO # g'/usr/lib/courier-imap/etc/imapd-ssl
[Root @ mail tools] # service courier-imap start
Starting Courier-IMAP server: pop3 generating-SSL-certificate... pop3-ssl
[Root @ mail tools] # telnet localhost 110.
Trying: 1...
Connected to localhost.
Escape character is '^]'.
+ OK Hello there.
User test@extmail.org <input content
+ OK Password required.
Pass ADMIN <input content
+ OK logged in.
List <input content
+ OK POP3 clients that break here, they violate STD53.
.
Quit <input content
+ OK Bye-bye.
Connection closed by foreign host.
Mail log:
[Root @ mail/] # tail-f/var/log/maillog
Dec 7 12:17:34 mail extmail [13439]: user = <byrd@selmy.org>, client = 115.193.8.143, module = login, status = badlogin
Dec 7 12:17:40 mail extmail [13442]: user = <byrd@selmy.org>, client = 115.193.8.143, module = login, status = loginok
Dec 7 12:18:22 mail postfix/smtpd [13450]: connect from localhost [127.0.0.1]
Dec 7 12:18:22 mail postfix/smtpd [13450]: 76BBB4066: client = localhost [127.0.0.1]
Dec 7 12:18:22 mail postfix/cleanup [13456]: 76BBB4066: message-id = <20141207121822.76AAA4066@mail.extmail.org>
Dec 7 12:18:22 mail postfix/qmgr [11692]: 76BBB4066: from = <byrd@selmy.org>, size = 572, nrcpt = 1 (queue active)
Dec 7 12:18:22 mail postfix/smtpd [13450]: disconnect from localhost [127.0.0.1]
Dec 7 12:18:25 mail postfix/smtp [13458]: 76AAA4066: to = <root@t4x.org>, relay = mxbiz1.qq.com [184.105.206.87]: 25, delay = 3.4, delays = 0.06/0.02/1.5/1.8, dsn = 2.0.0, status = sent (250 OK: queued)
Dec 7 12:18:25 mail postfix/qmgr [11692]: 76AAA4066: removed
Email receiving log:
Dec 7 12:20:36 mail postfix/smtpd [13460]: connect from smtpbg343.qq.com [14.17.44.38]
Dec 7 12:20:37 mail postfix/smtpd [13460]: 3490A4066: client = smtpbg343.qq.com [14.17.44.38]
Dec 7 12:20:37 mail postfix/cleanup [13469]: 3490A4066: message-id = <tencent_3C6FDDDF3F0B276135D045EC@qq.com>
Dec 7 12:20:37 mail postfix/qmgr [11692]: 3490A4066: from = <root@t4x.org>, size = 2425, nrcpt = 1 (queue active)
Dec 7 12:20:37 mail postfix/pipe [13471]: 3490A4066: to = <byrd@selmy.org>, relay = maildrop, delay = 0.81, delays = 0.79/0.01/0/0.01, dsn = 2.0.0, status = sent (delivered via maildrop service)
Dec 7 12:20:37 mail postfix/qmgr [11692]: 3490C4066: removed
Dec 7 12:20:37 mail postfix/smtpd [13460]: disconnect from smtpbg343.qq.com [14.17.44.38]
Dec 7 12:23:57 mail postfix/anvilde [13462]: statistics: max connection rate 1/60 s for (smtp: 14.17.44.38) at Dec 7 12:20:36
Dec 7 12:23:57 mail postfix/andevil [13462]: statistics: max connection count 1 for (smtp: 14.17.44.38) at Dec 7 12:20:36
Dec 7 12:23:57 mail postfix/andevil [13462]: statistics: max cache size 1 at Dec 7 12:20:36
At this point, the basic configuration of the mail service is complete, and the domain name can be set to mx.
This server is located in Japan (linode host) and only sets the same IP address.
Note:
1: EMOS1.5 download (for centos5.X series): http://mirror.extmail.org/iso/emos/EMOS_1.5_x86_64.iso
2: EMOS1.6 download (for centos6.X series): http://mirror.extmail.org/iso/emos/EMOS_1.6_x86_64.iso