LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-04-2008, 03:52 AM   #1
Swakoo
Member
 
Registered: Apr 2005
Distribution: Red Hat / Fedora / CentOS
Posts: 508

Rep: Reputation: 30
masqueraded domain for sendmail, but not working


Hi guys,

my web server, web1.domain.com, when sending mail via php,
is shown as nobody@web1.domain.com

To reflect a valid domain, I edit sendmail.mc to have masquearde domain on
I set it to mail.domain.com

I then use m4 to create the new sendmail.cf
Restart server.

But when I do a test send to internal user, it still sends as web1.domain.com

Am I missing something?

Thanks!

Last edited by Swakoo; 06-19-2008 at 10:28 PM.
 
Old 06-19-2008, 05:49 AM   #2
Swakoo
Member
 
Registered: Apr 2005
Distribution: Red Hat / Fedora / CentOS
Posts: 508

Original Poster
Rep: Reputation: 30
hi guys.. i am still facing this problem unfortunately..
does anyone know what i am missing?

I did try a suggestion that i found elsewhere on this forum, that is to add the alias of the domain in local-host-names

But after I added it, it won't send any mails at all...


thanks!

Last edited by Swakoo; 06-19-2008 at 05:51 AM.
 
Old 06-19-2008, 06:04 AM   #3
Swakoo
Member
 
Registered: Apr 2005
Distribution: Red Hat / Fedora / CentOS
Posts: 508

Original Poster
Rep: Reputation: 30
ust to update:

I followed this link: http://www.cyberciti.biz/tips/sendma...ion-howto.html

but it doesn't seem to work

I read online and many sites seems to suggest the same thing, but it still is sending using the machine hostname...

i tried sending over CLi (mail) and mutt... same result...
I sent it to my own gmail account...
 
Old 06-19-2008, 11:35 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
You can't (or rather shouldn't) masquerade for a domain you don't own (nor a hostname that can't be resolved or PTRed) as remote MTA's won't accept it anyway AFAIK. I can confirm the tut you used works, and wrt masking even internally, try adding FEATURE(allmasquerade)dnl. I wonder what's keeping it from masqing properly. Maybe it would be good to re-check and list slash post all the changes you made, check logs and all that?
 
Old 06-19-2008, 10:27 PM   #5
Swakoo
Member
 
Registered: Apr 2005
Distribution: Red Hat / Fedora / CentOS
Posts: 508

Original Poster
Rep: Reputation: 30
hi there, i tried adding FEATURE(allmasquerade)dnl but to no avail.

I've so far followed the tutorial and make the same changes, but naturally the domain is according to my setup.

Code:
MASQUERADE_AS(domain name I want to masquerade as)dnl
MASQUERADE_DOMAIN(hostname of machine)dnl

I test sending of mail to my mail account (on google apps) with this command:

Code:
echo "test mail" | mail -sTest4 my@email.com
I did a tail -f on var/log/maillog all this while with the output the same
hostname of machine is reflected as staging.hostname.com.
My email add is my@email.com. They are bold

Code:
Jun 20 11:22:43 staging sendmail[1340]: m5K3Mhro001340: from=root, size=48, class=0, nrcpts=1, msgid=<200806200322.m5K3Mhro001340@staging.hostname.com>, relay=root@localhost
Jun 20 11:22:44 staging sendmail[1341]: m5K3Mhn4001341: from=<root@staging.hostname.com>, size=333, class=0, nrcpts=1, msgid=<200806200322.m5K3Mhro001340@staging.hostname.com>, proto=ESMTP, daemon=MTA, relay=staging.hostname.com [127.0.0.1]
Jun 20 11:22:44 staging sendmail[1340]: m5K3Mhro001340: to=my@email.com, ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30048, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m5K3Mhn4001341 Message accepted for delivery)
Jun 20 11:22:46 staging sendmail[1343]: m5K3Mhn4001341: to=<my@email.com>, ctladdr=<root@staging.hostname.com> (0/0), delay=00:00:03, xdelay=00:00:02, mailer=esmtp, pri=120333, relay=aspmx.l.google.com. [209.85.143.114], dsn=2.0.0, stat=Sent (OK 1213932166 y5si2342118tia.8)

Last edited by Swakoo; 06-19-2008 at 10:29 PM.
 
Old 06-20-2008, 10:53 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Not entirely your fault but it's hard to deal with this without a combination of /etc/mail/ configuration files, logs and message headers. And saying "but to no avail" kinda equals "doesn't work". I'd rather read specific, factual info like "no, the headers remain unchanged". Also testing as unprivileged user is preferred, maybe not relevant here, but root usually overrides a lot of checks and such. Is "staging.hostname.com" a FQDN that can be resolved by remote MTA's? Do you send directly or do you use a smarthost? Did the message you sent arrive? Did it show no or partial header changes?
 
Old 06-24-2008, 06:34 AM   #7
Swakoo
Member
 
Registered: Apr 2005
Distribution: Red Hat / Fedora / CentOS
Posts: 508

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by unSpawn View Post
Not entirely your fault but it's hard to deal with this without a combination of /etc/mail/ configuration files, logs and message headers. And saying "but to no avail" kinda equals "doesn't work". I'd rather read specific, factual info like "no, the headers remain unchanged". Also testing as unprivileged user is preferred, maybe not relevant here, but root usually overrides a lot of checks and such. Is "staging.hostname.com" a FQDN that can be resolved by remote MTA's? Do you send directly or do you use a smarthost? Did the message you sent arrive? Did it show no or partial header changes?
hi unSpawn,

mails received after masquerading options are implemented still have the same values in their mail header. i.e. the domain is still reflecting the hostname of the machine.

I did a test using both a non-privilege user (mis) and root to send to a public domain

mydomain is my server domain, domain.com is the email recipient

Sending using mis

Command used: echo "test masqurading" | mail -sTest2 me@domain.com
output on screen: /home/mis/dead.letter... Saved message in /home/mis/dead.letter

maillog
Code:
Jun 24 19:25:09 web5 sendmail[2397]: m5OBP9ab002397: from=mis, size=55, class=0, nrcpts=1, msgid=<200806241125.m5OBP9ab002397@web5.mydomain.com>, relay=mis@localhost
Jun 24 19:25:09 web5 sendmail[2398]: m5OBP9UM002398: <me@domain.com>... Unrecognized host name domain.com.
Jun 24 19:25:09 web5 sendmail[2397]: m5OBP9ab002397: to=me@domain.com, ctladdr=mis (1234/1234), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30055, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.2, stat=User unknown
Jun 24 19:25:09 web5 sendmail[2398]: m5OBP9UM002398: from=<mis@web5.mydomain.com>, size=55, class=0, nrcpts=0, proto=ESMTP, daemon=MTA, relay=web5.mydomain.com [127.0.0.1]
Sending using root

command: echo "test masqurading" | mail -sTest3 me@domain.com
output on screen: nothing
maillog
Code:
Jun 24 19:26:11 web5 sendmail[2428]: m5OBQBnu002428: from=root, size=55, class=0, nrcpts=1, msgid=<200806241126.m5OBQBnu002428@web5.mydomain.com>, relay=root@localhost
Jun 24 19:26:11 web5 sendmail[2429]: m5OBQBZP002429: <me@domain.com>... Unrecognized host name domain.com.
Jun 24 19:26:11 web5 sendmail[2428]: m5OBQBnu002428: to=me@domain.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30055, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.2, stat=User unknown
Jun 24 19:26:11 web5 sendmail[2429]: m5OBQBZP002429: from=<root@web5.mydomain.com>, size=55, class=0, nrcpts=0, proto=ESMTP, daemon=MTA, relay=web5.mydomain.com [127.0.0.1]
Jun 24 19:26:11 web5 sendmail[2428]: m5OBQBnu002428: m5OBQBnv002428: DSN: User unknown
I have not touch any other settings since I last posted here on LQ abt this matter. Strangely, I have not receive the mail at my domain.com account yet... its a google apps account, not sure if it is lagging, but nonetheless I will monitor...

but strangely when user mis send I tend to get dead.letter. what's that?

Lastly.. if you can see server hostname is web5.mydomain.com
In my sendmail.mc, I have set it to masquearade to mydomain.com but to no avail

I hope these information are useful

Thanks !
 
Old 06-24-2008, 06:56 AM   #8
Arpita
LQ Newbie
 
Registered: Sep 2007
Posts: 17

Rep: Reputation: 0
Check out the steps given in following site.Each step is given in detail:

http://www.linuxhomenetworking.com/w...x_Mail_Servers
 
Old 06-24-2008, 07:06 AM   #9
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by Swakoo View Post
I have not touch any other settings since I last posted here on LQ abt this matter.
I don't know if that's comforting to know or not :-]


Quote:
Originally Posted by Swakoo View Post
Strangely, I have not receive the mail at my domain.com account yet... (..) but strangely when user mis send I tend to get dead.letter. what's that?
Nothing about Google, it seems the machine can't resolve (or the user hasn't got rights to resolver methods) the given address "me@domain.com". If you check your maillog you'll see a note it can't resolve the host or can't find the user @domain.com.

If you want to test resolving (preferably as user "mis") you can use 'dig mx domain.com' and 'echo "/mx domain.com"|/usr/sbin/sendmail -v -bt -d8.99'. One is a system-centric view, the other of course is how Sendmail perceives things. Should be the first thing to fix if it fails.


If all of this doesn't work then I suggest you restore your MTA back to working order w/o masquerading RSN so it *at least* works. Then we'll run an instance of your MTA with different configs on a different port to "play" with. That way we don't hamper traffic. OK?
 
Old 06-24-2008, 09:43 PM   #10
Swakoo
Member
 
Registered: Apr 2005
Distribution: Red Hat / Fedora / CentOS
Posts: 508

Original Poster
Rep: Reputation: 30
Heh unSpawn, I hope that's comforting
As in... I didn't mess around with any other settings.. thats what I meant

I'll check out the link Arpita provided to see if I can figure this out.

Btw.. my web servers can resolve domain normally. Thats why its interesting to see that sendmail can't resolve.
ping, dig etc.. works like a charm

Mail is still being send as per normal but mails are getting bounced back as they can't resolve domains like hotmail.com.
Through mutt, I see this:
Quote:
----- The following addresses had permanent fatal errors -----
user@yahoo.com
(reason: 553 5.1.2 <user@yahoo.com>... Unrecognized host name yahoo.com.)
(expanded from: user@yahoo.com)
i replaced userid with user for privacy reasons

But I can resolve yahoo over the CLi, so thats what is perplexing heh.

And interestingly, for the bounced mails, it is now showing mail.domain.com, which is what I wanted... haha.. but I don't know why sendmail can't resolve domains now.. trying to figure that out now...
 
Old 06-25-2008, 10:37 AM   #11
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by Swakoo View Post
As in... I didn't mess around with any other settings.. thats what I meant
Yeah, I know... You see in essence that means two things: you didn't proceed on your own (bad) but also you didn't mess up things more (good). I'm just playing. Lets move on...


Quote:
Originally Posted by Swakoo View Post
But I can resolve yahoo over the CLi
Does this mean no e-mails get sent? All fail with resolver errrors? Or just some? What does 'echo "/mx yahoo.com"|/usr/sbin/sendmail -v -bt -d1-20.99' return? What does maillog say? BTW, IIRC e-mail to domains like hotmail, yahoo and such should be handled cautiously: some domains have anti-spam features that will block you automagically and for prolonged periods of time after one mistake, so once you're "caught" any following errors don't mean much anymore. Better use some other, "less aggressive" domains as crash test dummies.


Quote:
Originally Posted by Swakoo View Post
And interestingly, for the bounced mails, it is now showing mail.domain.com, which is what I wanted...
Ah. Now who said you can't always get what you want? ;-p
 
Old 07-04-2008, 02:06 AM   #12
Swakoo
Member
 
Registered: Apr 2005
Distribution: Red Hat / Fedora / CentOS
Posts: 508

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by unSpawn View Post
Does this mean no e-mails get sent? All fail with resolver errrors? Or just some? What does 'echo "/mx yahoo.com"|/usr/sbin/sendmail -v -bt -d1-20.99' return? What does maillog say? BTW, IIRC e-mail to domains like hotmail, yahoo and such should be handled cautiously: some domains have anti-spam features that will block you automagically and for prolonged periods of time after one mistake, so once you're "caught" any following errors don't mean much anymore. Better use some other, "less aggressive" domains as crash test dummies.



Ah. Now who said you can't always get what you want? ;-p
Well, my experience with Sendmail, especially on the matter on the masquerading so far, is always of mixed results.

Though now I suddenly got it working, here I have another machine which I tried to masquerade. Pump in the same settings but, nah doesn't work.

Also, realise that gmail receives the masquearded mail as such:
Quote:
Received: from web1.domain.com (mail.domain.com [this.is.my.ip])
by mx.google.com with ESMTP id i9si115199tid.15.2008.07.03.09.01.05;
Thu, 03 Jul 2008 09:02:18 -0700 (PDT)
mail.domain.com is the masqueraded address, but it still captures the hostname... I guess there's no masking that?

When I send as root, the "From" field is always the hostname of the machine
when I send as non-root, the "From" field will be the masqueraded one, but the above quoted text will still be in the mail header... normal?

For your earlier suggestion, I got the following result:
Quote:
getla(): 0.44
getauthinfo: root@localhost
assign_queueid: random_offset = 871529807 (2207)
assign_queueid: assigned id m645meal019074, e=0x552ac62740
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> /mx yahoo.com
getmxrr(yahoo.com, droplocalhost=0)
mxrand(g.mx.mail.yahoo.com) = 25
mxrand(a.mx.mail.yahoo.com) = 256
mxrand(b.mx.mail.yahoo.com) = 220
mxrand(c.mx.mail.yahoo.com) = 184
mxrand(d.mx.mail.yahoo.com) = 185
mxrand(e.mx.mail.yahoo.com) = 15
mxrand(f.mx.mail.yahoo.com) = 3
getmxrr(yahoo.com) returns 7 value(s):
f.mx.mail.yahoo.com.
e.mx.mail.yahoo.com.
g.mx.mail.yahoo.com.
c.mx.mail.yahoo.com.
d.mx.mail.yahoo.com.
b.mx.mail.yahoo.com.
a.mx.mail.yahoo.com.

====finis: stat 0 e_id=NOQUEUE e_flags=4001<OLDSTYLE,METOO>
0: fl=0x0, mode=10600: FIFO: dev=0/7, ino=32742596, nlink=1, u/gid=0/0, size=0
1: fl=0x8002, mode=20620: CHR: dev=0/9, ino=2, nlink=1, u/gid=1234/5, size=0
2: fl=0x8002, mode=20620: CHR: dev=0/9, ino=2, nlink=1, u/gid=1234/5, size=0
just curious what does this do?

also, i have been trying to send mail, either via mutt or via mail command... i keep getting bounce with the following:

Quote:
----- The following addresses had permanent fatal errors -----
validuser@validdomain.com
(reason: 553 5.1.2 <validuser@validdomain.com>... Unrecognized host name
+validdomain.com.)
(expanded from: validuser@validdomain.com)
Strangely, ping is very fine.

maillog shows the same too
Quote:
Unrecognized host name validdomain.com
it does seems that no email can get sent... weirdly.

when i try to send as a non-root user from the problem server, i get this:
Quote:
/home/user/dead.letter... Saved message in /home/user/dead.letter
I mentioned this a post earlier... and googling it.. does seems to be because of the unresolvable domain

Just strangely... ping/traceroute have no problem...
perplexing...

i've checked ip routes, network config etc. its all fine.
i tried ssh <publicdomainname> and I can connect, no problem. it recognises the name.
But when I send mail to the same domain, it doesn't.

Is there, perhaps, a separate mechanism/file/config that controls the dns lookup for sendmail?
 
Old 07-23-2008, 10:11 PM   #13
Swakoo
Member
 
Registered: Apr 2005
Distribution: Red Hat / Fedora / CentOS
Posts: 508

Original Poster
Rep: Reputation: 30
anyone?

thanks
 
  


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 Domain?? jmorris8 Linux - Newbie 6 03-14-2007 07:47 AM
sendmail is not working & on $prompt the cmd sendmail hangs Pavan mahoorker Linux - Software 1 04-04-2006 03:57 PM
Sendmail sending as host.domain.com, i want it to be from just domain.com. PlatinumRik Linux - Software 5 10-07-2004 04:32 PM
Sendmail needs my real domain name??? ugol Linux - Software 2 06-21-2004 11:04 PM
HELP! Sendmail Config for xxx.domain.com where xxx is not domain, but want act like 1 rld1025 Linux - Newbie 2 09-11-2003 07:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

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