Dovecot Installation on FreeBSD 12.1 - Running daemon (Non-SSL) - Doesn't work

Good morning everyone,

This is my first time deploying Dovecot and I am intentionally configuring it to not run SSL for a short time until I can install SSL certificates through a SSL online merchant.

My first bit for /etc/rc.conf is as follows:

Code:
# Disable SendMail
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"

# Enable Postfix Mail Server [MTA-Mail-Transfer-Agent]
postfix_enable="NO"

# Enable Dovecot Mail Server [IMAP/POP3]
dovecot_enable="YES"

My dovecot directory looks like the following:

/usr/local/etc/dovecot # ls
README dovecot-sql.conf dovecot.conf
conf.d dovecot-sql.conf.ext


My dovecot.conf looks like the following:

Code:
protocols = imap pop3

disable_plaintext_auth = yes

service imap-login {
  inet_listener imap {
    address = 185.x.x.x
    port = 143
  }
  inet_listener imaps {
    address = 185.x.x.x
    port = 993
    ssl = no
  }
}
service pop3-login {
  inet_listener pop3 {
    address = 185.x.x.x
    port = 110
  }
  inet_listener pop3s {
    address = 185.x.x.x
    port = 995
    ssl = no
  }
}
#ssl_cert = </etc/pki/dovecot/certs/dovecot.pem
#ssl_key = </etc/pki/dovecot/private/dovecot.pem

base_dir = /var/run/dovecot/
instance_name = dovecot
login_greeting = Dovecot ready.

verbose_proctitle = no

shutdown_clients = yes

doveadm_worker_count = 0
doveadm_socket_path = doveadm-server

import_environment = TZ

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

!include conf.d/*.conf
!include_try local.conf

passdb sql {
    args = /usr/local/etc/dovecot/dovecot-sql.conf
    driver = sql
}

userdb sql {
    args = /usr/local/etc/dovecot/dovecot-sql.conf
    driver = sql
}

My dovecot-sql.conf looks like the following:

Code:
driver = mysql

connect = host=127.0.0.1 dbname=databasename user=databaseuname password=actualpassword123

default_pass_scheme = MD5

user_query = \

password_query = \

}

My dovecot-sql.conf.ext is default with no changes.

My /conf.d/10-ssl.conf has the following lines hashed out to disable SSL checks until I get the mail working and configure my SSL certificate from my online merchant.

Code:
#ssl_cert = </etc/ssl/certs/dovecot.pem
#ssl_key = </etc/ssl/private/dovecot.pem

Dovecot daemon status is showing the following:

Code:
root@server: /usr/local/etc/dovecot
# service dovecot status
dovecot is running as pid 73604.

Any pointers would be helpful! Thank you!

~ TruthSword
 
Which version of Dovecot is this. The new installation of dovecot has !include configuration that include conf.d/*.conf and the dovecot.conf is a quite different. Every service is configured in it's own config file under conf.d/

Port 993/995 ARE required to have SSL enabled. My advice is to create a self signed certificate or even better to use Let's Encrypt and enable the SSL. If you don't want to use SSL then disalbe it under 10-ssl.conf file with ssl=no. Do not change the protocol pop3s and imaps.

You are missing the SQL lookup query for the username and password. Depending of your database scheme it may vary from installation to installation so there's no exact example for it to follow. In my case i'm using postfixadmin structure for the database and my query look like this:

Code:
password_query = SELECT password, CONCAT('*:bytes=', quota) AS userdb_quota_rule FROM mailbox WHERE username
= '%u' AND active = true

Code:
user_query = SELECT CONCAT('/mail/', maildir) as home, 110 AS uid, 110 AS gid, CONCAT('*:bytes=', quota) AS q
uota_rule \
             FROM mailbox WHERE username = '%u' AND active = true
 
Which version of Dovecot is this. The new installation of dovecot has !include configuration that include conf.d/*.conf and the dovecot.conf is a quite different. Every service is configured in it's own config file under conf.d/

Port 993/995 ARE required to have SSL enabled. My advice is to create a self signed certificate or even better to use Let's Encrypt and enable the SSL. If you don't want to use SSL then disalbe it under 10-ssl.conf file with ssl=no. Do not change the protocol pop3s and imaps.

You are missing the SQL lookup query for the username and password. Depending of your database scheme it may vary from installation to installation so there's no exact example for it to follow. In my case i'm using postfixadmin structure for the database and my query look like this:

Code:
password_query = SELECT password, CONCAT('*:bytes=', quota) AS userdb_quota_rule FROM mailbox WHERE username
= '%u' AND active = true

Code:
user_query = SELECT CONCAT('/mail/', maildir) as home, 110 AS uid, 110 AS gid, CONCAT('*:bytes=', quota) AS q
uota_rule \
             FROM mailbox WHERE username = '%u' AND active = true
VladiBG,

Thank you very much for the quick reply. Glad to know things changed and it's not complete not knowing what I am doing here. :)

My version output is as following:

Code:
dovecot --version
2.3.9.2 (cf2918cac)

I went ahead and removed the # from /usr/local/etc/dovecot/conf.d/10-ssl.conf for the following line:

Code:
ssl = no

Regarding the SQL queries; are you utilizing MySQL for your setup? If so; if I append my dovecot.conf in /usr/local/etc/dovecot/ to the following: (will it work) ?

Code:
!include conf.d/*.conf
!include_try local.conf

passdb sql {
    args = /usr/local/etc/dovecot/dovecot-sql.conf
    driver = sql
}

userdb sql {
    args = /usr/local/etc/dovecot/dovecot-sql.conf
    driver = sql
}

password_query = SELECT password, CONCAT('*:bytes=', quota) AS userdb_quota_rule FROM mailbox WHERE username
= '%u' AND active = true

user_query = SELECT CONCAT('/mail/', maildir) as home, 110 AS uid, 110 AS gid, CONCAT('*:bytes=', quota) AS q
uota_rule \
             FROM mailbox WHERE username = '%u' AND active = true

Thank you again!

~TruthSword
 
No i'm not using MySQL in my setup. I'm using PostgreSQL with postfix.

Instead of manually creating the configuration file it would be easy to copy all examples and then only to modify the required changes.
cd /usr/local/etc/dovecot/example-config
cp -Rp * ../
This will overwrite your current configuration. After that you can proceed and edit the files.
There's a good howto at http://www.purplehat.org/?page_id=4
 
Back
Top