tbrehm
2010-02-24 0ca0b8489a72768765e85b4432e167ed72986006
- Improved debian 5 courier installation guide.
- Fixed a problem with the automatic creation of maildir subfolders.
2 files modified
154 ■■■■■ changed files
docs/INSTALL_DEBIAN_5.0_courier_mydns.txt 70 ●●●● patch | view | raw | blame | history
server/plugins-available/mail_plugin.inc.php 84 ●●●● patch | view | raw | blame | history
docs/INSTALL_DEBIAN_5.0_courier_mydns.txt
@@ -14,6 +14,7 @@
# if not, then we assign a hostname (for example ispconfig):
echo ispconfig.example.com > /etc/hostname
/etc/init.d/hostname.sh
vi /etc/hosts
@@ -36,14 +37,14 @@
opt0.3) Optionally if you want vi editor improvement
apt-get install vim-nox
apt-get -y install vim-nox
# Next is the real deal
1) Install Postfix, Courier, Saslauthd, MySQL, phpMyAdmin, rkhunter, binutils with the following command line (on one line!):
apt-get install postfix postfix-mysql postfix-doc mysql-client mysql-server courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2-2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl courier-maildrop getmail4 rkhunter binutils
apt-get -y install postfix postfix-mysql postfix-doc mysql-client mysql-server courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2-2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl courier-maildrop getmail4 rkhunter binutils
# Answer the questions from the package manager as follows.
@@ -74,7 +75,7 @@
2) Install Amavisd-new, Spamassassin and Clamav (1 line!):
apt-get install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 arj nomarch lzop cabextract apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl
apt-get -y install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 arj nomarch lzop cabextract apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl
# During the installation, the SSL certificates for IMAP-SSL and POP3-SSL are created with the hostname localhost. To change this to the correct hostname (server1.example.com in this tutorial), delete the certificates...
@@ -109,7 +110,7 @@
3) Install apache, PHP5, phpmyadmin, better fastCGI, suexec, Pear and mcrypt (1 line!):
apt-get install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick libapache2-mod-suphp libopenssl-ruby
apt-get -y install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick libapache2-mod-suphp libopenssl-ruby
# When phpMyAdmin is asking weather to configure itself automatically, select "Apache2"
@@ -125,25 +126,7 @@
4) Install pure-ftpd and quota
apt-get install pure-ftpd-common pure-ftpd-mysql quota quotatool
# Edit the file /etc/default/pure-ftpd-common to change the start mode from "inetd" to "standalone"
and set VIRTUALCHROOT=true
vi /etc/default/pure-ftpd-common
# Edit the file /etc/inetd.conf to prevent inetd from trying to start ftp.
# To do this, comment line starting like "ftp   stream  tcp" by adding "#"-sign in front of the line.
vi /etc/inetd.conf
# Then execute:
/etc/init.d/openbsd-inetd restart
# Some additional settings for pureftpd
echo 'yes' > /etc/pure-ftpd/conf/DontResolve
apt-get -y install pure-ftpd-common pure-ftpd-mysql quota quotatool
# Enable TLS in pureftpd
echo 1 > /etc/pure-ftpd/conf/TLS
@@ -262,25 +245,18 @@
apt-get install vlogger webalizer
Change the following line in /etc/webalizer/webalizer.conf from
#Incremental    no
to
Incremental    yes
7) Install Jailkit (optional, only needed if you want to use chrroting for SSH users)
apt-get install build-essential autoconf automake1.9 libtool flex bison debhelper
cd /tmp
wget http://olivier.sessink.nl/jailkit/jailkit-2.7.tar.gz
tar xvfz jailkit-2.7.tar.gz
cd jailkit-2.7
wget http://olivier.sessink.nl/jailkit/jailkit-2.11.tar.gz
tar xvfz jailkit-2.11.tar.gz
cd jailkit-2.11
./debian/rules binary
cd ..
dpkg -i jailkit_2.7-1_*.deb
rm -rf jailkit-2.7*
dpkg -i jailkit_2.11-1_*.deb
rm -rf jailkit-2.11*
8) Install fail2ban (optional but recomended, because the monitor tries to show the log)
More info at: http://www.howtoforge.com/fail2ban_debian_etch
@@ -289,26 +265,10 @@
9) Install ISPConfig 3
# There are two possile scenarios, but not both:
9.1) Install the latest released version
9.2) Install directly from SVN
9.1) Installation of last version from tar.gz
  cd /tmp
  wget http://www.ispconfig.org/downloads/ISPConfig-3.0.0.9-rc2.tar.gz
  tar xvfz ISPConfig-3.0.0.9-rc2.tar.gz
  cd ispconfig3_install/install/
9.2) Installation from SVN
  apt-get install subversion
  cd /tmp
  svn export svn://svn.ispconfig.org/ispconfig3/trunk/
  cd trunk/install
9.1+9.2) Now proceed with the ISPConfig installation.
cd /tmp
wget http://www.ispconfig.org/downloads/ISPConfig-3.0.2.tar.gz
tar xvfz ISPConfig-3.0.2.tar.gz
cd ispconfig3_install/install/
# Now start the installation process by executing:
server/plugins-available/mail_plugin.inc.php
@@ -119,27 +119,6 @@
            //exec("su -c 'maildirmake ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
            $app->system->maildirmake($maildomain_path,$mail_config['mailuser_name']);
            if(!is_dir($data['new']['maildir'].'/.Sent')) {
                //exec("su -c 'maildirmake -f Sent ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
                //$app->log('Created submaildir Sent: '."su -c 'maildirmake -f Sent ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
                $app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Sent');
            }
            if(!is_dir($data['new']['maildir'].'/.Drafts')) {
                //exec("su -c 'maildirmake -f Drafts ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
                //$app->log('Created submaildir Drafts: '."su -c 'maildirmake -f Drafts ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
                $app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Drafts');
            }
            if(!is_dir($data['new']['maildir'].'/.Trash')) {
                //exec("su -c 'maildirmake -f Trash ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
                //$app->log('Created submaildir Trash: '."su -c 'maildirmake -f Trash ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
                $app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Trash');
            }
            if(!is_dir($data['new']['maildir'].'/.Junk')) {
                //exec("su -c 'maildirmake -f Junk ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
                //$app->log('Created submaildir Junk: '."su -c 'maildirmake -f Junk ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
                $app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Junk');
            }
            exec('chown -R '.$mail_config['mailuser_name'].':'.$mail_config['mailuser_group'].' '.escapeshellcmd($data['new']['maildir']));
            $app->log("Set ownership on ".escapeshellcmd($data['new']['maildir']),LOGLEVEL_DEBUG);
@@ -148,6 +127,27 @@
                exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); // Avoid maildirmake quota bug, see debian bug #214911
                $app->log('Created Maildir: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
            }
        }
        if(!is_dir($data['new']['maildir'].'/.Sent')) {
            //exec("su -c 'maildirmake -f Sent ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
            //$app->log('Created submaildir Sent: '."su -c 'maildirmake -f Sent ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
            $app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Sent');
        }
        if(!is_dir($data['new']['maildir'].'/.Drafts')) {
            //exec("su -c 'maildirmake -f Drafts ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
            //$app->log('Created submaildir Drafts: '."su -c 'maildirmake -f Drafts ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
            $app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Drafts');
        }
        if(!is_dir($data['new']['maildir'].'/.Trash')) {
            //exec("su -c 'maildirmake -f Trash ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
            //$app->log('Created submaildir Trash: '."su -c 'maildirmake -f Trash ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
            $app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Trash');
        }
        if(!is_dir($data['new']['maildir'].'/.Junk')) {
            //exec("su -c 'maildirmake -f Junk ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
            //$app->log('Created submaildir Junk: '."su -c 'maildirmake -f Junk ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
            $app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Junk');
        }
        
        //* Set the maildir quota
@@ -207,27 +207,6 @@
            //$app->log("Created Maildir "."su -c 'maildirmake ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
            $app->system->maildirmake($maildomain_path,$mail_config['mailuser_name']);
            if(!is_dir($data['new']['maildir'].'/.Sent')) {
                //exec("su -c 'maildirmake -f Sent ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
                //$app->log('Created submaildir Sent: '."su -c 'maildirmake -f Sent ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
                $app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Sent');
            }
            if(!is_dir($data['new']['maildir'].'/.Drafts')) {
                //exec("su -c 'maildirmake -f Drafts ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
                //$app->log('Created submaildir Drafts: '."su -c 'maildirmake -f Drafts ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
                $app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Drafts');
            }
            if(!is_dir($data['new']['maildir'].'/.Trash')) {
                //exec("su -c 'maildirmake -f Trash ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
                //$app->log('Created submaildir Trash: '."su -c 'maildirmake -f Trash ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
                $app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Trash');
            }
            if(!is_dir($data['new']['maildir'].'/.Junk')) {
                //exec("su -c 'maildirmake -f Junk ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
                //$app->log('Created submaildir Junk: '."su -c 'maildirmake -f Junk ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
                $app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Junk');
            }
            exec('chown -R '.$mail_config['mailuser_name'].':'.$mail_config['mailuser_group'].' '.escapeshellcmd($data['new']['maildir']));
            $app->log("Set ownership on ".escapeshellcmd($data['new']['maildir']),LOGLEVEL_DEBUG);
            //* This is to fix the maildrop quota not being rebuilt after the quota is changed.
@@ -237,6 +216,27 @@
            }
        }
        
        if(!is_dir($data['new']['maildir'].'/.Sent')) {
            //exec("su -c 'maildirmake -f Sent ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
            //$app->log('Created submaildir Sent: '."su -c 'maildirmake -f Sent ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
            $app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Sent');
        }
        if(!is_dir($data['new']['maildir'].'/.Drafts')) {
            //exec("su -c 'maildirmake -f Drafts ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
            //$app->log('Created submaildir Drafts: '."su -c 'maildirmake -f Drafts ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
            $app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Drafts');
        }
        if(!is_dir($data['new']['maildir'].'/.Trash')) {
            //exec("su -c 'maildirmake -f Trash ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
            //$app->log('Created submaildir Trash: '."su -c 'maildirmake -f Trash ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
            $app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Trash');
        }
        if(!is_dir($data['new']['maildir'].'/.Junk')) {
            //exec("su -c 'maildirmake -f Junk ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
            //$app->log('Created submaildir Junk: '."su -c 'maildirmake -f Junk ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
            $app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Junk');
        }
        // Move mailbox, if domain has changed and delete old mailbox
        if($data['new']['maildir'] != $data['old']['maildir'] && is_dir($data['old']['maildir'])) {
            if(is_dir($data['new']['maildir'])) {