Unable to configure IMAP with DOVECOT

Discussion in 'Server Operation' started by Tristars, Mar 14, 2024.

  1. Tristars

    Tristars New Member

    Hello,

    I can't configure my iPhone13 to connect my mailbox using IMAP.

    I use a dedicated server at home using Debian 12 with Postfix and Dovecot. My firewall ports are well opened. I can receive and send mails from local and from outside.

    The Linux username is : contact

    Email address is : [email protected]

    First of all i can connect locally on port 143 and 993 using commands :

    Code:
    root@hostname:/home/username# openssl s_client -starttls imap -connect localhost:143 CONNECTED(00000003)
    And :

    Code:
    root@hostname:/home/username# openssl s_client -starttls imap -connect localhost:993 CONNECTED(00000003)
    Then when I configure my iPhone for IMAP i have this error message on /var/log/mail.log :

    Code:
    dovecot: imap-login: Disconnected: Connection closed: SSL_accept() failed: error:0A000416:SSL routines::sslv3 alert certificate unknown: SSL alert number 46 (no auth attempts in 0 secs): user=<>, rip=XX.XX.XX.XX, lip=192.168.1.51, TLS handshaking: SSL_accept() failed: error:0A000416:SSL routines::sslv3 alert certificate unknown: SSL alert number 46, session=<2REUAJITb/JaWxwU>
    Here is my dovecot config :

    Code:
    dovecot -n
    # 2.3.19.1 (9b53102964): /etc/dovecot/dovecot.conf
    # Pigeonhole version 0.5.19 (4eae2f79)
    # OS: Linux 6.1.0-rpi8-rpi-2712 aarch64 Debian 12.5
    # Hostname: hostname.mydomain.com
    auth_mechanisms = plain login
    disable_plaintext_auth = no
    mail_location = maildir:~/Maildir
    mail_privileged_group = mail
    managesieve_notify_capability = mailto
    managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext
    namespace {
      inbox = yes
      location =
      mailbox {
        special_use = \Drafts
        name = Drafts
      }
      mailbox {
        special_use = \Junk
        name = Junk
      }
      mailbox {
        special_use = \Sent
        name = Sent
      }
      mailbox {
        special_use = \Sent
        name = Sent Messages
      }
      mailbox {
        special_use = \Trash
        name = Trash
      }
      prefix =
      name = inbox
    }
    passdb {
      driver = pam
    }
    plugin {
      sieve = file:~/sieve;active=~/.dovecot.sieve
    }
    protocols = imap pop3
    service replication-notify-fifo {
      name = aggregator
    }
    service anvil-auth-penalty {
      name = anvil
    }
    service auth-worker {
      name = auth-worker
    }
    service auth-client {
      name = auth
    }
    service config {
      name = config
    }
    service dict-async {
      name = dict-async
    }
    service dict {
      name = dict
    }
    service login/proxy-notify {
      name = director
    }
    service dns-client {
      name = dns-client
    }
    service doveadm-server {
      name = doveadm
    }
    service imap-hibernate {
      name = imap-hibernate
    }
    service imap {
      name = imap-login
    }
    service imap-urlauth {
      name = imap-urlauth-login
    }
    service imap-urlauth-worker {
      name = imap-urlauth-worker
    }
    service token-login/imap-urlauth {
      name = imap-urlauth
    }
    service imap-master {
      name = imap
    }
    service indexer-worker {
      name = indexer-worker
    }
    service indexer {
      name = indexer
    }
    service ipc {
      name = ipc
    }
    service lmtp {
      name = lmtp
    }
    service log-errors {
      name = log
    }
    service sieve {
      name = managesieve-login
    }
    service login/sieve {
      name = managesieve
    }
    service old-stats-mail {
      name = old-stats
    }
    service pop3 {
      name = pop3-login
    }
    service login/pop3 {
      name = pop3
    }
    service replicator-doveadm {
      name = replicator
    }
    service login/stats-writer {
      name = stats
    }
    service submission {
      name = submission-login
    }
    service login/submission {
      name = submission
    }
    ssl_cert = </etc/dovecot/private/dovecot.pem
    ssl_cipher_list = ECDHE-RSA-AES256-SHA384:AES256-SHA256:AES256-SHA256:HIGH:MEDIUM:+TLSv1:+TLSv1.1:+TLSv1.2:!MD5:!ADH:!aNULL:!eNULL:!NULL:!DH:!ADH:!EDH:!AESGCM
    ssl_client_ca_dir = /etc/ssl/certs
    ssl_dh = # hidden, use -P to show it
    ssl_key = # hidden, use -P to show it
    userdb {
      driver = passwd
    }
    protocol lmtp {
      service replication-notify-fifo {
        name = aggregator
      }
      service anvil-auth-penalty {
        name = anvil
      }
      service auth-worker {
        name = auth-worker
      }
      service auth-client {
        name = auth
      }
      service config {
        name = config
      }
      service dict-async {
        name = dict-async
      }
      service dict {
        name = dict
      }
      service login/proxy-notify {
        name = director
      }
      service dns-client {
        name = dns-client
      }
      service doveadm-server {
        name = doveadm
      }
      service imap-hibernate {
        name = imap-hibernate
      }
      service imap {
        name = imap-login
      }
      service imap-urlauth {
        name = imap-urlauth-login
      }
      service imap-urlauth-worker {
        name = imap-urlauth-worker
      }
      service token-login/imap-urlauth {
        name = imap-urlauth
      }
      service imap-master {
        name = imap
      }
      service indexer-worker {
        name = indexer-worker
      }
      service indexer {
        name = indexer
      }
      service ipc {
        name = ipc
      }
      service lmtp {
        name = lmtp
      }
      service log-errors {
        name = log
      }
      service sieve {
        name = managesieve-login
      }
      service login/sieve {
        name = managesieve
      }
      service old-stats-mail {
        name = old-stats
      }
      service pop3 {
        name = pop3-login
      }
      service login/pop3 {
        name = pop3
      }
      service replicator-doveadm {
        name = replicator
      }
      service login/stats-writer {
        name = stats
      }
      service submission {
        name = submission-login
      }
      service login/submission {
        name = submission
      }
    }
    protocol !indexer-worker {
      service replication-notify-fifo {
        name = aggregator
      }
      service anvil-auth-penalty {
        name = anvil
      }
      service auth-worker {
        name = auth-worker
      }
      service auth-client {
        name = auth
      }
      service config {
        name = config
      }
      service dict-async {
        name = dict-async
      }
      service dict {
        name = dict
      }
      service login/proxy-notify {
        name = director
      }
      service dns-client {
        name = dns-client
      }
      service doveadm-server {
        name = doveadm
      }
      service imap-hibernate {
        name = imap-hibernate
      }
      service imap {
        name = imap-login
      }
      service imap-urlauth {
        name = imap-urlauth-login
      }
      service imap-urlauth-worker {
        name = imap-urlauth-worker
      }
      service token-login/imap-urlauth {
        name = imap-urlauth
      }
      service imap-master {
        name = imap
      }
      service indexer-worker {
        name = indexer-worker
      }
      service indexer {
        name = indexer
      }
      service ipc {
        name = ipc
      }
      service lmtp {
        name = lmtp
      }
      service log-errors {
        name = log
      }
      service sieve {
        name = managesieve-login
      }
      service login/sieve {
        name = managesieve
      }
      service old-stats-mail {
        name = old-stats
      }
      service pop3 {
        name = pop3-login
      }
      service login/pop3 {
        name = pop3
      }
      service replicator-doveadm {
        name = replicator
      }
      service login/stats-writer {
        name = stats
      }
      service submission {
        name = submission-login
      }
      service login/submission {
        name = submission
      }
    }
    protocol lda {
      service replication-notify-fifo {
        name = aggregator
      }
      service anvil-auth-penalty {
        name = anvil
      }
      service auth-worker {
        name = auth-worker
      }
      service auth-client {
        name = auth
      }
      service config {
        name = config
      }
      service dict-async {
        name = dict-async
      }
      service dict {
        name = dict
      }
      service login/proxy-notify {
        name = director
      }
      service dns-client {
        name = dns-client
      }
      service doveadm-server {
        name = doveadm
      }
      service imap-hibernate {
        name = imap-hibernate
      }
      service imap {
        name = imap-login
      }
      service imap-urlauth {
        name = imap-urlauth-login
      }
      service imap-urlauth-worker {
        name = imap-urlauth-worker
      }
      service token-login/imap-urlauth {
        name = imap-urlauth
      }
      service imap-master {
        name = imap
      }
      service indexer-worker {
        name = indexer-worker
      }
      service indexer {
        name = indexer
      }
      service ipc {
        name = ipc
      }
      service lmtp {
        name = lmtp
      }
      service log-errors {
        name = log
      }
      service sieve {
        name = managesieve-login
      }
      service login/sieve {
        name = managesieve
      }
      service old-stats-mail {
        name = old-stats
      }
      service pop3 {
        name = pop3-login
      }
      service login/pop3 {
        name = pop3
      }
      service replicator-doveadm {
        name = replicator
      }
      service login/stats-writer {
        name = stats
      }
      service submission {
        name = submission-login
      }
      service login/submission {
        name = submission
      }
    }
    protocol imap {
      service replication-notify-fifo {
        name = aggregator
      }
      service anvil-auth-penalty {
        name = anvil
      }
      service auth-worker {
        name = auth-worker
      }
      service auth-client {
        name = auth
      }
      service config {
        name = config
      }
      service dict-async {
        name = dict-async
      }
      service dict {
        name = dict
      }
      service login/proxy-notify {
        name = director
      }
      service dns-client {
        name = dns-client
      }
      service doveadm-server {
        name = doveadm
      }
      service imap-hibernate {
        name = imap-hibernate
      }
      service imap {
        name = imap-login
      }
      service imap-urlauth {
        name = imap-urlauth-login
      }
      service imap-urlauth-worker {
        name = imap-urlauth-worker
      }
      service token-login/imap-urlauth {
        name = imap-urlauth
      }
      service imap-master {
        name = imap
      }
      service indexer-worker {
        name = indexer-worker
      }
      service indexer {
        name = indexer
      }
      service ipc {
        name = ipc
      }
      service lmtp {
        name = lmtp
      }
      service log-errors {
        name = log
      }
      service sieve {
        name = managesieve-login
      }
      service login/sieve {
        name = managesieve
      }
      service old-stats-mail {
        name = old-stats
      }
      service pop3 {
        name = pop3-login
      }
      service login/pop3 {
        name = pop3
      }
      service replicator-doveadm {
        name = replicator
      }
      service login/stats-writer {
        name = stats
      }
      service submission {
        name = submission-login
      }
      service login/submission {
        name = submission
      }
    }
    protocol sieve {
      service replication-notify-fifo {
        name = aggregator
      }
      service anvil-auth-penalty {
        name = anvil
      }
      service auth-worker {
        name = auth-worker
      }
      service auth-client {
        name = auth
      }
      service config {
        name = config
      }
      service dict-async {
        name = dict-async
      }
      service dict {
        name = dict
      }
      service login/proxy-notify {
        name = director
      }
      service dns-client {
        name = dns-client
      }
      service doveadm-server {
        name = doveadm
      }
      service imap-hibernate {
        name = imap-hibernate
      }
      service imap {
        name = imap-login
      }
      service imap-urlauth {
        name = imap-urlauth-login
      }
      service imap-urlauth-worker {
        name = imap-urlauth-worker
      }
      service token-login/imap-urlauth {
        name = imap-urlauth
      }
      service imap-master {
        name = imap
      }
      service indexer-worker {
        name = indexer-worker
      }
      service indexer {
        name = indexer
      }
      service ipc {
        name = ipc
      }
      service lmtp {
        name = lmtp
      }
      service log-errors {
        name = log
      }
      service sieve {
        name = managesieve-login
      }
      service login/sieve {
        name = managesieve
      }
      service old-stats-mail {
        name = old-stats
      }
      service pop3 {
        name = pop3-login
      }
      service login/pop3 {
        name = pop3
      }
      service replicator-doveadm {
        name = replicator
      }
      service login/stats-writer {
        name = stats
      }
      service submission {
        name = submission-login
      }
      service login/submission {
        name = submission
      }
    }
    protocol pop3 {
      service replication-notify-fifo {
        name = aggregator
      }
      service anvil-auth-penalty {
        name = anvil
      }
      service auth-worker {
        name = auth-worker
      }
      service auth-client {
        name = auth
      }
      service config {
        name = config
      }
      service dict-async {
        name = dict-async
      }
      service dict {
        name = dict
      }
      service login/proxy-notify {
        name = director
      }
      service dns-client {
        name = dns-client
      }
      service doveadm-server {
        name = doveadm
      }
      service imap-hibernate {
        name = imap-hibernate
      }
      service imap {
        name = imap-login
      }
      service imap-urlauth {
        name = imap-urlauth-login
      }
      service imap-urlauth-worker {
        name = imap-urlauth-worker
      }
      service token-login/imap-urlauth {
        name = imap-urlauth
      }
      service imap-master {
        name = imap
      }
      service indexer-worker {
        name = indexer-worker
      }
      service indexer {
        name = indexer
      }
      service ipc {
        name = ipc
      }
      service lmtp {
        name = lmtp
      }
      service log-errors {
        name = log
      }
      service sieve {
        name = managesieve-login
      }
      service login/sieve {
        name = managesieve
      }
      service old-stats-mail {
        name = old-stats
      }
      service pop3 {
        name = pop3-login
      }
      service login/pop3 {
        name = pop3
      }
      service replicator-doveadm {
        name = replicator
      }
      service login/stats-writer {
        name = stats
      }
      service submission {
        name = submission-login
      }
      service login/submission {
        name = submission
      }
    }
    local_name mydomain.com {
      service replication-notify-fifo {
        name = aggregator
      }
      service anvil-auth-penalty {
        name = anvil
      }
      service auth-worker {
        name = auth-worker
      }
      service auth-client {
        name = auth
      }
      service config {
        name = config
      }
      service dict-async {
        name = dict-async
      }
      service dict {
        name = dict
      }
      service login/proxy-notify {
        name = director
      }
      service dns-client {
        name = dns-client
      }
      service doveadm-server {
        name = doveadm
      }
      service imap-hibernate {
        name = imap-hibernate
      }
      service imap {
        name = imap-login
      }
      service imap-urlauth {
        name = imap-urlauth-login
      }
      service imap-urlauth-worker {
        name = imap-urlauth-worker
      }
      service token-login/imap-urlauth {
        name = imap-urlauth
      }
      service imap-master {
        name = imap
      }
      service indexer-worker {
        name = indexer-worker
      }
      service indexer {
        name = indexer
      }
      service ipc {
        name = ipc
      }
      service lmtp {
        name = lmtp
      }
      service log-errors {
        name = log
      }
      service sieve {
        name = managesieve-login
      }
      service login/sieve {
        name = managesieve
      }
      service old-stats-mail {
        name = old-stats
      }
      service pop3 {
        name = pop3-login
      }
      service login/pop3 {
        name = pop3
      }
      service replicator-doveadm {
        name = replicator
      }
      service login/stats-writer {
        name = stats
      }
      service submission {
        name = submission-login
      }
      service login/submission {
        name = submission
      }
      ssl_cert = </etc/ssl/virtualmin/170976492385827/ssl.combined
      ssl_key = # hidden, use -P to show it
    }
    local_name *.mydomain.com {
      service replication-notify-fifo {
        name = aggregator
      }
      service anvil-auth-penalty {
        name = anvil
      }
      service auth-worker {
        name = auth-worker
      }
      service auth-client {
        name = auth
      }
      service config {
        name = config
      }
      service dict-async {
        name = dict-async
      }
      service dict {
        name = dict
      }
      service login/proxy-notify {
        name = director
      }
      service dns-client {
        name = dns-client
      }
      service doveadm-server {
        name = doveadm
      }
      service imap-hibernate {
        name = imap-hibernate
      }
      service imap {
        name = imap-login
      }
      service imap-urlauth {
        name = imap-urlauth-login
      }
      service imap-urlauth-worker {
        name = imap-urlauth-worker
      }
      service token-login/imap-urlauth {
        name = imap-urlauth
      }
      service imap-master {
        name = imap
      }
      service indexer-worker {
        name = indexer-worker
      }
      service indexer {
        name = indexer
      }
      service ipc {
        name = ipc
      }
      service lmtp {
        name = lmtp
      }
      service log-errors {
        name = log
      }
      service sieve {
        name = managesieve-login
      }
      service login/sieve {
        name = managesieve
      }
      service old-stats-mail {
        name = old-stats
      }
      service pop3 {
        name = pop3-login
      }
      service login/pop3 {
        name = pop3
      }
      service replicator-doveadm {
        name = replicator
      }
      service login/stats-writer {
        name = stats
      }
      service submission {
        name = submission-login
      }
      service login/submission {
        name = submission
      }
      ssl_cert = </etc/ssl/virtualmin/170976492385827/ssl.combined
      ssl_key = # hidden, use -P to show it
    }
    Can anyone help me with my config ?

    Thanks a lot ! (sorry for my bad english..)
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Can you connect with some other e-mail client?
    It would be good to know if the problem is only with iPhone e-mail client connecting, or if IMAP is completely unreachable.
    Which ports? IMAP uses 143 and if TLS/SSL port is 993.
    Try with no encryption, that would give one more data point if port 143 works.

    the following output confirms that the dovecot config is OK.

    Code:
    root@host:~# doveconf 1>/dev/null
    root@host:~# echo $?
    0
    root@host:~#
     
    Last edited: Mar 16, 2024
  3. Tristars

    Tristars New Member

    Hello,

    I mean I opened ports 25, 587, 143, 993 from outside on my ISP. Telnet tests from outside on those ports work.

    My dovecot conf is ok :

    Code:
    root@raspberrypi:/home/tristars# doveconf 1>/dev/null
    root@raspberrypi:/home/tristars# echo $?
    0
     
  4. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Can you share the config you have set up on your phone?
     

Share This Page