Installing a new mailserver: Difference between revisions

From Edgar BV Wiki
Jump to navigation Jump to search
No edit summary
Line 34: Line 34:


= Postfix and Procmail =
= Postfix and Procmail =
First install [[Postfix]]
First install [[Postfix]] as the mail transport agent


= Spamassassin =
= Spamassassin =
Line 40: Line 40:


= Dovecot =
= Dovecot =
[[ Dovecot ]]
Now install [[ Dovecot ]] as an IMAP / POP3 server
 
== after installation ==
Logging:
<pre>
log_path = /var/log/mail/dovecot.err
info_log_path = /var/log/mail/dovecot.info
</pre>
<pre>
touch /var/log/mail/dovecot.err
touch /var/log/mail/dovecot.info
</pre>
in /etc/logrotate.d/rsyslog add
<pre>
/var/log/mail/dovecot.err
/var/log/mail/dovecot.info
</pre>
to the rest of the mail lines
 
Create a maildir for www-data manually (dovecot has no permissions to create in /var/www)
<pre>
mkdir /var/www/Maildir
chown www-data /var/www/Maildir
</pre>
 
To test:
<pre>
mutt -f imap://username@localhost
mutt -f pop://username@localhost
 
or to open a user's maildir:
mutt -m maildir -f ~user/Maildir
</pre>


= Roundcube webmail =
= Roundcube webmail =
We're going to get the backport version as it's much much better
And install [[ Roundcube ]] for webmail
 
so in /etc/apt/sources.list add
<pre>
deb http://backports.debian.org/debian-backports squeeze-backports main
</pre>
 
and to install
<pre>
apt-get -t squeeze-backports install roundcube roundcube-mysql roundcube-plugins roundcube-plugins-extra
</pre>
 
You will need mysql-server, apache2 and php5 as well.
 
then in /etc/roundcube/apache.conf
<pre>
uncomment:
    Alias /roundcube/program/js/tiny_mce/ /usr/share/tinymce/www/
    Alias /roundcube /var/lib/roundcube
</pre>
 
in /etc/roundcube/main.inc.php change
<pre>
$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';
</pre>
 
Settings that need looking at and haven't been enabled yet!
<pre>
$rcmail_config['smtp_server'] = 'localhost';
$rcmail_config['smtp_user'] = '%u';
$rcmail_config['smtp_pass'] = '%p';
</pre>
 
in /usr/local/etc/php.ini
<pre>
upload_max_filesize = 5M</pre>
 
== 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
<pre>
$rcmail_config['plugins'] = array('virtuser_file');
</pre>
To enable it. and then all the way at the bottom set
<pre>
$rcmail_config['virtuser_file'] = '/etc/postfix/virtual';
</pre>
 
=== DragnDrop Attachments ===
You can find that [https://github.com/strimpak/dragndrop_attachments here]
 
download, then unzip and mv to /var/lib/roundcube/plugins/dragndrop_attachments/
 
In main.inc.php
<pre>
$rcmail_config['plugins'] = array('virtuser_file','vcard_attachments','show_additional_headers','emoticons','jqueryui','dragndrop_attachments', 'vacation');
</pre>
 
== Vacation autoresponder ==
Download it from [http://sourceforge.net/projects/rcubevacation/files/ here]
 
unzip it to /var/lib/roundcube/plugins/vacation/
 
The config.ini should look like this:
<pre>
[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
</pre>
 
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:
<pre>
#pagecontent {
width: 800px;
padding-top:70px;
}
</pre>
 
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 =
= Converting from mbox to maildir =

Revision as of 14:48, 17 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 as the mail transport agent

Spamassassin

Then install Spamassassin

Dovecot

Now install Dovecot as an IMAP / POP3 server

Roundcube webmail

And install Roundcube for webmail

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

Webmail performance

package imapproxy implements UP-IMapProxy

Iphone Push

package imaprowl implements push for Iphone and Gmail