HOWTO: Upgrade layer1 MailScanner

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
33
473
Go on, have a guess
Hi,

I recently upgraded our MailScanner installations to the latest version (MailScanner-4.32.5-1). The following procedure is for use after having used the http://layer1.cpanel.net mailscanner add-on.

You use the following completely at your own risk. Don't come running to me if it breaks everything!

Code:
/scripts/perlinstaller Net::CIDR
/scripts/perlinstaller Archive::Zip
/scripts/perlinstaller Compress::Zlib
/scripts/perlinstaller Convert::BinHex

wget http://www.sng.ecs.soton.ac.uk/mailscanner/files/4/tar/MailScanner-install-4.32.5-1.tar.gz
tar -xzf MailScanner-install-*.tar.gz
rm -Rf /usr/mailscanner.new/
rm -Rf /usr/mailscanner.old/
cd MailScanner-install-*/perl-tar
tar -xzf MailScanner-*.tar.gz
mv -f MailScanner-*/ /usr/mailscanner.new
cd ../..
rm -Rf MailScanner-install-*
cd /usr/mailscanner/etc/
mv -f MailScanner.conf.new MailScanner.conf.old # MailScanner.conf.new may not exist, don't worry about it
cd reports/en
mv -f languages.conf.new languages.conf.old # languages.conf.new may not exist, don't worry about it
cd /usr/mailscanner.new/etc/
mv -f MailScanner.conf MailScanner.conf.new
mv -f virus.scanners.conf virus.scanners.conf.new
cd reports/en
mv -f languages.conf languages.conf.new
cd ../..
cp -Rf /usr/mailscanner/etc/* ./
mv -f virus.scanners.conf.new virus.scanners.conf
cd reports/en/
mv -f languages.conf.new languages.conf
cd /usr/mailscanner.new/
find ./ -type f | xargs replace "/opt/MailScanner/" "/usr/mailscanner/" --
cd etc/
../bin/upgrade_MailScanner_conf MailScanner.conf MailScanner.conf.new >  MailScanner.new
mv -f MailScanner.conf MailScanner.old
mv -f MailScanner.new  MailScanner.conf
At this point you should edit MailScanner.conf and make any modifications that you want to new settings added by the upgrade.

Then:

Code:
cd /usr
killall MailScanner
sleep 8  # then wait a few seconds for it to stop
mv -f mailscanner mailscanner.old
mv -f mailscanner.new mailscanner
/usr/mailscanner/bin/check_mailscanner
tail -f /var/log/maillog
That last command is to watch the maillog file for any errors. Then test.

If you have any problems, or would prefer someone with experience to do this for you, we offer a cheap package for this service:
http://www.webumake.com/services/

[updated for latest release of MailScanner 1 August 2004]
 
Last edited:

FWC

Well-Known Member
May 13, 2002
349
0
316
Ontario, Canada
Thanks for the How To. I got this to work with a couple modifications. I had to install:

Net::CIDR
Archive::Zip

Also, this command:
Code:
cp -Rf /usr/mailscanner/etc/* ./
overwrote the new virus.scanners.conf file with the old one, which is in the wrong format. I uncrunched the archive again, copied the new version into the new directory and ran this command again:
Code:
perl -pi -e "s/\/opt\/MailScanner/\/usr\/mailscanner/g"  /usr/mailscanner.new/etc/virus.scanners.conf
After adding the missing Perl modules and fixing the virus.scanners.conf file the updated MailScanner started right up and seems to be working fine. :)
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
33
473
Go on, have a guess
Hi FWC,

Thank you for that. I've updated the howto with the steps you've mentioned. Oddly my installation already had both the perl compression libraries (RHE3.0 perl 5.8.1).
 

FWC

Well-Known Member
May 13, 2002
349
0
316
Ontario, Canada
Originally posted by chirpy
Hi FWC,

Thank you for that. I've updated the howto with the steps you've mentioned. Oddly my installation already had both the perl compression libraries (RHE3.0 perl 5.8.1).
I did it on a 7.3 box that didn't have them. I have an RHE one I haven't updated yet. Everything is working fine and I'll be updating them all tonight. Thanks again. :)
 

puzz1ed1

Active Member
Jan 31, 2004
39
0
156
Thurrock, UK
Jonathan,

get the following lines in /maillog..... any ideas what's gone wrong?! ;-)

Steve


MailScanner E-Mail Virus Scanner version 4.28.5 starting...
Using locktype = posix
Creating hardcoded struct_flock subroutine for linux (Linux-type)
New Batch: Scanning 1 messages, 2398 bytes
Looked up unknown string unreadablearchive in language translation file /usr/mailscanner/etc/reports/en/languages.conf
Virus and Content Scanning: Starting
Your virus.scanners.conf file does not have 3 words on each line. See if you have an old one left over by mistake.
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
33
473
Go on, have a guess
Looks like you missed out some of this bit:
Code:
cd /usr/mailscanner/etc/
mv MailScanner.conf.new MailScanner.conf.old # MailScanner.conf.new may not exist, don't worry about it
cd reports/en
mv languages.conf.new languages.conf.old # languages.conf.new may not exist, don't worry about it
cd /usr/mailscanner.new/etc/
mv MailScanner.conf MailScanner.conf.new
mv virus.scanners.conf virus.scanners.conf.new
cd reports/en
mv languages.conf languages.conf.new
cd ../..
cp -Rf /usr/mailscanner/etc/* ./
mv virus.scanners.conf.new virus.scanners.conf
cd reports/en/
mv languages.conf.new languages.conf
You can recover it by downloading the tar.gz file again, then open it up and go to the directories in this distribution for languages.conf and then virus.scanners.conf and copy those new files over the top of the ones now in your /usr/mailscanner/etc/ directory tree.

Let me know if you want more specific instructions.
 

puzz1ed1

Active Member
Jan 31, 2004
39
0
156
Thurrock, UK
ok, fixed that, but now have....

Mar 8 10:55:16 dennis MailScanner[12974]: Can't run commercial checker clamav ("/opt/MailScanner/lib/clamav-wrapper"): No such file or directory
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
33
473
Go on, have a guess
Need to run this:

Code:
perl -pi -e "s/\/opt\/MailScanner/\/usr\/mailscanner/g"  /usr/mailscanner/etc/virus.scanners.conf
 

hostseeker

Well-Known Member
Sep 4, 2001
86
0
306
I got the following errors when I tried to start MailScanner after going through the outlined upgrade process:

Starting Mailscanner...
/usr/mailscanner/bin/check_mailscanner: line 112: cd: Sr/mailscanner/bin: No such file or directory
/usr/mailscanner/bin/check_mailscanner: line 113: MailsScanner: command not found

I repeated the process and got the same error. I had installed MailScanner from layer1 about 1 month ago and it was working fine..

Any ideas?
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
33
473
Go on, have a guess
It appears that you may have mis-typed the per substitutes or something.

If you edit /usr/mailscanner/check_mailscanner lines 44 to 46 shouls read:

process=MailScanner
msbindir=/usr/mailscanner/bin
config=/usr/mailscanner/etc/MailScanner.conf

What do yours?
 

hostseeker

Well-Known Member
Sep 4, 2001
86
0
306
Mine showed:

process=MailScanner
msbindir=Sr/mailscanner/bin
config=Sr/mailscanner/etc/MailScanner.conf

I corrected them as you stated, however it still isn't working I think the problem has something to do with the very first line of the /usr/mailscanner/bin/MailScanner file.

What should the first line be?
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
33
473
Go on, have a guess
That should read:

#!/usr/bin/perl -I/usr/mailscanner/lib

It does sound like the search and replace didn't work right for you. You might find more files with similar problems.
 

hostseeker

Well-Known Member
Sep 4, 2001
86
0
306
Yeah, the first line of mine had Sr/ instead of -I/usr

I fixed that, and started Mailscanner and it seemed to start okay.

However, at this point my email system is completely down and has been since I did this MailScanner upgrade. MailScanner is not running but I can't receive any email. I have restarted Exim and Cpop and the restart worked okay, but no email for the last 2 hours!

Can you give me any ideas as to what might have messed it up and how to fix it?
 

hostseeker

Well-Known Member
Sep 4, 2001
86
0
306
okay apparently I mistyped when doing the upgrade and the search and replace changed some paths. My fault!

If someone could share the proper paths for the following files so I can correct my mistake I will be grateful:

In /usr/mailscanner/etc/virus.scanners.conf

the line for clamav I have:

clamav /usr/mailscanner/lib/clamav-wrapper /u/usr/local

is this correct?
 

anand

Well-Known Member
Nov 11, 2002
1,432
1
168
India
cPanel Access Level
DataCenter Provider
Originally posted by hostseeker
okay apparently I mistyped when doing the upgrade and the search and replace changed some paths. My fault!

If someone could share the proper paths for the following files so I can correct my mistake I will be grateful:

In /usr/mailscanner/etc/virus.scanners.conf

the line for clamav I have:

clamav /usr/mailscanner/lib/clamav-wrapper /u/usr/local

is this correct?
The correct lines are:

PHP:
clamav          /usr/mailscanner/lib/clamav-wrapper     /usr/local
clamavmodule    /bin/false
 

hostseeker

Well-Known Member
Sep 4, 2001
86
0
306
Thank you!

It appears my upgrade and search and replace didn't go right at all.

Is there a unix command that I could use for search and replace in SSHl for the entire mailscanner directory for the occurances of Sr where it is case sensitive?

It seems instead of /usr/ it came our Sr/ which I know I probably caused by hitting the wrong keys.

Also in the virus.scanners.conf file somehow the last colum ended up with /u/usr instead of just /usr, but I have already fixed that.

Thanks!
 

anand

Well-Known Member
Nov 11, 2002
1,432
1
168
India
cPanel Access Level
DataCenter Provider
Originally posted by hostseeker
Thank you!
np :)


It appears my upgrade and search and replace didn't go right at all.

Is there a unix command that I could use for search and replace in SSHl for the entire mailscanner directory for the occurances of Sr where it is case sensitive?

It seems instead of /usr/ it came our Sr/ which I know I probably caused by hitting the wrong keys.

Also in the virus.scanners.conf file somehow the last colum ended up with /u/usr instead of just /usr, but I have already fixed that.

Thanks!
Are you sure its only that ? Well i recommend you to reinstall it. Probably while you are at it, just follow instructions at http://forums.cpanel.net/showthread.php?threadid=20412 . I have posted a complete howto to update clam+mailscanner installed from layer1. It would be better to go that way to avoid any loose ends left.
 

hostseeker

Well-Known Member
Sep 4, 2001
86
0
306
anand,

Thank you for your help.

I was looking at your post earlier before I attempted the upgrade, but your post looked like it was only for clamav and not for both clam. Plus that thread was 5 pages long and I couldn't figure out what to follow as each page had modified instructions.

The instructions I followed were for both Mailscanner and Clamav. I am sure I just messed up somehow and hit the wrong key and ended up replacing some text wrong.

I think I have most all of it corrected, but just wanted to be sure.

To be absolutely sure I guess I would need to completely uninstall Mailscanner and Clamav but I really don't know how to do that either, LOL.

I learn more every day but it seems like this learning process takes forever, I am glad people are patient!
 

anand

Well-Known Member
Nov 11, 2002
1,432
1
168
India
cPanel Access Level
DataCenter Provider
Originally posted by hostseeker
anand,

Thank you for your help.

I was looking at your post earlier before I attempted the upgrade, but your post looked like it was only for clamav and not for both clam. Plus that thread was 5 pages long and I couldn't figure out what to follow as each page had modified instructions.

The instructions I followed were for both Mailscanner and Clamav. I am sure I just messed up somehow and hit the wrong key and ended up replacing some text wrong.

I think I have most all of it corrected, but just wanted to be sure.

To be absolutely sure I guess I would need to completely uninstall Mailscanner and Clamav but I really don't know how to do that either, LOL.

I learn more every day but it seems like this learning process takes forever, I am glad people are patient!
Thx. My post was first infact for clam only. Later i thought of doing mailscanner also. Let me guide you.

Btw to uninstall, just go in the directory where you untarred the mailscanner installation from layer1. Run ./uninstall. It will do everything for you.
 

anand

Well-Known Member
Nov 11, 2002
1,432
1
168
India
cPanel Access Level
DataCenter Provider
Go to this post

http://forums.cpanel.net/showthread.php?s=&postid=99110#post99110

Find this "New mailscanner 4.28.5-2 and clam 0.67-1 for FRESH BOXES ONLY".

That post will tell you how to update your clam and mailscanner using the layer1 installation itself.

Incase you get in trouble, PM me your server info, i will help fix it.