Upgrade MailScanner 4.x to 5

DutchDaemon

Administrator
Staff member
Administrator
Moderator
Developer
This is just a 'documentation dump' that I had to make to perform this upgrade. Note that MailScanner 5 in its current incarnation annihilates your existing MailScanner 4.x installation. E.g.: it has not been 'delinuxized', so all paths are wrong. I have managed to perform the upgrade on seven servers using the following steps. Please review them all, do not just type them in without knowing what you're doing.

Code:
# cp -Rp /usr/local/etc/MailScanner /somewhere/etc-MailScanner
# cp -Rp /usr/local/lib/MailScanner /somewhere/lib-MailScanner
# cp -Rp /usr/local/libexec/MailScanner /somewhere/libexec-MailScanner
# cp -Rp /usr/local/share/MailScanner /somewhere/share-MailScanner

# service mta stop
# service mailscanner stop

# pkg delete -y mailscanner
# pkg autoremove -y

# rm -rf /usr/local/etc/MailScanner
# rm -rf /usr/local/lib/MailScanner
# rm -rf /usr/local/libexec/MailScanner
# rm -rf /usr/local/share/MailScanner

# pkg install -y MailScanner

# cd /etc && ln -s /usr/local/etc/MailScanner
# cd /usr/lib && ln -s /usr/local/lib/MailScanner
# cd /usr/share && ln -s /usr/local/share/MailScanner
# cd /usr/sbin && ln -s /usr/local/sbin/MailScanner
# cd /usr/local/etc/MailScanner/
Now edit file defaults. Fix all paths!
Code:
# cd /usr/local/etc/MailScanner/conf.d/
# grep -v -e ^$ -e ^# /somewhere/etc-MailScanner/MailScanner.conf > my_config.conf
Be sure to comment out include /usr/local/etc/MailScanner/conf.d/* in my_config.conf (or you will have an endless start loop).
Code:
# cd /usr/sbin/
(if your shell complains during the next command, type 'sh' and enter)
# ls /usr/local/sbin/ms-* | while read file
  do ln -s "${file}"
  done
(if you typed 'sh' before doing this, you can press Ctl+d now)
# cd /usr/local/sbin
# ln -s MailScanner mailscanner

# mkdir -p /usr/local/lib/MailScanner/MailScanner
# cp -Rp /somewhere/lib-MailScanner/MailScanner/CustomFunctions /usr/local/lib/MailScanner/MailScanner/
# mkdir /usr/local/lib/MailScanner/wrapper
# cp -p /somewhere/libexec-MailScanner/* /usr/local/lib/MailScanner/wrapper/
Now review the /rules/ directory in /somewhere/etc-MailScanner and put wanted rules back.

Also review .conf files (not MailScanner.conf) in /somewhere/etc-MailScanner and (re)apply them to the ones in /usr/local/etc/MailScanner, if and when needed.
Code:
# service mailscanner start
Any remaining errors (also check /var/log/maillog!) are likely to be changed file/configuration names, which you can change by hand (either in your my_config.conf or by renaming files).

Test for output errors, and fix those:
Code:
# /usr/local/sbin/ms-cron HOURLY
# /usr/local/sbin/ms-cron DAILY
If MailScanner starts cleanly (again: also check /var/log/maillog!):
Code:
# service mta restart
 
Last edited:
Thanks for sharing your notes. MailScanner 5.03, IMHO, is not ready for FreeBSD. It should be removed from the ports tree and version 4.85.2 brought back in.
 
Just run into this issue, so I fixed it.

I may have missed a few path issues, so email me crees@ if you notice any. Thanks to DutchDaemon for the instructions, all should be unnecessary now!

Cheers,

Chris
 
It worked out well with the new fixes!

The only problem I ran in to was the /usr/local/etc/MailScanner.conf line for Custom Functions Dir = ... . In MailScanner 4.85.2, it's /usr/local/lib/MailScanner/MailScanner/CustomFunctions, but in the newer version, the directory has been moved to /usr/local/share/MailScanner/perl/custom. No big deal, this was probably done upstream. There are some perl scripts for MailWatch (http://mailwatch.org/) that go in the Custom Functions Dir and everything was good with MailWatch and the new directory.

Thanks to the Port Maintainers and all others for fixing MailScanner 5.0.3.1! It's good now :)
 
Back
Top