Webmail Squirrelmail for Debian

From Edgar BV Wiki
Revision as of 15:25, 5 November 2007 by Red (talk | contribs)
Jump to navigation Jump to search
Squirrelmail requires an IMAP server to be installed.


1) Dovecot seems to be the easiest package.

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

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

protocols = imap imaps
imap_listen = localhost (only localhost because only squirrelmail will be using imap)
imaps_listen = localhost
default_mail_env =	(leave empty due to using the /var/spool/mail/userid structure)

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.