LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 03-13-2009, 07:55 PM   #1
crisostomo_enrico
Member
 
Registered: Dec 2005
Location: Madrid
Distribution: Solaris 10, Solaris Express Community Edition
Posts: 547

Rep: Reputation: 36
Cannot configure sendmail masquerading on Solaris 10


Hi.

I'm configuring sendmail on a Solaris 10 05/08 and I've got the following problem: when I send a mail from the mail server the mail appears as sent by hostname.mysubdomain.mydomain.com, which is the FQDN of that machine. Reading sendmail documentation, and Googling a whole day (while banging my head on my desk), I thought I could just masquerade the hostname. The strange thing is that it appear to work when testing the configuration but than it fails.

My current sendmail.mc contains:
Code:
MASQUERADE_AS(`mydomain.com')dnl
FEATURE(`masquerade_envelope')dnl
FEATURE(`masquerade_entire_domain')dnl
FEATURE(`always_add_domain')dnl
MASQUERADE_DOMAIN(`mydomain.com')dnl
If I try to send a mail with:
Code:
echo Hello | sendmail -C ./mynewsendmail.cf -v enrico@mydomain.com
I receive a mail where the From is indeed enrico@mydomain.com. The previous commands logs:
Code:
Connecting to aspmx.l.google.com. via esmtp...
220 mx.google.com ESMTP 28si2840019eyg.45
>>> EHLO hostname.mysubdomain.mydomain.com
250-mx.google.com at your service, [84.127.228.172]
250-SIZE 35651584
250-8BITMIME
250-ENHANCEDSTATUSCODES
250 PIPELINING
>>> MAIL From:<enrico@mydomain.com> SIZE=5
250 2.1.0 OK 28si2840019eyg.45
>>> RCPT To:<enrico@mydomain.com>
>>> DATA
250 2.1.5 OK 28si2840019eyg.45
354  Go ahead 28si2840019eyg.45
>>> .
250 2.0.0 OK 1236991822 28si2840019eyg.45
enrico@mydomain.com... Sent (OK 1236991822 28si2840019eyg.45)
Closing connection to aspmx.l.google.com.
>>> QUIT
221 2.0.0 closing connection 28si2840019eyg.45
I then compile the mc file, disable sendmail, copy the configuration in /etc/mail/sendmail.cf, restart the service but sendmail behaves differently:
Code:
(trim)
050 250-mx.google.com at your service, [84.127.228.172]
050 250-SIZE 35651584
050 250-8BITMIME
050 250-ENHANCEDSTATUSCODES
050 250 PIPELINING
050 >>> MAIL From:<enrico@hostname.mysubdomain.mydomain.com> SIZE=342
050 250 2.1.0 OK 5si2838297eyf.22
(trim)
I really cannot understand what happens here!
Have you got some ideas?
 
Old 03-13-2009, 09:48 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by crisostomo_enrico View Post
Hi.

I'm configuring sendmail on a Solaris 10 05/08 and I've got the following problem: when I send a mail from the mail server the mail appears as sent by hostname.mysubdomain.mydomain.com, which is the FQDN of that machine. Reading sendmail documentation, and Googling a whole day (while banging my head on my desk), I thought I could just masquerade the hostname. The strange thing is that it appear to work when testing the configuration but than it fails.

My current sendmail.mc contains:
Code:
MASQUERADE_AS(`mydomain.com')dnl
FEATURE(`masquerade_envelope')dnl
FEATURE(`masquerade_entire_domain')dnl
FEATURE(`always_add_domain')dnl
MASQUERADE_DOMAIN(`mydomain.com')dnl
If I try to send a mail with:
Code:
echo Hello | sendmail -C ./mynewsendmail.cf -v enrico@mydomain.com
I receive a mail where the From is indeed enrico@mydomain.com. The previous commands logs:
Code:
Connecting to aspmx.l.google.com. via esmtp...
220 mx.google.com ESMTP 28si2840019eyg.45
>>> EHLO hostname.mysubdomain.mydomain.com
250-mx.google.com at your service, [84.127.228.172]
250-SIZE 35651584
250-8BITMIME
250-ENHANCEDSTATUSCODES
250 PIPELINING
>>> MAIL From:<enrico@mydomain.com> SIZE=5
250 2.1.0 OK 28si2840019eyg.45
>>> RCPT To:<enrico@mydomain.com>
>>> DATA
250 2.1.5 OK 28si2840019eyg.45
354  Go ahead 28si2840019eyg.45
>>> .
250 2.0.0 OK 1236991822 28si2840019eyg.45
enrico@mydomain.com... Sent (OK 1236991822 28si2840019eyg.45)
Closing connection to aspmx.l.google.com.
>>> QUIT
221 2.0.0 closing connection 28si2840019eyg.45
I then compile the mc file, disable sendmail, copy the configuration in /etc/mail/sendmail.cf, restart the service but sendmail behaves differently:
Code:
(trim)
050 250-mx.google.com at your service, [84.127.228.172]
050 250-SIZE 35651584
050 250-8BITMIME
050 250-ENHANCEDSTATUSCODES
050 250 PIPELINING
050 >>> MAIL From:<enrico@hostname.mysubdomain.mydomain.com> SIZE=342
050 250 2.1.0 OK 5si2838297eyf.22
(trim)
I really cannot understand what happens here!
Have you got some ideas?
I feel your pain....and it's not just on Solaris either. Sendmail is indeed a black art, and the books available on the subject are well worth getting.

Check out the /etc/mail/domaintable file (see here http://www.sendmail.org/m4/features.html for more info). That may help you out. I know I chased this around for quite a while too.

I *THINK* I remember there being a quick-n-dirty solution: I edited the /etc/mail/sendmail.cf file (yes, I know...bad practice indeed), but changed the Dj directive from:

Code:
Djdomain.com
to

Code:
Dj domain.com
The space seemed to make a difference, if I remember correctly. I've slept since then.
 
Old 03-14-2009, 04:56 PM   #3
crisostomo_enrico
Member
 
Registered: Dec 2005
Location: Madrid
Distribution: Solaris 10, Solaris Express Community Edition
Posts: 547

Original Poster
Rep: Reputation: 36
Thanks TB0ne, yesterday was so loooong that... I cannot even tell...

By the way, thanks for the information you posted. I was reading the Sendmail Cookbook, that's why I was so sure that it would work. Sendmail documentation and that book are both so clear...

I'll also take a look at the domaintable stuff: it seemed "overkill" just for masking an hostname, that's why I stuck trying all of the possible permutations of MASQUERADING_* and FEAUTURE that I could figure out but I failed finding something that works. Worse: it works when invoked with -bt, as I told you, but then... nothing.

One thing: I wanted to try your "dirty trick" to see if I could sleep well too but surprise! My generated cf file has no Dj... option whatsoever! Should it be there in your opinion? Have MASQUERADE_* directive some effect on it?

Thanks in advance,
Enrico
 
Old 03-14-2009, 07:08 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by crisostomo_enrico View Post
Thanks TB0ne, yesterday was so loooong that... I cannot even tell...

By the way, thanks for the information you posted. I was reading the Sendmail Cookbook, that's why I was so sure that it would work. Sendmail documentation and that book are both so clear...

I'll also take a look at the domaintable stuff: it seemed "overkill" just for masking an hostname, that's why I stuck trying all of the possible permutations of MASQUERADING_* and FEAUTURE that I could figure out but I failed finding something that works. Worse: it works when invoked with -bt, as I told you, but then... nothing.

One thing: I wanted to try your "dirty trick" to see if I could sleep well too but surprise! My generated cf file has no Dj... option whatsoever! Should it be there in your opinion? Have MASQUERADE_* directive some effect on it?

Thanks in advance,
Enrico
Well, if you can afford a quick bounce to sendmail, adding a Dj option is a quick thing to try.

The domaintable thing, though, is cleaner, and while it does seem like overkill, it does bring some far greater flexibility to the party, in case you need it later.
 
Old 03-16-2009, 10:39 AM   #5
crisostomo_enrico
Member
 
Registered: Dec 2005
Location: Madrid
Distribution: Solaris 10, Solaris Express Community Edition
Posts: 547

Original Poster
Rep: Reputation: 36
Thanks TB0ne, I'll have a look at that as soon as I can, then. The documentation indeed indicates that's a pretty powerful feature.

Thanks,
Enrico
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sendmail: masquerading question Berhanie Linux - Networking 4 02-11-2010 06:47 PM
Solaris 10 - How to configure Sendmail or SMTP rust8y Solaris / OpenSolaris 1 08-10-2008 10:53 PM
Sendmail masquerading configuration Raidmax Slackware 2 04-14-2007 01:47 PM
Sendmail not Masquerading Domains mpgram Linux - Networking 0 06-06-2005 09:20 PM
how to configure ip masquerading hariiyer Linux - Networking 5 07-16-2004 10:53 AM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 03:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration