Ubuntu 16.04.5 Apache2 MySQL Postfix cu MySQL Porumbar SASL2 UFW
Încerc să instalez un server de mail funcțional și un client pe această mașină. Am urmat acest tutorial care permite autentificarea prin MySQL. Am toate intrările DB setate corect, am configurat domeniul / cutia poștală în PostfixAdmin. Totul mergea bine până la autentificarea Test în instalarea RoundCube. Utilizatorul nu se poate conecta prin portul 993 pentru a se conecta.
Connecting to localhost...
IMAP connect: NOT OK(Login failed for noreply@example.com from /ip address/. Could not connect to localhost:993: Connection refused)
Am încercat Telneting-ul de la distanță la {adresa IP} 993 cu Conexiunea refuzată
, de asemenea.
Serverul rulează pe un IP static abordare. RoundCube se află în directorul ../ html / webmail /
și funcționează bine, dar lucruri precum PHPMyAdmin se află la http: // {ipaddress} / phpmyadmin
, deoarece există mai multe gazde virtuale pentru servicii web.
UFW are toate porturile necesare IMAP / POP3 permise.
To Action From
-- ------ ----
Apache Full ALLOW Anywhere
20/tcp ALLOW Anywhere
21/tcp ALLOW Anywhere
990/tcp ALLOW Anywhere
40000:50000/tcp ALLOW Anywhere
22 ALLOW Anywhere
80 ALLOW Anywhere
443 ALLOW Anywhere
8080 ALLOW Anywhere
Postfix ALLOW Anywhere
993 ALLOW Anywhere
143 ALLOW Anywhere
110 ALLOW Anywhere
995 ALLOW Anywhere
25 ALLOW Anywhere
25/tcp ALLOW Anywhere
Apache Full (v6) ALLOW Anywhere (v6)
20/tcp (v6) ALLOW Anywhere (v6)
21/tcp (v6) ALLOW Anywhere (v6)
990/tcp (v6) ALLOW Anywhere (v6)
40000:50000/tcp (v6) ALLOW Anywhere (v6)
22 (v6) ALLOW Anywhere (v6)
80 (v6) ALLOW Anywhere (v6)
443 (v6) ALLOW Anywhere (v6)
8080 (v6) ALLOW Anywhere (v6)
Postfix (v6) ALLOW Anywhere (v6)
993 (v6) ALLOW Anywhere (v6)
143 (v6) ALLOW Anywhere (v6)
110 (v6) ALLOW Anywhere (v6)
995 (v6) ALLOW Anywhere (v6)
25 (v6) ALLOW Anywhere (v6)
25/tcp (v6) ALLOW Anywhere (v6)
Dovecot rulează
# 2.2.22 (fe789d2): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.13 (7b14904)
# OS: Linux 4.4.0-141-generic x86_64 Ubuntu 16.04.5 LTS ext4
auth_debug = yes
auth_debug_passwords = yes
auth_mechanisms = plain login
auth_verbose = yes
auth_verbose_passwords = plain
mail_debug = yes
mail_location = maildir:/var/mail/vmail/%d/%n/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 {
inbox = yes
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =
}
passdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
plugin {
sieve = file:~/sieve;active=~/.dovecot.sieve
}
protocols = " imap sieve"
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0600
user = postfix
}
unix_listener auth-userdb {
mode = 0600
user = vmail
}
user = dovecot
}
ssl = no
userdb {
args = uid=vmail gid=vmail home=/var/mail/vmail/%d/%n
driver = static
}
verbose_ssl = yes
protocol lda {
mail_plugins = " sieve"
}
Postfix config
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
inet_interfaces = all
inet_protocols = all
mailbox_size_limit = 0
mydestination = $myhostname, example.com, {rootusername}, localhost.localdomain, localhost, example2.com, example3.com
myhostname = {rootusername}
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = no
smtpd_tls_cert_file = /etc/letsencrypt/live/example.com/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/example.com/privkey.pem
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_alias_maps = mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/sql/mysql_virtual_mailbox_maps.cf
Fișierele de certificare / cheie nu sunt necesare, am încercat să le adaug pentru a vedea dacă există Ar fi vreo diferență. Certificările SSL sunt pentru domeniu și anumite subdomenii, nu există mail.example.com.
Ceea ce pare ciudat este că nimic nu ascultă pe portul 993, Dovecot ascultă pe 4190?
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 111 14759 1084/mysqld
tcp 0 0 0.0.0.0:587 0.0.0.0:* LISTEN 0 34677 6207/master
tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 0 43563 7001/dovecot
tcp 0 0 0.0.0.0:465 0.0.0.0:* LISTEN 0 34683 6207/master
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 16213 1149/sshd
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 0 34671 6207/master
tcp 0 0 0.0.0.0:4190 0.0.0.0:* LISTEN 0 43523 7001/dovecot
tcp 0 212 xx.xxx.xx.xxx:22 xxx.xx.xxx.xxx:53808 ESTABLISHED 0 75664 12943/sshd: ********
tcp6 0 0 :::587 :::* LISTEN 0 34678 6207/master
tcp6 0 0 :::143 :::* LISTEN 0 43564 7001/dovecot
tcp6 0 0 :::80 :::* LISTEN 0 18106 1614/apache2
tcp6 0 0 :::465 :::* LISTEN 0 34684 6207/master
tcp6 0 0 :::21 :::* LISTEN 0 12274 1012/vsftpd
tcp6 0 0 :::22 :::* LISTEN 0 16215 1149/sshd
tcp6 0 0 :::25 :::* LISTEN 0 34672 6207/master
tcp6 0 0 :::443 :::* LISTEN 0 18110 1614/apache2
tcp6 0 0 :::4190 :::* LISTEN 0 43524 7001/dovecot
tcp6 0 0 xx.xxx.xx.xxx:80 xxx.xx.xxx.xxx:53832 TIME_WAIT 0 0 -
De ce ar asculta Dovecot pe 4190 ? M-am asigurat că toate configurațiile sunt corecte, repornind toate serviciile necesare, chiar am încercat să reporniți sistemul. Există o greșeală evidentă pe care o fac?
Итак, после некоторой отладки я обнаружил, что:
Ошибка 1 : Предполагается, что 993
правильный порт. Dovecot работает на 143
. Правильная установка для сервера в Roundcube - tls: // localhost
.
Ошибка 2 : в /etc/dovecot/dovecot-sql.conf.ext
connect
и password_query
должны находиться в разных строках. Возможно из-за копирования / вставки из руководств.
Справа:
connect = host=localhost dbname=postfix user=postfix password=dontusep@ssw0rd
password_query = SELECT username,domain,password FROM mailbox WHERE username='%u';
Неправильно
connect = host=localhost dbname=postfix user=postfix password=dontusep@ssw0rd password_query = SELECT username,domain,password FROM mailbox WHERE username='%u';
Рекомендация
nano /etc/dovecot/conf.d/10-logging.conf
Установите log_path = /var/log/dovecot.log
, чтобы отличать ошибки от системных ошибок. Dovecot будет записывать все, что вы напортачили.
Надеюсь, это поможет кому-то в будущем.