1.1 Prerequisites
PoCoMy requires:
- Webserver (apache) with php4 / php5 including mysql-support
- mysql-server (tested with 4.1 and 5.0)
- Postfix Mail-Server
- Courier IMAP/POP3-Server
- courier-authlib with mysql-support
- sasl2 with mysql-support
On a debian-system (etch) the required software may be installed this way:
apt-get install \
postfix-mysql postfix-pcre postfix-cdb postfix \
sasl2-bin libsasl2-modules libsasl2-modules-sql \
courier-authlib-mysql courier-pop-ssl courier-pop \
courier-imap courier-imap-ssl \
libapache2-mod-php5 php5-mysql apache2 \
mysql-client mysql-server
1.2 Installation
The current version of PoCoMy may be found here:
PoCoMy project hosted by sourceforge.net
Download the current version of PoCoMy and extract the archive into a directory
accessible through your webserver. e.g.
/var/www/:
tar xz -f PoCoMy-0.8.tgz -C /var/www/
n order to simplify the URL for the access of the webapplication you
may create a link to the
PoCoMy-0.8-directory:
ln -sv /var/www/PoCoMy-0.8/ /var/www/pocomy
Change into the PoCoMy-directory;
all examples in this HowTo assume that your working directory is the
newly created PoCoMy-directory.
cd /var/www/PoCoMy-0.8
Create the database:
Use the command listed below to create the database and the database-user:
mysql -u root -p < sql/pocomy.sql;
1.3 Configuration
1.3.1 Configuring PoCoMy
Edit the file
config/config.php and adjust:
| POCOMY__SITENAME |
eloquent name of your mailsystem |
| POCOMY__ENABLE_USERINTERFACE |
false - no; true - yes;
If this is set to true, the PoCoMy User-Module will be activated and the
users will gain some control over their account.
see: The PoCoMy User-Module
(NOTE: the user interface is not extensively tested!)
|
| POCOMY__USERINTERFACE_URL |
URL pointing to the User-Module
(if this remains unconfigured, the URL will be guessed)
|
| POCOMY__ENABLE_NEWUSEREMAIL |
false - no; true - yes;
controls if a email will be send to a newly created user
|
| POCOMY__POSTMASTERMAIL |
mail of the postmaster for the system;
if this remains unconfigured, the email of the admin will be used;
|
POCOMY__SERVERNAME_SMTP POCOMY__SERVERNAME_POP3 POCOMY__SERVERNAME_IMAP |
Servername for the smtp, pop3 and imap server;
if this remains unconfigured, the servername of the
webserver running PoCoMy will be used;
|
1.3.2 Configuring Postfix
The directory
etc/postfix contains a example configuration for postfix.
Copy the files to
/etc/postfix (please backup the original files)
cp -r etc/postfix/* /etc/postfix
On some systems you must create a symbolic link for SASL:
ln -sv /etc/postfix/sasl/smtpd.conf /usr/lib/sasl2/smtpd.conf
NOTE: the provided file main.cf is only a example configuration.
Use at your own risk!
You must edit at least the variable myhostname!
Please edit the file with care!
1.3.3 Configuring Courier
The directory
etc/courier contains a example configuration for
courier.
Copy the files to
/etc/courier (please backup the original files)
cp -r etc/courier/* /etc/courier
NOTE: The provided files contain only a sample working configuration.
Use at your own risk and edit the files with care!
1.3.4 Configuring the Mailstore
Mails are stored by default in
/srv/mail.
If you like to change this setting, you must change the value of
virtual_mailbox_base in the file
/etc/postfix/main AND the value of
MYSQL_MAILDIR_FIELD and
MYSQL_HOME_FIELD
in the file
/etc/courier/authmysqlrc!
User- and Group-ID for the mailstore are preconfigured to
101:8 (postfix:mail).
Please check if the UID and GID match the one used on your system!
grep postfix /etc/passwd | mawk -F : '{print $3}';
grep mail /etc/group | mawk -F : '{print $3}';
If you like to change this settings, you have to change the value of
virtual_uid_maps and / or
virtual_gid_maps in the file
/etc/postfix/main
AND the values of
MYSQL_UID_FIELD and / or
MYSQL_GID_FIELD
in the file
/etc/courier/authmysqlrc!
Use the following commands to create and configure the mailstore:
mkdir /srv/mail;
chown postfix:mail /srv/mail;
chmod 770 /srv/mail;
1.3.5 Configuring the Directory Structure of the Mailstore
The directory structure of the mailstore is configurable.
Some examples may be found in the configuration file
mysql-virtual-mailbox-maps
in the
select_field section.
If you like to change the directory strukture, please consider
that the changes must be accomplished for both parts:
postfix
and
courier:
| file |
setting |
| /etc/postfix/mysql-virtual-mailbox-maps |
select_field |
| /etc/courier/authmysqlrc |
MYSQL_MAILDIR_FIELD |
1.3.6 Notes about the Database-Users
PoCoMy is using 2 database accounts:
-
pocomyweb for the webinterface
configured in config/config.php
section // database connection
-
pocomymail for postfix and courier configured in
-
/etc/courier/authmysqlrc sections
MYSQL_SERVER MYSQL_USERNAME MYSQL_PASSWORD MYSQL_DATABASE
-
/etc/postfix/mysql-* sections
user password dbname hosts
This enables a good separation of the access-rights
and increases the scalability of the system.
1.4 Adjusting File Rights
Files containing sensitive informations should be secured by
assigning them restrictive user rights:
chown root.postfix /etc/postfix/mysql-* ;
chmod 640 /etc/postfix/mysql-* ;
chown root.postfix /etc/postfix/sasl/smtpd.conf ;
chmod 640 /etc/postfix/sasl/smtpd.conf ;
chown daemon.daemon /etc/courier/* ;
chmod 640 /etc/courier/* ;
1.5 Restart Services
In order to apply the changes, the corresponding services must
be restarted:
for i in /etc/init.d/postfix /etc/init.d/courier-*; do $i restart; done;