Auf der deutschen Postfix-user Mailingliste gab es einen interessanten Tipp zum greylisting. Mich hat immer gestört, dass die meisten Mails erst sehr verzögert ankommen, allerdings ist greylisting immer noch ein effektives Mittel gegen Spam. Die Idee in dem Tipp ist greylisting nur für bestimmte Clients einzusetzen. Dabei geht man wie folgt vor.
Man fügt in smtpd_recipient_restrictions folgende Abfrage hinzu:
smtpd_recipient_restrictions = ... check_client_access pcre:/etc/postfix/greylisting.pcre, ...
und zusätzlich noch in der main.conf
smtpd_restriction_classes = greylisting greylisting = check_policy_service inet:127.0.0.1:10023
Die Datei greylisting.pcre hat folgenden Inhalt:
# these look like IPs or are domain names with lots of labels /(\-.+){4}$/ greylisting /(\..+){4}$/ greylisting # these look like dynamically assigned hostnames /(^|[0-9.x_-])(abo|br(e|oa)dband|cabel|(hk)?cablep?|catv|cbl|cidr|d?client2?|cust(omer)?s?|dhcp|dial?(in|up)?|d[iu]p|[asx]?dsld?|dyn(a(dsl|mic)?)?|home|in-addr|modem(cable)?|(di)?pool|ppp|ptr|rev|static|user|YahooBB[0-9]{12}|c[[:alnum:]]{6,}(\.[a-z]{3})?\.virtua|[1-9]Cust[0-9]+|AC[A-Z][0-9A-F]{5}\.ipt|pcp[0-9]{6,}pcs|S0106[[:alnum:]]{12,}\.[a-z]{2})[0-9.x_-]/ greylisting # these do not have a matching hostname->rdns mapping /^unknown$/ greylisting # these are countries with higher than average spam appearance /\.br$/ greylisting /\.cn$/ greylisting /\.hk$/ greylisting /\.id$/ greylisting /\.in$/ greylisting /\.kz$/ greylisting /\.ru$/ greylisting /\.th$/ greylisting /\.tw$/ greylisting /\.ua$/ greylisting /\.vn$/ greylisting
Die Domains sollten natürlich den eigenen Bedürfnissen angepasst werden.
Greylisting für ausgewählte Clients