0

My MASQUERADE settings looks as follows...

dnl # Also accept email sent to "localhost.localdomain" as local email.
dnl #
LOCAL_DOMAIN(`localhost.localdomain')dnl
dnl #
dnl # The following example makes mail from this host and any additional
dnl # specified domains appear to be sent from mydomain.com
dnl #
MASQUERADE_AS(`wantedomain.com')dnl
dnl #
dnl # masquerade not just the headers, but the envelope as well
dnl #
FEATURE(masquerade_envelope)dnl
dnl #
dnl # masquerade not just @mydomainalias.com, but @*.mydomainalias.com as well
dnl #
FEATURE(masquerade_entire_domain)dnl
dnl #
MASQUERADE_DOMAIN(localhost)dnl
MASQUERADE_DOMAIN(localhost.localdomain)dnl
MASQUERADE_DOMAIN(localhost02.ux.com.tus)dnl
MASQUERADE_DOMAIN(localhost02)dnl
dnl MASQUERADE_DOMAIN(mydomain.lan)dnl

My hosts file contains...

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.101.129 localhost02.ux.com.tus localhost02
[root@localhost02 mail]# hostname -s
localhost02
[root@localhost02 mail]# hostname -f
localhost02.ux.com.tus
[root@localhost02 mail]#

When I'm trying to send a mail, sendmail keeps try to send this with localhost02.ux.com.tus and does not take into account the MASQUERADING settings (I'm expecting user@wantedomain.com as the sender)...

[root@localhost02 mail]# mail dzsordzs.kluni@heretofind.com
Subject: TEST
Hello World.
.
EOT
[root@localhost02 mail]# mailq
        /var/spool/mqueue (1 request)
-----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-----------
20JB4OZi054827*      13 Wed Jan 19 12:04 <user@localhost02.ux.com.tus>
                                         <dzsordzs.kluni@heretofind.com>
        Total requests: 1

Any help would be much appreciated!

20222.01.27 - UPDATE

I have created a short shell script, containing the followings...

#!/bin/sh
RECIPIENT=dzsordzs.kluni@heretofind.com
SENDER=user@wantedomain.com

/usr/sbin/sendmail -i -v -Am -f$SENDER $RECIPIENT <<END
Subject: TEST
From: $SENDER

Hello World.
END

After executing the shell script, I still get a time out error from the SMTP server...

[root@localhost02 mail]# ./sendmail.sh
dzsordzs.kluni@heretofind.com... Connecting to email-smtp.eu-central-1.amazonaws.com. port 587 via relay...
dzsordzs.kluni@heretofind.com... Deferred: Connection timed out with email-smtp.eu-central-1.amazonaws.com.
[root@localhost02 mail]# mailq
        /var/spool/mqueue (6 requests)
-----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-----------
20R7JX1b017298       13 Thu Jan 27 08:19 user@wantedomain.com
                 (Deferred: Connection timed out with email-smtp.eu-central-1.)
                                         dzsordzs.kluni@heretofind.com

However telnet connection to the server via port 587 looks OK...

[root@localhost02 mail]# telnet email-smtp.eu-central-1.amazonaws.com 587
Trying 172.27.1.14...
Connected to email-smtp.eu-central-1.amazonaws.com.
Escape character is '^]'.
220 email-smtp.amazonaws.com ESMTP SimpleEmailService-d-B4HOZL4HF JJQ6jMD4ztoBhcmitWhE
451 4.4.2 Timeout waiting for data from client.
Connection closed by foreign host.
[root@localhost02 mail]#

...and finally the content of the /var/log/maillog file...

Jan 27 08:19:33 localhost02 sendmail[17298]: 20R7JX1b017298: from=user@wantedomain.com, size=57, class=0, nrcpts=1, msgid=<202201270719.20R7JX1b017298@localost02.ux.com.tus>, relay=root@localhost
Jan 27 08:25:33 localhost02 sendmail[17298]: 20R7JX1b017298: to=dzsordzs.kluni@heretofind.com, ctladdr=user@wantedomain.com (0/0), delay=00:06:00, xdelay=00:06:00, mailer=relay, pri=30057, relay=email-smtp.eu-central-1.amazonaws.com. [18.158.92.82], dsn=4.0.0, stat=Deferred: Connection timed out with email-smtp.eu-central-1.amazonaws.com.
Mike
  • 1
  • 1
  • 1
    I haven't used sendmail for a long time, but one of the things I do remember quite well is making all the correct changes in the `sendmail.mc` but omitting the step to convert the sendmail.mc to the `sendmail.cf` configuration file that sendmail actually uses. That may happen automatically when sendmail is restarted, but can also require running `m4 sendmail.mc > sendmail.cf` manually before restarting sendmail. – Bob Jan 21 '22 at 12:37
  • 1
    Also https://serverfault.com/questions/710861 suggests that masquerade changes happen only when mail leaves the server, checking in the queue may not be the best place to check and confirm that your settings are correct. – Bob Jan 21 '22 at 12:43
  • Dear Bob, many thanks for your input! I believe my sendmail.mc is configured correctly and I have generated the .cf file as well as it's necessary of course. My task is to configure sendmail with AWS SMTP, sending mails out from the server. – Mike Jan 26 '22 at 09:33

0 Answers0