There is a new version of this tutorial available for Ubuntu 18.04 (Bionic Beaver).

Postfix Virtual Hosting With LDAP Backend And With Dovecot As IMAP/POP3 Server On Ubuntu Trusty Tahr 14.04 - Page 4

Step 4: Install And Configure Dovecot

aptitude install dovecot-imapd dovecot-pop3d dovecot-ldap

This will install dovecot and all necessary files and also create the standard ssl certificates for IMAPs and POP3s.

First we change in to the dovecot directory.

 cd /etc/dovecot

 Now we configure the different dovecot configuration files.

vi  dovecot-ldap.conf.ext

 And make the following changes:

hosts           = localhost:389
ldap_version    = 3
auth_bind       = yes
dn              = cn=phamm,o=hosting,dc=example,dc=tld
dnpass          = readonly
base            = o=hosting,dc=hosting,dc=tld
scope           = subtree
deref           = never

user_attrs = quota=quota=maildir:storage
user_attrs = quota=quota=maildir:storage=%$B
user_filter = (&(objectClass=VirtualMailAccount)(accountActive=TRUE)(mail=%u))
pass_attrs = mail,userPassword
pass_filter = (&(objectClass=VirtualMailAccount)(accountActive=TRUE)(mail=%u))
default_pass_scheme = MD5

cd conf.d

vi 10-auth.conf

 And change the section Password and User Databases to this:

#!include auth-deny.conf.ext
#!include auth-master.conf.ext

#!include auth-system.conf.ext
#!include auth-sql.conf.ext
!include auth-ldap.conf.ext
#!include auth-passwdfile.conf.ext
#!include auth-checkpassword.conf.ext
#!include auth-vpopmail.conf.ext
#!include auth-static.conf.ext

vi 10-mail.conf

 And make the following changes:

mail_location = maildir:/home/vmail/%d/%u

mail_uid = 1000

mail_gid = 1000

first_valid_uid = 1000

first_valid_gid = 1000

vi 10-master.conf

And make the following changes:

   unix_listener auth-userdb {
    mode = 0666
    user = vmail
    group = vmail

  # Postfix smtp-auth
  unix_listener /var/spool/postfix/private/auth {
    mode = 0666

 vi 15-lda.conf

And make the following changes:

postmaster_address = [email protected]

lda_mailbox_autocreate = yes

This concludes the Dovecot configuration.

Step 5: Install And Configure gnarwl

Let's install gnarwl:

apt-get install gnarwl

Now let's configure gnarwl.

First we're going to back up the original configuration file and replace it with a new one.

mv /etc/gnarwl.conf /etc/gnarwl.conf.bck

Now we create the new conf file:

vi /etc/gnarwl.conf

And insert the following:

map_sender $sender
map_receiver $recepient
map_subject $subject
map_field $begin vacationStart
map_field $end vacationEnd
map_field $fullname cn
map_field $deputy vacationForward
map_field $reply mail
server localhost
port 389
scope sub
login cn=phamm,o=hosting,dc=example,dc=tld
password readonly
protocol 0
base dc=example,dc=tld
queryfilter (&(mailAutoreply=$recepient)(vacationActive=TRUE))
result vacationInfo
blockfiles /var/lib/gnarwl/block/
umask 0644
blockexpire 48
mta /usr/sbin/sendmail -F $recepient -t $sender
maxreceivers 64
maxheader 512
charset ISO8859-1
badheaders /var/lib/gnarwl/badheaders.db
blacklist /var/lib/gnarwl/blacklist.db
forceheader /var/lib/gnarwl/header.txt
forcefooter /var/lib/gnarwl/footer.txt
recvheader To Cc
loglevel 3

Make the gnarwl directory readable for the vmail user

chown -R vmail:vmail /var/lib/gnarwl/

Next we need to add the gnarwl transport to postfix

vi /etc/postfix/transport

Insert the following:

.autoreply      gnarwl:

postmap /etc/postfix/transport

This concludes the gnarwl configuration.

Share this page:

Suggested articles

0 Comment(s)

Add comment


From: Miguel