Test the process!

Before upgrading a production server, test on a development server. If you don't have a development server, consider settings up a FreeBSD jailed test environment.

http://www.tnpi.biz/computing/perl/MATT-Bundle/freebsd.shtml#createjail


Step 1: Upgrade Perl.

Certain features (like spam filtering) require perl 5.6.1 or higher to function fully. If perl -v reflects anything smaller than 5.6.1, it is recommended that you upgrade to 5.8.x. You can use toaster_setup.pl -s perl to do this for you.

Disable any cron jobs that run perl scripts *before* upgrading perl. When you upgrade perl, the installed modules get left behind and need to be re-installed. After upgrading perl and all the installed modules, test the cron jobs by running them on the command line before enabling them.

If you don't want to use toaster_setup.pl to upgrade perl, you can do it manually as follows:

  cd /usr/ports/lang/perl5.8;
  make -DENABLE_SUIDPERL install clean;
  rehash; use.perl port;

You need Perl's CPAN working for installing perl modules so make sure it's configured. If the following command doesn't give you a prompt, then you'll be prompted to configure.

  perl -MCPAN -e shell
  exit

If you choose to install Perl 5.8, make sure you enable suidperl. You do this by adding -DENABLE_SUIDPERL as shown above or if using pkg* and friends, add the following line to the MAKE_ARGS of /usr/local/etc/pkgtools.conf:

 'lang/perl5.8'   => 'ENABLE_SUIDPERL=yes',

After upgrading Perl, your installed Perl modules will not work with the new version of Perl. You'll want to update them. I find the easiest approach is something like this:

  portupgrade -f `pkg_info | grep p5- | cut -d" " -f1`
  portupgrade -f `pkg_info | grep rrdtool- | cut -d" " -f1`


Step 2: Upgrade Mail::Toaster

   perl -e 'use MATT::Utility; InstallMailToaster';

If that doesn't work, try toaster_setup.pl -s toaster. If neither works, your toaster is pre-historic and you'll have to manually install Mail::Toaster.

Documentation for the modules being called by toaster_setup.pl, toaster_watcher.pl, maillogs, and index.cgi are all installed in Perl's pod format (perldoc Mail::Toaster, perldoc Mail::Toaster::CGI, etc) as well as being available online at http://www.tnpi.biz/internet/mail/toaster/docs/.


Step 3: Upgrade FreeBSD.

Follow the docs at http://www.freebsd.org/handbook/ A few things to help you along are:

  toaster_setup.pl -s sources
  toaster_setup.pl -s ports

That'll update your FreeBSD sources and ports tree with the latest versions. Then you'll want to upgrade your FreeBSD. I do it this way:

  cd /usr/src
  make buildworld
  make kernel
  reboot
  cd /usr/src
  make installworld
  mergemaster
  reboot

The process will vary based on the version of FreeBSD you are upgrading from and to. The above assumes that I've also configured /etc/make.conf. It's ALWAYS best to read the docs first, including /usr/src/UPDATING. Failure to do so can be quite difficult to recover from. If you are upgrading from FreeBSD 4.x to 5.x, be sure to read all the documentation and follow it carefully.

After upgrading the OS, you'll want to run portupgrade and upgrade all the ports with the latest version. I do so like this:

  pkgdb -F
  portupgrade -ai

Some folks like running portupgrade -a. This almost always breaks their toaster. See the FAQ for reasons why. Do NOT upgrade ports that are manually installed by the toaster, such as qmail, ucspi, etc. You have been warned. If you let portupgrade reinstall qmail and your settings get wiped out, you have yourself to blame.


Step 4: Update Toaster config files

   cd /usr/local/etc
   sdiff -o tmp toaster-watcher.conf toaster-watcher.conf-dist
   mv tmp toaster-watcher.conf
   sdiff -o tmp toaster.conf toaster.conf-dist
   mv tmp toaster.conf

Make your .conf files resemble the -dist files, with your local customizations. If the CVS id string at the top of the file(s) has changed, that's a good indication that new settings have been added and it's time to update your file. Use sdiff to merge the differences and create a new file.

Use 'perldoc toaster.conf' or 'perldoc toaster-watcher.conf' to read the man pages with extensive documentation describing what all them settings are for.


Step 5: Start updating the toaster!

   toaster_setup.pl -s pre
   toaster_setup.pl -s ucspi
   toaster_setup.pl -s vpopmail
   toaster_setup.pl -s qmailadmin
   toaster_setup.pl -s courier
   toaster_setup.pl -s apache (optional)

If toaster_setup.pl has any problems running, fix what it complains about and then run it again with the same parameter. It will resume and finish that section.

Don't forget to add the following two lines to ~vpopmail/etc/tcp.smtp if you haven't yet. (If you don't, toaster-watcher will remind you, frequently.)

  ### BEGIN QMAIL SCANNER VIRUS ENTRIES ###
  ### END QMAIL SCANNER VIRUS ENTRIES ###


Step 6: Upgrade Qmail

   toaster_setup.pl -s qmail

patch info: http://www.tnpi.biz/internet/mail/toaster/patches/


Step 7: Set up mail filtering and logging

   toaster_setup.pl -s filter
   toaster_setup.pl -s qss     (optional)
   toaster_setup.pl -s supervise
   toaster_setup.pl -s maillogs
   toaster_setup.pl -s rrdutil (optional)


Step 8: Verify cron entries

Run all these commands from the command line and verify their proper functionality (no complaints or errors) BEFORE adding to cron.

 crontab -u root -e
   9-59/10 * * * * /usr/local/vpopmail/bin/clearopensmtp
   40  * * * *  /usr/local/share/sqwebmail/cleancache.pl
   */5 * * * * /usr/local/sbin/toaster-watcher.pl
   */5 * * * * /usr/local/www/cgi-bin/rrdutil.cgi -a update


Step 9: Watch the log files

A good way to test is simply watching the logs in a second session while running the test script or sending some messages.

  tail -F /var/log/maillog &
  tail -F /var/log/mail/send/current &
  tail -F /var/log/mail/smtp/current &
  tail -F /var/log/mail/maildrop.log

Note that unless filtering_debug is enabled in toaster-watcher.conf, nothing will be written to maildrop.log. It is enabled by default, and changes only take effect after running ``toaster_setup.pl -s maildrop''.


Step 10: Test the Upgrade

  toaster_setup.pl -s test

That will send some test messages. Also, test other aspects of your mail system including:

 Mail::CGI
 Squirrelmail
 Sqwebmail
 Qmailadmin
 POP3
 IMAP
 SMTP
 SMTP-Submit