2

I have a sendmail/cyrus installation. Sendmail rejects mails from non existent MAIL FROM:-addresses. This is good. But sendmail does not reject mails from non-existent From:-header-addresses. The mail is then forwarded to cyrus, cyrus makes this check and rejects the mail. Now sendmail tries to (and usually can) send mail back an error mail to the MAIL FROM address.

Is it possible to configure sendmail to not accept non-existent domains in From:-header field?

Other ideas for a solution? Probably writing a milter could be a solution, but are there simpler solutions?

Thanks Teddy

Law29
  • 3,507
  • 1
  • 15
  • 28
Teddy
  • 175
  • 2
  • 7
  • On further reflection I think your problem is that the rejected message isn't sent to envelope sender but to the random crap a spammer put in the message body and headers there... – HBruijn Sep 23 '16 at 20:33
  • The message body can be poked around with by a milter such as MIMEDefang. – thrig Sep 23 '16 at 20:38

1 Answers1

1

There are two different FROM "headers", one as part of the SMTP envelope, which sendmail can check, and the one in the message body that your mail clients usually display. As far as I know sendmail doesn't care a whit about the second one.

Disable the following feature in your sendmail.mc and regenerate your sendmail.cf:

FEATURE(accept_unresolvable_domains) 

and your mailserver will decline messages from non-existent domains.

Test with:

telnet mailhost 25

220 mail.example.nl ESMTP Sendmail 8.14.4/8.14.4; Fri, 23 Sep 2016 22:25:58 +0200
MAIL FROM: me@jkhshfdsghhsdfhgfghsdfgddhsj.hgadsgaghs
553 5.1.8 me@jkhshfdsghhsdfhgfghsdfgddhsj.hgadsgaghs... 
          Domain of sender address me@jkhshfdsghhsdfhgfghsdfgddhsj.hgadsgaghs does not exist

Sendmail adds the SMTP envelope sender as the Return-Path header to messages it processes.

HBruijn
  • 72,524
  • 21
  • 127
  • 192