Pages

Tuesday, March 18, 2008

Postfix client restrction and SMTP reverse domain lookup

Add following line to main.cf file.

% vi /etc/postfix/main.cf

################start####################
#reject unless the hostname has valid syntax.
#reject unless the host has a valid MX or A record in DNS.
#reject unless the host is fully qualified.
#Postfix will allow dotted quads that are not wrapped in square brackets (à la [
127.28.29.1]) even though it violates the RFC.
# look up the hostname in the file mapname and reject or accept as appropriate.

smtpd_helo_required = yes

smtpd_helo_restrictions = reject_invalid_hostname, reject_unknown_hostname, reje
ct_non_fqdn_hostname, permit_mynetworks


######reverse dns lookup ##############

smtpd_client_restrictions = hash:/etc/postfix/client_restrictions, reject_unknow
n_client, reject_maps_rbl
maps_rbl_domains = bl.spamcop.net, rbl-plus.mail-abuse.org
################end####################



%vi /etc/postfix/client_restrictions
################start####################
# Whoops, we need to talk to these machines
# but they has no reverse DNS set up:
10.0.10.1 OK
10.0.10.5 OK

# Reject these guys, they keep sending us junk mail
# and won't take us off their lists
spam_central.com REJECT

################end####################


% Test postfix for changes

[leo@linux]$ telnet 192.164.1.30 25
Trying 192.168.1.30...
Connected to test.domain.org (192.168.1.30).
Escape character is '^]'.
220 *******************************2*****
MAIL FROM:leo@anilinux.org
250 2.1.0 Ok
RCPT TO: user@domain.org
250 2.1.5 Ok
DATA
354 End data with .
test data
.
250 2.0.0 Ok: queued as CE6F53A4084
Quit
221 2.0.0 Bye
Connection closed by foreign host.



[leo@linux]$ telnet 192.164.1.30 25
Trying 192.168.1.30...
Connected to test.domain.org (192.168.1.30).
Escape character is '^]'.
220 *******************************2*****
MAIL FROM:leo@anilinux.org
250 2.1.0 Ok
RCPT TO: user@domain.org
450 4.7.1 Client host rejected: cannot find your hostname, [domain.org]
quit
221 2.0.0 Bye
Connection closed by foreign host.

No comments: