-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not deliver message with whole content unparsable #65
base: master
Are you sure you want to change the base?
Do not deliver message with whole content unparsable #65
Conversation
@giosh94mhz Could you please provide sample messages such that we can test this |
Sure, give me some time to retrieve it. |
Ok, I had to anonymize it: example.eml.zip I run it with something like: /usr/sbin/sendmail.postfix -i -f [email protected] [email protected] < example.eml
MailScanner --debug |
The main message headers contain
Is this what you intended. There are two issues here.
|
No I meant it. This is an email I have received and is very broken as you This is reason for I think the actual behaviour is incorrect.
|
Cann't you provide the actual email even if you have to reduct it. |
For the message you have provided, these are the headers:
and the rest is message body. Since it is a MIME multipart message, everything up to the first boundary is prologue. The defect is there is no boundary, but the
is all just part of the prologue, not headers of a sub-part so the fact that they are not valid headers is irrelevant. |
Well I can't provide the actual email, since it's full of personal the real message is not different from this. A broken mail, with headers
|
For what it's worth, Python's email package parses the message with two defects: So the question is if we have a message which claims to be multipart but has no |
@msapiro I would say quarantine. |
@msapiro I don't agree. In RFC2045 section 5 there is: For example, the "charset" parameter is applicable to any subtype of And the whole RFC2046, which is about multiparts, ephatize this requirement Of course, a good MUA, like Thunderbird or Mutt, need to try hard and
|
@akissa The current behavior is to quarantine. The PR is to not deliver the notice to the recipient about the quarantined message. If anything, I think this should be a configuration setting with a possible rule set, but the only setting I see is @giosh94mhz When I run your test message through current MailScanner, it IS quarantined and the recipient receives only the notice that it's been quarantined. I thought your PR is to not deliver the notice to the recipient. If the actual message is being delivered, do you have |
When I said quarantine I meant "go to jail" not just "save the original copy" I see your point, but I this it doesn't fit the rest of the MailScanner application though. Sending a message with no useful content, only to have "hopefully meaningful" subject and/of from address is wrong to me. If going this way, then all the spam/viruses/garbage will deserve a notification without content. MailScanner already support the generation of report to the In my configurations Consider a scenario like this (a real anonymized story, by the way). EvilSpammer setup an "appointment confirmed for today" campaign and send it to all the email address he collected by crawling the web, but he left a small bug in his |
@giosh94mhz I disagree. I think never sending the notice to the recipient is not the appropriate way to deal with this. If you're really concerned about the scenario you describe, you can always edit the appropriate stored.content.message.txt template to say something else. I do think it would be appropriate to have a config setting such as |
@giosh94mhz Regarding your point about all spam, etc. There are extensive configuration controls over this. See |
Well, I think we are going off topic here, since we started with bugfix and we are now discussing new features and configurations. Lets's recap why I think this should be merged:
About the notification concern, I think that this kind of error should notified with a ruleset in That's my opinion, I leave to the maintainer (ping @jcbenton) the final choice. PS: I'm not a native English speaker, so no rudeness/offence intended. |
I don't see a bug. Mailscanner doesn't deliver the message. It delivers a notice about the message. In fact, I have tested with and without your patch and with If this is not what you see, please explain what your patch actually does in your case compared to what unpatched MailScanner does, and provide enough information about your configuration so I can see what you see.
I agree, and so does MailScanner as far as I can tell. It doesn't deliver the message.
But your patch doesn't do that. |
Ok, I have not been following this closely. I have been waiting for everyone else to hash this out. However, apparently I need to make something clear. Whatever change you want to make, it needs to fit 40,000+ installations. What I want MailScanner to do for me and what you want it to do for you is irrelevant. If you have found a bug, address that specific issue and do not try to change the behavior of the intended actions. Mark has mentioned several configurable actions. From my cursory look at this you are trying to bypass those options and have it behave the way you would like. Please stop doing that. (If that is what is going on.) I am not trying to discourage you from pointing out issues. We do need people to do that. It is even better if you have a suggested fix. Just keep the fix within the scope of the original logic. Jerry Benton
|
@jcbenton thank you for the feedback. I'm currently handling ~1000 installations of MailScanner with possibily 10k+ domains, so I'm not talking about "I like that", but "my users complained about". This is a small self-promotion just not to look like a PR troll :) And I really appreciate @msapiro feedback too, even if I'm not following his reasoning correctly as it seems.
Exactly, this is correct IMO. A fully broken message with absolutely nothing readable, is a disinfected message or a "nuked" message? My patch just do the same thing MailScanner already does with all other unparsable message (too many attachment, too big, no main entity): mark it as "virus > other". You probably have options set, which I don't have, that send notifications of viruses. I have set Is my understanding correct? |
Whatever you guys work out, make sure it gets added to the v5 branch. Jerry Benton
|
I finally think I see what you are trying to do with this PR. The title, amongst other things is what confused me. To me, "Do not deliver message with whole content unparsable" means don't deliver the message and what you really mean is don't deliver a notice about the message. OK, I still think this PR is not the appropriate way to address this. "virus" refers to a specific form of malware. An unparseable message is not a virus and shouldn't be categorized as one. I think that if there are other things that aren't viruses which are classified as such, the fact that they are misclassified is not sufficient justification for adding yet another misclassification. Also, I think that the fact that controls to suppress notifications about viruses exist and controls for other classes may not is not sufficient reason to classify something as a virus which isn't. A better way to deal with this is to add more controls for other classes of unwanted mail. Clearly, this patch works for you, and that's fine, but I don't think it is the correct approach for the base code. |
There is a bad behaviour with malformed multipart messages. This happens when a message containes the following snippet (for example):
Note the spurious question mark. In this situation the message is completely replaced by a configured message and sent to the user, but it can't hardly find something useful there. It is much better to quarantine the message and prevent the sending.
The fix is quite simple, as MailScanner already handle a
cantparse
situation and I've just joined two very similar situations. In the end, the message is saved in the quarantine, the log message is the same as before, but the useless placeholder message is prevented.