Squirrelmail Install HowTo

Quick and basic steps to installing SquirrelMail on RedHat 7.3

I assume this ficticious setup:


Install stuff, all except the squirrelmail rpm will be on your O/S CDs:
# rpm -Uvh gd-1.8.4-11.i386.rpm         May already be installed
# rpm -Uvh httpd-2.0.40-21.i386.rpm     May already be installed
# rpm -Uvh php-4.2.2-17.i386.rpm        May already be installed
# rpm -Uvh mod_ssl-2.0.40-21.i386.rpm   May already be installed
# 
# rpm -Uvh squirrelmail-1.4.1-2.noarch.rpm

Setup Squirrelmail:
# vi /usr/share/squirrelmail/config/config.php
	/* $org_name			= "SquirrelMail"; */
	$org_name			= "Oursite Limited";

	$org_logo			= SM_PATH . 'oursiteLogo.png';
	$org_logo_width			= '250';
	$org_logo_height		= '75';

	/* $imapServerAddress		= 'localhost'; */
	$imapServerAddress		= 'our_imap_server.oursite.co.nz';

	/* $imap_server_type		= 'uw'; */
	$imap_server_type		= 'exchange';

	/* $allow_thread_sort		= true; */
	$allow_thread_sort		= false;

	/* $default_left_size		= '150'; */
	$default_left_size		= '170';

	/* $default_folder_prefix	= 'mail/'; */
	$default_folder_prefix		= '';

	/* $sent_folder			= 'Sent'; */
	$sent_folder			= 'Sent Items';

	/* $trash_folder		= 'Trash'; */
	$trash_folder			= 'Deleted Items';

	/* $useSendmail			= true; */
	$useSendmail			= false;

	/* $smtpServerAddress		= 'localhost'; */
	$smtpServerAddress		= 'smtp_server.oursite.co.nz';

People are allowed to attach 10MB files
# vi /etc/php.ini
	; Maximum amount of memory a script may consume
	; memory_limit = 8M
	memory_limit = 20M

	; Maximum size of POST data that PHP will accept.
	; post_max_size = 8M
	post_max_size = 10M

	; Maximum allowed size for uploaded files.
	; upload_max_filesize = 2M
	upload_max_filesize = 20M

# vi /etc/httpd/conf.d/php.conf
	# LimitRequestBody 524288
	LimitRequestBody 12000000

Setup secure webserver:
# vi /etc/httpd/conf.d/ssl.conf
	# DocumentRoot "/var/www/html"
	DocumentRoot "/usr/share/squirrelmail"

	# ServerName new.host.name:443
	ServerName webmail.oursite.co.nz:443

	# ServerAdmin you@your.address
	ServerAdmin c.mills@oursite.co.nz

Redirect insecure connects to secure:
# vi /var/www/html/index.html
<html>
 <head>
  <meta http-equiv="Refresh" content="0;url=https://webmail.oursite.co.nz/">
 </head>
 <body>
 </body>
</html>

Poke a hole in the firewall for web access:
# vi /etc/sysconfig/iptables
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 443 --syn -j ACCEPT
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 80 --syn -j ACCEPT


Make a self-signed certificate and start things up:
# touch /etc/httpd/conf/ssl.crt/server.crt
# cd /etc/httpd/conf
# make testcert
# chkconfig httpd on
# chkconfig iptables on
# service iptables start
# service httpd start

Your webmail is now accessible at https://webmail.oursite.co.nz/

Add Logging of Successful and Failed Logins

Install the plugin:
# cd /usr/share/squirrelmail/plugins/
# tar -xvzf ~/squirrel_logger.1.3.0-1.0.6.tar.gz

Configure the plugin:
# vi /usr/share/squirrelmail/plugins/squirrel_logger/setup.php
           // $sl_logfile = "../data/access_log";
           $sl_logfile = "/var/log/squirrelmail.log";

           // $sl_delimiter= ",";
           $sl_delimiter= "\t";

           // $sl_dateformat = "m/d/Y G:i:s";
           $sl_dateformat = "Y/m/d H:i:s";

Enable the plugin:
# vi /usr/share/squirrelmail/config/config.php
        $plugins[2] = 'newmail';
        $plugins[3] = 'squirrel_logger';

Hook to log failed logins:
# vi /usr/share/squirrelmail/functions/imap_general.php
                include_once(SM_PATH . 'functions/display_messages.php' );
                do_hook('invalid_login');
                sqsession_destroy();

Create log file:
# touch /var/log/squirrelmail.log
# chown apache:apache /var/log/squirrelmail.log
# chmod 640 /var/log/squirrelmail.log


Problems


Todo


Rebuild from source rough notes dated 2004-09-06

cd ~/Build
gtar -xvzf ~/openssl-0.9.7d.tar.gz
cd openssl-0.9.7d/
./config --prefix=/opt/openssl/0.9.7d
make
sudo make install
cd /opt/openssl/
sudo rm -f P
sudo ln -s 0.9.7d P

cd ~/Build
gtar -xvzf ~/httpd-2.0.50.tar.gz
cd httpd-2.0.50
./configure --enable-so --prefix=/opt/httpd/2.0.50 --enable-ssl --with-ssl=/opt/openssl/P
make
sudo make install
cd /opt/httpd/
sudo rm -f P
sudo ln -s 2.0.50 P


cd ~/Build
gtar -xvzf ~/libxml2-2.6.12.tar.gz
cd libxml2-2.6.12
./configure --prefix=/opt/libxml2/2.6.12
make
sudo make install
cd /opt/libxml2/
sudo rm -f P
sudo ln -s 2.6.12 P

cd ~/Build
gtar -xvjf ~/php-5.0.1.tar.bz2
cd php-5.0.1
./configure --prefix=/opt/php/5.0.1 --with-libxml-dir=/opt/libxml2/P --with-apxs2=/opt/httpd/P/bin/apxs
make
sudo make install
sudo cp php.ini-dist /usr/local/lib/php.ini
ln -s /etc/php.ini /opt/php/5.0.3/lib/

sudo vi /opt/httpd/2.0.50/conf/httpd.conf

	# DirectoryIndex index.html index.html.var 
	DirectoryIndex index.html index.html.var index.php

	AddType application/x-httpd-php .php .phtml
	AddType application/x-httpd-php-source .phps

sudo mkdir /opt/squirrelmail
cd /opt/squirrelmail
sudo sudo gtar -xvjf ~/squirrelmail-1.4.3a.tar.bz2
sudo mv squirrelmail-1.4.3a 1.4.3a
sudo rm -f P
sudo ln -s 1.4.3a P
cd P
sudo mkdir attachments
# sudo vi .htaccess
sudo chmod -R 777 attachments data
cd config
cp /usr/share/squirrelmail/logo.gif /opt/squirrelmail/P/images/
sudo perl conf.pl
# sudo vi /opt/squirrelmail/P/config/config.php


cd /opt/squirrelmail/P/plugins/
tar -xvzf ~/squirrel_logger.1.4.0-1.0.6.tar.gz
vi /opt/squirrelmail/P/plugins/squirrel_logger/setup.php

	// $sl_logfile = "../data/access_log";
	$sl_logfile = "/var/log/squirrelmail.log";

	// $sl_delimiter= ",";
	$sl_delimiter= "\t";

	// $sl_dateformat = "m/d/Y G:i:s";
	$sl_dateformat = "Y/m/d H:i:s";

# Copy users preferences across
cd /opt/squirrelmail/P/data/
mkdir OLD
mv *.pref *.abook *.cal OLD/
cp /var/lib/squirrelmail/prefs/* .
chown nobody *



sudo mkdir /opt/httpd/conf/
sudo cp ~cmills/server.crt /opt/httpd/conf/
sudo cp ~cmills/server.key /opt/httpd/conf/
sudo chown root:root /opt/httpd/conf/ /opt/httpd/conf/*
sudo chmod o-rwx /opt/httpd/conf/ /opt/httpd/conf/*

sudo vi /opt/httpd/2.0.50/conf/ssl.conf

	# SSLCertificateFile /opt/httpd/2.0.50/conf/ssl.crt/server.crt
	SSLCertificateFile /opt/httpd/conf/server.crt

	# SSLCertificateKeyFile /opt/httpd/2.0.50/conf/ssl.key/server.key
	SSLCertificateKeyFile /opt/httpd/conf/server.key

	# DocumentRoot "/opt/httpd/2.0.50/htdocs"
	DocumentRoot "/opt/squirrelmail/P"

sudo /opt/httpd/P/bin/apachectl startssl


sudo vi /opt/httpd/P/htdocs/index.html

	<html>
	 <head>
	  <meta http-equiv="Refresh"
	content="0;url=https://webmail.oursite.co.nz/">
	 </head>
	 <body>
	 </body>
	</html>

vi /usr/local/lib/php.ini

	; memory_limit = 8M
	memory_limit = 20M

	; post_max_size = 8M
	post_max_size = 10M     

	; upload_max_filesize = 2M
	upload_max_filesize = 20M

ln -s /etc/php.ini /opt/php/5.0.3/lib/


Squirrelmail upgrade from 1.4.4 to 1.4.5 rough notes dated 2005-07-09

/opt/httpd/P/bin/apachectl stop

cd /opt/squirrelmail/
rm -f P
gtar -xvjf ~/squirrelmail-1.4.5.tar.bz2
mv squirrelmail-1.4.5 1.4.5
ln -s 1.4.5 P

cd P
mkdir attachments
chmod -R 777 attachments data

cd config
cp /opt/squirrelmail/1.4.4/images/logo.gif /opt/squirrelmail/P/images/
cp /opt/squirrelmail/1.4.4/config/config.php .

cd /opt/squirrelmail/P/plugins
tar -xvzf ~/squirrel_logger.1.4.0-1.0.6.tar.gz
vi /opt/squirrelmail/P/plugins/squirrel_logger/setup.php

	// $sl_logfile = "../data/access_log";
	$sl_logfile = "/var/log/squirrelmail.log";

	// $sl_delimiter= ",";
	$sl_delimiter= "\t";

	// $sl_dateformat = "m/d/Y G:i:s";
	$sl_dateformat = "Y/m/d H:i:s";

# Insert before session_destroy()
vi +572 /opt/squirrelmail/P/functions/imap_general.php

	do_hook('invalid_login');

cd /opt/squirrelmail/1.4.4
cp favicon.ico ../P

cd data
find . -depth -print0 | cpio -pvumd0 /opt/squirrelmail/P/data

/opt/httpd/P/bin/apachectl startssl

Megan Mills

Document History
Tue Aug 19 17:23:59 NZST 2003 c.mills Created
Wed Aug 20 07:33:09 NZST 2003 c.mills Exchange imap type tweak, redirect http
Wed Oct  8 09:57:44 NZDT 2003 c.mills Typos fix :-(
Fri Oct 10 08:49:59 NZDT 2003 c.mills Logging of good/bad logins
Fri Sep 24 12:57:53 NZST 2004 c.mills Rough rebuild notes added
Tue Mar 22 15:41:13 NZST 2005 c.mills php.ini location notes
Tue Jul 19 11:32:59 NZST 2005 c.mills Patch squirrelmail only
Clark Mills
c.mills@auckland.ac.nz