# Linux Avast Upgrades

## Manual patch for some 64 bit linux systems where normal installation segfaults

*** TEST AVAST INSTALL TO BE BROKEN ***

    [root@mu surgemail]# pwd
    /usr/local/surgemail
    [root@mu surgemail]# ./av_avast -test
    This test will:
     - dynamically load avast libraries (checking dependencies)
     - attempt to scan an infected message
     - attempt to scan a clean message...
    Loading avast libraries
    Segmentation fault
    [root@mu surgemail]# uname -a
    Linux *** 2.6.9-55.ELsmp #1 SMP Fri Apr 20 16:36:54 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux

*** DOWNLOAD PATCH ***

    [root@mu surgemail]# wget ftp://netwinsite.com/pub/surgemail/util/avast4surgemail_
    linux_engine470c_64bitpatch.tar.gz
    --08:11:37--  ftp://netwinsite.com/pub/surgemail/util/avast4surgemail_linux_engine
    470c_64bitpatch.tar.gz
               => `avast4surgemail_linux_engine470c_64bitpatch.tar.gz'
    Resolving netwinsite.com... 70.85.155.194
    Connecting to netwinsite.com|70.85.155.194|:21... connected.
    Logging in as anonymous ... Logged in!
    ==> SYST ... done.    ==> PWD ... done.
    ==> TYPE I ... done.  ==> CWD /pub/surgemail/util ... done.
    ==> PASV ... done.    ==> RETR avast4surgemail_linux_engine470c_64bitpatch.tar.gz ... done.

        [     <=>                                                                 ] 860,612        1.01M/s

    08:11:38 (1.01 MB/s) - `avast4surgemail_linux_engine470c_64bitpatch.tar.gz' saved [860612]

    [root@mu surgemail]# tar -xzf avast4surgemail_linux_engine470c_64bitpatch.tar.gz
    [root@mu surgemail]# cd temp_patch/
    [root@mu temp_patch]# ls -l
    total 2064
    -rwxr-xr-x  1 root root   30092 Aug  9 07:45 avastvpsreload
    -rwxr-xr-x  1 root root  232691 Aug  9 07:44 av_avast
    -rwxr-xr-x  1 root root 1824264 Aug  9 07:45 libavastengine-4.so.7.0.1

*** NOW UPGRADE 2 RELEVANT FILES ***

    [root@mu temp_patch]# ls -l /usr/bin | grep avast
    -rwxr-xr-x  1 root root      29868 Aug  9 08:08 avastvpsreload
    -rwxr-xr-x  1 root root      26743 Aug  9 08:08 avastvpsupdate.pl
    -rwxr-xr-x  1 root root       9682 Aug  9 08:08 avastvpsupdate.sh
    [root@mu temp_patch]# cp avastvpsreload /usr/bin
    cp: overwrite `/usr/bin/avastvpsreload'? y
    [root@mu temp_patch]# cd /usr/lib
    [root@mu lib]# ls -l | grep avast
    lrwxrwxrwx    1 root root       25 Aug  9 08:08 libavastengine-4.so.7 -> libavastengine-4.so.7.0.0
    -rwxr-xr-x    1 root root  1674072 Aug  9 08:08 libavastengine-4.so.7.0.0
    lrwxrwxrwx    1 root root       25 Aug  9 08:08 libavastengine.so -> libavastengine-4.so.7.0.0
    [root@mu lib]# mv libavastengine.so _libavastengine.so
    [root@mu lib]# mv libavastengine-4.so.7 _libavastengine-4.so.7
    [root@mu lib]# cp /usr/local/surgemail/temp_patch/libavastengine-4.so.7.0.1 .
    [root@mu lib]# ln -s libavastengine-4.so.7.0.1 libavastengine-4.so.7
    [root@mu lib]# ln -s libavastengine-4.so.7.0.1 libavastengine.so
    [root@mu lib]# ls -l | grep avast
    lrwxrwxrwx    1 root root       25 Aug  9 08:08 _libavastengine-4.so.7 -> libavastengine-4.so.7.0.0
    lrwxrwxrwx    1 root root       25 Aug  9 08:15 libavastengine-4.so.7 -> libavastengine-4.so.7.0.1
    -rwxr-xr-x    1 root root  1674072 Aug  9 08:08 libavastengine-4.so.7.0.0
    -rwxr-xr-x    1 root root  1824264 Aug  9 08:14 libavastengine-4.so.7.0.1
    lrwxrwxrwx    1 root root       25 Aug  9 08:08 _libavastengine.so -> libavastengine-4.so.7.0.0
    lrwxrwxrwx    1 root root       25 Aug  9 08:15 libavastengine.so -> libavastengine-4.so.7.0.1
    [root@mu lib]# cd /usr/local/surgemail

*** MAKE SURE SPECIAL INI SETTING SET ***
(requires av_avast version 1.4 - included with patch or avast4surgemail_linux_engine470c.tar.gz)

    [root@mu surgemail]# echo 64BITFIX_INIT true >> av_avast.ini

*** CONFIRM IT IS FIXED ***

    [root@mu surgemail]# ./av_avast -test
    This test will:
     - dynamically load avast libraries (checking dependencies)
     - attempt to scan an infected message
     - attempt to scan a clean message...
    Loading avast libraries
    Scanning infected email : SUCCESS - Virus detected (EICAR Test-NOT virus!!)
    Scanning clean email    : SUCCESS - Message is clean
    Avast installed and working :-)
    [root@mu surgemail]# ./av_avast -version
    av_avast version 1.4
    AVAST virus database version 643-1 (23.10.2006)
    To find scanning engine version issue "ls -l /usr/lib/libavastengine.so" command (or
    wherever you installed avast to)

*** MAKE SURE WE HAVE LATEST VERSION ***

    [root@mu surgemail]# ./av_avast -update
    new style update command syntax used
    avastvpsreload: Using the avast! virus signature database reloader for '/var/lib/avas
    t4/400.vps' file
    avastvpsreload: can't get the avast! engine semaphore identifier
    avastvpsreload: uploaded '/var/lib/avast4/400.vps' VPS file
    [root@mu surgemail]# ./av_avast -version
    av_avast version 1.4
    AVAST virus database version 764-3 (09.08.2007)
    To find scanning engine version issue "ls -l /usr/lib/libavastengine.so" command (or
    wherever you installed avast to)
    [root@mu surgemail]#

## Manual linux engine upgrade

Note: This is somewhat out of date, but still indicative of installation process.

*** TEST AVAST INSTALL TO BE BROKEN ***

    [root@localhost root]# cd /usr/local/surgemail
    [root@localhost surgemail]# ./av_avast -test
    This test will:
     - dynamically load avast libraries (checking dependancies)
     - attempt to scan an infected message
     - attempt to scan a clean message...
    Loading avast libraries
    Avast initialisation failed, avworkInitialize returned 42000
     is virus database installed? (try running 'av_avast -update')... Aborting now

*** DOWNLOAD NEW DISTRIBUTION ***

    [root@localhost surgemail]# ftp netwinsite.com
    Connected to netwinsite.com (216.65.3.228).
    220 SurgeFTP netwin1 (Version 2.2k13)
    Name (netwinsite.com:root): anonymous
    331 Guest login ok, send your complete e-mail address as password.
    Password:
    230-  Alias                Real path                      Access
    230-  /                    /disk2/ftp                     read
    230 User anonymous logged in.
    Remote system type is UNIX.
    Using binary mode to transfer files.
    ftp> bin
    200 Type set to I
    ftp> cd pub/surgemail/util
    250 CWD command successful now (/pub/surgemail/util)
    ftp> get avast4surgemail_linux_engine463.tar.gz
    local: avast4surgemail_linux_engine463.tar.gz remote: avast4surgemail_linux_engine463.tar.gz
    227 Entering Passive Mode (216,65,3,228,117,49).
    150 Opening BINARY connection for avast4surgemail_linux_engine463.tar.gz
    226 Transfer complete.
    3291829 bytes received in 102 secs (32 Kbytes/sec)
    ftp> quit
    221 Closing connection - goodbye!

*** INSTALL NEW DISTRIBUTION ***

    [root@localhost surgemail]# tar -xzf avast4surgemail_linux_engine463.tar.gz
    [root@localhost surgemail]# cd temp
    [root@localhost temp]# ./install.sh

    Copyright(C) 2003-2005 ALWIL Software.  All rights reserved.

    the avast! engine for Linux will be installed on this
    machine

    Technical support is available at:
    http://www.avast.com/eng/support/technical_support.html

    Support is available at http://www.asw.cz/support/

    Default avast installer modified by NetWin for use with surgemail
    It is recommended to use the default file locations
    For surgemail specific questions contact surgemail support:
          https://netwinsite.com/support.htm

    To install 'libavastengine-4.so.6.0.6' library now, press ENTER.

    To cancel the installation at any time, press Control-C.

    Checking for previous libavastengine installation

    found installed /usr/lib/libavastengine-4.so.6.0.6 file
    found installed /usr/bin/avastvpsreload file
    found installed /usr/bin/avastvpsupdate.pl file
    found installed /usr/share/man/man1/avastvpsreload.1 file
    found installed /usr/share/man/man1/avastvpsupdate.pl.1 file
    found installed /usr/share/man/man5/avastengine.conf.5 file
    found installed /usr/share/doc/libavastengine-4.6.3 directory

    Do you want to proceed with the installation?
    [ yes / no ]

    Do you want to install this package to the following directories:
        configuration to:  /etc
        binary files to:   /usr/bin
        shared library to: /usr/lib
        manual pages to:   /usr/share/man
        documentation to:  /usr/share/doc

        The following directories will be used by the shared library:
            data dir:    /var/lib/avast4
            temp dir:    /var/tmp/avast4
            log dir:     /var/log/avast4
            moved dir:   /var/lib/avast4/moved
            license dir: /var/lib/avast4

    [ yes / no ]

    NOT INSTALLING VPS updater cron scripts as this is handled by surgemail
       (to update manually run 'av_avast -update')

    In which directory is Surgemail installed?
    [ /usr/local/surgemail ]

    Installing av_avast in the surgemail drectory (/usr/local/surgemail)

    The libavastengine-4.so.6.0.6 library installation complete.

    To test your Surgemail Linux Avast install:
            run './av_avast -test' in the /usr/local/surgemail directory

    To use with surgemail use the following settings
            g_virus_filter cmd="av_avast" type=""
            g_virus_avast "true"
            g_virus_avast_hour "0,6,12,18"

    For further help see: https://netwinsite.com/surgemail/help/avast.htm

*** TEST AVAST INSTALLATION TO BE OK ***

    [root@localhost temp]# cd ..

    [root@localhost surgemail]# ./av_avast -version
    av_avast version 1.1
    AVAST virus database version 549-3 (07.12.2005)

    [root@localhost surgemail]# ./av_avast -test
    This test will:
     - dynamically load avast libraries (checking dependancies)
     - attempt to scan an infected message
     - attempt to scan a clean message...
    Loading avast libraries
    Scanning infected email : SUCCESS - Virus detected (EICAR Test-NOT virus!!)
    Scanning clean email    : SUCCESS - Message is clean
    Avast installed and working :-)

    [root@localhost surgemail]# ./av_avast -update
    [root@localhost surgemail]# ./av_avast -version
    av_avast version 1.1
    AVAST virus database
    version 613-1 (29.03.2006)
    [root@localhost surgemail]# ./av_avast -test
    This test will:
     - dynamically load avast libraries (checking dependancies)
     - attempt to scan an infected message
     - attempt to scan a clean message...
    Loading avast libraries
    Scanning infected email : SUCCESS - Virus detected (EICAR Test-NOT virus!!)
    Scanning clean email    : SUCCESS - Message is clean
    Avast installed and working :-)

*** RESTART SURGEMAIL ***

    [root@localhost surgemail]# tellmail shutdown
    SurgeMail Version 3.7b-2, Built Mar  9 2006 09:59:34, Platform Linux
    Key OK, email=trial@netwinsite.com, Expires in 29 days

       Shutting down now

    [root@localhost surgemail]# ./surgemail_start.sh
    Startmail starting surgemail using configuration file /etc/surgemail.ini
    Starting surgemail as uid=8 gid=12 based on /usr/local/surgemail
    Call execv (./surgemail)
    MAIL Running - Home /usr/local/surgemail - log file is /usr/local/surgemail/mail.log
    Detaching server process
    [root@localhost surgemail]#