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.
test
Run a variety of tests to verify that your Mail::Toaster installation is working correctly.
simscan
Install simscan from Inter7.
$setup->simscan($conf);
See toaster-watcher.conf to see which settings affect the build of simscan.
maildrop_filter
Creates and installs the maildrop mailfilter file.
$setup->maildrop_filter($conf);
phpmyadmin
$setup->phpmyadmin($conf);
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.
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.
mysqld
$setup->mysqld($conf);
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.
mattbundle
$setup->mattbundle;
Downloads and installs the latest version of MATT::Bundle.
rrdutil
$setup->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.
ports
$setup->ports($conf);
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.
apache
$setup->apache($conf, $version);
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.
vpopmail
$setup->vpopmail($conf);
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.
If you don't have toaster-watcher.conf installed, it'll ask you a series of questions and then install based on your answers.
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.
SetupVmysql
SetupVmysql(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.
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.
maillogs
$setup->maillogs($conf);
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.
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.
filtering
$setup->filtering($conf);
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.
maildrop
$setup->maildrop($conf, $debug);
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.
config_spamassassin
$setup->config_spamassassin();
Shows this URL: http://www.yrex.com/spam/spamconfig.php
config_qmailscanner
$setup->config_qmailscanner;
prints out a note telling you how to enable qmail-scanner.
qmail_scanner
Installs qmail_scanner and configures it for use.
$setup->qmail_scanner($conf, $debug);
qs_stats
Install qmailscanner stats
$setup->qs_stats($conf);
clamav
Install ClamAV, configure the startup and config files, download the latest virus definitions, and start up the daemons.
$setup->clamav($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, gnupg, maildrop, mysql-client(3), autorespond, qmail, qmailanalog, daemontools, openldap-client, Compress::Zlib, Crypt::PasswdMD5, HTML::Template, Net::DNS, Crypt::OpenSSL-RSA, DBI, DBD::mysql, TimeDate.
courier
$setup->courier($conf);
Installs courier imap based on your settings in toaster-watcher.conf.
sqwebmail
$setup->sqwebmail($conf);
install sqwebmail based on your settings in toaster-watcher.conf.
qmailadmin
$setup->qmailadmin($conf, $debug);
Install qmailadmin based on your settings in toaster-watcher.conf.
ucspi
$setup->ucspi($conf, $debug);
Installs ucspi-tcp with my (Matt Simerson) MySQL patch.
ezmlm
$setup->ezmlm($conf);
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.
config_courier
$config->config_courier($conf);
Does all the post-install configuration of Courier IMAP.
config_vpopmail_etc
$setup->config_vpopmail_etc($conf);
Builds the ~vpopmail/etc/tcp.smtp file.
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
AUTHOR
Matt Simerson - matt@tnpi.biz
BUGS
None known. Report any to matt@cadillac.net.
TODO
Documentation. It's almost reasonable now.
SEE ALSO
http://matt.simerson.net/computing/mail/toaster/
Mail::Toaster::CGI, Mail::Toaster::DNS, Mail::Toaster::Logs, Mail::Toaster::Qmail, Mail::Toaster::Setup, Mail::Toaster::FreeBSD
COPYRIGHT
Copyright (c) 2004, 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.