Installation Guide: IMP 3.2.1 on RedHat 9






Index
1. Introduction
2. Prerequisites
3. Configuring Apache
3.1 Configure PHP
3.2 Configure the VirtualHost
3.3 Create the directories
3.4 Test Apache
4. Configuring Horde
4.1 Download and Install Horde
4.2 Download and Install Pear
4.3 Configure mysql
4.4 Configure Horder config files
4.5 Test Horde
5. Configuring IMP
5.1 Download and Install IMP
5.2 Configure Horde for IMP
5.3 Configure IMP config files
5.4 Test IMP
6. Configuring Turba
6.1 Download and Install Turba
6.2 Configure Horde for Turba
6.3 Configure MySQL for Turba
6.4 Test Turba
7. Configuring Passwd
7.1 Download and Install poppassd-ceti
7.2 Download and Install Passwd
7.3 Configure Horde for Passwd
7.4 Configure IMP for Passwd
7.5 Test Passwd
8. Security
9. Troubleshooting/Notes
10. Links
11. About
















 
 





1. Introduction
In this document we describe step by step instructions on how to configure IMP 3.2.1 from www.horde.org in a Linux box running RedHat Linux 9
This guide may help you configure a basic installation of IMP so you can later tweak IMP to your specific requirement.
We use the .tar.gz installation method.

After reading this guide you should be able to have up and running:
Horde, IMP, Turba, poppassd and the Passwd module for Horde.

We will use a sample Linux server with this characteristics:
Intranet IP:
192.168.1.1
Internet IP:
192.168.1.2
Hostname:
mail.example.com
Domain:
example.com
SMTP host:
mail.example.com
IMAP host:
localhost
IMAP folder:
~/mail/
SQL host:
localhost

Servers used:
SMTP Server: sendmail
SQL Server: MySQL
PostgreeSQL (need work)
IMAP Server:
WU-IMAP 2001a
poppassd Server:
poppassd-ceti 1.8.3

Versions used:
RedHat:
9
Horde:
2.2.3
IMP:
3.2.1
Turba:
1.2
Passwd:
2.2
Pear:
1.1 (form horde.org)

Modules Used:
Horde:
PHP Framework
IMP:
Horde IMAP Client
Turba:
Horde Contact Manager
Passwd:
Horde Password changer

Many file will have to be edited in Horde, and to indicate which file should be edited, we will use a table like this:
File: here will be the path of the file
Content:
here will be the
lines that you should
edit/add in this file

When shell commands should be executed, the commands will be showed like this:
# echo "Hello World"
# echo "Hello World 2" # this is a comment for this command

2. Prerequisites
In order to follow this instructions, you need to have RedHat Linux 9 and this RPM installed:
httpd-2.0.40-21
php-4.2.2-17
php-imap-4.2.2-17
php-ldap-4.2.2-17
php-mysql-4.2.2-17
mysql-server-3.23.56-1.73
mysql-3.23.56-1.73
imap-2001a-18
sendmail-8.12.8-5.90

I'm sure this guide can be used for other distributions(Debian, SuSE, Mandrake, etc), but I don't have access to them right now.
You need to have all this rpm installed and running. Test that all this rpm are working properly before installing and configuring Horde.

3. Configuring Apache
The installation directory will be:
/var/www/html/mail/

3.1 Configure PHP
First, configure php in /etc/php.ini. This lines should be configured:
/etc/php.ini
file_uploads = On
// short_open_tag is not needed in newer versions of IMP
//short_open_tag = On

Configure the maximum attachment size in PHP(is is the value for POST and GET methods in PHP):
/etc/httpd/conf.d/php.conf
<Files *.php>
    SetOutputFilter PHP
    SetInputFilter PHP
    # max attachment size: 512 kbytes
    LimitRequestBody 524288
</Files>

3.2 Configure the VirtualHost
Edit the apache config file and add a VirtualHost :

3.2.1 /etc/httpd/conf/httpd.conf
/etc/httpd/conf/httpd.conf
# make .htpasswd work
<Directory /var/www/html/mail/horde>
  AllowOverride All
</Directory>

# One NameVirtualHost per IP address
NameVirtualHost 192.168.1.1:80
NameVirtualHost 192.168.1.2:80

<VirtualHost 192.168.1.1:80 192.168.1.2:80>
    ServerAdmin webmaster@example.com
    DocumentRoot /var/www/html/mail/horde/imp
    ServerName mail.example.com
    ErrorLog /var/log/httpd/mail/error_log
    CustomLog /var/log/httpd/mail/access_log combined

    Alias /horde /var/www/html/mail/horde/
    Alias /horde/ /var/www/html/mail/horde/
</VirtualHost>

3.3 Create the directories
Create all the necessary directories:
# mkdir -p /var/www/html/mail/horde/imp/
# mkdir -p /var/log/httpd/mail/

3.4 Test Apache
restart apache for the changes to take effect:
# service httpd configtest
# service httpd restart

creating a temporary file:
# touch /var/www/html/mail/horde/imp/test.html

and browsing to:
http://mail.example.com/
You should see the file named test.html

4. Configuring Horde
Once Apache is setup, we need to configure Horde.

4.1 Download and Install Horde:
# cd /tmp
# wget -c http://ftp.horde.org/pub/horde/horde-2.2.3.tar.gz
# tar xzf horde-2.2.3.tar.gz -C /var/www/html/mail
# cd /var/www/html/mail
# mv horde-2.2.3/* horde/
# rmdir horde-2.2.3

4.2 Download and Install Pear
In RedHat 9, we already have a version of Pear installed in /usr/share/pear by the php rpm package.

If you want to use the RedHat 9 version of pear, update your pear installation by running these commands:
# pear upgrade
# pear list-upgrades
# pear install

If you have troubles with RedHat Pear, you can install the latest version of Pear from Horde:
# cd /usr/share
# mv pear pear.4.2.2.rh9
# cd /tmp
# wget -c http://ftp.horde.org/pub/pear/pear-1.1.tar.gz
# tar xzf pear-1.1.tar.gz -C /usr/share
# cd /usr/share
# chown root.root -R pear
Remember that if you update your php rpms, you need to do this procedure again.

4.3 Configure mysql
Check that mysql is running:
# service mysqld restart

Create the horde database:
# cd horde/scripts/db
# vi mysql_create.sql # >>>Important<<< edit the default password
# mysql --user=root --password < mysql_create.sql # create the tables
# mysqladmin --user=root --password reload  # restart the mysql server
If the user root does not have a password in mysql, just press ENTER when asked for a password.

Test to see if you can connect to the database:
# mysql -h localhost -D horde -u horde -p
Exit mysql with the command 'exit'
If you can't connect, look a the troubleshooting guide before continuing

4.3.1 Configure PostgreeSQL
Check that postgreesql is running:
# service postgresql restart

Create the horde database:
# cd horde/scripts/db
# vi pgsql_create.sql # >>>Important<<< edit the default password by uncommenting the last line
# psql -d template1 -f pgsql_create.sql -U postgres # create the database and horde user
Important note: Depending on how is your postgreesql database security configured, you may need to supply a user name and/or password to connect to the database. If any problems, check your pg_hba.conf file in postgreesql installation

Create the horde system tables in the database created
# psql -d horde -U horde -f auth.sql
# psql -d horde -U horde -f category.sql
# psql -d horde -U horde -f prefs.sql
Note: You will see "NOTICE" messages from the postgreesql database indicating that implicit indexes has been created

Test to see if you can connect to the database:
# psql -h localhost -d horde -U horde
Note: You can ommit the "-h" option. If you don't, remember to allow postgreesql database to receive connections through TCP/IP
Exit psql with the command '\q'
If you can't connect, or have other database related problems, look at the troubleshooting section before continuing

4.4 Configure Horde config files
Make a copy of the default configuration files for editing:
# cd horde/config
# for foo in *.dist; do cp -v $foo `basename $foo .dist`; done

Then edit the following files:
4.4.1 horde/config/horde.php
horde/config/horde.php
// Optional. RedHat's 9 PHP does have zlib support
$conf['compress_pages'] = true;

// use IMAP to authenticate users
$conf['auth']['driver'] = 'imap';
$conf['auth']['params']['dsn'] = '{localhost/imap:143}INBOX';

// use MySQL to store Horde Stuff
$conf['prefs']['driver'] = 'sql';
$conf['prefs']['params']['phptype'] = 'mysql';
//$conf['prefs']['params']['phptype'] = 'pgsql';
$conf['prefs']['params']['hostspec'] = 'localhost';
$conf['prefs']['params']['username'] = 'horde';
$conf['prefs']['params']['password'] = '******';  /* <- edit this line */
$conf['prefs']['params']['database'] = 'horde';
$conf['prefs']['params']['table'] = 'horde_prefs';

// the sendmail, not SMTP, to send emails
$conf['mailer']['type'] = 'sendmail'

4.4.2 /etc/mail/trusted-users
Add the user 'apache' to the list of trusted users to sendmail.
This will allow the local user apache to send emails as other users:
/etc/mail/trusted-users
apache

4.4.3 horde/config/lang.php
Configure the default language for Horde
horde/config/lang.php
// look down for the list of aliases
$nls['defaults']['language'] = 'en_US';
//$nls['defaults']['language'] = 'es_ES';

4.5 Test Horde
Test the initial configuration of horde by browsing:
http://mail.example.com/horde/test.php
You should see a page like this example

Then try this page:
http://mail.example.com/horde/
If you see some errors, look at the troubleshooting guide before continuing.

Security Issue
Make sure you can *not* see the contents of this URL:
http://mail.example.com/horde/config/
If you can see the contents of this URL, check you apache configuration (Point 3.2.1)

5. Configuring IMP
5.1 Download and Install IMP:
# cd /tmp
# wget -c http://ftp.horde.org/pub/imp/imp-3.2.1.tar.gz
# tar xzf imp-3.2.1.tar.gz -C /var/www/html/mail/horde
# cd /var/www/html/mail/horde
# mv imp-3.2.1/* imp/
# rmdir imp-3.2.1

5.2 Configure Horde for IMP
Edit this files to allow IMP to run under Horde:

5.2.1 horde/config/registry.php
Register IMP in Horde
horde/config/registry.php
// uncomment the following
$this->registry['auth']['login'] = 'imp';
$this->registry['auth']['logout'] = 'imp';

// show the imp icon in horde
$this->applications['imp'] = array(
    ...
    'status' => 'active'
);

5.3 Configure IMP config files
Make a copy of the default configuration files for editing:
# cd horde/imp/config
# for foo in *.dist; do cp -v $foo `basename $foo .dist`; done

Now, edit this IMP config files in horde/imp/config
5.3.1 horde/imp/config/servers.php
horde/imp/config/servers.php
// edit this lines
$servers['imap'] = array(
    'name' => 'IMAP Server',
    'server' => 'localhost',
    'protocol' => 'imap/notls',
    'port' => 143,
    'folders' => 'mail/', /* or just use 'folders' => '' */
    'namespace' => '',
    'maildomain' => 'example.com',
    'smtphost' => 'mail.example.com',
    'realm' => '',
    'preferred' => ''
);
If you use 'folders' => 'mail/', then the IMAP folders will be created in /home/user/mail/

5.3.2 horde/imp/config/prefs.php
Optional, edit this file for better customization
horde/imp/config/prefs.php
// user language
// look at horde/config/lang.php for language aliases
$_prefs['language'] = array(
    'value' => 'en_US',
    'locked' => false,
    'shared' => true,
    'type' => 'select',
    'desc' => _("Select your preferred language:")
);

// user default mailbox
// the default inbox cannot be changed
$_prefs['mailbox'] = array(
    'value' => 'INBOX',
    'locked' => true,
    'shared' => false,
    'type' => 'implicit'
);

// use IMAP subscribe?
// show only folders subscribed by IMAP
$_prefs['subscribe'] = array(
    'value' => 1,
    'locked' => true,
    'shared' => false,
    'type' => 'checkbox',
    'desc' => _("Use IMAP folder subscriptions")
);

// sent mail folder
// Use the same name as in Mozilla, Outlook Express, etc
$_prefs['sent_mail_folder'] = array(
    'value' => 'Sent',
    'locked' => false,
    'shared' => true,
    'type' => 'implicit'
);

// trash folder
// Use the same name as in Mozilla, Outlook Express, etc
$_prefs['trash_folder'] = array(
    'value' => 'Trash',
    'locked' => false,
    'shared' => false,
    'type' => 'implicit'
);

5.4 Test IMP
Now is time to test IMP, browse to:
http://mail.example.com/horde/imp/test.php
complete the test.php form like this example

You should see a result page like this example after you test the IMAP connection.

If the test page works, try sending an email to another server and to yourself.
If you have any troubles, look at the troubleshooting guide before continuing.


Security Issue
Make sure you can *not* see the contents of this URL:
http://mail.example.com/horde/imp/config/
If you can see the contents of this URL, check you apache configuration (Point 3.2.1)

6. Configuring Turba
Now we have up and running Horde and IMP and we need a contact manager, alias, Address Book.

6.1 Download and Install Turba
# cd /tmp
# wget -c http://ftp.horde.org/pub/turba/turba-1.2.tar.gz
# tar xzf turba-1.2.tar.gz -C /var/www/html/mail/horde
# cd /var/www/html/mail/horde
# mv turba-1.2 turba

6.1.1 Configure Turba config files
Make a copy of the default configuration files for editing:
# cd horde/turba/config
# for foo in *.dist; do cp -v $foo `basename $foo .dist`; done

6.2 Configure Horde for Turba
Edit this files to allow Turba to run under Horde.

6.2.1 horde/config/registry.php
horde/config/registry.php
// show the turba icon in horde
$this->applications['turba'] = array(
    ...
    'status' => 'active'
);

6.2.2 horde/imp/config/conf.php
Configure in IMP an icon for Turba
horde/imp/config/conf.php
$conf['menu']['apps'] = array('turba');

6.2.3 horde/turba/config/conf.php
Configure in Turba an icon for IMP
horde/turba/config/conf.php
$conf['menu']['apps'] = array('imp');

6.2.4 horde/turba/config/prefs.php
horde/turba/config/prefs.php
// user language
// set the same default language as Horde and IMP
$_prefs['language'] = array(
    'value' => 'en_US',
    'locked' => false,
    'shared' => true,
    'type' => 'select',
    'desc' => _("Select your preferred language:")
);

6.2.5 horde/turba/config/sources.php
Configure Turba to use MySQL to store all the contact data
horde/turba/config/sources.php
// complete this part of the config with the data
// of the database as in horde/config/horde.php
// Also config the title to a know name in your locale
$cfgSources['localsql'] = array(
    'title' => 'My Addressbook',
    'type' => 'sql',
    'params' => array(
        'phptype' => 'mysql',
        'hostspec' => 'localhost',
        'username' => 'horde',
        'password' => '******', /*Edit this line!!!*/
        'database' => 'horde',
        'table' => 'turba_objects'
    ),
    ... 

6.3 Configure MySQL for Turba
Now create the table in MySQL that Turba will use:
# cd horde/turba/scripts/drivers/
# mysql --user=root --password < mysql_create.sql

6.4 Test Turba
To test turba, browse to this address and login in the Turba link:
http://mail.example.com/horde/
Create a new entry in the address book and then go to IMP, then Options
and select to use the address book with name "IMP Address Book".

If you have any troubles, look at the troubleshooting guide before continuing.

7. Configuring Passwd
Now that we have configured Horde with IMP and Turba, we need to provide our users with a method to change their password via Horde. We will use the Passwd module from the Sork Project for this.

7.1 Download and Install poppassd-ceti
Poppassd-ceti is a poppassd server that is modified from the poppassd provided from Qualcom/Eudora to support Linux PAM.

7.1.1 Using RPM
The easier way to install is via rpm:
# cd /tmp
# wget -c http://www.samera.net/rpm/poppassd-ceti-1.8.3-rh9.i386.rpm
# rpm -ivh poppassd-ceti-1.8.3-rh9.i386.rpm

7.1.2 Using .tar.gz
you can also install it after manually compiling the source code:
# wget -c http://echelon.pl/pubs/poppassd-1.8.3.tar.gz
# tar xzf poppassd-1.8.3.tar.gz
# cd poppassd-1.8.3
# make
# make install
# vi /etc/xinetd.d/poppassd # create and edit this file

/etc/xinetd.d/poppassd
# default: off
# description: The POPPASSD service allows remote users to change their
#   password remotely via Eudora or NUPOP using a network
#   protocol on port 106.
#
service poppassd
{
 disable = no
 socket_type = stream
 wait = no
 user = root
 server = /usr/sbin/poppassd
 #only_from = localhost
 log_on_success += USERID
 log_on_failure += USERID
}

7.1.3 Enable the poppassd service
After installation(via rpm or .tar.gz), enable the poppassd service:
# ntsysv --level 35
# service xinetd restart

7.2 Download and Install Passwd
Now, we need to install the Passwd module from the Sork project:
# cd /tmp
# wget -c http://ftp.horde.org/pub/passwd/passwd-2.2.tar.gz
# tar xzf passwd-2.2.tar.gz -C /var/www/html/mail/horde
# cd /var/www/html/mail/horde
# mv passwd-2.2 passwd

7.2.1 Configure Passwd config files
Make a copy of the default configuration files for editing:
# cd horde/passwd/config
# for foo in *.dist; do cp -v $foo `basename $foo .dist`; done

Edit the config file:
horde/passwd/config/conf.php
$conf['menu']['apps'] = array('imp');

Edit the backends file:
horde/passwd/config/backends.php
$backends['poppassd'] = array(
    'name' => 'Your server/organization name',
    'preferred' => '',
    'password policy' => array(),
    'driver' => 'poppassd',
    'params' => array(
        'host' => 'localhost',
        'port' => 106
    )
);


7.3 Configure Horde for Passwd
Edit Horde config files to support the Passwd module:
horde/config/registry.php
// add a registry entry for passwd and show the icon in horde
$this->applications['passwd'] = array(
    'fileroot' => dirname(__FILE__) . '/../passwd',
    'webroot' => $this->applications['horde']['webroot'] . '/passwd',
    'icon' => $this->applications['horde']['webroot'] .
                '/passwd/graphics/lock.gif',
    'name' => _("Password"),
    'allow_guests' => false,
    'status' => 'active'
);

7.4 Configure IMP for Passwd
Configure an icon for Passwd in IMP
horde/imp/config/conf.php
$conf['menu']['apps'] = array('turba', 'passwd');

7.5 Test Passwd

Login into Passwd from Horde:
http://mail.example.com/horde/passwd/
and change your password.

Look at /var/log/messages for debug messages.

Any passwd of any length will be accepted because poppassd is run as root. Maybe you will get warnings in /var/log/messages about short or easy passwords being used, but your password will be changed.

8.Security
Please take special care about this security notes:
  • Confirm that you can NOT browse to this URLs:
    http://mail.example.com/horde/config/
    If you can browse this URL, then your .htpasswd files are not treaded by apache. This is a high security risk and you should configure the AllowOverride apache directive as described in Point 3.2.1
    Please note that there are many more directories that should not be browseable. But if you configure properly the AllowOveride directive and do not deleted any .htpasswd file, then, your installation should be ok.
  • After completing the installation, set the correct permission to all files inside the horde directory by running the script set_perms.sh like this:
    # cd /var/www/html/mail/horde
    # sh scripts/set_perms.sh
    Set the group to 'apache' when asked and then answer all question with Yes(y)
    This script will change the owner, group and mode of each file inside the horde/ directory.

    If you want to secure the files manually, you can run these commands:
    # cd /var/www/html/mail
    # chmod -x -R horde
    # chmod +X -R horde
    # chmod o-rwx -R horde
    # chmod 000 horde/test.php horde/imp/test.php
9.Troubleshooting/Notes
Here you can find solutions to common problems
[Still to come, keep those feedback coming]
  • Can't connect from Horde to the database
    Maybe there is a problem with the user horde. Look at the parameters in 4.4.1 and try using a different method to connect to the database using the same user. For example, if you use MySQL, try this command:
    $ mysql -D horde -h hostname -u user -p

  • /bin/passwd and Poppasswd
    If you use md5 and shadow in RedHat 9(enabled by default), be sure that the file:
    /etc/pam.d/poppassd
    have the same contents as in:
    /etc/pam.d/passwd
    In other words, /etc/pam.d/poppassd should be the same as /etc/pam.d/passwd:
    # cp -f /etc/pam.d/passwd /etc/pam.d/poppassd

  • Debug messages in Horde
    To look for debug messages in Horde, configure:
    horde/config/horde.php
    $conf['log']['enabled'] = true;
    $conf['log']['type'] = 'file';
    $conf['log']['name'] = '/tmp/horde.log';
    $conf['log']['priority'] = LOG_NOTICE;
    // log everything
    // $conf['log']['priority'] = LOG_DEBUG;
    Then look at the file /tmp/horde.log, for example:
    # grep -i error /tmp/horde.log

  • Replacing sendmail with postfix
    Replace 'sendmail' with 'smtp' in point 4.4.1 like this:
    $conf['mailer']['type'] = 'smtp';
    Then, uninstall sendmail and install postfix.
    (Thanks to: Laurent DUBETTIER-GRENIER)

  • DNS verification
    Verify that you have DNS entries for all your servers.
    You can use this command to find out:
    $ host server.example.com
    (Thanks to: James)

  • Install pear-4.1.2 from RH 7.3
    As an alternative, you can install the pear rpm from the RedHat 7.3 distribution.
    This will help you maintain an installation based on RPM.
    (Thanks to: Aaron Hope)

  • Using STMP to send emails from IMP
    If you need that all the outgoing mail goes though your sendmail server via SMTP, you will have to configure Horde in a different way.
    This setup will help you for example if you parse your maillog file or use a Milter filter in sendmail.
    horde/config/horde.php
    $conf['mailer']['type'] = 'smtp';

    $conf['mailer']['params'] = array();
    $conf['mailer']['params'] = array('server' => 'smtp.example.com');
    $conf['mailer']['params'] = array('port' => '25');
    Note: I tried using the ssmtp package with IMP 2.x. In IMP 3.x I need more feedback on this setup.

  • Problems when searching in Turba
    Please check this answer from Chuck here

  • Just uninstalled nedstat.com/motigo.com counter service because it was launching pop-ups from the counter image!
10. Links
Here are the links to all software used in this document

11. About
This is my 0.02$ to the IMP project. Thanks to the Horde Team for this excellent Work!
Please feel free to send me comments and corrections.





Many Thanks to all the people who contributed or visited this page: Feedback users:
  • Peter Farrow
  • Francisco Ho
  • Jason Reusch
  • Christopher Thompson
  • Laurent Dubettier-Grenier
  • James (no last name sended)
  • Jason (no last name sended jason at reusch.net)
  • Aaron Hope
  • Andrea `Zuse' Balestrero
  • Marcos Rivarola
  • Pablo Javier Santa Cruz
  • Patrick de Ruiter
  • Jan Schneider
  • Colin Smillie
  • Jean-Marc ANDRE
  • John Surcombe



 

The HTML code is formated by Tidy. Used CSS2 as much as posible.

Made with Mozilla 1.6
Valid HTML 4.01!Valid CSS2! Tobin Hosting (donated the free mirror)




26-jan-2004