I have written a little script that will install Maia Mailguard in ISPConfig3 Code: #!/bin/sh # # Set up the basic environment # MAIA="maia-1.0.2a.tar.gz" MYSQLPASS="mysqlpasswd" PASS="maiapasswd" FQDN="mymail.example.com" DN="myexample.com" GEOG="Geography-Countries-2009041301.tar.gz" IPCOUNTRY="IP-Country-2.27.tar.gz" DOMKEYS="Mail-DomainKeys-1.0.tar.gz" # /usr/bin/apt-get update /usr/bin/apt-get --yes upgrade # # /usr/bin/apt-get --yes install amavisd-new /usr/bin/apt-get --yes install spamassassin /usr/bin/apt-get --yes install openssh-server /usr/bin/apt-get --yes install unzip /usr/bin/apt-get --yes install build-essential /usr/bin/apt-get --yes install lynx /usr/bin/apt-get --yes install ncftp2 /usr/bin/apt-get --yes install libssl-dev /usr/bin/apt-get --yes install apt-show-versions /usr/bin/apt-get --yes install whois # # Set up apache2 # /usr/bin/apt-get --yes install apache2 /usr/bin/apt-get --yes install apache2-doc /usr/bin/apt-get --yes install libapache2-mod-perl2 /usr/bin/apt-get --yes install libapache2-mod-auth-mysql /usr/bin/apt-get --yes install libapache2-mod-php5 # #Set up MySQL # /usr/bin/apt-get --yes install mysql-server /usr/bin/apt-get --yes install libgd2 /usr/bin/apt-get --yes install php5 /usr/bin/apt-get --yes install php5-cgi /usr/bin/apt-get --yes install phpmyadmin /usr/bin/apt-get --yes install php5-imap /usr/bin/apt-get --yes install php5-ldap /usr/bin/apt-get --yes install php5-mcrypt /usr/bin/apt-get --yes install php5-mysql /usr/bin/apt-get --yes install php5-gd /usr/bin/apt-get --yes install php-mail-mime /usr/bin/apt-get --yes install libcrypt-blowfish-perl /usr/bin/apt-get --yes install libossp-uuid-perl /usr/bin/apt-get --yes install libio-zlib-perl /usr/bin/apt-get --yes install libarchive-tar-perl /usr/bin/apt-get --yes install libarchive-zip-perl /usr/bin/apt-get --yes install libtemplate-perl /usr/bin/apt-get --yes install libemail-address-perl /usr/bin/apt-get --yes install libconvert-tnef-perl /usr/bin/apt-get --yes install libnet-cidr-lite-perl /usr/bin/apt-get --yes install libmail-spf-query-perl /usr/bin/apt-get --yes install libcrypt-cbc-perl /usr/bin/apt-get --yes install libdbd-pg-perl /usr/bin/apt-get --yes install libnet-ldap-perl /usr/bin/apt-get --yes install libunix-syslog-perl /usr/bin/apt-get --yes install libnet-dns-perl /usr/bin/apt-get --yes install libberkeleydb-perl /usr/bin/apt-get --yes install imagemagick #Geography:Countries cd /tmp if [ -f /var/cache/apt/$GEOG ] then cp /var/cache/apt/$GEOG /tmp else /usr/bin/wget http://search.cpan.org/CPAN/authors/id/A/AB/ABIGAIL/$GEOG cp $GEOG /var/cache/apt/$GEOG fi tar xvzf Geogra* cd Geogra* perl Makefile.PL make make install #IP::Country cd /tmp if [ -f /var/cache/apt/$IPCOUNTRY ] then cp /var/cache/apt/$IPCOUNTRY /tmp else /usr/bin/wget http://search.cpan.org/CPAN/authors/id/N/NW/NWETTERS/$IPCOUNTRY cp $IPCOUNTRY /var/cache/apt/$IPCOUNTRY fi tar xvzf IP-Cou* cd IP-Cou* perl Makefile.PL make make install #Mail:DomainKeys cd /tmp if [ -f /var/cache/apt/$DOMKEYS ] then cp /var/cache/apt/$DOMKEYS /tmp else /usr/bin/wget http://search.cpan.org/CPAN/authors/id/A/AN/ANTHONYU/$DOMKEYS cp $DOMKEYS /var/cache/apt/$DOMKEYS fi tar xvzf Mail-D* cd Mail-D* perl Makefile.PL make make install # # /usr/bin/apt-get --yes install php-pear /usr/bin/pear channel-update pear.php.net /usr/bin/pear install Mail_Mime /usr/bin/pear install XML_RPC /usr/bin/pear install DB_Pager /usr/bin/pear install Auth_SASL /usr/bin/pear install Net_Socket /usr/bin/pear install Net_IMAP /usr/bin/pear install Net_POP3 /usr/bin/pear install Net_SMTP /usr/bin/pear install Log # # /usr/bin/apt-get --yes install clamav /usr/bin/apt-get --yes install clamav-daemon /usr/bin/apt-get --yes install clamav-docs /usr/bin/apt-get --yes install unrar-free /usr/bin/apt-get --yes install unzoo /usr/bin/apt-get --yes install amavis /usr/bin/apt-get --yes install smarty /bin/ln -s /usr/share/php/smarty /usr/share/php/Smarty # # /usr/bin/pear channel-update pear.php.net /usr/bin/pear install DB /usr/bin/pear install Pager /usr/bin/pear install -f Image_Color /usr/bin/pear install -f Image_Canvas /usr/bin/pear install -f Numbers_Words /usr/bin/pear install Numbers_Roman /usr/bin/pear install -f Image_Graph-0.7.2 cp /var/cache/apt/Pie.php /usr/share/php/Image/Graph/Plot/Pie.php # # /usr/bin/apt-get --yes install razor /usr/bin/apt-get --yes install pyzor # cp /var/cache/apt/phpinfo.php /var/www/ # /etc/init.d/apache2 restart # # Download and Install Maia # cd /usr/src if [ -f /var/cache/apt/$MAIA ] then cp /var/cache/apt/$MAIA /usr/src else /usr/bin/wget http://www.maiamailguard.com/files/$MAIA cp $MAIA /var/cache/apt/$MAIA fi /bin/tar -zxvf $MAIA cd maia* /bin/mkdir /var/amavisd /bin/mkdir /var/amavisd/maia /bin/mkdir /var/amavisd/db /bin/mkdir /var/amavisd/tmp /bin/mv scripts /var/amavisd/maia/ /bin/mv templates /var/amavisd/maia/ /bin/mv php /var/www/maia /bin/mv amavisd-maia /usr/sbin cat amavisd.conf.dist | sed -e 's/yourdomain.tld/'$DN'/' -e 's/host.domain.tld/'$FQDN'/' -e 's/password/'$PASS'/' -e 's/\/amavisd\/clamd.sock/\/run\/clamav\/clamd.ctl/' -e 's/log_level\ =\ 0/log_level\ =\ 3/' -e 's/\$MYHOME\/amavis.log/\/var\/log\/amavis.log/' -e 's/#\$unrar/\$unrar/' > /etc/amavisd.conf /bin/mv /var/amavisd/maia/templates/digest.tpl /var/amavisd/maia/templates/digest.tpl.bak /bin/mv /var/cache/apt/digest.tpl /var/amavisd/maia/templates/digest.tpl cat maia.conf.dist | sed -e 's/password = "passwd"/password = "'$PASS'"/' -e 's/base_url = "http:\/\/example.com\/"/base_url = "http:\/\/www.'$DN'\/maia"/' -e 's/report_options = 1 + 2 + 4 + 8/report_options = 0/' > /etc/maia.conf cat /var/www/maia/config.php.dist |sed -e 's/passwd/'$PASS'/' > /var/www/maia/config.php cat /var/www/maia/admin/configtest.php | sed -e 's/PEAR\/Remote.php/PEAR\/Command\/Remote.php/' > /var/www/maia/admin/configtest.php.bak mv /var/www/maia/admin/configtest.php.bak /var/www/maia/admin/configtest.php # Rotate logs echo >> /etc/logrotate.conf echo '# amavis' >> /etc/logrotate.conf echo '/var/log/amavis.log {' >> /etc/logrotate.conf echo ' missingok' >> /etc/logrotate.conf echo ' daily' >> /etc/logrotate.conf echo ' rotate 7' >> /etc/logrotate.conf echo ' create' >> /etc/logrotate.conf echo ' compress' >> /etc/logrotate.conf echo ' start 0' >> /etc/logrotate.conf echo '}' >> /etc/logrotate.conf # # Ceating Maia database cat maia-mysql.sql | sed -e 's/-- PREAMBLE/USE maia;/' > maia-mysqldb.sql echo 'DROP DATABASE IF EXISTS maia;' > create_maia_db.sql echo 'CREATE DATABASE maia;' >> create_maia_db.sql echo 'USE maia;' >> create_maia_db.sql echo 'GRANT CREATE, DROP, ALTER, SELECT, INSERT, UPDATE, DELETE ON maia.* TO amavis@localhost IDENTIFIED BY '\'$PASS\'';' >> create_maia_db.sql /usr/bin/mysql -u root -p$MYSQLPASS < create_maia_db.sql /usr/bin/mysql -u root -p$MYSQLPASS < maia-mysqldb.sql cd /root /usr/sbin/adduser www-data amavis /bin/chown -R amavis. /var/amavisd /bin/chown -R www-data /var/www/maia /bin/chown root. /usr/sbin/amavisd-maia /bin/chown amavis.amavis /etc/maia.conf /bin/chmod 640 /var/amavisd/maia/templates/*.tpl /bin/chmod 750 /var/amavisd/maia/scripts/*.pl /bin/chmod 640 /etc/maia.conf /bin/chmod 755 /usr/sbin/amavisd-maia /bin/ln -s /usr/sbin/amavisd-maia /usr/sbin/amavisd cat /var/www/maia/core.php | sed -e 's/:.\/libs:/:\/usr\/share\/php/' > /root/core.php mv /root/core.php /var/www/maia/core.php cd /etc/default echo '# /etc/default/amavisd' > amavisd echo '#' >> amavisd echo '' >> amavisd echo '# Change to one to enable amavis' >> amavisd echo 'ENABLED=1' >> amavisd echo '' >> amavisd echo '# Where should amavisd write its PID to file? If you use the -u or' >> amavisd echo '# --username option above, this needs to be writable by that user.' >> amavisd echo '# Otherwise, the init script will not be able to shut amavisd down.' >> amavisd echo 'PIDFILE="/var/amavisd/amavisd.pid"' >> amavisd echo '' >> amavisd echo '# Set nice level of spamd' >> amavisd echo '#NICE="--nicelevel 15"' >> amavisd cd /etc/init.d cp /var/cache/apt/amavisd_init.d_script.sh amavisd chmod 755 amavisd update-rc.d amavisd defaults update-rc.d -f amavis remove cd /root /etc/init.d/apache2 restart /etc/init.d/amavis stop /etc/init.d/amavisd start mv /etc/init.d/amavis /root # 8) Setting up cron # ******************************************************************************* echo '0 * * * * /var/amavisd/maia/scripts/process-quarantine.pl --learn &> /dev/null' >> /var/spool/cron/crontabs/root echo '0 1 * * * /var/amavisd/maia/scripts/expire-quarantine-cache.pl &> /dev/null' >> /var/spool/cron/crontabs/root echo '0 2 * * 1 /var/amavisd/maia/scripts/send-quarantine-reminders.pl &> /dev/null' >> /var/spool/cron/crontabs/root echo '*/30 * * * * /var/amavisd/maia/scripts/send-quarantine-digests.pl &> /dev/null' >> /var/spool/cron/crontabs/root echo '0 0 * * * sa-update && /var/amavisd/maia/scripts/load-sa-rules.pl && /etc/init.d/amavisd restart' >> /var/spool/cron/crontabs/root echo '0 * * * * /var/amavisd/maia/scripts/stats-snapshot.pl &> /dev/null' >> /var/spool/cron/crontabs/root # 9) Done !!!!! # ******************************************************************************* echo 'Check your install -> http://www.'$DN'/maia/admin/configtest.php' echo 'Setup initial user -> http://www.'$DN'/maia/internal-init.php' echo 'Setup super user -> http://www.'$DN'/maia/login.php?super=register' You will also need to save this as /var/cache/apt/amavisd_init.d_script.sh Code: #! /bin/sh # amavis init script # February 26, 2006 # David Sims # Based on SpamAssassin script PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/amavisd NAME=amavisd SNAME=amavisd DESC="Amavis Mail Filter Daemon" PIDFILE="/var/run/$NAME.pid" PNAME="amavisd" export TMPDIR=/tmp # Apparently people have trouble if this isn't explicitly set... # Defaults - don't touch, edit /etc/default/amavisd ENABLED=0 OPTIONS="" NICE= test -f /etc/default/amavisd && . /etc/default/amavisd if [ "$ENABLED" = "0" ]; then echo "$DESC: disabled, see /etc/default/amavisd" exit 0 fi test -f $DAEMON || exit 0 set -e case "$1" in start) echo -n "Starting $DESC: " start-stop-daemon --start --pidfile $PIDFILE --name $PNAME \ $NICE --oknodo --startas $DAEMON -- $OPTIONS $DOPTIONS echo "$NAME." ;; stop) echo -n "Stopping $DESC: " start-stop-daemon --stop --pidfile /var/amavisd/amavisd.pid rm /var/amavisd/amavisd.lock echo "$NAME." ;; reload|force-reload) echo -n "Reloading $DESC: " start-stop-daemon --stop --pidfile $PIDFILE --signal HUP --name $PNAME echo "$NAME." ;; restart) echo -n "Restarting $DESC: " start-stop-daemon --stop --pidfile /var/amavisd/amavisd.pid start-stop-daemon --start --pidfile $PIDFILE --name $PNAME \ $NICE --oknodo --startas $DAEMON -- $OPTIONS $DOPTIONS echo "$NAME." ;; *) N=/etc/init.d/$SNAME echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 exit 1 ;; esac exit 0 Use at your own risk and I take no responsibility if it breaks your system
Any gotchas to note on this? I'm running isp3 on deb lenny 64. I'm wondering if a later upgrade will break anything (doubtful)....or even better...any thought of including this into the next release?
I noticed there is a plugin for roundcube that seems to do much of the same in giving users some control.
Well, that are probably my plugins, where the new version will be released on Monday. PS: If there are feature missing, people just have to tell me.
Hi warlock, thanks for that script but am I right that if I installed maia I must do the spamsettings in maia not in ispconfig? Regards, xabbu