How to change the default use archive zip format in amavis

Mark Martinec Mark.Martinec+amavis at ijs.si
Tue Jan 31 17:31:25 CET 2012


Kshitij,

> I want want to change the archive zip format used by amavisd-new to 7za how
> to achive this is there any configuration setting used in amavisd.conf
> file.
> 
> The problem is recent amavisd-new.2.6.4-4.rle4 skiped one email unchecked
> after investigating it looks like amavis where unable to decompress
> because it use unzip default decompress i gess.
> 
> [root at D1SNX680RL ~]# *unzip -t ARTUS\ 016.zip*
> Archive:  ARTUS 016.zip
>    skipping: EXFU144406-2.pdf        need PK compat. v6.3 (can do v2.1)
>    skipping: EXFU144421-0.pdf        need PK compat. v6.3 (can do v2.1)
>    skipping: EXFU144452-4.pdf        need PK compat. v6.3 (can do v2.1)
>    skipping: EXFU144464-8.pdf        need PK compat. v6.3 (can do v2.1)
>    skipping: EXFU144481-7.pdf        need PK compat. v6.3 (can do v2.1)
>    skipping: EXFU144483-8.pdf        need PK compat. v6.3 (can do v2.1)
>    skipping: EXFU144493-0.pdf        need PK compat. v6.3 (can do v2.1)
>    skipping: EXFU144506-9.pdf        need PK compat. v6.3 (can do v2.1)
>    skipping: EXFU144516-1.pdf        need PK compat. v6.3 (can do v2.1)
>    skipping: EXFU144299-0.pdf        need PK compat. v6.3 (can do v2.1)
>    skipping: EXFU144312-7.pdf        need PK compat. v6.3 (can do v2.1)
>    skipping: EXFU144324-0.pdf        need PK compat. v6.3 (can do v2.1)
>    skipping: EXFU144326-1.pdf        need PK compat. v6.3 (can do v2.1)
>    skipping: EXFU144327-7.pdf        need PK compat. v6.3 (can do v2.1)
>    skipping: EXFU144333-8.pdf        need PK compat. v6.3 (can do v2.1)
>    skipping: EXFU144346-7.pdf        need PK compat. v6.3 (can do v2.1)
>    skipping: EXFU144402-0.pdf        need PK compat. v6.3 (can do v2.1)
> Caution:  zero files tested in ARTUS 016.zip.
> 17 files skipped because of unsupported compression or encoding.
> 
> If tried to open it using 7zip, it tested properly
> 
> [root at D1SNX680RL ~]# *7za t ARTUS\ 016.zip*
> 
> 7-Zip (A) 9.13 beta  Copyright (c) 1999-2010 Igor Pavlov  2010-04-15
> p7zip Version 9.13 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,8 CPUs)
> 
> Processing archive: ARTUS 016.zip
> 
> Testing     EXFU144406-2.pdf
> Testing     EXFU144421-0.pdf
> Testing     EXFU144452-4.pdf
> Testing     EXFU144464-8.pdf
> Testing     EXFU144481-7.pdf
> Testing     EXFU144483-8.pdf
> Testing     EXFU144493-0.pdf
> Testing     EXFU144506-9.pdf
> Testing     EXFU144516-1.pdf
> Testing     EXFU144299-0.pdf
> Testing     EXFU144312-7.pdf
> Testing     EXFU144324-0.pdf
> Testing     EXFU144326-1.pdf
> Testing     EXFU144327-7.pdf
> Testing     EXFU144333-8.pdf
> Testing     EXFU144346-7.pdf
> Testing     EXFU144402-0.pdf
> 
> Everything is Ok
> Files: 17
> Size:       963404
> Compressed: 793522
> 
> I think the attachment contents was packaged using pkzip utility by
> application server and unzip is unable to decode it.
> 
> please help me what should i do

Add the entry:

   ['zip',  \&Amavis::Unpackers::do_7zip, ['7z','7za'] ],

somewhere early in the @decoders list, before an existing 'zip' entry.

This can be achieved either by:

1) adding the following somewhere late in amavisd.conf,
following any existing assignments (if any) to @decoders :

unshift(@decoders,
  ['zip',  \&Amavis::Unpackers::do_7zip, ['7z','7za'] ],
);


2) or by editing the existing assignment to the @decoders list,
either in a config file (if you have it there), or in the file 'amavisd';


3) or by assigning a complete replacement llist to @decoders
somewhere in the config file, e.g.:

  @decoders = (
    ['mail', \&Amavis::Unpackers::do_mime_decode],
    ['F',    \&Amavis::Unpackers::do_uncompress, \$unfreeze],
    ['Z',    \&Amavis::Unpackers::do_uncompress, \$uncompress],
    ['gz',   \&Amavis::Unpackers::do_gunzip],
    ['gz',   \&Amavis::Unpackers::do_uncompress, \$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'] ],
    ['lzo',  \&Amavis::Unpackers::do_uncompress, \$unlzop],
    ['rpm',  \&Amavis::Unpackers::do_uncompress, \$rpm2cpio],
    ['cpio', \&Amavis::Unpackers::do_pax_cpio,   \$pax],
    ['cpio', \&Amavis::Unpackers::do_pax_cpio,   \$cpio],
    ['tar',  \&Amavis::Unpackers::do_pax_cpio,   \$pax],
    ['tar',  \&Amavis::Unpackers::do_pax_cpio,   \$cpio],
    ['deb',  \&Amavis::Unpackers::do_ar, \$ar],
    ['zip',  \&Amavis::Unpackers::do_7zip,       ['7z','7za'] ],
    ['zip',  \&Amavis::Unpackers::do_unzip],
    ['kmz',  \&Amavis::Unpackers::do_unzip],
    ['7z',   \&Amavis::Unpackers::do_7zip,       ['7zr','7za','7z'] ],
    ['rar',  \&Amavis::Unpackers::do_unrar,      \$unrar],
    ['arj',  \&Amavis::Unpackers::do_unarj,      \$unarj],
    ['arc',  \&Amavis::Unpackers::do_arc,        \$arc],
    ['zoo',  \&Amavis::Unpackers::do_zoo,        \$zoo],
    ['doc',  \&Amavis::Unpackers::do_ole,        \$ripole],
    ['cab',  \&Amavis::Unpackers::do_cabextract, \$cabextract],
    ['tnef', \&Amavis::Unpackers::do_tnef_ext,   \$tnef],
    ['tnef', \&Amavis::Unpackers::do_tnef],
    ['exe',  \&Amavis::Unpackers::do_executable, \$unrar,\$lha,\$unarj],
  );


The 7z claims to also be able to decode many other types of archives,
so these can be added too somewhere early into the @decoders list.
Note, first match wins (top-down).

E.g.:

    ['gz',   \&Amavis::Unpackers::do_7zip, '7z' ],
    ['Z',    \&Amavis::Unpackers::do_7zip, '7z' ],
    ['tar',  \&Amavis::Unpackers::do_7zip, '7z' ],
    ['arj',  \&Amavis::Unpackers::do_7zip, '7z' ],
    ['cab',  \&Amavis::Unpackers::do_7zip, '7z' ],
    ['rar',  \&Amavis::Unpackers::do_7zip, '7z' ],
    ['swf',  \&Amavis::Unpackers::do_7zip, '7z' ],
    ['lha',  \&Amavis::Unpackers::do_7zip, '7z' ],
    ['lzma', \&Amavis::Unpackers::do_7zip, '7z' ],
    ['cpio', \&Amavis::Unpackers::do_7zip, '7z' ],
    ['jar',  \&Amavis::Unpackers::do_7zip, '7z' ],
    ['iso',  \&Amavis::Unpackers::do_7zip, '7z' ],
    ['deb',  \&Amavis::Unpackers::do_7zip, '7z' ],
    ['rpm',  \&Amavis::Unpackers::do_7zip, '7z' ],

(The '7z' is a full-function executable, the '7za' and '7zr' have
limited capabilities, so for decoding other formats the limited
standalone executables are not suitable).

  Mark


More information about the amavis-users mailing list