The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mail::Toaster::Setup

DESCRIPTION

The meat and potatoes of toaster_setup.pl. This is where the majority of the work gets done. Big chunks of the code got moved here, mainly because toaster_setup.pl was getting rather unwieldly. The biggest benefit requiring me to clean up the code considerably. It's now in nice tidy little subroutines that are pretty easy to read and understand.

METHODS

new

To use any methods in Mail::Toaster::Setup, you must create a setup object:

  use Mail::Toaster::Setup;
  my $setup = Mail::Toaster::Setup->new;

From there you can run any of the following methods via $setup->method as documented below.

Many of the methods require $conf, which is a hashref containing the contents of toaster-watcher.conf.

apache

Calls $apache->install[1|2] which then builds and install Apache for you based on how it was called. See Mail::Toaster::Apache for more details.

  $setup->apache($conf, $version);

autorespond

Install autorespond. Fetches sources from Inter7 web site and installs it.

  $setup->autorespond($conf);

clamav

Install ClamAV, configure the startup and config files, download the latest virus definitions, and start up the daemons.

  $setup->clamav($conf);

courier

  $setup->courier($conf);

Installs courier imap based on your settings in toaster-watcher.conf.

courier_config

  $setup->courier_config($conf);

Does all the post-install configuration of Courier IMAP.

daemontools

Fetches sources from DJB's web site and installs daemontools, per his instructions.

  $setup->daemontools($conf);

dependencies

  $setup->dependencies($conf, $debug);

Installs a bunch of programs that are needed by subsequent programs we'll be installing. You can install these yourself if you'd like, this doesn't do anything special beyond installing them:

ispell, gdbm, setquota, expect, maildrop, autorespond, qmail, qmailanalog, daemontools, openldap-client, Compress::Zlib, Crypt::PasswdMD5, HTML::Template, Net::DNS, Crypt::OpenSSL-RSA, DBI, DBD::mysql, TimeDate.

djbdns

Fetches djbdns, compiles and installs it.

  $setup->djbdns($conf);

ezmlm

Installs Ezmlm-idx. This also tweaks the port Makefile so that it'll build against MySQL 4.0 libraries as if you don't have MySQL 3 installed. It also copies the sample config files into place so that you have some default settings.

  $setup->ezmlm($conf);

filtering

Installs SpamAssassin, ClamAV, simscan, QmailScanner, maildrop, procmail, and programs that support the aforementioned ones. See toaster-watcher.conf for options that allow you to customize which programs are installed and any options available.

  $setup->filtering($conf);

is_newer

Checks a three place version string like 5.3.24 to see if the current version is newer than some value. Useful when you have various version of a program like vpopmail or mysql and the syntax you need to use for building it is different for differing version of the software.

isoqlog

Installs isoqlog.

  $setup->isoqlog($conf);

maildrop

Installs a maildrop filter in /usr/local/etc/mail/mailfilter, a script for use with Courier-IMAP in /usr/local/sbin/subscribeIMAP.sh, and sets up a filter debugging file in /var/log/mail/maildrop.log.

  $setup->maildrop($conf, $debug);

maillogs

Installs the maillogs script, creates the logging directories (toaster_log_dir/*), creates the qmail supervise dirs, installs maillogs as a log post-processor and then builds the corresponding service/log/run file to use with each post-processor.

  $setup->maillogs($conf);

mattbundle

Downloads and installs the latest version of MATT::Bundle.

  $setup->mattbundle($debug);

maildrop_filter

Creates and installs the maildrop mailfilter file.

  $setup->maildrop_filter($conf);

phpmyadmin

Installs PhpMyAdmin for you, based on your settings in toaster-watcher.conf. The actual code that does the work is in Mail::Toaster::Mysql (part of Mail::Toaster::Bundle) so read the man page for Mail::Toaster::Mysql for more info.

  $setup->phpmyadmin($conf);

mysqld

Installs mysql server for you, based on your settings in toaster-watcher.conf. The actual code that does the work is in Mail::Toaster::Mysql so read the man page for Mail::Toaster::Mysql for more info.

  $setup->mysqld($conf);

ports

Install the ports tree on FreeBSD or Darwin and update it with cvsup.

On FreeBSD, it optionally uses cvsup_fastest to choose the fastest cvsup server to mirror from. Configure toaster-watch.conf to adjust it's behaviour. It can also install the portupgrade port to use for updating your legacy installed ports. Portupgrade is very useful, but be very careful about using portupgrade -a. I always use portupgrade -ai and skip the toaster related ports such as qmail since we have customized version(s) of them installed.

  $setup->ports($conf);

qmailadmin

Install qmailadmin based on your settings in toaster-watcher.conf.

  $setup->qmailadmin($conf, $debug);

qmail_scanner

Installs qmail_scanner and configures it for use.

  $setup->qmail_scanner($conf, $debug);

qmail_scanner_config

prints out a note telling you how to enable qmail-scanner.

  $setup->qmail_scanner_config;

qmail_scanner_test

Send several test messages via qmail-scanner to test it. Sends a clean message, an attachment, a virus, and spam message.

  $setup->qmail_scanner_test($conf);

qs_stats

Install qmail-scanner stats

  $setup->qs_stats($conf);

razor

Install Vipul's Razor2

  $setup->razor($conf);

ripmime

Installs ripmime

  $setup->ripmime($conf);

rrdutil

Checks for and installs any missing programs upon which RRDutil depends (rrdtool, net-snmp, Net::SNMP, Time::Date) and then downloads and installs the latest version of RRDutil.

If upgrading, it is wise to check for differences in your installed rrdutil.conf and the latest rrdutil.conf-dist included in the RRDutil distribution.

  $setup->rrdutil;

simscan

Install simscan from Inter7.

  $setup->simscan($conf);

See toaster-watcher.conf to see how these settings affect the build and operations of simscan.

simscan_conf

Build the simcontrol and ssattach config files based on toaster-watcher.conf settings.

simscan_test

Send some test messages to the mail admin using simscan as a message scanner.

    $setup->simscan_test($conf);

socklog

        $setup->socklog($conf, $ip);

If you need to use socklog, then you'll appreciate how nicely this configures it. :) $ip is the IP address of the socklog master server.

socklog_qmail_control

        socklog_qmail_control($service, $ip, $user, $supervisedir);

Builds a service/log/run file for use with socklog.

config_spamassassin

        $setup->config_spamassassin();

Shows this URL: http://www.yrex.com/spam/spamconfig.php

squirrelmail

        $setup->squirrelmail

Installs Squirrelmail using FreeBSD ports. Adjusts the FreeBSD port by passing along WITH_APACHE2 if you have Apache2 selected in your toaster-watcher.conf.

sqwebmail

        $setup->sqwebmail($conf);

install sqwebmail based on your settings in toaster-watcher.conf.

supervise

        $setup->supervise($conf);

One stop shopping: calls the following subs:

  $qmail->configure_qmail_control($conf);
  $setup->service_dir($conf);
  $setup->supervise_dirs($conf);
  $qmail->install_supervise_run($conf);
  $qmail->install_supervise_log_run($conf);
  $setup->configure_services($conf, $supervise);

service_dir

Create the supevised services directory (if it doesn't exist).

        $setup->service_dir($conf);

Also sets the permissions to 775.

configure_services

Sets up the supervised mail services for Mail::Toaster

        $setup->configure_services($conf, $supervise);

This creates (if it doesn't exist) your qmail service directory (default /var/service) and populates it with symlinks to the supervise control directories (typically /var/qmail/supervise). Creates and sets permissions on the following directories and files:

  /var/service
  /var/service/pop3
  /var/service/smtp
  /var/service/send
  /var/service/submit
  /usr/local/etc/rc.d/services.sh
  /usr/local/sbin/services

supervise_dirs

Creates the qmail supervise directories.

        $setup->supervise_dirs($conf, $debug);

The default directories created are:

  $supervise/smtp
  $supervise/submit
  $supervise/send
  $supervise/pop3

unless otherwise specified in $conf

test

Run a variety of tests to verify that your Mail::Toaster installation is working correctly.

ucspi_tcp

Installs ucspi-tcp with my (Matt Simerson) MySQL patch.

        $setup->ucspi_tcp($conf);

vpopmail

Vpopmail is great, but it has lots of options and remembering which option you used months or years ago to build a mail server isn't always easy. So, store all the settings in toaster-watcher.conf and this sub will install vpopmail for you honoring all your settings and passing the appropriate configure flags to vpopmail's configure.

        $setup->vpopmail($conf);

If you don't have toaster-watcher.conf installed, it'll ask you a series of questions and then install based on your answers.

vpopmail_etc

Builds the ~vpopmail/etc/tcp.smtp file with a mess of sample entries and user specified settings.

        $setup->vpopmail_etc($conf);

vpopmail_vmysql_h

        vpopmail_vmysql_h(replication, master, slave, user, pass);

Versions of vpopmail less than 5.2.26 (or thereabouts) required you to manually edit vmysql.h to set your mysql login parameters. This sub modifies that file for you.

vpopmail_mysql_privs

Connects to MySQL server, creates the vpopmail table if it doesn't exist, and sets up a vpopmail user and password as set in $conf.

    $setup->vpopmail_mysql_privs($conf);

vqadmin

        $setup->vqadmin($conf, $debug);

Installs vqadmin from ports on FreeBSD and from sources on other platforms. It honors your cgi-bin and your htdocs directory as configured in toaster-watcher.conf.

AUTHOR

Matt Simerson - matt@tnpi.biz

BUGS

None known. Report any to matt@cadillac.net.

TODO

Documentation. It's almost reasonable now.

SEE ALSO

The following are all man/perldoc pages:

 Mail::Toaster 
 Mail::Toaster::Apache 
 Mail::Toaster::CGI  
 Mail::Toaster::DNS 
 Mail::Toaster::Darwin
 Mail::Toaster::Ezmlm
 Mail::Toaster::FreeBSD
 Mail::Toaster::Logs 
 Mail::Toaster::Mysql
 Mail::Toaster::Passwd
 Mail::Toaster::Perl
 Mail::Toaster::Provision
 Mail::Toaster::Qmail
 Mail::Toaster::Setup
 Mail::Toaster::Utility

 Mail::Toaster::Conf
 toaster.conf
 toaster-watcher.conf

 http://matt.simerson.net/computing/mail/toaster/
 http://matt.simerson.net/computing/mail/toaster/docs/

COPYRIGHT

Copyright (c) 2004-2005, The Network People, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of the The Network People, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.