Sendmail, configure for no hostname in from.

Hi, we have a big problem at our site. The folks that handle the smtp gateway set it up so that it rejects email from an unknown domain.i.e. root@hostname.domain. The gateway does not recognize hostname.domain. If I could configure sendmail on our unix servers to send only user@domain, then the mail would go through.

Question: how can I configure send mail to not use the hostname when it sends mail? Also, how can I configure it to point to a specific relay server?

Thanks, Mike michael.parry.ctr@edwards.af.mil

[533 byte] By [parrym] at [2007-11-26 10:47:31]
# 1

You need to create a mc file and use it to generate a new sendmail.cf

The lines you need are

define(`SMART_HOST',mailgateway.domain)

MASQUERADE_AS(domain)

Copy /usr/lib/mail/cf/main.mc to domain.mc

add the above lines before the MAILER lines.

do a make domain.cf

and copy domain.cf to /etc/mail/sendmail.cf

robertcohen at 2007-7-7 2:59:47 > top of Java-index,General,Sys Admin Best Practices...
# 2
Robert, thanks, this should solve my relay problem. Do you know how to make sendmail send it's mail without the host name attached as part of the domain? Our exchange mail server does not recognize root@server.edwards.af.mil, but does work with root@edwards.af.mil. Thanks, Mike
parrym at 2007-7-7 2:59:47 > top of Java-index,General,Sys Admin Best Practices...
# 3
Thats what the MASQUERADE_AS line does.
robertcohen at 2007-7-7 2:59:47 > top of Java-index,General,Sys Admin Best Practices...
# 4

Got it to work! One last thing. When email is sent from root, it still shows the hostname in the domain string, i.e. root@server.edwards.af.mil. I tried removing the EXPOSED_USER for root, but I still get the hostname with the domain.I presume that EXPOSED_USER(root) is default. Anyway of getting the root to use just the domain? I've been doing some research, would FEATURE(masquerade_entire_domain) solve this problem?

Thanks, Mike

parrym at 2007-7-7 2:59:47 > top of Java-index,General,Sys Admin Best Practices...
# 5
No masquerade entire domain won't help.Its an exposed user issue.You can fix it as described here http://www.grok.org.uk/docs/smroot.html
robertcohen at 2007-7-7 2:59:47 > top of Java-index,General,Sys Admin Best Practices...
# 6

Rober, thanks for your inputs. Here's what I have come up with that seems to work.

Description:

This is the fix for sendmail that will allow the following functionality:

1. Send mail only, not receive (security stuff)

2. Send the domain name only for both root and other accounts. i.e. not root@myserver.bob.com, but

root@bob.com.

3. Send mail specifically to a defined relay, in this case peter.bob.com, which is the firewall.

Fix:

Create and mod a new mc file.

cd /usr/lib/mail/cf

cp main.mc mymain.mc

vi mymain.mc, add the following lines:

DOMAIN(`mydomain')dnl

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')

define(`SMART_HOST',peter.bob.com)

MASQUERADE_AS(bob.com)

FEATURE(`allmasquerade')

FEATURE(`masquerade_envelope')

Make sure you change the DOMAIN to mydomain from solaris-generic.

mymain.mc should look like this:

divert(0)dnl

VERSIONID(`@(#)main.mc 1.5 (Sun) 08/10/00')

OSTYPE(`solaris8')dnl

DOMAIN(`mydomain')dnl

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')

define(`SMART_HOST',peter.bob.com)

MASQUERADE_AS(bob.com)

FEATURE(`allmasquerade')

FEATURE(`masquerade_envelope')

MAILER(`local')dnl

MAILER(`smtp')dnl

Remove the EXPOSED_USER root.

cd /usr/lib/mail/domain

cp generic.m4 mydomain.m4

vi mydomain.m4 and delete the EXPOSED_USER(`root') line.

mydomain.m4 will look like this:

divert(0)

VERSIONID(`$Id: generic.m4,v 8.15 1999/04/04 00:51:09 ca Exp $')

define(`confFORWARD_PATH', `$z/.forward.$w+$h:$z/.forward+$h:$z/.forward.$w:$z/.forward')dnl

define(`confMAX_HEADERS_LENGTH', `32768')dnl

FEATURE(`redirect')dnl

FEATURE(`use_cw_file')dnl

cd /usr/lib/mail/cf

Make a new cf file.

/usr/ccs/bin/make mymain.cf

cp mymain.cf /etc/mail/sendmail.cf

Stop and start sendmail.

/etc/init.d/sendmail stop

/etc/init.d/sendmail start

Test

mailx -v -s"test" yourname@bob.com < /dev/null

parrym at 2007-7-7 2:59:47 > top of Java-index,General,Sys Admin Best Practices...