歡迎您光臨本站 註冊首頁

如何解決dovecot默認domian的認證問題?

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

如何解決dovecot默認domian的認證問題?

以前用dovecot+postfix做的個郵件系統,現在換了extmail的系統,想通過extmail的收取其他pop3信箱的郵件功能,把老信箱的郵件導入進來,添加了老的帳號后卻一直不能成功接收。但是可以收取其他比如sohu信箱的pop3的郵件。單獨用foxmail等也可以通過pop3收取老郵件伺服器的郵件。用telnet老的郵件伺服器發現問題:

用用戶名@域名無法登錄110埠

# telnet 192.168.10.4 110
Trying 192.168.10.4...
Connected to 192.168.10.4.
Escape character is '^]'.
+OK dovecot ready.
user myuser@mydomain
+OK
pass mypass
-ERR Authentication failed.

只用用戶名可以登錄110埠

# telnet 192.168.10.4 110
Trying 192.168.10.4...
Connected to 192.168.10.4.
Escape character is '^]'.
+OK dovecot ready.
user myuser
+OK
pass mypass
+OK Logged in.
.

但是extmail系統強制pop3帳號必須是用戶名@域名的形式。

老郵件伺服器的dovecot 的配置文件如下



    # cat dovecot.conf |grep -v "#"

    protocols = pop3 imap imaps

    imap_listen = [::]
    pop3_listen = [::]

    login_dir = /var/run/dovecot-login
    login = imap

    login = pop3

    mbox_locks = fcntl

    auth = default

    auth_mechanisms = plain

    auth_userdb = passwd

    auth_passdb = pam

    auth_user = root

    #

以前這個老的郵件伺服器域名是:mail.ourdomain.net.cn 現在改名為oldmail.ourdomain.net.cn  老郵件伺服器裡面hosts文件和機器名字都已經更改為old……並且重啟過

求助……

[ 本帖最後由 arbor 於 2009-1-11 09:50 編輯 ]
《解決方案》

參考:http://www.iredmail.org/wiki/index.php/IRedMail-doc-MySQL-0.2-Dovecot

在文檔中搜索 auth_default_realm 參數:
auth_default_realm = iredmail.org
《解決方案》

原帖由 MichaelBibby 於 2009-1-11 10:05 發表 http://bbs.chinaunix.net/images/common/back.gif
參考:http://www.iredmail.org/wiki/index.php/IRedMail-doc-MySQL-0.2-Dovecot

在文檔中搜索 auth_default_realm 參數:
auth_default_realm = iredmail.org

多謝!

# Space separated list of realms for SASL authentication mechanisms that need
# them. You can leave it empty if you don't want to support multiple realms.
# Many clients simply use the first one listed here, so keep the default realm
# first.
#auth_realms =oldmail.ourdomain.net.cn

# Default realm/domain to use if none was specified. This is used for both
# SASL realms and appending @domain to username in plaintext logins.
auth_default_realm = oldmail.ourdomain.net.cn


重啟dovecot,再用extmail收信,故障依舊!看日誌:
Jan 11 13:23:32 oldmail dovecot: Killed with signal 15
Jan 11 13:23:32 oldmail dovecot: Dovecot starting up
Jan 11 13:24:31 oldmail pop3-login: Aborted login [::ffff:192.168.100.2]
《解決方案》

打開 dovecot 調試模式,檢查日誌
《解決方案》

原帖由 MichaelBibby 於 2009-1-11 13:04 發表 http://bbs.chinaunix.net/images/common/back.gif
打開 dovecot 調試模式,檢查日誌

這個……我好像不會打開調試模式……慚愧……
《解決方案》

在/etc/dovecot.conf文件裡面搜索debug看下
《解決方案》

原帖由 arbor 於 2009-1-11 12:55 發表 http://bbs.chinaunix.net/images/common/back.gif


多謝!



重啟dovecot,再用extmail收信,故障依舊!看日誌:



應是要註釋掉auth_default_realm
《解決方案》

dovecot.conf說明:
# There are a few special variables you can use, eg.:
#
#   %u - username
#   %n - user part in user@domain, same as %u if there's no domain
#   %d - domain part in user@domain, empty if there's no domain
#   %h - home directory
#
  #passdb pam {
    #
    # [<service name>]
    #
    # session=yes makes Dovecot open and immediately close PAM session. Some
    # PAM plugins need this to work, such as pam_mkhomedir.
    #
    # setcred=yes makes Dovecot establish PAM credentials if some PAM plugins
    # need that. They aren't ever deleted though, so this isn't enabled by
    # default.
    #
    # cache_key can be used to enable authentication caching for PAM
    # (auth_cache_size also needs to be set). It isn't enabled by default
    # because PAM modules can do all kinds of checks besides checking password,
    # such as checking IP address. Dovecot can't know about these checks
    # without some help. cache_key is simply a list of variables (see
    # doc/wiki/Variables.txt) which must match for the cached data to be used.
    # Here are some examples:
    #   %u - Username must match. Probably sufficient for most uses.
    #   %u%r - Username and remote IP address must match.
    #   %u%s - Username and service (ie. IMAP, POP3) must match.
    #
    # The service name can contain variables, for example %Ls expands to
    # pop3 or imap.
    #
    # Some examples:
    #   args = session=yes %Ls
    #   args = cache_key=%u dovecot
    #args = dovecot
  #}

偶的例子:
  passdb:
    driver: passwd-file
    args: username_format=%n /etc/dovecot/openwebmail/%d/passwd

LZ聰明人,應該知道怎麼做了吧?
《解決方案》

多謝樓上各位!

# vim dovecot.conf
在auth_mechanisms = plain 後面

添加:
username_format = %n
然後
# /etc/init.d/dovecot restart
Stopping Dovecot Imap:                                    
Starting Dovecot Imap: Fatal: Error in configuration file /etc/dovecot.conf line 407: Unknown setting: username_format
                                                           


我使用的是系統用戶,passwd file就是/etc/passwd了

# rpm -qa|grep dovecot
dovecot-0.99.11-8.EL4


是不是版本太低的問題?

[ 本帖最後由 arbor 於 2009-1-13 14:12 編輯 ]
《解決方案》

原帖由 arbor 於 2009-1-13 14:01 發表 http://bbs.chinaunix.net/images/common/back.gif
多謝樓上各位!



我使用的是系統用戶,passwd file就是/etc/passwd了



是不是版本太低的問題?

應該在pam後面的{}裡面加入args,具體的參數請參考DOC文檔,寫得很全

[火星人 ] 如何解決dovecot默認domian的認證問題?已經有918次圍觀

http://coctec.com/docs/service/show-post-24863.html