Dovecot IMAP 仅在 localhost 中有效

Dovecot IMAP 仅在 localhost 中有效

我可以在本地连接到 imap 和 pop3,但远程连接却不行。我在 ufw 中打开了端口,但仍然无法工作。

如果我远程执行 nmap 操作,端口会关闭:

Host is up (0.040s latency). Not shown: 85 filtered ports PORT STATE SERVICE 21/tcp open ftp 22/tcp open ssh 25/tcp closed smtp 53/tcp open domain 80/tcp open http 110/tcp closed pop3 143/tcp closed imap 443/tcp open https 587/tcp open submission 993/tcp closed imaps 995/tcp closed pop3s 3306/tcp open mysql 8080/tcp open http-proxy 8081/tcp open blackice-icecap 10000/tcp closed snet-sensor-mgmt

这是我的配置文件:

listen = *,[::]
protocols = imap pop3
auth_mechanisms = plain login
#imap_listen = * 

disable_plaintext_auth = no
log_timestamp = "%Y-%m-%d %H:%M:%S "
mail_privileged_group = vmail
postmaster_address = [email protected]
ssl_cert = </etc/postfix/smtpd.cert
ssl_key = </etc/postfix/smtpd.key
ssl_protocols = !SSLv2 !SSLv3
mail_max_userip_connections = 100
passdb {
  args = /etc/dovecot/dovecot-sql.conf
  driver = sql
}
userdb {
  driver = prefetch
}
userdb {
  args = /etc/dovecot/dovecot-sql.conf
  driver = sql
}
plugin {
  quota = dict:user::file:/var/vmail/%d/%n/.quotausage
  sieve=/var/vmail/%d/%n/.sieve
  sieve_max_redirects = 25
}
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  }
  unix_listener auth-userdb {
    group = vmail
    mode = 0600
    user = vmail
  }
  user = root
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
   group = postfix
   mode = 0600
   user = postfix
  }
}
service imap-login {
  client_limit = 1000
  process_limit = 512
}
protocol imap {
  mail_plugins = quota imap_quota
  listen = *:143
  ssl_listen = *:993
}

protocol pop3 {
  pop3_uidl_format = %08Xu%08Xv
  mail_plugins = quota
  listen = *:110
  ssl_listen = *:995
}
protocol lda {
  postmaster_address = webmaster@localhost
  mail_plugins = sieve quota
}
protocol lmtp {
  postmaster_address = webmaster@localhost
  mail_plugins = quota sieve
}
mail_plugins = $mail_plugins quota
log_path = /var/log/dovecot.log
info_log_path = /var/log/dovecot.info.log

以及监听端口:

Proto Recv-Q Send-Q Local Address           Foreign Address     

    State       PID/Program name
tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN      1659/dovecot    
tcp        0      0 0.0.0.0:465             0.0.0.0:*               LISTEN      30994/master    
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      6813/pure-ftpd (SER
tcp        0      0 serverip:53        0.0.0.0:*               LISTEN      21356/named     
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      21356/named     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      13835/sshd      
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      30994/master    
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      21356/named     
tcp        0      0 0.0.0.0:2812            0.0.0.0:*               LISTEN      890/monit       
tcp        0      0 0.0.0.0:993             0.0.0.0:*               LISTEN      1659/dovecot    
tcp        0      0 0.0.0.0:995             0.0.0.0:*               LISTEN      1659/dovecot    
tcp        0      0 127.0.0.1:8999          0.0.0.0:*               LISTEN      1755/php-fpm.conf)
tcp        0      0 127.0.0.1:10023         0.0.0.0:*               LISTEN      956/postgrey.pid --
tcp        0      0 127.0.0.1:10024         0.0.0.0:*               LISTEN      10170/amavisd-new (
tcp        0      0 127.0.0.1:10025         0.0.0.0:*               LISTEN      30994/master    
tcp        0      0 127.0.0.1:10026         0.0.0.0:*               LISTEN      10170/amavisd-new (
tcp        0      0 127.0.0.1:10027         0.0.0.0:*               LISTEN      30994/master    
tcp        0      0 0.0.0.0:587             0.0.0.0:*               LISTEN      30994/master    
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      23012/redis-server 
tcp        0      0 127.0.0.1:11211         0.0.0.0:*               LISTEN      1765/memcached  
tcp        0      0 0.0.0.0:110             0.0.0.0:*               LISTEN      1659/dovecot    
tcp6       0      0 :::8080                 :::*                    LISTEN      1643/apache2    
tcp6       0      0 :::80                   :::*                    LISTEN      1643/apache2    
tcp6       0      0 :::465                  :::*                    LISTEN      30994/master    
tcp6       0      0 :::8081                 :::*                    LISTEN      1643/apache2    
tcp6       0      0 :::8081                 :::*                    LISTEN      1643/apache2    
tcp6       0      0 :::8081                 :::*                    LISTEN      1643/apache2    
tcp6       0      0 :::21                   :::*                    LISTEN      6813/pure-ftpd (SER
tcp6       0      0 :::53                   :::*                    LISTEN      21356/named     
tcp6       0      0 :::4949                 :::*                    LISTEN      937/perl        
tcp6       0      0 :::22                   :::*                    LISTEN      13835/sshd      
tcp6       0      0 :::8888                 :::*                    LISTEN      1643/apache2    
tcp6       0      0 :::8888                 :::*                    LISTEN      1643/apache2    
tcp6       0      0 :::8888                 :::*                    LISTEN      1643/apache2    
tcp6       0      0 :::25                   :::*                    LISTEN      30994/master    
tcp6       0      0 ::1:953                 :::*                    LISTEN      21356/named     
tcp6       0      0 :::443                  :::*                    LISTEN      1643/apache2    
tcp6       0      0 ::1:10023               :::*                    LISTEN      956/postgrey.pid --
tcp6       0      0 ::1:10024               :::*                    LISTEN      10170/amavisd-new (
tcp6       0      0 ::1:10026               :::*                    LISTEN      10170/amavisd-new (
tcp6       0      0 :::3306                 :::*                    LISTEN      17878/mysqld    
tcp6       0      0 :::587                  :::*                    LISTEN      30994/master    
udp        0      0 127.0.0.1:11211         0.0.0.0:*                           1765/memcached  
udp        0      0 serverip:53        0.0.0.0:*                           21356/named     
udp        0      0 127.0.0.1:53            0.0.0.0:*                           21356/named     
udp        0      0 serverip:123       0.0.0.0:*                           32419/ntpd      
udp        0      0 127.0.0.1:123           0.0.0.0:*                           32419/ntpd      
udp        0      0 0.0.0.0:123             0.0.0.0:*                           32419/ntpd      
udp6       0      0 :::53                   :::*                                21356/named     
udp6       0      0 fe80::ae22:bff:fec7:123 :::*                                32419/ntpd      
udp6       0      0 2001:41d0:a:2e9d:::123  :::*                                32419/ntpd      
udp6       0      0 ::1:123                 :::*                                32419/ntpd      
udp6       0      0 :::123                  :::*                                32419/ntpd   

如果有人发现一些错误......

ufw status 的输出:

Status: active

To                         Action      From
--                         ------      ----
20/tcp                     ALLOW       Anywhere                  
21/tcp                     ALLOW       Anywhere                  
22/tcp                     ALLOW       Anywhere                  
25/tcp                     ALLOW       Anywhere                  
53/tcp                     ALLOW       Anywhere                  
80/tcp                     ALLOW       Anywhere                  
110/tcp                    ALLOW       Anywhere                  
143/tcp                    ALLOW       Anywhere                  
443/tcp                    ALLOW       Anywhere                  
587/tcp                    ALLOW       Anywhere                  
993/tcp                    ALLOW       Anywhere                  
995/tcp                    ALLOW       Anywhere                  
3306/tcp                   ALLOW       Anywhere                  
8080/tcp                   ALLOW       Anywhere                  
8081/tcp                   ALLOW       Anywhere                  
10000/tcp                  ALLOW       Anywhere                  
53/udp                     ALLOW       Anywhere                  
3306/udp                   ALLOW       Anywhere                  
20/tcp (v6)                ALLOW       Anywhere (v6)             
21/tcp (v6)                ALLOW       Anywhere (v6)             
22/tcp (v6)                ALLOW       Anywhere (v6)             
25/tcp (v6)                ALLOW       Anywhere (v6)             
53/tcp (v6)                ALLOW       Anywhere (v6)             
80/tcp (v6)                ALLOW       Anywhere (v6)             
110/tcp (v6)               ALLOW       Anywhere (v6)             
143/tcp (v6)               ALLOW       Anywhere (v6)             
443/tcp (v6)               ALLOW       Anywhere (v6)             
587/tcp (v6)               ALLOW       Anywhere (v6)             
993/tcp (v6)               ALLOW       Anywhere (v6)             
995/tcp (v6)               ALLOW       Anywhere (v6)             
3306/tcp (v6)              ALLOW       Anywhere (v6)             
8080/tcp (v6)              ALLOW       Anywhere (v6)             
8081/tcp (v6)              ALLOW       Anywhere (v6)             
10000/tcp (v6)             ALLOW       Anywhere (v6)             
53/udp (v6)                ALLOW       Anywhere (v6)             
3306/udp (v6)              ALLOW       Anywhere (v6)

相关内容