Why does regular expression !
doesn't work?
In my header_checks
file I got
!/^Subject:.*NotBot.*/ REJECT fuck off
In my master.cf I use the cleanup daemon for checking
cleanup unix n - n - 0 cleanup
-o header_checks=pcre:/etc/postfix/header_checks
when I connect to stmpd via telnet to test (Good Subject) I get this
220 test.com ESMTP Postfix
HELO www.test.com
MAIL From: <[email protected]>
RCPT To: <[email protected]>
DATA
From: <[email protected]>
Subject: NotBot123
test250 test.com
250 2.1.0 Ok
250 2.1.5 Ok
354 End data with <CR><LF>.<CR><LF>
.
550 5.7.1 fuck off
But Bad Subject's also work
220 example.com ESMTP Postfix
HELO www.example.com
MAIL From: <[email protected]>
RCPT To: <[email protected]>
DATA
From: <[email protected]>
Subject: hahaha
test250 test.com
250 2.1.0 Ok
250 2.1.5 Ok
354 End data with <CR><LF>.<CR><LF>
.
550 5.7.1 fuck off
Fixed it! was pretty easy..
the check_headers is checked for every information in the mail.. so you need to use if/endif
to check only Subject:
field.
if /^Subject:/
!/^Subject:.*NotBot.*/ REJECT fuck off
endif
Dumb spammers suspended my email account due to abusing my open stmp port.