Postfix Virtual Hosting With LDAP Backend And With Dovecot As IMAP/POP3 Server On Ubuntu Intrepid Ibex Server 8.10 - Page 5

Want to support HowtoForge? Become a subscriber!
 
Submitted by Miguel (Contact Author) (Forums) on Mon, 2009-01-19 21:07. ::

Step 6: 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=admin,dc=example,dc=tld
password secret
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

Change the default to your actual configuration.

Last but not least execute the following command to make gnarwl work:

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

This concludes the gnarwl configuration. 

 

Step 7: Bringing It All Together And Making It Work

The following command will put into effect the configurations we made before:

/etc/init.d/apache2 stop
/etc/init.d/apache2 start
/etc/init.d/postfix/stop
/etc/init.d/dovecot stop

First we restart postfix:

/etc/init.d/postfix start

We need to do this in order to have the following directory created:

/var/run/dovecot/login

Now we need to make new ssl certificates for Dovecot:

dpkg-reconfigure dovecot-common

If the directory /var/run/dovecot and /var/run/dovecot/login don't exist the reconfigure command above will produce errors complaining that the directories do not exist. In that case just create them. And re-run the command above.

Now we can start Dovecot:

/etc/init.d/dovecot start

You can now browse to http://example.tld/phamm

Log in with the user admin and your OpenLDAP password.

You should now be able to create domains and users.

One more thing: since phamm doesn't actually delete users and / or domains, we need to enable the cleaner.sh that comes with phamm.

cp /var/www/tools/cleaner.sh /home/vmail/.

Edit the file to your settings, but set the  BINDDN to BINDDN="cn=admin,dc=example,dc=tld" for the script to work correctly.

Now we add a crontab to run the script periodically:

crontab -e

And insert the following:

30 * * * * /home/vmail/cleaner.sh

Well everything should be up and running now.


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Anonymous (not registered) on Mon, 2009-03-09 15:20.

hi there, great work on this howto.

there's some work that isn't entirely explicit, which is mostly fine, except for security holes.  since you configure various things to use the rootdn, those configuration files should be unreadable.

# chmod o-rwx /etc/postfix/main.cf (readable by all by default)

# chmod o-rwx /etc/dovecot/dovecot-ldap.conf (secure by default in ubuntu intrepid, but good practice to check)

# chmod o-rwx /etc/gnarwl.cfg (readable by all by default)