2

I am running CENTOS 6.2 with 2 virtual machines one 'auth'(192.168.0.2) and another proxy (192.168.0.3). Proxy host has no internet connection. My intention is proxy host will send its mail to auth host and auth host send the mail out from there.

I have configured the smart host configuration in sendmail.mc in proxy as such :

define(`SMART_HOST', '192.168.0.2')

I also have set up a relay in auth under access:

CONNECT:192.168.0.3 RELAY

However, when I still try to send mail out from proxy using :

mail cumaresen@gmail.com

The mail is not being sent out and the logs show it as such :

Jan 15 01:03:48 test1 sendmail[14388]: s0F8xmdl014388: from=proxy, size=244, class=0, nrcpts=1, msgid=<201401150859.s0F8xmdl014388@test1>, relay=root@localhost
Jan 15 01:03:48 test1 sendmail[14388]: s0F8xmdl014388: to=cumaresen@gmail.com, delay=00:04:00, mailer=esmtp, pri=30244, dsn=4.4.3, stat=queued

It is still relaying via root@localhost.

I have tried using the fix as explained by EreBusBat and I still experience the same issue.

Qumar
  • 45
  • 1
  • 3
  • 9
  • i have dont the necessary recompiles: i.e: m4 sendmail.mc > /etc/sendmail.cf makemap hash access.db < access – Qumar Jan 15 '14 at 09:08

2 Answers2

1

Include mailer specification in your smart host definition and put the IP address inside square brackets.

define(`SMART_HOST', `relay:[192.168.0.2]')
AnFi
  • 5,883
  • 1
  • 12
  • 26
1

I tried that and still did not work.

However, i looked around somemore and foudna solution. What was happening was that 'proxy''s sendmail kept checking with my DNS servers to resolve for the location of 'auth' although it did not have internet. As such, when it failed it fell back to root@localhost as a relay agent.

I needed to force proxy's sendmail to look up my /etc/hosts file instead. to do that , i did the follwowing:

In /etc/mail/submit.mc file :

divert(0)dnl
include(`/usr/share/sendmail-cf/m4/cf.m4')
VERSIONID(`linux setup for RHEL')dnl
define(`confCF_VERSION', `Submit')dnl
define(`__OSTYPE__',`')dnl dirty hack to keep proto.m4 from complaining
define(`confTIME_ZONE', `USE_TZ')dnl
define(`confDONT_INIT_GROUPS', `True')dnl
define(`confPID_FILE', `/var/run/sm-client.pid')dnl
define(`SMART_HOST',`my smarthost from /etc/hosts')dnl
define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl
define(`ALIAS_FILE', `/etc/aliases')dnl
MASQUERADE_AS(`Your DNS domain: example.com')dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
FEATURE(`use_ct_file')dnl
MAILER(smtp)dnl
MAILER(procmail)dnl

Also, create in /etc/mail a server.switch file :

hosts files aliases files

Credits to : http://www.tenox.net/docs/force2smarthost.html for the solution.

Also, thanks to Andrez for the quick help.

Qumar
  • 45
  • 1
  • 3
  • 9
  • Could your report what has been recorded in the log files? – AnFi Jan 19 '14 at 00:44
  • Hi Andrzej, i was able to resolve it. What was reported was that proxy was realying the message to root@localhost There were no error messages in that case if that is what you were asking about. – Qumar Jan 20 '14 at 02:33