Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 899
  • Last Modified:

Block cyrillic emails in sendmail

Hi,
I have a linux mailserver (CentOS 5.3) with sendmail, I use DNS blacklisting for filtering spam and clamav-milter for viruses. The level of spam is ok with the exception of a few users that receive around 50-100 spam messages/day and all of them in koi8-r encoding (it's cyrillic characters). I need a simple method of blocking or rejecting emails written in cyrillic characters if possible without applying other antispam rules.

Thank you
0
aligigi
Asked:
aligigi
1 Solution
 
jar3817Commented:
Without applying other antispam rules? I don't think so. The only thing I can think of is to use a milter like mimedefang (http://mimedefang.org) and test for the encoding of the body in the filter() section.

This site has an example using the subject instead of the body:
http://lists.roaringpenguin.com/pipermail/mimedefang/2009-April/034698.html

This is not for the faint-of-heart and you really need to know some perl, or be able to figure it out.
0
 
Alan HardistyCommented:
Not sure about how to do this with sendmail, but if you had Vamsoft ORF (www.vamsoft.com), then you could do this easily.  I use this amongst it's other features and so far in 19 days, have had Zero spam.
It is very well priced too and I am now recommending this to all my customers.
0
 
aligigiAuthor Commented:
Hi,
I finally resolved it, I tried simpler solutions, none worked so in the end I used mimedefang. I installed mimedefang using yum, I added the following line to sendmail.mc:
INPUT_MAIL_FILTER(`mimedefang', `S=unix:/var/spool/MIMEDefang/mimedefang.sock, F=T, T=C:30m;S:30m;R:30m;E:30m')
and I added this to mimedefang-filte in the filter procedurer:
    $head = $entity->head;
    $charset = $head->mime_attr("content-type.charset");
    if (defined($charset)) {
      $charset =~ tr/A-Z/a-z/;
      if ($charset eq "koi8-r" or
          $charset eq "euc-kr" or
          $charset eq "koi8-u" or
          $charset eq "3deu-kr" or
          $charset eq "windows-1251") {
          syslog('alert',"MIMEDefang rejected an E-Mail using charset $charset");
         
          return action_bounce("CONTENT VIOLATION: Mail using character set $charset not accepted here");
          }
    }
I had some problems with mimedefang not finding the antivirus (I use clamav) so I commented out that part of the code since I use clamav-milter directly in sendmail.mc.
Thanks for the help.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now