I'm having an issue with Postfix+Dovecot configuration in Ubuntu 16.04. I could configure my mailboxes and I can correctly send and receive emails and now I wanted to set up POP3+IMAP.
The problem I'm having is that when connecting I always get the wrong certificate
root@server:~# openssl s_client -connect server:993 #with or without servername parameter
CONNECTED(00000003)
depth=0 CN = localhost.localdomain
verify return:1
---
Certificate chain
0 s:/CN=localhost.localdomain
i:/CN=localhost.localdomain
Then it does not return the certificate configured in /etc/dovecot/conf.d/10-ssl.conf. In this file I specify the ssl, ssl_cert, ssl_key, ssl_key_password and verbose_ssl. For building the certificate I concatenated the "example.com" crt, the CA bundle and the key all in same file.
The certificate used was issued for "example.com" (no subdomain), and I configured my server /etc/postfix/main.cf to include "example.com" as myhostname and as mydestination fields. My MX record also points to "example.com"
The hostname of the machine is "server"
The only weird messages in the log are:
May 20 01:33:47 server dovecot: lda(root): Error: chdir(/root/) failed: Permission denied (euid=65534(nobody) egid=65534(nogroup) missing +x perm: /root, dir owned by 0:0 mode=0700)
May 20 01:33:47 server dovecot: lda(root): Error: chdir(/root) failed: Permission denied
May 20 01:33:47 server dovecot: lda(root): Error: User initialization failed: Namespace '': stat(/root/Maildir) failed: Permission denied (euid=65534(nobody) egid=65534(nogroup) missing +x perm: /root, dir owned by 0:0 mode=0700)
May 20 10:58:47 server dovecot: lda: Fatal: Invalid user settings. Refer to server log for more information.
May 20 01:33:47 server dovecot: lda: Fatal: Invalid user settings. Refer to server log for more information.
May 20 09:26:07 server postfix/smtpd[23663]: warning: cannot get RSA certificate from file "/etc/ssl/certs/mail_with_key_creationbyte_com.crt": disabling TLS support
May 20 09:26:07 server postfix/smtpd[23663]: warning: TLS library problem: error:140DC009:SSL routines:SSL_CTX_use_certificate_chain_file:PEM lib:ssl_rsa.c:708:
The root folder already has root:root 0700 permission.
Any ideas of which commands to use to debug this? I'm blind on how dovecot decides which certificate to serve..