EzDevInfo.com

dovecot interview questions

Top dovecot frequently asked interview questions

duplicate imap uid validities with mbsync

I am using mbsync to get imap mail from my university server and then dovecot locally to serve it to gnus/emacs. This works fine on one desktop machine, and one laptop, but a second laptop creates duplicate UIDs everytime I use it to access my mail. As I have the exact same set-up (to the best of my knowledge) on all three machines I am a bit baffled as to the source of this error. Does this ring any bells for anyone? Is there some sort of hidden or temp file that might be the source of such a problem that I could look for? Any guidance is appreciated.

  • mbsync version = 1.2.0
  • emacs = 24.5.50.1
  • dovecot 2.2.18
  • gnus 5.13

P.S. A great guide to fix these problems once they occur is this blog post here: http://tiborsimko.org/mbsync-duplicate-uid.html


Source: (StackOverflow)

IMAP open stream: Self signed certificate issue

I'm trying to open the non-secure (port 143) IMAP connection (I am using PHP):

imap_open('{localhost:143/imap}INBOX', USERNAME, PASS);

and I get the next error: Certificate failure for localhost: self signed certificate ...

Ok. I've tried to use /novalidate-cert mailbox param. Then I get another error: Can not authenticate to IMAP server.

I've also tried to combine all possible non-secure connection params like /notls,/norsh and /secure. But I always get errors.

This is the Dovecot configuration I'm using:

* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=LOGIN] Dovecot ready.

The certificate is really self-signed and generated with openssl.

The questions are:

  1. Why does the certificate error occurs when I am using non-secure connection?
  2. What is wrong with the mail server configuration?

Source: (StackOverflow)

Advertisements

Connect to local POP3 inbox Java

I am trying to connect to locally hosted email POP3 inbox and display emails in the mailbox, but I keep getting error:

Exception in thread "main" javax.mail.MessagingException: Connect failed; nested exception is:
java.net.ConnectException: Connection refused
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:209)
at javax.mail.Service.connect(Service.java:295)
at javax.mail.Service.connect(Service.java:176)
at com.kami.utils.MailClient.checkInbox(MailClient.java:33)
at com.kami.Main.main(Main.java:38)

My class looks like this:

public class MailClient {
    private String host;
    private String username;
    private String password;
    private String provider;
    protected Session session;

    public MailClient() {
        Properties props = new Properties();

        this.host = "localhost";
        this.username = "unix-user";
        this.password = "unix-password";
        this.provider = "pop3";

        this.session = Session.getDefaultInstance(props, null);
    }

    public void checkInbox() throws MessagingException, IOException {
        Store store = session.getStore(provider);
        store.connect(host, username, password); //This is line 33
        Folder inbox = store.getFolder("inbox");
        inbox.open(Folder.READ_ONLY);
        Message[] messages = inbox.getMessages();

        for(Message message : messages){
            System.out.println(message.getReceivedDate());
            System.out.println(message.getSubject());
        }

        inbox.close(true);
        store.close();
    }
}

It is locally hosted email server using Dovecot IMAP/POP3 Server Version 2.2.9 and Postfix Mail Server Postfix version 2.11.0


Source: (StackOverflow)

Configure postfix to view catch-all address in mail header

I configured catchall for postfix as follows:-

"#vim /etc/postfix/virtual

@example.com test"

So if we send mail to xyzjsdv@example.com will get delivered to test@example.com.

But the problem was it always shows the same user name in the mail header "test@example.com". I created a script for checking the mail header, so that I need the particular user@example should be display at the mail header since I need to differentiate all the users.

Please help me how to configure the postfix, so that I will get this outcome. Sudden answers would be appreciated


Source: (StackOverflow)

Postfix with Dovecot: Send only?

I have a mailserver with Dovecot + Postfix + MySQL. (This Tutorial: https://workaround.org/ispmail/jessie)

Now I would like to allow for one user only SMTP.

Configuration in Dovecote:

service auth {
  # Postfix smtp-auth
    unix_listener /var/spool/postfix/private/auth {
        mode = 0660
        user = postfix
        group = postfix
    }
}

Configuration in Postfix:

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes

Is that possible?


Source: (StackOverflow)

Using Docker for a mail server

I've been interested in docker for a while, but not jumped in yet. I have a need to set up a mail server, so thought maybe I could use this as a reason to learn more about docker. However, I'm unclear how to best go about it.

I've installed a mailserver on a VPS before, but not into multiple containers. I'd like to install Postfix, Dovecot, MySQL or Postgresql, and SpamAssassin, similar to what is described here:

https://www.digitalocean.com/community/tutorials/how-to-configure-a-mail-server-using-postfix-dovecot-mysql-and-spamassasin

However, what would be a good way to dockerize it? Would I simply put everything into a single container? Or would it be better to have MySQL in one container, Postfix in another, and additional containers for Dovecot and SpamAssassin? Or should some containers be shared?

Are there any HOWTOs on installing a mailserver using docker? If there is, I haven't found it yet.


Source: (StackOverflow)

How to integrate dovecot version 2 with gnus emacs

I am trying to use emacs and gnus as a mail reader. There are several snippets of instructions online for how to do this with offlineimap and dovecot, however they seem to be for the earlier version of dovecot. I have successfully installed offlineimap and dovecot2 (using Archlinux pacman). I have both offlineimap and dovecot "working." I can retrieve my mail from my university's imap server using offlineimap. Dovecot starts and I can login to telnet localhost in a terminal. However, I have tried several commands in my .gnus.el file, but I am unable to achieve an integration with gnus that will allow gnus to find my local email folders. I have placed the local address of my Maildir in the dovecot configuration files.

Any advice or pointers would be appreciated. Please suggest any additional information that I should provide to assist in the diagnosis of my problem.


Source: (StackOverflow)

Dovecot with virtual hosts and SSL - wrong certificate?

I'm trying to set up Dovecot with multiple vhosts using SSL.

I've set up my main domain (example.de) and for my vhosts (example2.com & example3.co.uk) I'm using the local -option.

My problem:

When I connect to my server, it complains about a wrong hostname (example3.co.uk) on my main and other domain for the certificate.

How can I make dovecot use the correct certificate for each host?

Here's my dovecot config:

listen = *
ssl = yes
protocols = imap pop3
disable_plaintext_auth = no
auth_mechanisms = plain login
mail_access_groups = vmail
default_login_user = vmail
first_valid_uid = 2222
first_valid_gid = 2222
#mail_location = maildir:~/Maildir
mail_location = maildir:/home/vmail/%d/%n

passdb {
    driver = passwd-file
    args = scheme=SHA1 /etc/dovecot/passwd
}
userdb {
    driver = static
    args = uid=2222 gid=2222 home=/home/vmail/%d/%n allow_all_users=yes
}
service auth {
    unix_listener auth-client {
        group = postfix
        mode = 0660
        user = root
    }
    user = root
}
service imap-login {
  process_min_avail = 1
  user = vmail
}

ssl_cert = </etc/pki/tls/certs/example.de.crt
ssl_key = </etc/pki/tls/private/example.de.key

local ohmygodpresents.com {
  ssl_cert = </etc/pki/tls/certs/example2.com.crt
  ssl_key = </etc/pki/tls/private/example2.com.key
}
local ohmygodpresents.co.uk {
  ssl_cert = </etc/pki/tls/certs/example3.co.uk.crt
  ssl_key = </etc/pki/tls/private/example3.co.uk.key
}

Source: (StackOverflow)

salted password hashes without saving the salt

I've got a mailserver which stores passwords for mailboxes in a mysql database with the following sql:

ENCRYPT([PASSWORT], concat(_utf8"$1$", right(md5(rand()), 8), _utf8"$"))

But there is no salt stored in the database.

Now i need to build a login process around this database but it is hard to compare the stored password because of the missing salt. I noticed, that the password-hash holds the salt in it self in the following form:

$1$[SALT]$[PASSWORD-HASH]

How can i create a comparable password hash to build a login?

Dovecot is able to login users using the stored passwords but how?


Source: (StackOverflow)

sha512-crypt mysql and dovecot

I have a question about understanding sha512-crypt hashing. I found this tutorial to set up dovecot and postfix with mysql. I followed the tutorial (with slight modifications) and everything works fine. But there is one thing, that I do not understand:

To add a user, I should use:

INSERT INTO `mailserver`.`virtual_users`
  (`id`, `domain_id`, `password` , `email`)
VALUES
  ('1', '1', ENCRYPT('firstpassword', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16))),    'email1@example.com'),
  ('2', '1', ENCRYPT('secondpassword', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16))), 'email2@example.com');

and again, this works perfectly fine, i.e. I can log in with my password (and only my password) to dovecot. But why? If I see it right, it encrypts the password with a random salt, but it doesn't save it anywhere. So hashing the same password twice gives me 2 different hashes (I tried it). So my question boils down to: Could I get a brief explanation of sha-512 (which I couldn't find online) and and explanation as to why these lines work?

Thanks already


Source: (StackOverflow)

Postfix/dovecot email sent but not received

Please help! I'm trying to setup an internal mail server on LAN using Postfix and Dovecot. Everything seems to be configured fine, emails sent (and received on my gmail account) but never received on the local server (using Webmail by Squirrelmail). I'm using an Ubuntu Server 12.04 LTS, which sends me notifications about my new emails but cannot read in Squirrelmail (I see sent messages, messages in trash, maybe Drafts [didn't check that] but no incoming messages in the Inbox folder). Though It would be a badly configured webmail thing I logged in with Thunderbird, where the problem is the same. Looks like email is sent and received but Dovecot is unable to find it.

Here's my Postfix configuration file (main.cf): # See /usr/share/postfix/main.cf.dist for a commented, more complete version

# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = <SERVERNAME>
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = <SERVERNAME>, localhost.localdomain, localhost
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

...and my dovecot configuration file (dovecot.conf): ## Dovecot configuration file

# If you're in a hurry, see http://wiki2.dovecot.org/QuickConfiguration

# "doveconf -n" command gives a clean output of the changed settings. Use it
# instead of copy&pasting files when posting to the Dovecot mailing list.

# '#' character and everything after it is treated as comments. Extra spaces
# and tabs are ignored. If you want to use either of these explicitly, put the
# value inside quotes, eg.: key = "# char and trailing whitespace  "

# Default values are shown for each setting, it's not required to uncomment
# those. These are exceptions to this though: No sections (e.g. namespace {})
# or plugin settings are added by default, they're listed only as examples.
# Paths are also just examples with the real defaults being based on configure
# options. The paths listed here are for configure --prefix=/usr
# --sysconfdir=/etc --localstatedir=/var

# Enable installed protocols
!include_try /usr/share/dovecot/protocols.d/*.protocol

# A comma separated list of IPs or hosts where to listen in for connections. 
# "*" listens in all IPv4 interfaces, "::" listens in all IPv6 interfaces.
# If you want to specify non-default ports or anything more complex,
# edit conf.d/master.conf.
#listen = *, ::

# Base directory where to store runtime data.
#base_dir = /var/run/dovecot/

# Name of this instance. Used to prefix all Dovecot processes in ps output.
#instance_name = dovecot

# Greeting message for clients.
#login_greeting = Dovecot ready.

# Space separated list of trusted network ranges. Connections from these
# IPs are allowed to override their IP addresses and ports (for logging and
# for authentication checks). disable_plaintext_auth is also ignored for
# these networks. Typically you'd specify your IMAP proxy servers here.
#login_trusted_networks =

# Sepace separated list of login access check sockets (e.g. tcpwrap)
#login_access_sockets = 

# Show more verbose process titles (in ps). Currently shows user name and
# IP address. Useful for seeing who are actually using the IMAP processes
# (eg. shared mailboxes or if same uid is used for multiple accounts).
#verbose_proctitle = no

# Should all processes be killed when Dovecot master process shuts down.
# Setting this to "no" means that Dovecot can be upgraded without
# forcing existing client connections to close (although that could also be
# a problem if the upgrade is e.g. because of a security fix).
#shutdown_clients = yes

# If non-zero, run mail commands via this many connections to doveadm server,
# instead of running them directly in the same process.
#doveadm_worker_count = 0
# UNIX socket or host:port used for connecting to doveadm server
#doveadm_socket_path = doveadm-server

# Space separated list of environment variables that are preserved on Dovecot
# startup and passed down to all of its child processes. You can also give
# key=value pairs to always set specific settings.
#import_environment = TZ

##
## Dictionary server settings
##

# Dictionary can be used to store key=value lists. This is used by several
# plugins. The dictionary can be accessed either directly or though a
# dictionary server. The following dict block maps dictionary names to URIs
# when the server is used. These can then be referenced using URIs in format
# "proxy::<name>".

dict {
  #quota = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
  #expire = sqlite:/etc/dovecot/dovecot-dict-sql.conf.ext
}

# Most of the actual configuration gets included below. The filenames are
# first sorted by their ASCII value and parsed in that order. The 00-prefixes
# in filenames are intended to make it easier to understand the ordering.
!include conf.d/*.conf

# A config file can also tried to be included without giving an error if
# it's not found:
!include_try local.conf

protocols = imap imaps pop3 pop3s
#disable_plaintext_auth = no
#default_mail_env = mbox:~/mail/
mail_location = mbox:~/mail:INBOX=/var/mail/%u
mail_location = maildir:~/Maildir

I tried EVERYTHING to make this work but no success. Some forums say I must create namespaces for the mail directories, others say I must tell procmail/sendmail where to copy local emails but none of them tell me where I should configure these.

I'm out of ideas, it is driving me insane and I'm about to give up. Simply nothing works. Never ever succeeded to set up fully functional internal mail server using these tools.

Can you tell me what I'm doing wrong?

Thank you in advance.

UPDATE:

dovecot -n outputs the following:

# 2.0.19: /etc/dovecot/dovecot.conf
# OS: Linux 3.8.0-29-generic i686 Ubuntu 12.04.3 LTS 
mail_location = maildir:~/Maildir
passdb {
  driver = pam
}
protocols = imap pop3
ssl_cert = </etc/ssl/certs/dovecot.pem
ssl_key = </etc/ssl/private/dovecot.pem
userdb {
  driver = passwd
}

Source: (StackOverflow)

read localhost POP3 inbox with javax.mail

What is the Java analogue for:

thufir@dur:~$ 
thufir@dur:~$ 
thufir@dur:~$ telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK Dovecot ready.
user thufir
+OK
pass password
+OK Logged in.
stat
+OK 16 84695
retr 1
+OK 4978 octets
Return-Path: <thufir@dur.bounceme.net>
X-Original-To: thufir@dur
Delivered-To: thufir@dur
Received: from dur.bounceme.net (localhost [127.0.0.1])
    (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
    (No client certificate requested)
    by dur.bounceme.net (Postfix) with ESMTPS id E6A58180508
    for <thufir@dur>; Sun, 26 Aug 2012 06:48:47 -0700 (PDT)
Message-Id: <1027505969.1345988926766.JavaMail.thufir@dur.bounceme.net>
To: thufir@dur
Subject: Google Developers Expert: recognizing and rewarding top developers
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="----=_Part_0_2465937.1345988926695"
Date: Sun, 26 Aug 2012 06:48:47 -0700 (PDT)
From: thufir@dur.bounceme.net

------=_Part_0_2465937.1345988926695
Content-Type: text/html
Content-Transfer-Encoding: 7bit

<img height="80" src="http://2.bp.blogspot.com/-vC8YT1LrWbw/UAW2oUAlvXI/AAAAAAAABt8/Xp5ZDiHi6JQ/s1600/
...
------=_Part_0_2465937.1345988926695--

.
quit
+OK Logging out.
Connection closed by foreign host.
thufir@dur:~$ 

I'm getting:

init:
Deleting: /home/thufir/NetBeansProjects/leafnode_postfix/build/built-jar.properties
deps-jar:
Updating property file: /home/thufir/NetBeansProjects/leafnode_postfix/build/built-jar.properties
Compiling 1 source file to /home/thufir/NetBeansProjects/leafnode_postfix/build/classes
compile:
run:
DEBUG: nntp: newsrc loading /home/thufir/.newsrc
DEBUG: nntp: newsrc load: 1 groups in 27ms
Show INBOX for thufir@localhost
Exception in thread "main" javax.mail.NoSuchProviderException: Invalid protocol: null
    at javax.mail.Session.getProvider(Session.java:468)
    at javax.mail.Session.getStore(Session.java:546)
    at javax.mail.Session.getStore(Session.java:531)
    at javax.mail.Session.getStore(Session.java:520)
    at net.bounceme.dur.leafnode_postfix.MailClient.checkInbox(Unknown Source)
    at net.bounceme.dur.leafnode_postfix.Main.readMail(Unknown Source)
    at net.bounceme.dur.leafnode_postfix.Main.<init>(Unknown Source)
    at net.bounceme.dur.leafnode_postfix.Main.main(Unknown Source)
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)

Presumably the problem is that I'm not logging into the dovecot POP3 server correctly? How do I pass login credentials?

package net.bounceme.dur.leafnode_postfix;

import java.io.IOException;
import static java.lang.System.out;
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;

public class MailClient extends Authenticator {

    public static final int SHOW_MESSAGES = 1;
    public static final int CLEAR_MESSAGES = 2;
    public static final int SHOW_AND_CLEAR =
            SHOW_MESSAGES + CLEAR_MESSAGES;
    protected String from;
    protected Session session;
    protected PasswordAuthentication authentication;

    public MailClient(UserHost userHost) {
        String user = userHost.getUser();
        String host = userHost.getHost();
        boolean debug = userHost.isDebug();
        from = user + '@' + host;
        authentication = new PasswordAuthentication(user, user);
        Properties props = new Properties();
        props.put("mail.user", user);
        props.put("mail.host", host);
        props.put("mail.debug", debug ? "true" : "false");
        props.put("mail.store.protocol", "pop3");
        props.put("mail.transport.protocol", "smtp");
        session = Session.getDefaultInstance(props);
    }

    @Override
    public PasswordAuthentication getPasswordAuthentication() {
        return authentication;
    }

    public void sendMessage(Message post) throws MessagingException, IOException {
        Message message = new MimeMessage(session);
        InternetAddress address = new InternetAddress("thufir@dur");
        message.setRecipient(Message.RecipientType.TO, address);
        message.setSubject(post.getSubject());
        Multipart mp = new MimeMultipart();
        BodyPart part = new MimeBodyPart();
        part.setContent(post.getContent(), "text/html");
        mp.addBodyPart(part);
        message.setContent(mp);
        Transport.send(message);
    }

    public void checkInbox(int mode)
            throws MessagingException, IOException {
        if (mode == 0) {
            return;
        }
        boolean show = (mode & SHOW_MESSAGES) > 0;
        boolean clear = (mode & CLEAR_MESSAGES) > 0;
        String action =
                (show ? "Show" : "")
                + (show && clear ? " and " : "")
                + (clear ? "Clear" : "");
        out.println(action + " INBOX for " + from);
        Store store = session.getStore();
        store.connect();
        out.println(store.getDefaultFolder());
        Folder root = store.getDefaultFolder();
        Folder inbox = root.getFolder("inbox");
        inbox.open(Folder.READ_WRITE);
        Message[] msgs = inbox.getMessages();
        if (msgs.length == 0 && show) {
            System.out.println("No messages in inbox");
        }
        for (int i = 0; i < msgs.length; i++) {
            MimeMessage msg = (MimeMessage) msgs[i];
            if (show) {
                System.out.println("    From: " + msg.getFrom()[0]);
                System.out.println(" Subject: " + msg.getSubject());
                System.out.println(" Content: " + msg.getContent());
            }
            if (clear) {
                msg.setFlag(Flags.Flag.DELETED, true);
            }
        }
        inbox.close(true);
        store.close();
        System.out.println();
    }
}

Incidentally, sending messages to localhost, or dur, works fine. The full FQDN is dur.bounceme.net, although just dur seems to suffice in many cases. I'm just doing everything on one box, nothing over the intertubes.


Source: (StackOverflow)

Linux postfix/dovecot 554 Relay access denied

I have this error 554 Relay access denied when trying to send email from my outlook client.

I can read incoming mails but cannot send.

If i connect with telnet localhost 25 i can send external emails, but with outlook client it doesn't work.

Here's my postfix and dovecot config :

postconf -n

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
mailbox_size_limit = 0
mydestination = localhost
myhostname = mail.mydomain.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/certs/dovecot.pem
smtpd_tls_key_file = /etc/ssl/private/dovecot.pem
smtpd_use_tls = yes
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp

doveconf -n

# 2.1.7: /etc/dovecot/dovecot.conf
# OS: Linux 3.9.3-x86_64-linode33 x86_64 Ubuntu 13.04 ext3
auth_mechanisms = plain login
mail_location = maildir:/var/mail/vhosts/%d/%n
mail_privileged_group = mail
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
}
passdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
protocols = imap pop3 lmtp
service auth-worker {
  user = vmail
}
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0666
    user = postfix
  }
  unix_listener auth-userdb {
    mode = 0600
    user = vmail
  }
  user = dovecot
}
service imap-login {
  inet_listener imap {
    port = 0
  }
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0600
    user = postfix
  }
}
service pop3-login {
  inet_listener pop3 {
    port = 0
  }
}
ssl = required
ssl_cert = </etc/dovecot/dovecot.pem
ssl_key = </etc/dovecot/private/dovecot.pem
userdb {
  args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n
  driver = static
}
userdb {
  args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n
  driver = static
}

Any thoughts?


Source: (StackOverflow)

script to move files from one directory to another

I have successfully changed my mail imap agent from dovecot to courier-imap, for some required features, how ever i am facing a problem during the maildrop/seive directory structure where i need to move 10000 mailboxes to correct directory structure,

so what i need is a script that will convert to move like this

mv /var/vmail/[ domain ]/[ username ]/Maildir/* /var/vmail/[ domain ]/[ username ]/

and i dont want to run this command 10000 times, its troublesome, could you help with this,

thank you


Source: (StackOverflow)

Thunderbird does not connect to Postfix/Dovecot. Webmail works

Thunderbird does not connect to Postfix/Dovecot.
My webmail interface works with login (name@domain.tld + password),
incoming (SSL/TLS, Port 993) and outgoing messages (STARTTLS, Port 587).
I did a bit debugging and got to know that it must be a certificate error.
Does anyone here know how to fix it, please?

This is my mail.log with SSL debugging:

Apr 26 16:57:28 m123851 dovecot: imap-login: Debug: SSL: elliptic curve secp384r1 will be used for ECDH and ECDHE key exchanges
Apr 26 16:57:28 m123851 dovecot: imap-login: Debug: SSL: elliptic curve secp384r1 will be used for ECDH and ECDHE key exchanges
Apr 26 16:57:28 m123851 dovecot: imap-login: Debug: SSL: where=0x10, ret=1: before/accept initialization [x.x.x.x]
Apr 26 16:57:28 m123851 dovecot: imap-login: Debug: SSL: where=0x2001, ret=1: before/accept initialization [x.x.x.x]
Apr 26 16:57:28 m123851 dovecot: imap-login: Debug: SSL: where=0x2002, ret=-1: unknown state [x.x.x.x]
Apr 26 16:57:28 m123851 dovecot: imap-login: Debug: SSL: where=0x2001, ret=1: SSLv3 read client hello A [x.x.x.x]
Apr 26 16:57:28 m123851 dovecot: imap-login: Debug: SSL: where=0x2001, ret=1: SSLv3 write server hello A [x.x.x.x]
Apr 26 16:57:28 m123851 dovecot: imap-login: Debug: SSL: where=0x2001, ret=1: SSLv3 write certificate A [x.x.x.x]
Apr 26 16:57:28 m123851 dovecot: imap-login: Debug: SSL: where=0x2001, ret=1: SSLv3 write key exchange A [x.x.x.x]
Apr 26 16:57:28 m123851 dovecot: imap-login: Debug: SSL: where=0x2001, ret=1: SSLv3 write server done A [x.x.x.x]
Apr 26 16:57:28 m123851 dovecot: imap-login: Debug: SSL: where=0x2001, ret=1: SSLv3 flush data [x.x.x.x]
Apr 26 16:57:28 m123851 dovecot: imap-login: Debug: SSL: where=0x2002, ret=-1: SSLv3 read client certificate A [x.x.x.x]
Apr 26 16:57:28 m123851 dovecot: imap-login: Debug: SSL: where=0x2002, ret=-1: SSLv3 read client certificate A [x.x.x.x]
Apr 26 16:57:29 m123851 dovecot: imap-login: Warning: SSL alert: where=0x4004, ret=560: fatal unknown CA [x.x.x.x]
Apr 26 16:57:29 m123851 dovecot: imap-login: Warning: SSL failed: where=0x2002: SSLv3 read client certificate A [x.x.x.x]
Apr 26 16:57:29 m123851 dovecot: imap-login: Disconnected (no auth attempts in 1 secs): user=<>, rip=192.x.x.x, lip=85.x.x.x, TLS handshaking: SSL_accept() failed: error:14094418:SSL routines:SSL3_READ_BYTES:tlsv1 alert unknown ca: SSL alert number 48, session=<NDYo2aEUWQAfBhbN>

This is my Dovecot ssl-config file (/etc/dovecot/conf.d/10-ssl.conf):

# Log SSL problems
verbose_ssl = yes

ssl = required

ssl_cert = </etc/dovecot/dovecot.pem
ssl_key = </etc/dovecot/private/dovecot.pem

ssl_protocols = !SSLv3 !SSLv2

ssl_cipher_list = EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+
                  SHA384:EECDH+aRSA+SHA256:EECDH:+CAMELLIA256:+AES256:+
                  CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:
                  !EXP:!PSK:!DSS:!RC4:!SEED:!ECDSA:CAMELLIA256-SHA:
                  AES256-SHA:CAMELLIA128-SHA:AES128-SHA

ssl_prefer_server_ciphers = yes

The SSL cert for Dovecot is setup for localhost.
As I tried to integrate my root ca and domain cert into the dovecot cert, the problem remains:
dovecot.pem cert = dovecot cert content + domain cert content + root ca cert content (exactly in this order from top to bottom)
dovecot.pem key = dovecot cert key + domain cert key + root ca cert key (exactly in this order from top to bottom)


Source: (StackOverflow)