When I started using sendmail to receive mail for my domain the server's FQDN wasn't set up right so it would appear to be localhost when other MTA connected to it.

This seems to work fine. i.e. something like:

My Server: 220 localhost.localdomain ESMTP
Client: EHLO example.com
My Server: 250 localhost.localdomain

I could also send mail fine since I masqueraded as the correct domain. I have never received a spam message at this domain. I believe spammers typically scan the internet looking for replies to port 25 and when they find it connect, take the domain name from either the greeting or the domain name after the 250 response and then try random usernames at that domain.

Since they only get localhost as the domain name they can't try this and so only genuine people who know the domain name (having got the mail server address from the mx records in the DNS for the domain) can send mail to the domain. (My reverse DNS does not match my domain so they can't get the domain from this either). Unfortunately I have now set up the server with a proper FQDN which is now being shown.

Now it goes something like this:

My server: 220 (My reverse DNS which is not my domain name)
(I set this using confSMTP_LOGIN_MSG,'(My reverse DNS) Sendmail; $b')
C: EHLO example.com
My Server: 250 (My FQDN) oh no:(

How do I change the bit after 250 to be something else other than my FQDN without getting rid of the FQDN on the server?

Also are there any bad consequences to this apart from breaking the relevant RFC?

  • 2
    Your idea about how spammers generate email addresses is probably mistaken. You should configure your server to answer with your FQDN, otherwise some legitimate MTAs will refuse to deliver mail to you on the basis that you have a misconfigured server. May 27 '14 at 4:02
  • Thank you very much for your reply Greg, and for your editing of my post to make it more readable Abhijeet. To be honest it is more important to me that I don't get spam than that all MTAs will deliver mail and I have so far not had any problems with connecting MTAs refusing to deliver. I don't receive a lot of emails at this domain but I do know that Google's and my ISP's MTA's both deliver and noone has yet told me that their email to the domain has bounced. Does anyone know how I can tell sendmail to put something different than the hostname after the 250 reply? Thank you. May 27 '14 at 11:40
  • That's not what spammers do. They find your domain's MX record and just connect to it. This won't help anything.
    – Bandrami
    May 27 '14 at 17:21
  • Just to point out that the whole point is that the spammers (at least the ones that scan for port 25 and then subsequently connect to sendmail) don't have my domain name in the first place so they can't connect to my domain's dns server to get the MX record. There are other methods that spammers use to get email addresses e.g. scraping mail(to) addresses on webpages/forums etc. I am interested in stopping this one particular (possible) method for sending spam. May 28 '14 at 17:09

I have added the line DjMyReverseDNS to sendmail.mc where MyReverseDNS is whatever I want it to show i.e. setting j (which is the variable for the FQDN AFAIK) to what I want. This seems to work in a basic test, although i will need to test this more later. Ty

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.