Rejection based on total message size including attachments
As a web hosting provider I have searched and searched for a way to limit the total size of messages posted to all lists. We have moderators who just can't get it through their heads to limit the size of attachments. One list today distributed a 6 mb pdf to over 700 recipients. I have found information on creating a custom handler and some old and brief logic on limiting max_message_size from Mr. Sapiro.
Would anyone who has developed a custom handler to reject messages based on total size, mind sharing the full file? If so, could you also state where the handler was positioned in the chain of handlers.
Thank you for your time.
On 09/19/2018 03:34 PM, leith@khimaira.com wrote:
As a web hosting provider I have searched and searched for a way to limit the total size of messages posted to all lists. We have moderators who just can't get it through their heads to limit the size of attachments. One list today distributed a 6 mb pdf to over 700 recipients. I have found information on creating a custom handler and some old and brief logic on limiting max_message_size from Mr. Sapiro.
Would anyone who has developed a custom handler to reject messages based on total size, mind sharing the full file? If so, could you also state where the handler was positioned in the chain of handlers.
Is this a Mailman 3 question or a Mailman 2.1 question? If Mailman 3, the architecture is quite different. This would be done with a rule, not a handler, but based on details in your question, I think you are asking about Mailman 2.1.
In that case, the appropriate list is really mailman-users@python.org <https://mail.python.org/mailman/listinfo/mailman-users>, but since you're here, the basic info on custom handlers for MM 2.1 is at <https://wiki.list.org/x/4030615>. There is an example called MyHandler.py linked from that page. It won't do what you want but can be used as a starting point. Also, look at Mailman/Handlers/Hold.py, in particular the code following the "# Is the message too big?" for how to determine the message size.
That handler will compare the size to the list's max_message_size and hold the post if it's too big. You probably want to compare the size to a fixed value or a size defined in mm_cfg.py and either reject or discard the message. If you put your handler between Moderate and Hold, it's probably safe to reject the message because it is from a member or an address in accept_these_nonmembers. Rejecting post from arbitrary non-members is a bad idea because of spam backscatter.
If you need more help, please join mailman-users@python.org and post to that list.
In any case, this could be generally useful enough that I will probably add it to the stuff at <https://www.msapiro.net/scripts/>.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
I apologize for posting to the wrong forum. I didn't realize cPanel's mailman 2.1.26 was somewhat behind. I do appreciate your assistance and will followup if necessary on the correct forum.
participants (2)
-
leith@khimaira.com
-
Mark Sapiro