设为首页 收藏本站
查看: 4813|回复: 5

[求助] 邮件服务器客户端能发不能收,web访问收发正常

[复制链接]
回帖奖励 8 金币 回复本帖可获得 1 金币奖励! 每人限 1 次(中奖概率 50%)
累计签到:4 天
连续签到:1 天
发表于 2015-7-18 17:20:01 | 显示全部楼层 |阅读模式
系统 CentOS7.1.1503 gnome安装  postfix+dovecot+courier-authlib+extmail+extman+nginx  QQ34888013 可远程
参考 http://www.iyunv.com/thread-63348-1-1.htm

现象:outlook foxmail客户端只能发不能收邮件
有时提示 无法打开到主机的连接,在端口110.  telnet 25发送测试正常。
重启dovecot服务后,telnet 10.10.1.xxx 110 一直提示:ERR Disconncetd :Auth Process Broken

1.防火墙
SELINUX=disabled
firewall防火墙 stop记录

2. 110、25端口已映射 MX和DNS解析都OK

3.配置文件
   3.1  配置POSTFIX   /etc/postfix/main.cf
675 readme_directory = no
676 inet_protocols = ipv4
677 meta_directory = /etc/postfix
678 shlib_directory = no
679
680 myhostname = mail.test.com
681 mydomain = test.com
682 myorigin = $mydomain
683 inet_interfaces = all
684 #mydestination = $myhostname, localhost.$mydomain, localhost,$mydomain      
685 mynetworks_style = host
686 mynetworks =  127.0.0.0/8,127.0.0.1,192.168.0.0/24,192.168.1.0/24,10.10.1.0/24
687 relay_domains = $mydestination
688 alias_maps = hash:/etc/aliases
689
690
691 ##postfix支持SMTP##
692 smtpd_sasl_auth_enable = yes
693 #smtpd_sasl_local_domain = ''
694 smtpd_sasl_local_domain = '$mydomain'
695 smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
696 broken_sasl_auth_clients=yes
697 #smtpd_client_restrictions = permit_sasl_authenticated
698 smtpd_client_restrictions = permit_mynetworks,permit_sasl_authenticated
699 smtpd_sasl_security_options = noanonymous
700 ##postfix支持虚拟用户##
701 virtual_mailbox_base = /var/mailbox
702 virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
703 #这里的配置文件需在后面extman里复制过来
704 virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
705 virtual_alias_domains =
706 virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
707 virtual_uid_maps = static:2525

3.2  DOVECOT 配置dovecot
3.2.1 /etc/dovecot/dovecot.conf
protocols = imap pop3
!include conf.d/*.conf
listen = *
base_dir = /var/run/dovecot/

3.2.2 /etc/dovecot/conf.d/10-auth.conf
disable_plaintext_auth = no

3.2.3 /etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:~/Maildir
mail_location = maildir:/var/mailbox/%d/%n/Maildir
mail_privileged_group = mail

3.2.4 /etc/dovecot/conf.d/10-ssl.conf
ssl = no

3.2.5 /etc/dovecot/conf.d/10-logging.conf
log_path = /var/log/dovecot.log
info_log_path = /var/log/dovecot.info
log_timestamp = "%Y-%m-%d %H:%M:%S "

3.2.6  cp auth-sql.conf.ext auth-sql.conf
   /etc/dovecot/conf.d/auth-sql.conf

passdb {
    driver = sql
  
    # Path for SQL configuration file, see example-config/dovecot-sql.conf.ext
     args = /etc/dovecot/dovecot-sql.conf.ext
}
passdb {
     driver = sql
   
     # Path for SQL configuration file, see example-config/dovecot-sql.conf.ext
    args = /etc/dovecot/dovecot-sql.conf.ext
  }

3.2.8 编辑dovecot通过mysql认证的配置文件
/etc/dovecot-mysql.conf
driver = mysql
connect = host=localhost dbname=extmail user=extmail password=extmail
default_pass_scheme = CRYPT
password_query = SELECT username AS user,password AS password FROM mailbox WHERE username = '%u'
user_query = SELECT maildir, uidnumber AS uid, gidnumber AS gid FROM mailbox WHERE username = '%u'

3.3 配置courier-authlib
chmod 755 /usr/local/courier-authlib/var/spool/authdaemon
cp /etc/authdaemonrc.dist  /etc/authdaemonrc
cp /etc/authmysqlrc.dist  /etc/authmysqlrc
  3.3.1 /etc/authdaemonrc  
#只使用authmysql
authmodulelist="authmysql"
authmodulelistorig="authmysql"
  
   3.3.2 /etc/authmysqlrc   
  #直接添加到配置文件尾部,然后去上面将响应系统默认的注视掉,或者删除即可
MYSQL_SERVER            localhost
MYSQL_USERNAME          extmail
MYSQL_PASSWORD          extmail
MYSQL_SOCKET            /var/lib/mysql/mysql.sock
MYSQL_PORT               3306
MYSQL_DATABASE          extmail
MYSQL_USER_TABLE        mailbox
MYSQL_CRYPT_PWFIELD     password
DEFAULT_DOMAIN          test.com
MYSQL_UID_FIELD         '2525'
MYSQL_GID_FIELD         '2525'
MYSQL_LOGIN_FIELD       username
MYSQL_HOME_FIELD        concat('/var/mailbox/',homedir)
MYSQL_NAME_FIELD        name
MYSQL_MAILDIR_FIELD     concat('/var/mailbox/',maildir)

3.3.3courier-authlib添加服务启动脚本及其他(略)

3.3.4 smtp以及虚拟用户相关的设置
//文件不存在,要自己创建
vim /usr/lib64/sasl2/smtpd.conf        
pwcheck_method: authdaemond
log_level: 3
mech_list: PLAIN LOGIN
authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket

3.3.5postfix支持SMTP 和虚拟用户
vim /etc/postfix/main.cf
##postfix支持SMTP##
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = ''
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
broken_sasl_auth_clients=yes
smtpd_client_restrictions = permit_sasl_authenticated
smtpd_sasl_security_options = noanonymous
##postfix支持虚拟用户##
virtual_mailbox_base = /var/mailbox
//这里的配置文件需在后面extman里复制过来
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf   

virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_alias_domains =
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_uid_maps = static:2525
virtual_gid_maps = static:2525
virtual_transport = virtual

3.4 更改extmail的配置文件
cd /var/www/extsuite/extmail
cp webmail.cf.default webmail.cf

webmail.cf配置

SYS_SESS_DIR = /tmp/extmail
SYS_UPLOAD_TMPDIR = /tmp/extmail/upload
SYS_USER_LANG = zh_CN
SYS_MIN_PASS_LEN = 8
SYS_MAILDIR_BASE = /var/mailbox
SYS_MYSQL_USER = extmail
SYS_MYSQL_PASS = extmail
SYS_MYSQL_DB = extmail
SYS_MYSQL_HOST = localhost
SYS_MYSQL_SOCKET = /var/lib/mysql/mysql.sock
SYS_MYSQL_TABLE = mailbox
SYS_MYSQL_ATTR_USERNAME = username
SYS_MYSQL_ATTR_DOMAIN = domain
SYS_MYSQL_ATTR_PASSWD = password
SYS_AUTHLIB_SOCKET = /usr/local/courier-authlib/var/spool/authdaemon/socket

3.5 更改extman配置文件
cp webman.cf.default webman.cf

3.6需要修改my.cnf配置文件
/etc/my.cnf

#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES   
//将这行注视掉,重启mysql,这里需要注意的是,等数据库导入成功后,这项是不可以去掉注释的,不然mysql就启动不起来了。

3.7导入数据库
# 由于数据库不能识别TYPE=MyISAM,所以这里直接导入会出错,先编辑extmail.sql数据库文件,将TYPE=MyISAM更改为ENGINE=MyISAM
vim docs/extmail.sql  
:% s/TYPE/ENGINE/g
#mysql -uroot < docs/extmail.sql
# mysql -uroot < docs/init.sql

3.8 创建数据库用户extmail并授予权限
//这里直接在授权任何权限在任意地址上了
mysql> GRANT ALL ON extmail.* to extmail@'%' identified by 'extmail';      
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

3.9 启动nginx实现web访问 nginx本身并不能解析cgi,extmail自带了解析cgi的程序,但是有些地方需要修改下
3.9.1 vim /var/www/extsuite/extmail/dispatch-init
SU_UID=postfix
SU_GID=postfix

3.9.2 启动dispatch-init
/var/www/extsuite/extmail/dispatch-init start

3.9.3 启动cmdserver,不启动会出现Connection refused
/var/www/extsuite/extman/daemon/cmdserver -v -d

3.9.4 添加nginx虚拟主机
vim /etc/nginx/conf.d/extmail.conf

server {
   listen       8080;
   server_name  mail.everyoo.com;
   index index.html index.htm index.php index.cgi;
   root  /var/www/extsuite/extmail/html/;
   location /extmail/cgi/ {
             fastcgi_pass          127.0.0.1:8888;
             fastcgi_index         index.cgi;
             fastcgi_param  SCRIPT_FILENAME   /var/www/extsuite/extmail/cgi/$fastcgi_script_name;
             include               fcgi.conf;
        }
        location  /extmail/  {
             alias  /var/www/extsuite/extmail/html/;
        }
        location /extman/cgi/ {
             fastcgi_pass          127.0.0.1:8888;
             fastcgi_index         index.cgi;
             fastcgi_param  SCRIPT_FILENAME   /var/www/extsuite/extman/cgi/$fastcgi_script_name;
             include            fcgi.conf;
        }
        location /extman/ {
             alias  /var/www/extsuite/extman/html/;
        }
      access_log  /var/log/extmail_access.log;
}

生成fcgi.conf
vim /etc/nginx/fcgi.conf

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx;
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;
fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

3.9.5 图形日志无法查看和新建域新建用户是提示没有此目录的解决(略)

4.mail日志和系统日志(关键处有修改)

Jul 18 15:11:49 localhost postfix/smtpd[7267]: connect from unknown[10.10.10.221]
Jul 18 15:12:16 localhost postfix/smtpd[7267]: too many errors after UNKNOWN from unknown[10.10.10.221]
Jul 18 15:12:16 localhost postfix/smtpd[7267]: disconnect from unknown[10.10.10.221] unknown=0/5 commands=0/5
Jul 18 15:28:22 localhost authdaemond: modules="authmysql", daemons=5
Jul 18 15:28:22 localhost authdaemond: Installing libauthmysql
Jul 18 15:28:22 localhost authdaemond: Installation complete: authmysql
Jul 18 15:30:27 localhost postfix/postfix-script[3628]: starting the Postfix mail system
Jul 18 15:30:27 localhost postfix/master[3630]: daemon started -- version 3.0.1, configuration /etc/postfix
Jul 18 16:45:12 localhost extmail[4955]: user=<admin@test.com>, client=10.10.10.221, module=login, status=badlogin
Jul 18 16:47:50 localhost extmail[3892]: user=<test@test.com>, client=10.10.10.235, module=login, status=badlogin
Jul 18 16:48:45 localhost extmail[3892]: user=<test@test.com>, client=10.10.10.236, module=login, status=loginok
Jul 18 16:49:02 localhost extmail[3892]: user=<test@test.com>, client=10.10.10.221, module=login, status=loginok
Jul 18 16:49:45 localhost postfix/smtpd[5099]: connect from m12-18.163.com[xx.xx.xx.xx]
Jul 18 16:49:45 localhost postfix/smtpd[5099]: 7t4C1428879g: client=m12-18.163.com[xx.xx.xx.xx]
Jul 18 16:49:45 localhost postfix/cleanup[5103]: 7t4C1428879g: message-id=<000a01d0cr#$#36$bb5ff0$321d4110$@com>
Jul 18 16:49:45 localhost postfix/qmgr[3632]: 7t4C1428879g: from=<zany81@163.com>, size=5676, nrcpt=1 (queue active)
Jul 18 16:49:45 localhost postfix/smtpd[5099]: disconnect from m12-18.163.com[xx.xx.xx.xx] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Jul 18 16:49:45 localhost postfix/virtual[5105]: 7t4C1428879g: to=<test@test.com>, relay=virtual, delay=0.28, delays=0.23/0.03/0/0.02, dsn=2.0.0, status=sent (delivered to maildir)
Jul 18 16:49:45 localhost postfix/qmgr[3632]: 7t4C1428879g: removed
Jul 18 16:51:08 localhost postfix/smtpd[5099]: connect from localhost[127.0.0.1]
Jul 18 16:51:08 localhost postfix/smtpd[5099]: b766ffb9b9gb: client=localhost[127.0.0.1]
Jul 18 16:51:08 localhost postfix/cleanup[5103]: b766ffb9b9gb: message-id=<20150718085108.b766ffb9b9gb@mail.test.com>
Jul 18 16:51:08 localhost postfix/qmgr[3632]: b766ffb9b9gb: from=<test@test.com>, size=659, nrcpt=1 (queue active)
Jul 18 16:51:08 localhost postfix/smtpd[5099]: disconnect from localhost[127.0.0.1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Jul 18 16:51:09 localhost postfix/smtp[5125]: b766ffb9b9gb: to=<zany81@163.com>, relay=163mx01.mxmail.netease.com[220.181.14.138]:25, delay=1.1, delays=0.22/0.08/0.28/0.48, dsn=2.0.0, status=sent (250 Mail OK queued as mx9,O8CowECZgUF9E6pVF+3BAA--.22268S2 1437209469)
Jul 18 16:51:09 localhost postfix/qmgr[3632]: b766ffb9b9gb: removed
Jul 18 16:54:28 localhost postfix/anvil[5101]: statistics: max connection rate 1/60s for (smtp:xx.xx.xx.xx) at Jul 18 16:49:45
Jul 18 16:54:28 localhost postfix/anvil[5101]: statistics: max connection count 1 for (smtp:xx.xx.xx.xx) at Jul 18 16:49:45
Jul 18 16:54:28 localhost postfix/anvil[5101]: statistics: max cache size 1 at Jul 18 16:49:45
Jul 18 16:54:59 localhost extmail[5159]: user=<test@test.com>, client=10.10.10.221, module=login, status=loginok


部分系统日志


Jul 18 15:34:12 localhost yum[3901]: Erased: 1:dovecot-mysql-2.2.10-4.el7_0.1.x86_64
Jul 18 15:34:13 localhost systemd: Reloading.
Jul 18 15:34:13 localhost systemd: [/usr/lib/systemd/system/lvm2-lvmetad.socket:9] Unknown lvalue 'RemoveOnStop' in section 'Socket'
Jul 18 15:34:13 localhost systemd: [/usr/lib/systemd/system/dm-event.socket:10] Unknown lvalue 'RemoveOnStop' in section 'Socket'
Jul 18 15:34:13 localhost systemd: [/usr/lib/systemd/system/nginx.service:13] Failed to parse kill mode, ignoring: mixed
Jul 18 15:34:13 localhost systemd: Stopping Dovecot IMAP/POP3 email server...
Jul 18 15:34:13 localhost systemd: Stopped Dovecot IMAP/POP3 email server.
Jul 18 15:34:13 localhost systemd: Closed Dovecot IMAP/POP3 email server activation socket.
Jul 18 15:34:13 localhost yum[3901]: Erased: 1:dovecot-2.2.10-4.el7_0.1.x86_64
Jul 18 15:34:13 localhost systemd: Reloading.
Jul 18 15:34:14 localhost systemd: [/usr/lib/systemd/system/lvm2-lvmetad.socket:9] Unknown lvalue 'RemoveOnStop' in section 'Socket'
Jul 18 15:34:14 localhost systemd: [/usr/lib/systemd/system/dm-event.socket:10] Unknown lvalue 'RemoveOnStop' in section 'Socket'
Jul 18 15:34:14 localhost systemd: [/usr/lib/systemd/system/nginx.service:13] Failed to parse kill mode, ignoring: mixed
Jul 18 15:34:43 localhost systemd: Reloading.
Jul 18 15:34:43 localhost systemd: [/usr/lib/systemd/system/lvm2-lvmetad.socket:9] Unknown lvalue 'RemoveOnStop' in section 'Socket'
Jul 18 15:34:43 localhost systemd: [/usr/lib/systemd/system/dm-event.socket:10] Unknown lvalue 'RemoveOnStop' in section 'Socket'
Jul 18 15:34:43 localhost systemd: [/usr/lib/systemd/system/nginx.service:13] Failed to parse kill mode, ignoring: mixed
Jul 18 15:34:43 localhost yum[3973]: Installed: 1:dovecot-2.2.10-4.el7_0.1.x86_64
Jul 18 15:35:41 localhost yum[4036]: Installed: 1:dovecot-mysql-2.2.10-4.el7_0.1.x86_64
Jul 18 15:40:01 localhost systemd: Starting Session 3 of user root.
Jul 18 15:40:01 localhost systemd: Started Session 3 of user root.
Jul 18 15:43:06 localhost systemd: Starting Cleanup of Temporary Directories...
Jul 18 15:43:06 localhost systemd: Started Cleanup of Temporary Directories.
Jul 18 15:48:12 localhost chronyd[958]: Selected source 202.118.1.130
Jul 18 15:48:14 localhost systemd: Starting Dovecot IMAP/POP3 email server...
Jul 18 15:48:14 localhost systemd: Started Dovecot IMAP/POP3 email server.
Jul 18 15:49:19 localhost systemd: Stopping Dovecot IMAP/POP3 email serve










运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-88047-1-1.html 上篇帖子: Red Hat Linux6:postfix邮件系统 下篇帖子: 邮件服务器之编译安装postfix 邮件服务器 客户端
累计签到:4 天
连续签到:1 天
 楼主| 发表于 2015-7-18 17:52:52 | 显示全部楼层
来个大神吧 阿门

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表