How do you change the file decoder in amavisd-new?

Nick Tait nick at tait.net.nz
Sun Aug 29 03:52:05 CEST 2021


Hi there.

I've recently upgraded my email relay, which has amavisd-new installed, 
and when amavis starts up it logs all the file types which it doesn't 
have decoders for. Looking at the amavisd-new script, I can see that 
@decoders is set to:

       @decoders = (
         ['mail', \&Amavis::Unpackers::do_mime_decode],
    #   [[qw(asc uue hqx ync)], \&Amavis::Unpackers::do_ascii],  # not safe
         ['F', \&Amavis::Unpackers::do_uncompress, \$unfreeze],
                  # ['unfreeze', 'freeze -d', 'melt', 'fcat'] ],
         ['Z', \&Amavis::Unpackers::do_uncompress, \$uncompress],
                  # ['uncompress', 'gzip -d', 'zcat'] ],
         ['gz', \&Amavis::Unpackers::do_uncompress, \$gunzip],
         ['gz', \&Amavis::Unpackers::do_gunzip],
         ['bz2', \&Amavis::Unpackers::do_uncompress, \$bunzip2],
         ['xz', \&Amavis::Unpackers::do_uncompress,
                  ['xzdec', 'xz -dc', 'unxz -c', 'xzcat'] ],
         ['lzma', \&Amavis::Unpackers::do_uncompress,
                  ['lzmadec', 'xz -dc --format=lzma',
                   'lzma -dc', 'unlzma -c', 'lzcat', 'lzmadec'] ],
         ['lrz', \&Amavis::Unpackers::do_uncompress,
                  ['lrzip -q -k -d -o -', 'lrzcat -q -k'] ],
         ['lzo', \&Amavis::Unpackers::do_uncompress, \$unlzop],
         ['lz4', \&Amavis::Unpackers::do_uncompress, ['lz4c -d'] ],
         ['rpm', \&Amavis::Unpackers::do_uncompress, \$rpm2cpio],
                  # ['rpm2cpio.pl', 'rpm2cpio'] ],
         [['cpio','tar'], \&Amavis::Unpackers::do_pax_cpio, \$pax],
                  # ['/usr/local/heirloom/usr/5bin/pax', 'pax', 'gcpio',
    'cpio'] ],
    #   ['tar', \&Amavis::Unpackers::do_tar],  # no longer supported
         ['deb', \&Amavis::Unpackers::do_ar, \$ar],
    #   ['a', \&Amavis::Unpackers::do_ar, \$ar], #unpacking .a seems an
    overkill
         ['rar', \&Amavis::Unpackers::do_unrar, \$unrar],  # ['unrar',
    'rar']
         ['arj', \&Amavis::Unpackers::do_unarj, \$unarj],  # ['unarj',
    'arj']
         ['arc', \&Amavis::Unpackers::do_arc,   \$arc],    # ['nomarch',
    'arc']
         ['zoo', \&Amavis::Unpackers::do_zoo,   \$zoo],    # ['zoo',
    'unzoo']
         ['doc', \&Amavis::Unpackers::do_ole,   \$ripole],
         ['cab', \&Amavis::Unpackers::do_cabextract, \$cabextract],
         ['tnef', \&Amavis::Unpackers::do_tnef_ext, \$tnef],
         ['tnef', \&Amavis::Unpackers::do_tnef],
    #   ['lha', \&Amavis::Unpackers::do_lha,   \$lha],  # not safe, use
    7z instead
    #   ['sit', \&Amavis::Unpackers::do_unstuff, \$unstuff],  # not safe
         [['zip','kmz'], \&Amavis::Unpackers::do_7zip,  ['7za', '7z'] ],
         [['zip','kmz'], \&Amavis::Unpackers::do_unzip],
         ['7z', \&Amavis::Unpackers::do_7zip,  ['7zr', '7za', '7z'] ],
         [[qw(gz bz2 Z tar)],
    \&Amavis::Unpackers::do_7zip,  ['7za', '7z'] ],
         [[qw(xz lzma jar cpio arj rar swf lha iso cab deb rpm)],
    \&Amavis::Unpackers::do_7zip,  '7z' ],
         ['exe', \&Amavis::Unpackers::do_executable, \$unrar, \$lha,
    \$unarj],
       ); 

Which seems to say that 7z can be used for the following file extensions:

    zip kmz
    7z
    gz bz2 Z tar
    xz lzma jar cpio arj rar swf lha iso cab deb rpm

So after installing p7zip-full and p7zip-rar packages, which provide the 
7z program (and also 7zr and 7za), I'm curious why I still see warnings 
for rpm, rar, arj and cab:

    Aug 29 13:13:39 mx amavis[10781]: No ext program for   .rpm, tried:
    rpm2cpio.pl, rpm2cpio
    Aug 29 13:13:39 mx amavis[10781]: No ext program for   .rar, tried:
    unrar-free
    Aug 29 13:13:39 mx amavis[10781]: No ext program for   .arj, tried:
    arj, unarj
    Aug 29 13:13:39 mx amavis[10781]: No ext program for   .cab, tried:
    cabextract

Does this mean that 7z isn't going to be used for these file types? And 
if so, is there something I can do to get amavis to use 7z for these 
file types?

Or should these messages just be ignored?

And on a related note, I know (on Windows at least) 7-zip can handle 
self-extracting exe files, although I notice that the "man 7z" manual 
page doesn't mention EXE files. So I wonder whether exe should or 
shouldn't be added to the list of files that 7z can handle in a future 
version of amavis?

Thanks,

Nick.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.amavis.org/pipermail/amavis-users/attachments/20210829/bcc34d0c/attachment.htm>


More information about the amavis-users mailing list