Mail::Toaster::Setup

- NAME
- DESCRIPTION
- METHODS

- new
- apache
- autorespond
- clamav
- config
- courier
- courier_config
- daemontools
- dependencies
- djbdns
- ezmlm
- filtering
- is_newer
- isoqlog
- maildrop
- maillogs
- mattbundle
- maildrop_filter
- phpmyadmin
- mysqld
- ports
- qmailadmin
- qmail_scanner
- qmail_scanner_config
- qs_stats
- razor
- ripmime
- rrdutil
- simscan
- simscan_conf
- simscan_test
- socklog
- socklog_qmail_control
- config_spamassassin
- squirrelmail
- sqwebmail
- supervise
- service_symlinks
- startup_script
- test
- ucspi_tcp
- vpopmail
- vpopmail_etc
- vpopmail_vmysql_h
- vpopmail_mysql_privs
- vqadmin

- AUTHOR
- BUGS
- TODO
- SEE ALSO
- COPYRIGHT

# 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);

## config

## 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;

## 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->control_create($conf);
      $setup->service_dir_create($conf);
      $toaster->supervise_dirs_create($conf);
      $qmail->install_qmail_control_files($conf);
      $qmail->install_qmail_control_log_files($conf);
      $setup->service_symlinks($conf, $debug);

## service_symlinks

Sets up the supervised mail services for Mail::Toaster

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

This populates the supervised service directory (default: /var/service) with symlinks to the supervise control directories (typically /var/qmail/supervise/*). Creates and sets permissions on the following directories and files:

      /var/service/pop3
      /var/service/smtp
      /var/service/send
      /var/service/submit

## startup_script

Sets up the supervised mail services for Mail::Toaster

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

This creates (if it doesn't exist) your daemontools service directory (default /var/service) and creates the symlink to the services link so you can run ``services stop'' or ``services start'' on your system. It affects the following files:

      etc/rc.d/[svscan|services].sh
      /usr/local/sbin/services

## 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::Conf
     toaster.conf
     toaster-watcher.conf

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

# 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.