Sendmail: send-only when local system has no domain name?
Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Sendmail: send-only when local system has no domain name?
Hello
Is it possible to configure sendmail to meet these requirements? The intention is that any locally generated mail will appear identifiably in my day-to-day inbox.
Note: I believe these values are "good practice" and will integrate well with most packages.
All mail sent to local users to be forwarded to <local recipient user name>.CW8@<my domain name> with a "From" address of <local sender user name>@<my domain name>. Note: the "To" address will route mail to my day-to-day inbox. The "From" address meets my mail service provider's requirement that "From" addresses include a valid internet domain name.
Attempt so far
After several attempts this is the closest.
Added lines to sendmail .mc file (and processed into /etc/mail/sendmail.cf using m4):
FEATURE(delay_checks)dnl
FEATURE(masquerade_envelope)dnl
FEATURE(allmasquerade)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_AS(`<my domain name>')dnl
Added aliases to /etc/mail/aliases (and processed into aliases.db usng newlaiases; this produced a warning about a duplicate entry for root)
root:root.CW8@<my domain name>
root@CW8.localdomain:root.CW8@<my domain name>
Result
As user c, ran
Code:
echo "hello" | mail -s test root
Mail was received (in Outlook) displayed as from Charles (taken from /etc/passwd file?) and to root@CW8.localdomain. The headers were
Code:
Return-Path: <c@<my domain name>>
Received: from CW8.localdomain ([<my external IP address>])
(authenticated bits=0)
by rs49.luxsci.com (8.13.1/8.13.7) with ESMTP id n9KGvC6P020547
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
for <root.CW8@<my domain name>>; Tue, 20 Oct 2009 11:57:14 -0500
Received: from CW8.localdomain (localhost [127.0.0.1])
by CW8.localdomain (8.14.3/8.14.3) with ESMTP id n9KGvC1k027490
for <root@CW8.localdomain>; Tue, 20 Oct 2009 22:27:12 +0530
Received: (from c@localhost)
by CW8.localdomain (8.14.3/8.14.3/Submit) id n9KGvBvV027489
for root; Tue, 20 Oct 2009 22:27:11 +0530
From: Charles <c@<my domain name>>
Message-Id: <200910201657.n9KGvBvV027489@CW8.localdomain>
Date: Tue, 20 Oct 2009 22:27:11 +0530
To: root@CW8.localdomain
As root, ran
Code:
echo "hello" | mail -s test root
Returned mail notification was received (in Outlook) with
Code:
root.CW8@<my domain name>
(reason: 553 5.1.8 <root@CW8.localdomain>... Domain of sender address root@CW8.localdomain does not exist)
(expanded from: <root@CW8.localdomain>)
The showstopper is that sendmail is not changing root@CW8.localdomain to root@<my domain name>. Other deviations from the requirements would be nice-to-fix but that's the biggy
Last edited by catkin; 10-20-2009 at 01:17 PM.
Reason: Tidying
As I understand it, this version is actually what you refer to as 'best practice'? I'm open to my interpretation being wrong though!
Essentially, the real problem you will hit with any of this is an inability to reply to any mails from this box, unless it is listed locally or globally as an MX record in DNS.
As I understand it, this version is actually what you refer to as 'best practice'? I'm open to my interpretation being wrong though!
Thanks irishbitte
Yes, it's the standard solution and I'm increasingly wondering why I don't just go for it! Perhaps my reluctance is more emotional than logical, something along the lines of keeping things "clean"; it's a good heuristic in programming or database work; never use a variable or field for something different because it happens to be available; "say what you mean and mean what you say'. Following this line of half-thought-through reasoning, CW8 has nothing to do with <my domain>; it is only my mail service provider's (reasonable) requirement that all mails are from a valid domain that requires this fudge; it is cleaner to limit the fudge to where it is actually necessary, that is sendmail and sendmail is immensely configurable -- that's why its config file is so complex we need m4 to write it!
Quote:
Originally Posted by irishbitte
Essentially, the real problem you will hit with any of this is an inability to reply to any mails from this box, unless it is listed locally or globally as an MX record in DNS.
Understood and no problem -- CW8 is not a mail server, it is a personal workstation that may report errors by email (smartd is configured, EDAC is on the way). Sure I could just check the local mails every now and then but what if I was away from home for a while? And it's a model for supporting other Linux systems.
Yup, you're on the right track now, and for error reporting your setup is perfect. I personally never knew that 'localdomain' was a variable to store local domain name! Is this coming from a netgroups setup by any chance? I've never used netgroups, but it sounds like one of the convenient things it provides....
Yup, you're on the right track now, and for error reporting your setup is perfect. I personally never knew that 'localdomain' was a variable to store local domain name! Is this coming from a netgroups setup by any chance? I've never used netgroups, but it sounds like one of the convenient things it provides....
No, not netgroups, just plain files. I figure I'm "boldly going" on this one so I'll do as you suggested and add exploring obscure corners of sendmail configuration to my TODO list.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.