Home > Linux, Servers, Tech > Virtual Mail Server Howto

Virtual Mail Server Howto

Well, I know it’s been a while since I’ve posted something new, but then again as my regular readers only count in single figures (i.e. me) I don’t think that will be a problem.

I’ve finally finished stage one of my Cyprix Mail Server Howto!

The howto is a very much step-by-step method of setting up a virtual domain, virtual user mail server using:

Currently the howto is based on Mandriva Linux, however with minor changes it can be applied to most Linux/Unix based distributions.

As I mentioned before this system uses virtual domains and users (and aliases) in a MySQL database. Hence it is highly expandable, and can host as many users and different domain names as you wish (well as much as your hardware will allow).

For those who peruse the Mandriva Club Forums, you will have seen this howto appear before, however it has now been updated & tested to work with Mandriva Linux 2007. (see my release candidate review here)

I’m looking for others to increase the scope and functionality of the howto so feel free to register on the wiki and translate the document or add other modules such as spamassasin, clamav etc.

The whole basis of this system is to be highly flexible, and as such I am developing an AJAX/PHP web application for managing this setup. Simply enough it’s called CyprixMail.

If anyone is interested in helping with development of CyprixMail, comment here or send an email to cyprixmail[at]cyprix[dot]com[dot]au. Hopefully the first alpha release will be open to the public soonish. License will be GPLv2.

Categories: Linux, Servers, Tech Tags:
  1. Richard
    February 19th, 2007 at 18:59 | #1

    Hi,
    This was the first workthrough that actually worked for me. I had previously tried to get postfix/courier working on Mandriva, but had givenup and used eXtremail in the end.
    When interfacing roundcubemail with eXtremail it turns out they are not compatible, so I found your write-up and got everything working just fine.

    I’d love to try your admin interface and help out with it.

    Cheers,

    Richard

  2. Doug Lytle
    March 10th, 2008 at 03:43 | #2

    I’ve been trying to get this to work under Mandriva 2008.0 but it wasn’t allowing incoming email. Doing LOTS of Googling turned up the following that needs to be used with Postfix version 2.4.5

    local_transport = virtual
    local_recipient_maps = $virtual_mailbox_maps

    Without it, postfix tries to verify the account against the local user accounts and comes back with account name not found.

  3. March 10th, 2008 at 09:47 | #3

    Thanks Doug.

    I’ve added that to the wiki now. I had previously setup the local accounts with a different domain.

  4. Doug Lytle
    March 16th, 2008 at 00:24 | #4

    I see by the comments in the tables for active that you don’t use it,

    but if you’d like to expand a little bit, you can add the following to the mysql query files for users and aliases. I quite often add temporary aliases that, after receiving the email, like to disable the address to limit my spam.

    To be added to mysql_aliases.cf and mysql_users.cf

    additional_conditions = AND active = ’1′

  5. March 16th, 2008 at 00:40 | #5

    Thanks again Doug. I’ve added that to the wiki.

  6. March 16th, 2008 at 00:59 | #6

    As a side note – I’ve added you (Doug) to the references list.

  7. Doug Lytle
    March 16th, 2008 at 02:17 | #7

    Thanks!

    I’m just moving over from eXtremail and trying to figure how to get a full featured mail server. I’ll be tackling SSL/TLS next.

  8. Doug Lytle
    April 1st, 2008 at 00:11 | #8

    Okay, this is what I’ve got for the SSL/TLS

    I stole this from HowToForge:

    Additional applications needed:

    courier-authlib
    cyrus-sasl
    libsasl2
    libsasl2-devel
    libsasl2-plug-plain
    libsasl2-plug-anonymous
    libsasl2-plug-crammd5
    libsasl2-plug-digestmd5
    libsasl2-plug-gssapi
    libsasl2-plug-login

    cd /etc/postfix

    openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 3650 -x509

    (Fill out the appropriate fields)

    Now we need to create the .pem

    cat smtpd.cert smtpd.key >courier.pem

    Then copy the courier.pem into the /etc/courier directory

    [postfix config]

    {main.cnf}

    smtpd_use_tls = yes
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_key_file = /etc/postfix/smtpd.key

    permit_sasl_authenticated

    [courier config]

    {imapd-ssl}

    TLS_CERTFILE=/etc/courier/courier.pem

    {pop3d-ssl}

    TLS_CERTFILE=/etc/courier/courier.pem

    [sasl2]

    cd /etc/sasl2

    {smtpd.conf}

    pwcheck_method: authdaemond
    log_level: 5
    mech_list: PLAIN LOGIN
    authdaemond_path:/var/lib/authdaemon/socket

  9. Doug Lytle
    April 1st, 2008 at 00:35 | #9

    Claros web mail

    Now for the best webmail that I’ve found to date. it’s called Claros Intouch2:

    http://www.claros.org/web/home.do

    The instructions on their site is straight forward enough. They have a demo on their website.

    Install:

    urpmi java java-sdk tomcat5

    Grab Claros Intouch2 2.2 beta and extract the contents to a temporary directory.

    Copy the intouch2.war file to /var/lib/tomcat5/webapps

    If Tomcat5 isn’t currently running, start it. Service tomcat5 start

    Tomcat will extract the contents of the .war file into a subdirectory called intouch2

    Create a webdisk directory within the intouch2 directory and chown tomcat5:tomcat5 webdisk

    cd /var/lib/tomcat5/webapps/intouch2/WEB-INF/config

    With your favorite editor, edit the config.xml

    Change the appropriate settings for your mail server

    Two things to note:

    Make sure the Match your directories that are created with maildirmake. I called mine Junk, Sent, Drafts and Trash so they match my current directories.

    The default connection string for mysql didn’t work for me, I had to use the following to get it to work:

    jdbc:mysql://localhost:3306/intouch2?useUnicode=true&characterEncoding=utf-8

    Once the changes have been made, you can restart tomcat5.

    Visiting the http://whateverdomain:8080/intouch2 should get you a login screen.

  1. No trackbacks yet.