banned file types

Deeztek Support support at deeztek.com
Tue Oct 21 17:50:18 CEST 2014


>
> I don't think there's any particular docs on the
> $map_full_type_to_short_type_re table.  Basically it's a list of the
> long descriptive names given by file(1) mapped to the common 3
> character extension.  It shouldn't need any adjustments, so it's not
> in a user config file.  But you can look at it for enlightenment.
>
> You can find the $map_full_type_to_short_type_re list in the main
> amavisd program. And I mean the amavisd PROGRAM, not a configuration
> file.  Probably in /usr/sbin or similar.


Okay, here's my understanding on how this works. Correct me if I'm wrong:

I ran the file(1) without the -i switch on a bunch of files to see what 
gets reported. For example, on a .rar archive the file(1) utility 
outputs the following:

RAR archive data, v1d, os: Win32

So, I went into the /usr/sbin/amavisd-new file and located the following 
entry under the $map_full_type_to_short_type_re section:

[qr/^RAR archive\b/i                => 'rar']

So far so good

Now, I ran the file(1) utility on Microsoft Excel .xls and a Microsoft 
Word .doc file and they both had the following output:

CDF V2 Document ......

Of course, there was no corresponding entry under the 
$map_full_type_to_short_type_re section, which tells me that Amavis is 
not able detect the file type using the file(1) utility, so I have to 
rely on the attachment name reported by the message, so I would add an 
entry in my $banned_filename_re like follows:

[qr'.\.(xls)$'i => 1],  #block excel files
[qr'.\.(doc)$'i => 1],  #block word files

(you said earlier that the () are not required, I'm just putting them in 
there for uniformity since it won't hurt anything)

Now, instead, could I theoretically add entries under the 
$map_full_type_to_short_type_re as follows?

[qr/^CDF V2 Document\b/i                => 'xls']
[qr/^CDF V2 Document\b/i                => 'doc']

so, that you know, I'm not stuck on office files I'm just using them as 
examples.


Thanks a lot







More information about the amavis-users mailing list