D
D
Den K2014-10-15 12:15:58
FreeBSD
Den K, 2014-10-15 12:15:58

Sendmail, relay, mailertable. Why mail arrives locally?

The problem is the following.
There is a mail relay on sendmail. Mail with the domain.ru domain should be forwarded to the internal Exchange mail server, as a rule, in the mailertable:
domain.ru smtp:[192.168.1.172]
but it arrives locally. If you create a local user, then the mail comes, otherwise - User unknown.
I also wrote localhost in local-host-names, and left it empty according to various recommendations on different forums.
Previously, the host was called as the MX record of mail.domain.ru, now it has been renamed to gw.worknet.local, following the same recommendations on the forums.
uname-a

FreeBSD gw.worknet.local 9.2-RELEASE-p6 FreeBSD 9.2-RELEASE-p6 #4: Tue Jun 17 11:17:41 MSK 2014     [email protected]:/usr/src/sys/i386/compile/MYKERN  i386

Here is one suspicion, "[email protected]", but I don't know how to change it.
The relay-doamin file The
domain.ru
sendmail config is standard (almost nothing changed), created via make. The config name is gw.worknet.local.mc.
The following appears in the logs:
Oct 15 13:01:10 gw sm-mta[35565]: STARTTLS=server, relay=f153.i.mail.ru [128.140.171.244], version=TLSv1/SSLv3, verify=NO, cipher=DHE-RSA-AES256-SHA, bits=256/256
Oct 15 13:01:10 gw milter-greylist: s9F917rG035565: Sender IP 128.140.171.244 and address <[email protected]> are SPF-compliant, bypassing greylist
Oct 15 13:01:46 gw sm-mta[35565]: s9F917rG035565: <[email protected]>... User unknown
Oct 15 13:01:46 gw sm-mta[35565]: s9F917rG035565: from=<[email protected]>, size=2354, class=0, nrcpts=0, proto=ESMTP, daemon=IPv4, relay=f153.i.mail.ru [128.140.171.244]

access file:
localhost       RELAY
192.168.1       RELAY

gw.worknet.local.mc:
divert(-1)
divert(0)
VERSIONID(`$FreeBSD: release/9.2.0/etc/sendmail/freebsd.mc 249867 2013-04-25 01:46:20Z gshapiro $')dnl
OSTYPE(freebsd6)dnl
DOMAIN(generic)dnl
FEATURE(access_db, `hash -o -T<TMPF> /etc/mail/access')dnl
FEATURE(blacklist_recipients)dnl
FEATURE(local_lmtp)dnl
FEATURE(mailertable, `hash -o /etc/mail/mailertable')dnl
FEATURE(virtusertable, `hash -o /etc/mail/virtusertable')dnl
FEATURE(`require_rdns')dnl
FEATURE(`badmx')dnl
define(`confCW_FILE', `-o /etc/mail/local-host-names')dnl
define(`confCR_FILE', `-o /etc/mail/relay-domains')dnl
dnl Enable for both IPv4 and IPv6 (optional)dnl
DAEMON_OPTIONS(`Name=IPv4, Family=inet')dnl
dnl DAEMON_OPTIONS(`Name=IPv6, Family=inet6, Modifiers=O')dnl
define(`confBIND_OPTS', `WorkAroundBrokenAAAA')dnl
define(`confNO_RCPT_ACTION', `add-to-undisclosed')dnl
define(`confPRIVACY_FLAGS', `authwarnings,noexpn,novrfy')dnl
define(`confMAX_DAEMON_CHILDREN', `30')dnl
define(`confCONNECTION_RATE_THROTTLE', `25')dnl
define(`confMAX_MESSAGE_SIZE', `15000000')dnl
define(`confMAX_RCPTS_PER_MESSAGE', `50')dnl
define(`confSMTP_LOGIN_MSG', `mail.xservx.ru MSERV!')dnl
define(`confTO_IDENT', `0')dnl
FEATURE(dnsbl, `bl.spamcop.net', `"550 Mail from " $&{client_addr} " rejected - see bl.spamcop.net"')dnl
FEATURE(dnsbl, `dnsbl.njabl.org', `"550 Mail from " $&{client_addr} " rejected - see dnsbl.njabl.org"')dnl
FEATURE(dnsbl, `list.dsbl.org', `"550 Mail from " $&{client_addr} " rejected - see list.dsbl.org"')dnl
FEATURE(dnsbl, `zen.spamhaus.org', `"550 Mail from " $&{client_addr} " rejected - see zen.spamhaus.org"')dnl
FEATURE(dnsbl, `sbl.spamhaus.org', `"550 Mail from " $&{client_addr} " rejected - see sbl.spamhaus.org"')dnl
define(`CERT_DIR',        `MAIL_SETTINGS_DIR`'certs')dnl
define(`confCACERT_PATH', `CERT_DIR')dnl
define(`confCACERT',      `CERT_DIR/cacert.pem')dnl
define(`confSERVER_CERT', `CERT_DIR/sendmail.pem')dnl
define(`confSERVER_KEY',  `CERT_DIR/sendmail.pem')dnl
define(`confCLIENT_CERT', `CERT_DIR/sendmail.pem')dnl
define(`confCLIENT_KEY',  `CERT_DIR/sendmail.pem')dnl
INPUT_MAIL_FILTER(`greylist', `S=local:/var/milter-greylist/milter-greylist.sock,F=, T=S:1m;R:1m')dnl
define(`confMILTER_MACROS_CONNECT', `j, {if_addr}')dnl
define(`confMILTER_MACROS_HELO', `{verify}, {cert_subject}')dnl
define(`confMILTER_MACROS_ENVFROM', `i, {auth_authen}')dnl
define(`confMILTER_MACROS_ENVRCPT', `{greylist}')dnl
define(`confMIN_QUEUE_AGE', `15m')dnl
define(`confTO_QUEUERETURN',`2d')dnl
dnl define(`confRECEIVED_HEADER', `id $i; $b')dnl
dnl define(`confDOMAIN_NAME', `,mail.domain.ru')dnl
define(`confALLOW_BOGUS_HELO',`True')dnl
define(`confHELO_NAME', `mail.domain.ru')dnl
TRUST_AUTH_MECH(`DIGEST-MD5 CRAM-MD5PLAIN LOGIN')dnl
define(`confAUTH_MECHANISMS', `DIGEST-MD5 CRAM-MD5 PLAIN LOGIN')dnl
FEATURE(`delay_checks')dnl
FEATURE(`greet_pause', `3000')dnl
MAILER(local)dnl
MAILER(smtp)dnl

Tell me where to look for the problem. Tried a lot. I suspect that when renaming the host, somewhere the old, external name mail.domain.ru remains, but these are just guesses.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Den K, 2014-10-15
@Bloodsn0w

Found a solution!
It was necessary to check which hosts and ip he considers local.

sendmail -bt
>$=w

The command will display the entire list of interfaces.
To remove the extra ones (I don’t know why exactly they are superfluous), you need to add a line to the .mc file
and the list of local hosts is reduced. It is necessary that it does not contain either a domain name or an external address.
Now everything works!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question