Hi,
I'm trying to setup a mailserver using Postfix, Dovecot and PostgreSQL. And I've ran into a problem that's driving me mad, since I can't figure out what's wrong. I've build multiple servers like this already and the current setup should work.
The problem is that I can't login via IMAP or IMAP-SSL. The logs show this:
Notice this little part: user=<>
That should be: user=<me@domain.com>
I started digging a little deeper and started logging all the PostgreSQL queries. And to my surpise, no query whatsoever from Dovecot shows up in the logs. I do see queries from Postfix. And incoming email are delivered as expected. So that seems to work. I also can login to PostgreSQL from the commandline. But Dovecot refuses to even touch PostgreSQL. I don't even see any errors in the logs.
The only difference with any setup I've done so far is that PostgreSQL runs in a seperate jail. I have jail_sysvipc_allow enabled and all connections to PostgreSQL work fine. Except for Dovecot. I installed Dovecot from ports (/usr/ports/mail/dovecot - dovecot-2.2.31_2) with pgsql enabled.
dovecot.conf
dovecot-sql.conf
Any help will be most appreciated.
I'm trying to setup a mailserver using Postfix, Dovecot and PostgreSQL. And I've ran into a problem that's driving me mad, since I can't figure out what's wrong. I've build multiple servers like this already and the current setup should work.
The problem is that I can't login via IMAP or IMAP-SSL. The logs show this:
Code:
Sep 20 14:22:32 imap-login: Info: Disconnected (disconnected before auth was ready, waited 0 secs): user=<>, rip=123.123.123.123, lip=321.321.321.321, TLS handshaking: SSL_accept() failed: error:1408A0C1:SSL routines:ssl3_get_client_hello:no shared cipher, session=<Wd21B55ZGtBcRCyZ>
Notice this little part: user=<>
That should be: user=<me@domain.com>
I started digging a little deeper and started logging all the PostgreSQL queries. And to my surpise, no query whatsoever from Dovecot shows up in the logs. I do see queries from Postfix. And incoming email are delivered as expected. So that seems to work. I also can login to PostgreSQL from the commandline. But Dovecot refuses to even touch PostgreSQL. I don't even see any errors in the logs.
The only difference with any setup I've done so far is that PostgreSQL runs in a seperate jail. I have jail_sysvipc_allow enabled and all connections to PostgreSQL work fine. Except for Dovecot. I installed Dovecot from ports (/usr/ports/mail/dovecot - dovecot-2.2.31_2) with pgsql enabled.
dovecot.conf
Code:
auth_debug=yes
auth_verbose=yes
mail_debug=yes
protocols = imap lmtp
listen = *
auth_mechanisms = plain login
mail_max_userip_connections = 40
disable_plaintext_auth = no
log_path = /var/log/dovecot.log
info_log_path = /var/log/dovecot_info.log
debug_log_path = /var/log/dovecot_debug.log
first_valid_uid = 1002
last_valid_uid = 1002
first_valid_gid = 1002
last_valid_gid = 1002
mail_home = /usr/local/virtual/%d/%u
mail_location = maildir:~
passdb {
driver = sql
args = /usr/local/etc/dovecot/dovecot-sql.conf
}
userdb {
driver = sql
args = /usr/local/etc/dovecot/dovecot-sql.conf
}
service imap-login {
inet_listener imap {
port = 143
ssl = no
}
inet_listener imaps {
port = 993
ssl = yes
}
type = login
process_limit = 250
process_min_avail = 5
}
namespace inbox {
separator = .
prefix = INBOX.
inbox = yes
}
service auth {
inet_listener {
port = 12345
}
}
plugin {
sieve = ~/sieve/.dovecot.sieve
sieve_global_path = /usr/local/etc/dovecot/sieve/default.sieve
sieve_dir = ~/sieve
sieve_global_dir = /usr/local/etc/dovecot/sieve/
}
verbose_ssl = yes
ssl_cert = </etc/ssl/dovecot/cert.pem
ssl_key = </etc/ssl/dovecot/key.pem
ssl_ca = </etc/ssl/dovecot/ca_x509.pem
dovecot-sql.conf
Code:
driver = pgsql
connect = host=123.123.123.123 dbname=postfix user=postfix password=SuperSecret
default_pass_scheme = MD5-CRYPT
# Get the mailbox
user_query = SELECT '/usr/local/virtual/%d/%u' as home, 'maildir:/usr/local/virtual/%d/%u' as mail, 1002 AS uid, 1002 AS gid, concat('dirsize:storage=', quota) AS quota FROM mailbox WHERE username = '%u' AND active = '1'
# Get the password
password_query = SELECT username as user, password, '/usr/local/virtual/%d/%u' as userdb_home, 'maildir:/usr/local/virtual/%d/%u' as userdb_mail, 1002 as userdb_uid, 1002 as userdb_gid FROM mailbox WHERE username = '%u' AND active = '1'
Any help will be most appreciated.