LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   sendmail-8.14.4-9 - Cannot configure to send to relay server w/o specifying cf file (https://www.linuxquestions.org/questions/linux-server-73/sendmail-8-14-4-9-cannot-configure-to-send-to-relay-server-w-o-specifying-cf-file-4175551747/)

eathernet 08-25-2015 08:33 PM

sendmail-8.14.4-9 - Cannot configure to send to relay server w/o specifying cf file
 
Hi,

Long time listener, first time caller. I'm no expert on sendmail, and this one has me a little stumped - hoping someone can help :)

(assume everything is run as root)

I configure my linux host to relay to relayserver.example.com, however when I test using:

echo sendmail test from `hostname` at `date` | sendmail -v my.email@example.com

I see the following:

my.email@example.com... Connecting to [127.0.0.1] via relay...
220 MYSERVER.localdomain ESMTP Postfix
>>> EHLO MYSERVER.example.com
250-MYSERVER.localdomain
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
>>> MAIL From:<root@MYSERVER.example.com> SIZE=69
250 2.1.0 Ok
>>> RCPT To:<my.email@example.com>
>>> DATA
250 2.1.5 Ok
354 End data with <CR><LF>.<CR><LF>
>>> .
250 2.0.0 Ok: queued as D40BA19FB3B
my.email@example.com... Sent (Ok: queued as D40BA19FB3B)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 Bye

I never receive the email. When I run the same command specifying the sendmail config:

my.email@example.com... Connecting to relayserver.example.com via relay...
220 relayserver.example.com Microsoft ESMTP MAIL Service ready at Wed, 26 Aug 2015 11:21:12 +1000
>>> EHLO MYSERVER.example.com
250-relayserver.example.com Hello [MYSERVER_IPADDRESS]
250-SIZE 55574528
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-AUTH
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 XEXCH50
>>> MAIL From:<MYSERVER@example.com> SIZE=69
250 2.1.0 Sender OK
>>> RCPT To:<my.email@example.com>
>>> DATA
250 2.1.5 Recipient OK
354 Start mail input; end with <CRLF>.<CRLF>
>>> .
250 2.6.0 <201508260121.t7Q1LDs8014576@MYSERVER.example.com> Queued mail for delivery
my.email@example.com... Sent (<201508260121.t7Q1LDs8014576@MYSERVER.example.com> Queued mail for delivery)
Closing connection to relayserver.example.com
>>> QUIT

And I receive the email fine. Here is my sendmail.mc file:

# grep -v ^dnl /etc/mail/sendmail.mc

divert(-1)dnl
include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
VERSIONID(`setup for linux')dnl
OSTYPE(`linux')dnl
define(`SMART_HOST', `relayserver.example.com')
FEATURE(masquerade_envelope)dnl
FEATURE(`genericstable')dnl
GENERICS_DOMAIN(`localhost.localdomain')dnl
MASQUERADE_DOMAIN(`localhost.localdomain')dnl
define(`confDEF_USER_ID', ``8:12'')dnl
define(`confTO_CONNECT', `1m')dnl
define(`confTRY_NULL_MX_LIST', `True')dnl
define(`confDONT_PROBE_INTERFACES', `True')dnl
define(`PROCMAIL_MAILER_PATH', `/usr/bin/procmail')dnl
define(`ALIAS_FILE', `/etc/aliases')dnl
define(`STATUS_FILE', `/var/log/mail/statistics')dnl
define(`UUCP_MAILER_MAX', `2000000')dnl
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
define(`confAUTH_OPTIONS', `A')dnl
define(`confTO_IDENT', `0')dnl
FEATURE(`no_default_msa', `dnl')dnl
FEATURE(`smrsh', `/usr/sbin/smrsh')dnl
FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl
FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')dnl
FEATURE(redirect)dnl
FEATURE(always_add_domain)dnl
FEATURE(use_cw_file)dnl
FEATURE(use_ct_file)dnl
FEATURE(local_procmail, `', `procmail -t -Y -a $h -d $u')dnl
FEATURE(`access_db', `hash -T<TMPF> -o /etc/mail/access.db')dnl
FEATURE(`blacklist_recipients')dnl
EXPOSED_USER(`root')dnl
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
FEATURE(`accept_unresolvable_domains')dnl
LOCAL_DOMAIN(`localhost.localdomain')dnl
MAILER(smtp)dnl
MAILER(procmail)dnl

The steps I took to configure was:

yum install sendmail
yum install sendmail-cf
[modify the sendmail.mc file to include the relayserver and 4 lines below it]
make -C /etc/mail (also tried m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf)
service restart sendmail

The man page says this about the -C option:
-C file Use alternate configuration file. Sendmail gives up any enhanced (set-user-ID or set-group-ID) privileges if an alternate configuration file is speci-fied.


My permissions look like this:
drwxr-xr-x 2 root root 4096 Aug 26 11:16 /etc/mail
drwxrwx--- 2 smmsp smmsp 4096 Aug 26 11:21 /var/spool/clientmqueue
drwx------ 2 root mail 4096 Aug 26 11:21 /var/spool/mqueue
-rwxr-sr-x 1 root smmsp 833544 May 7 22:01 /usr/sbin/sendmail.sendmail

Looking forward to any ideas someone has. I'm hoping it's just something silly I've missed!

Thanks for reading

eathernet 08-25-2015 09:12 PM

Got it! Rookie error...

I just needed to change
FEATURE(`msp', `[127.0.0.1]')dnl

in /etc/mail/submit.mc

to:

FEATURE(`msp', `[relayserver.example.com]')dnl

recompile and restart sendmail. The penny dropped when I noticed:

# This is the prototype file for a set-group-ID sm-msp sendmail that
# acts as a initial mail submission program.

In the submit.mc file

Given the -C argument for sendmail states:
"Use alternate configuration file. Sendmail gives up any enhanced (set-user-ID or set-group-ID) privileges if an alternate configuration file is speci-fied."

All the best.


All times are GMT -5. The time now is 03:37 PM.