Installing a new mailserver: Difference between revisions

From Edgar BV Wiki
Jump to navigation Jump to search
Line 212: Line 212:


Finally, add 'vacation' to the $rcmail_config['plugins'] in roundcube main.inc.php
Finally, add 'vacation' to the $rcmail_config['plugins'] in roundcube main.inc.php
You can find the auto reply in the settings


NB. when testing, you may need to delete the users from the database to check if certain settings are being set before logging in.
NB. when testing, you may need to delete the users from the database to check if certain settings are being set before logging in.

Revision as of 14:01, 15 January 2013

apt-get install openssh-server proftpd snmpd iotop iptstate atsar postfix shorewall vim awstats bmon nscd sshfs mc zip unzip bzip2 arj spamassassin pyzor razor ncftp rsync quota ntpdate ntp vacation pdnsd dovecot-common dovecot-imapd dovecot-pop3d

pdnsd - use resolvconf configuration

Network

Set up networking in /etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
#auto eth0
iface eth0 inet static
        address 192.168.0.112
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
#       gateway 192.168.0.1
        dns-nameservers 213.75.63.36 213.75.63.70 192.168.0.1
#       dns-nameservers 192.168.0.1 192.168.0.2
#       dns-search tripnet.int internal.tripnet.int ops.tripnet.int

auto eth1
iface eth1 inet static
        address 188.204.140.195
        netmask 255.255.255.224
        network 188.204.140.192
        broadcast 188.204.140.223
        gateway 188.204.140.193
        dns-nameservers 213.75.63.36 213.75.63.70 192.168.0.1

Postfix and Procmail

First install Postfix

Spamassassin

Then install Spamassassin

Dovecot

Check the following is set, or dovecot won't let people POP / IMAP in

protocols = imap imaps pop3 pop3s

We need to set it to listen on all interfaces, so uncomment

listen = *

Because we're allowing plaintext auth we need to change

disable_plaintext_auth = no

To set Dovecot to save files in Maildir format and then also use directories to store folders (instead of foldername.mail in one big folder), set NB the documentation says you should use an extra :layout=fs but that breaks just about everything and this way everything is put into subfolders starting with .

mail_location = maildir:~/Maildir

Ensure the following is set for performance

maildir_copy_with_hardlinks = yes

Because we're using NFS for mail storage we need to check:

mmap_disable = yes
dotlock_use_excl = yes # MUST CHECK THIS ONE
mail_nfs_storage = yes
mail_nfs_index = yes

Logging:

log_path = /var/log/mail/dovecot.err
info_log_path = /var/log/mail/dovecot.info
touch /var/log/mail/dovecot.err
touch /var/log/mail/dovecot.info

in /etc/logrotate.d/rsyslog add

/var/log/mail/dovecot.err
/var/log/mail/dovecot.info

to the rest of the mail lines

Create a maildir for www-data manually (dovecot has no permissions to create in /var/www)

mkdir /var/www/Maildir
chown www-data /var/www/Maildir

To test:

mutt -f imap://username@localhost
mutt -f pop://username@localhost

or to open a user's maildir:
mutt -m maildir -f ~user/Maildir

Roundcube webmail

We're going to get the backport version as it's much much better

so in /etc/apt/sources.list add

deb http://backports.debian.org/debian-backports squeeze-backports main

and to install

apt-get -t squeeze-backports install roundcube roundcube-mysql roundcube-plugins roundcube-plugins-extra

You will need mysql-server, apache2 and php5 as well.

then in /etc/roundcube/apache.conf

uncomment:
    Alias /roundcube/program/js/tiny_mce/ /usr/share/tinymce/www/
    Alias /roundcube /var/lib/roundcube

in /etc/roundcube/main.inc.php change

$rcmail_config['htmleditor'] = 0; to 1
$rcmail_config['preview_pane'] = 0; to 1
$rcmail_config['default_host'] = '127.0.0.1';
$rcmail_config['language'] = 'nl_NL';

Settings that need looking at and haven't been enabled yet!

$rcmail_config['smtp_server'] = 'localhost';
$rcmail_config['smtp_user'] = '%u';
$rcmail_config['smtp_pass'] = '%p';

in /usr/local/etc/php.ini

upload_max_filesize = 5M

Plugins

virtuser_file

This comes with the roundcube-plugins package and makes roundcube read the identities (@domain.ext) from a file in the format:

email@domain.ext user email2@domain2.ext user2

If a user has multiple @domain.ext set in the file, then it makes multiple entries you can choose from as your from address.

Find in /etc/roundcube/main.inc.php

$rcmail_config['plugins'] = array('virtuser_file');

To enable it. and then all the way at the bottom set

$rcmail_config['virtuser_file'] = '/etc/postfix/virtual';

DragnDrop Attachments

You can find that here

download, then unzip and mv to /var/lib/roundcube/plugins/dragndrop_attachments/

In main.inc.php

$rcmail_config['plugins'] = array('virtuser_file','vcard_attachments','show_additional_headers','emoticons','jqueryui','dragndrop_attachments', 'vacation');

Vacation autoresponder

Download it from here

unzip it to /var/lib/roundcube/plugins/vacation/

The config.ini should look like this:

[default]
driver = "ftp"
subject = "Afwezig"
body = "default.txt"

[dotforward]
binary = "/usr/bin/vacation"
flags = ""
message = ".vacation.msg"
database = ".vacation.db"
alias_identities = true
set_envelop_sender = false
always_keep_message = true

in Roundcube 0.5 the page layout has changed and the plugin displays incorrectly. To fix this, edit

plugins/vacation/skins/default/vacation.css

and add in some padding:

#pagecontent {
width: 800px;
padding-top:70px;
}

Also edit plugins/vacation/default.txt

Note that it won't save the autoresponder message and subject if you don't tick the checkbox on the top of the page (which we've moved down a bit above)

Finally, add 'vacation' to the $rcmail_config['plugins'] in roundcube main.inc.php

You can find the auto reply in the settings

NB. when testing, you may need to delete the users from the database to check if certain settings are being set before logging in.

Converting from mbox to maildir

Because we want the system to support IMAP functionality fully, there are some changes to to be made which will be documented further. For now, look at Converting from mbox to maildir