|
|
Want to know more about Packt's Article Network? Interested in contributing your article ideas? Please visit our FAQ for more information. See More |
Linux E-mail: Providing Webmail Access (Part 2)
Installing SquirrelMailSquirrelMail may be installed either though a package or directly from source. While no source code compilation takes place in either method, upgrades are made easier using the packages. Many of the various Linux and Unix distributions include the SquirrelMail package. Install the appropriate package from your distribution to use the binary method. On many Linux distributions, this may be an RPM file that begins with squirrelmail…. However, an updated version of SquirrelMail may not be included or available for your specific distribution. The following are the advantages of using the version of SquirrelMail provided with a Linux distribution:
The following are the disadvantages of using the version of SquirrelMail provided with a Linux distribution:
Source installationIf you do not install SquirrelMail through your distribution, you will need to obtain the appropriate tarball. To do so, visit the SquirrelMail website at http://www.squirrelmail.org , and click download it here. At the time of writing, this link is http://www.squirrelmail.org/download.php There are two versions available for download, a stable version and a development version. Unless you have specific reasons for choosing otherwise, it is generally best to choose the stable version. Download and save this file to an intermediate location. $ cd /tmp Next, unpack the tarball (.tar.gz) file. You may use the following command: $ tar xfz squirrelmail-1.4.19.tar.gz Move the folder just created to your web root folder. This is the directory from which Apache serves pages. In this case, we will assume that /var/www/html is your web root. We will also rename the clumsy squirrelmail-1.4.3a folder to a more simple mail folder. You will need to have superuser root privileges in order to do this on most systems. # mv squirrelmail-1.4.19 /var/www/html/mail Here we have used the name mail, so the URL that users will use will be http://www.sitename.com/mail. You can choose another name, such as webmail,and use that directory name instead of mail in the commands that you enter. It is also useful and secure to create a data directory for SquirrelMail that is outside the main web root, so that this folder will be inaccessible from the Web. # mv /var/www/html/mail/data /var/www/sqmdata It is important to make this newly created folder writable by the web server. To be able to do this, you must know the user and group that your web server runs under. This may be nobody and nobody, apache and apache, or something else. You will want to verify this; it will be listed in your httpd.conf file as the User and Group entries. # chown -R nobody:nobody /var/www/sqmdata Finally, we will create a directory to store attachments. This directory is special in that, although the web server should have write access to write the attachments, it should not have read access. We create this directory and assign the correct permissions with the following commands: # mkdir /var/www/sqmdata/attachments SquirrelMail has now been properly installed. All of the folders have been set up with correct permissions that will secure intermediate files from prying eyes. If a user aborts a message that contains an uploaded attachment,the attachment file on the web server will not be removed. It is a goodpractice to create a cron job on the server that erases excess files fromthe attachment directory. For example, create a file called remove_orphaned_attachments and place it in the /etc/cron.dailydirectory. Edit the file to have these lines:#!/bin/sh#!/bin/shrm `find /var/www/sqmdata/attachments -atime +2 | grep -v"."| grep -v _`This will run daily and search the SquirrelMail attachments directory forfiles which are orphaned, and delete them. Configuring SquirrelMailSquirrelMail is configured through the config.php file. To aid the configuration, a conf.pl Perl script has also been provided. These files are located within the config/ directory in the base installation directory. # cd /var/www/html/mail/config Once you have run this command, you should see the following menu:
To select an item from the menu, enter the appropriate letter or number, followed by the Enter key. As SquirrelMail has been developed, it has been noticed that IMAPservers don't always behave in the same way. To get the most out of your setup, you should tell SquirrelMail which IMAP server you are using. To load a default configuration for your IMAP server, enter the D option and type the name of the IMAP server that you have installed. This article covers the Courier IMAP server, so you should choose that. Press Enter again, and you will return to the main menu. We will be moving through the various subsections of the menu and configuring the appropriate options. Type 1 and then press Enter to select the Organization Preferences. You will get a list of items you can change. You may wish to edit the Organization Name, Organization Logo, and Organization Title fields. Once you have modifi ed these to your satisfaction, enter R to return to the main menu. After this, type 2 to visit the Server Settings. This allows you to set the IMAP server settings. It is important that you update the Domain field to the proper value. In our case, the Update IMAP Settings and Update SMTP Settings values should be correct. If you would like to use an IMAP or SMTP server that is located on a different machine, you may wish to update these values. Press R followed by the Enter key to return to the main menu. Next, type 4 to visit the General Options. You will need to modify two options in this section.
We have finished configuring the SquirrelMail settings needed for basic operation. You may return to this script at any time to update any settings you have set. There are many other options to set, including those regarding themes and plugins. SquirrelMail pluginsPlugins are pieces of software that extend or add functionality to a software package. SquirrelMail was designed from the ground up to be very extensible, and includes a powerful plugin system. Currently, there are over 200 different plugins available on the SquirrelMail website. They may be obtained at http://www.squirrelmail.org/ plugins.php. The functionality they provide includes administration tools, visual additions, user interface tweaks, security enhancements, and even weather forecasts. In the following section, we will first go over how to install and configure a plugin. After that, we'll go over some useful plugins, what they do, how to install them, and more. Installing pluginsThese SquirrelMail additions were designed to be simple to set up and configure. In fact, the majority of them follow exactly the same installation procedure. However, a few require custom setup instructions. For all plugins, the installation process is as follows:
Example plugin installationIn this section, we will go over the installation of the Compatibility plugin. This plugin is required in order to install plugins created for older versions of SquirrelMail. No matter how bare-bones your installation, the Compatibility plugin will most likely be part of your setup. Downloading and unpacking the pluginAll available plugins for SquirrelMail are listed on the SquirrelMail website at http://www.squirrelmail.org/ plugins.php. Certain plugins may require a specific version of SquirrelMail. Verify that you havethis version installed. Once you have located a plugin, download it to the plugins/directory within the SquirrelMail root folder.You may locate the Compatibility plugin by clicking on the Miscellaneous categoryin the plugins page on the SquirrelMail plugins web page. This page has a list ofplugins in the Miscellaneous category. Locate Compatibility and click on Detailsand downloads, and then download the latest version.
Download tarball to your SquirrelMail plugin directory. # cd /var/www/mail/plugins Once you have downloaded the plugin to the plugins directory, unpack it using the following command: # tar zxvf compatibility-2.0.14-1.0.tar.gz If a plugin of the same name has already been installed, its files may be overwritten. Verify that you either do not have a plugin of the same name, or save the files before you unpack the tarball. Linux Email
Performing custom installationThe current version of the Compatibility plugin does not require any additional configuration. However, you should always check the documentation for a plugin, as certain other plugins may require custom installation. Once you have unpacked the plugin package, the installation instructions will be listed in the INSTALL file within the newly created plugin directory. It is advisable to check the installation instructions before enabling the plugin in the configuration manager, as some plugins may require custom configuration. Enabling the plugin in conf.plWithin the main menu of the configuration editor, option number 8 is used to configure and enable plugins. Start conf.pl and select option 8. # cd /var/www/mail/plugins You should get the following display when you select this option for the first time:
All the plugins that have been installed and enabled are listed under the Installed Plugins list. All the plugins that have been installed but not enabled are listed under the Available Plugins list. Once you have unpacked a plugin within the plugins/ directory, it will show up under Available Plugins. As you can see in the previous figure, there are a number of installed plugins, but none of them are enabled. As a malfunctioning or wrongly configured plugin can cause SquirrelMail to stop functioning properly, it is advisableto enable plugins one by one, and verify that SquirrelMail works after each one. To enable the Compatibility plugin, locate it in the list Available Plugins (in this case, number 4) and press the Enter key. The Compatibility plugin is now installed. Plugins can be disabled by locating them in the Installed Plugins list and entering their number and pressing Enter. Useful pluginsWe'll now see some useful SquirrelMail plugins that you may consider installing. The information has been compiled to provide a helpful reference while deciding whether to install a plugin. Each plugin contains four specific categories:
Many other plugins exist that handle vacation messages, calendars, shared calendars, notes, to-do lists, exchange server integration, bookmarks, weather information, and much more. Check the Plugins section in the SquirrelMail website for all of the available plugins. Securing SquirrelMailThe SquirrelMail package, in and of itself, is fairly secure. It is well written and does not require JavaScript to function. However, there are a few precautions that may be taken to allow SquirrelMail to run as a secured mail handling solution.
SummaryNow that you've finished this article, you should have a working SquirrelMail installation as well as a greater understanding of the benefits and disadvantages of a webmail solution. You should be familiar with the benefits and drawbacks of a webmail solution. The benefits include remote access, a single central point to be maintained, and simpler testing; while disadvantages include potential performance problems and the security risk of allowing remote access from potentially compromised computers. You are now aware of the main features of SquirrelMail, including its flexibility and the availability of plugins, along with what the prerequisites for installing SquirrelMail are, and how to identify if they are already installed. You also have learned how to configure SquirrelMail, including locating, installing, and configuring plugins. You have been walked through the installation of a key plugin; the Compatibility plugin. Several other useful plugins have also been introduced. Finally, you have learned about some ways to improve the security of SquirrelMail, including web server confi guration and some appropriate plugins. If you have read this article you may be interested to view : Linux Email
About the AuthorAlistair McDonald is a software developer and IT consultant. He has worked as a freelancer in the UK for 15 years, developing cross-platform software systems in C, C++, Perl, Java, and SQL. He has been using open source software for over 20 years and implementing systems using it for the past 10 years. Last year, he gave up his freelance career and joined JDA Software, working in a technical role in their Service Industries division. Alistair is also the author of the book SpamAssassin: A practical guide to integration and configuration, published by Packt . Books from Packt |
|
| ||||||||