Technical article 114282

How can I prevent people from connecting to my SMTP port and sending mail through me or relaying mail by using Sendmail 8.8.x?

OpenServer 5.0.0OpenServer 5.0.2OpenServer 5.0.4OpenServer 5.0.5OpenServer 5.0.6

Written · Last revised

Problem

You have configured your system to use relaying with Sendmail 8.8.8, but other people can connect to your SMTP port and send mail through you.

Solution

If you're still running 8.8.x and can't upgrade for some reason, this TA should help you. However, the recommended way to deal with anti-relay problems is to upgrade to 8.9.3 or higher.

Sendmail 8.9.3 is installed on OpenServer 5.0.6 by default and can be upgraded to 8.11.0 after rs506a is installed.

The following examples are tentative and unsupported. However, they may prove useful to people who are having problems with spammers. It is highly recommended that you upgrade your version of Sendmail to a supported version, 8.9.3 or higher.

It is recommended you install sse022 on the system.  Please read
this article for information regarding this System Security
Enhancement:
https://ftp.scoexpert.com/SSE/sse022.ltr

You can obtain this System Security Enhancement here:

https://ftp.scoexpert.com/SSE/sse022.tar

Mail must originate or terminate locally (on this host), with exceptions made for hosts listed, one per line, in /etc/sendmail.cR. This ruleset does not allow relaying within your domain, except for the hosts listed in /etc/sendmail.cR.

Note: You must list fully qualified host names for each host you wish to allow relaying. Simply listing a domain name is not enough. Ideally, it would only restrict relaying from outside your domain. This is particularly useful if you are using mail clients such as MH or Eudora that like to try to find an SMTP relay on the local network to do outgoing mail submission.

FR-o /etc/sendmail.cR
Scheck_rcpt
# anything terminating locally is ok
R< $+ @ $=w >           $@ OK
R< $+ @ $=R >           $@ OK
# anything originating locally is ok
R$*                     $: $(dequote "" $&{client_name} $)
R$=w                    $@ OK
R$=R                    $@ OK
R$@                     $@ OK
# anything else is bogus
R$*                     $#error $: "550 Relaying Denied"

Notes: If you would prefer to list domains in sendmail.cR, you can replace all occurrences of $=R with $* $=R in the ruleset above. This rule doesn't block user%other.domain.com@your.domain.com. If you want to block this type of addressing, you'll need sendmail 8.8.6 or greater and this change to the ruleset. Replace the first section:

# anything terminating locally is ok
R< $+ @ $=w >           $@ OK
R< $+ @ $=R >           $@ OK
with
# anything terminating locally is ok
R$*                     $: $>Parse0 $>3 $1
R$+ < @ $* . > $*       $: $1 < @ $2 >
R$+ < @ $=w >           $@ OK
R$+ < @ $=R >           $@ OK

If your site is a backup mail server for another site (you are a higher numbered MX record for them), be sure to add the domain names of that site to your new sendmail.cR file.

In sendmail 8.9, relaying is disabled by default.

NOTES:    If you copy rules from this page, you must change the white space
          between the fields to tabs. Sendmail will reject the rule if there
          are merely spaces between the fields.

If your text editor changes tabs to spaces as they are entered, you may have to use another editor that does not.

See also

ta105884 How can I make sendmail filter unsolicited mail (spam) and prevent others sites from using my site as a mail relay under SCO OpenServer 5?

Selected clippings for this TA are taken from:

http://www.sendmail.org/antispam.html

From the Xinuos technical article database, record 114282. Reproduced with permission. The original is at www.sco.com/ta/114282, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.