LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-01-2009, 03:02 PM   #1
Mogget
Member
 
Registered: Dec 2008
Location: Norway
Distribution: Debian
Posts: 43

Rep: Reputation: 15
Postfix: How to stop domains that do not reverse DNS to ip with EHLO restrictions


Is it is possible to reverse DNS check the domain given with the EHLO/HELO command. Then reject/permit based on the reverse DNS telling me the IP connecting is/is not part of the network registered with that domain name. You will find a section of my configuration file and a dump of a telnet session with my server further down.

My /etc/postfix/main.cf looks like this.

Code:
smtpd_sender_restrictions =
  permit_mynetworks,
  reject_unknown_sender_domain,
  reject_non_fqdn_sender,
  reject_unknown_client_hostname,
  warn_if_reject,
  reject_sender_login_mismatch,
  permit_sasl_authenticated,
  permit

smtpd_helo_restrictions =
  permit_mynetworks,
  reject_unknown_helo_hostname,
  reject_non_fqdn_helo_hostname,
  reject_invalid_helo_hostname,
  permit_sasl_authenticated,
  permit

smtpd_data_restrictions = reject_unauth_pipelining

smtpd_client_restrictions =
  permit_mynetworks,
  permit_sasl_authenticated,
  reject_unknown_client_hostname,
  permit

smtpd_etrn_restrictions = permit_mynetworks, reject

smtpd_recipient_restrictions =
  permit_mynetworks,
  reject_non_fqdn_recipient,
  warn_if_reject,
  reject_unknown_recipient_domain,
  reject_unauth_destination,
  permit_sasl_authenticated,
  reject_rbl_client safe.dnsbl.sorbs.net,
  reject_rbl_client zen.spamhaus.org,
  permit
And the dump from the telnet session.

Code:
[bookie@tintaglia ~]$ telnet some.server.net 25
Trying x.x.x.x...
Connected to some.server.net.
Escape character is '^]'.
220 some.server.net ESMTP Postfix
EHLO microsoft.com
250-some.server.net
250-PIPELINING
250-SIZE 10240000
250-ETRN
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
MAIL FROM: devil@microsoft.com
250 2.1.0 Ok
RCPT TO: postmaster@some.server.net
250 2.1.5 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
From: devil@microsoft.com
To: Postmaster 
Subject: You have been givven the chance to win serious money! 

Hello, the devil talking here. You can now win serious money. 
Just send me $50 and i will guarantee you thousands of dollar in return.
.
250 2.0.0 Ok: queued as 82D346624C

Last edited by Mogget; 04-01-2009 at 03:05 PM.
 
Old 04-02-2009, 11:20 AM   #2
archangel_617b
Member
 
Registered: Sep 2003
Location: GMT -08:00
Distribution: Ubuntu, RHEL/CentOS, Fedora
Posts: 234

Rep: Reputation: 42
Well, I don't know of any way to do this. I think this is basically why there's stuff like SPF (http://www.openspf.org/) and DKIM (http://www.dkim.org/).

I think what you'll find is that many sites do not provide a HELO which matches their reverse DNS.

- Arch
 
Old 04-02-2009, 12:41 PM   #3
Mogget
Member
 
Registered: Dec 2008
Location: Norway
Distribution: Debian
Posts: 43

Original Poster
Rep: Reputation: 15
Yeah i've been looking through logs and i realised that the sending site/person might be from a domain other than the mail relay they use so that will not work well. I'm not sure if the expected input on EHLO is the senders domain or the relays domain but either way this won't work. SPF looks interesting so i will have a look at that.

Thank you for taking the time to answer.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
postfix stops at ehlo anarxi Linux - Server 1 01-27-2009 04:16 AM
Reverse DNS, 3 domains same IP maginotjr Linux - Networking 1 08-31-2007 10:46 PM
Postfix outside network 220 response and EHLO TheDude05 Linux - Networking 3 06-26-2007 08:57 AM
Postfix/Reverse DNS Problem otisthegbs Linux - Software 0 12-15-2003 01:05 PM
Mail Server Reverse DNS and Postfix streamalot Linux - General 1 10-15-2003 01:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration