Hi Mark, Thanks again for the helpful hint. It seems that I still miss something. I am running Mailman3.1.1. I ran the following on my test server. I am trying, for test purpose only, to filter PDF attachments.
First I just used the pass_type, assuming once this is set, everything else is filtered.
# mailman withlist testlist3@x.com
m.pass_types = ['multipart', 'message/rfc822', 'text', 'application/pgp-signature'] commit() print(list(m.pass_types)) ['multipart', 'message/rfc822', 'text', 'application/pgp-signature']
This let PDF be send by Mailman3. Well, I need to add filter_types too, so I did this:
m.filter_types = ['application/pdf'] commit() print(list(m.filter_types)) ['application/pdf']
Mailman3 still distributes PDF files as attachment. What am I doing wrong?
This is the final settings:
print(list(m.pass_types)) ['multipart', 'message/rfc822', 'text', 'application/pgp-signature'] print(list(m.filter_types)) ['application/pdf']
Thanks Mohsen
Thanks Mohsen
-----Original Message----- From: Mark Sapiro <mark@msapiro.net> Sent: Wednesday, September 30, 2020 1:07 PM To: mailman-users@mailman3.org Subject: [MM3-users] Re: How to prevent members to attach executables (exe, bat, ...) to the emails sent to list
[EXTERNAL EMAIL]
On 9/30/20 9:25 AM, Mohsen Masoudfar wrote:
Hi,
I am trying to find a way for content filtering to remove executables from the emails sent to the list. I found some hints under: https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail man.readthedocs.io%2Fen%2Fstable%2Fbuild%2Flib%2Fmailman%2Fhandlers%2F docs%2Ffiltering.html%3Fhighlight%3Dcontent%2520filter&data=01%7C0 1%7Cmmasoudf%40aaas.org%7Ceb728218f9884b4bfc1a08d865635075%7C2eebd8ff9 ed140f0a15638e5dfb3bc56%7C0&sdata=mGUdz5NfrJgEyPmd5Isa0l01WWPQMpTA 9thyWLZ0qbU%3D&reserved=0
but still not clear how to do it for all type of excecutables.
There are four list settings that affect this. They are pass_types, pass_extensions, filter_types and filter_extensions. the pass_* settings specify message parts the list will accept while the filter_* settings specify message parts the list won't accept. The page at <https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.readthedocs.io%2Fen%2Fstable%2Fsrc%2Fmailman%2Fhandlers%2Fdocs%2Ffiltering.html&data=01%7C01%7Cmmasoudf%40aaas.org%7Ceb728218f9884b4bfc1a08d865635075%7C2eebd8ff9ed140f0a15638e5dfb3bc56%7C0&sdata=3pndaAo8YQNZlIDRTFIIMtvJseW45LloihoEJGghDnE%3D&reserved=0> only discusses filter_types and needs updating for the others.
Filtering by extension only works on message parts that have an associated file name. Thus, while you can add things like 'exe', 'bat', 'cmd', 'com', 'pif', 'scr', 'vbs' and 'cpl' to filter_extensions, it won't be completely effective.
A better approach is to use MIME types[1] and only allow those you want. For a discussion list, a reasonable set is what this list uses:
multipart message/rfc822 text application/pgp-signature
This will accept any multipart and message/rfc822 parts for further analysis and ultimately accept only text/* and application/pgp-signature elemental parts. If you want to accept images and pdfs, you can add
image application/pdf
See <https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.iana.org%2Fassignments%2Fmedia-types%2Fmedia-types.xhtml&data=01%7C01%7Cmmasoudf%40aaas.org%7Ceb728218f9884b4bfc1a08d865635075%7C2eebd8ff9ed140f0a15638e5dfb3bc56%7C0&sdata=R0ilRz1I4Z2L34Yhwsy1jfWFBGRgKXOuHywJQytHXjI%3D&reserved=0> for a list of all registered MIME types. Note that these are all of the form
main_type/sub_type
and putting just
main_type
in *_types passes or filters all subtypes for that maintype.
[1] You can use both, e.g. filter_extensions to remove those you don't want and pass_types to accept the MIME types you do want.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.mail...