Webmail Squirrelmail for Debian

From Edgar BV Wiki
Jump to navigation Jump to search
Squirrelmail requires an IMAP server to be installed.


1) Dovecot seems to be the easiest package. (apt-get install dovecot-imapd)

Instructions to set up dovecot:
http://www.debian-administration.org/articles/275

The main changes in /etc/dovecot/dovecot.conf

protocols = imap imaps

mail_location = mbox:~/mail:INBOX=/var/mail/%u

mmap_disable = yes (only if mail is mounted over NFS)

then restart dovecot.

To test:
mutt -f imap://username@localhost

NB Dovecot is set up to only work for localhost, which is fine for squirrelmail because it runs on localhost. If you want to be able to use dovecot over internet, you need to set

listen = *

You also need to make sure that the SSL certificate in /etc/ssl/certs/dovecot.pem and /etc/ssl/private/dovecot.pem is up to date

SSL Howto


2) Squirrelmail

http://www.debian-administration.org/articles/200

apt-get the package and install.
It has an installer which is pretty easy to configure. 
If you need to reconfigure it
/var/www/squirrelmail/config/conf.pl

Use sendmail to send the mail, not smtp.
Under 4, General Options, you can make some tweaks. Be sure to set option 11, allow server-side sorting. This greatly improves SquirrelMail performance and works with nearly all IMAP servers

Then set up a virtual host in apache to go to /var/www/squirrelmail. (Debian does the following:

------------------
Alias /squirrelmail /usr/share/squirrelmail

<Directory /usr/share/squirrelmail>
  php_flag register_globals off
  php_value session.gc_maxlifetime 28800
  Options Indexes FollowSymLinks
  <IfModule mod_dir.c>
    DirectoryIndex index.php
  </IfModule>

  # access to configtest is limited by default to prevent information leak
  <Files configtest.php>
    order deny,allow
    deny from all
    allow from 127.0.0.1
  </Files>
</Directory>

# users will prefer a simple URL like http://webmail.example.com
<VirtualHost webmail.euhost.nl>
  DocumentRoot /usr/share/squirrelmail
  ServerName webmail.euhost.nl
</VirtualHost>

# redirect to https when available (thanks omen@descolada.dartmouth.edu)
#
#  Note: There are multiple ways to do this, and which one is suitable for
#  your site's configuration depends. Consult the apache documentation if
#  you're unsure, as this example might not work everywhere.
#
<IfModule mod_rewrite.c>
  <IfModule mod_ssl.c>
    <Location /squirrelmail>
      RewriteEngine on
      RewriteCond %{HTTPS} !^on$ [NC]
      RewriteRule . https://%{HTTP_HOST}%{REQUEST_URI}  [L]
    </Location>
  </IfModule>
</IfModule>
-------------------------------

to which I added php_value session.gc_maxlifetime 28800 to stop the system from chucking you out all the time

If using suphp chown userid:groupid /var/www/squirrelmail/ -R
(both user and group > 100)
make sure the attachments dir is rw for www-data / httpd

in /etc/squirrelmail/default_pref add
left_refresh=600
to stop the system from throwing you out too quickly.

Install Ask User Info plugin so that new users have to set their sent address info the first time they log in. Download the file and copy it to /usr/share/squirrelmail/plugins/askuserinfo then use squirrelmail-config to install it.

NB Roundcube is an alternative to squirrelmail, looks much nicer