Slackware This Forum is for the discussion of Slackware Linux.
|
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
|
06-05-2006, 04:50 AM
|
#1
|
Member
Registered: Oct 2004
Location: Norway
Distribution: Slackware, CentOS
Posts: 641
Rep:
|
Configuring sendmail for mail forwarding to server
It's time to become a bit more advanced
I've got a home network of 4-5 laptops (asterix, idefix, etc) who all connect to a central server (majestix) for local services etc.
What I need is to configure all the clients to have sendmail use the majestix-server as gateway. I assume this is very similar to most setups at campuses and companies, so I guess there's a default/simple way to configure asterix and idefix's sendmail.cf to just forward everything to majestix..
Once I've got that figured out I'll post back and ask how to get majestix to talk to the great-big-old internet, but one baby-step at the time
Thanks in advance!
|
|
|
06-05-2006, 05:28 AM
|
#2
|
Slackware Contributor
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559
|
You should set the "Smart Host" in /etc/mail/sendmail.cf to majestix:
Code:
# "Smart" relay host (may be null)
DSmajestics
And then restart sendmail:
Code:
/etc/rc.d/rc.sendmail restart
.
If you use m4 to generate a sendmail.cf out of a sendmail.mc file, you should be adding
Code:
define(`SMART_HOST',`majestix')
to the .mc file and then rebuild the sendmail.cf.
Now, sendmail will forward all mail to the Smart Host, and will assume that host is smart enough to know how to handle all mail :-)
Eric
|
|
|
06-05-2006, 06:10 AM
|
#3
|
Member
Registered: Oct 2004
Location: Norway
Distribution: Slackware, CentOS
Posts: 641
Original Poster
Rep:
|
Thanks much for once again coming to the rescue - my home network is getting close to perfect now thanks to your (and others) help
Quote:
Originally Posted by Alien Bob
Now, sendmail will forward all mail to the Smart Host, and will assume that host is smart enough to know how to handle all mail :-)
|
I guess it's more a question of whether or not the operator is smart enough to configure this correctly..
..which I'm not - so on to the next question. Now that I am taking the vanilla sendmail-slackware files and modifying them as you recommended and running m4 on all the clients/hosts, I need to prepare the home server to receive all of this. I don't want the server to be open to everyone and used as a SPAM relay, so all I want it to do is accept the incoming stuff from the client hosts I just configured, and then forward it to my VPS-hosted server in the US.
Is all I need to do on majestix to configure the same SMART_HOST as vps.mycompany.com and voila - it's up and running, or do I need to do some more intelligent stuff on majestix to gather and allow emails from all the asterix and idefix'es and pass it on?
-Y1
|
|
|
06-05-2006, 07:35 AM
|
#4
|
Member
Registered: Oct 2004
Location: Norway
Distribution: Slackware, CentOS
Posts: 641
Original Poster
Rep:
|
For some reason, /etc/mail/sendmail.cf doesn't contain the DSmajestix field, even though I have the (supposedly) correct field in sendmail-slackware.mc.
Here's what I've done:
1. Modify defailt /usr/share/sendmail/cf/cf/sendmail-slackware.mc with :
Code:
dnl define(`SMART_HOST',`majestix')
(instead of mailserver.example.com
2. Run
Code:
m4 /usr/share/sendmail/cf/cf/sendmail-slackware.mc > /etc/mail/sendmail.cf
3. search for DS in /etc/mail/sendmail.cf:
Code:
# "Smart" relay host (may be null)
DS
What am I doing wrong here?
|
|
|
06-05-2006, 07:37 AM
|
#5
|
Slackware Contributor
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559
|
Quote:
Originally Posted by Yalla-One
all I want it to do is accept the incoming stuff from the client hosts I just configured, and then forward it to my VPS-hosted server in the US.
Is all I need to do on majestix to configure the same SMART_HOST as vps.mycompany.com and voila - it's up and running, or do I need to do some more intelligent stuff on majestix to gather and allow emails from all the asterix and idefix'es and pass it on?
-Y1
|
...yes. There are some refinements you probably have to make to have sendmail accept and relay your internal machines' emails, like in
Code:
/etc/mail/local-host-names
I list all the hostnames my server will be addressed as - mine looks (almost) like
Code:
# names of hosts for which we receive email
localhost
my.net
gate.my.net
sox.homeip.net
and perhaps you'll have to populate
Code:
/etc/mail/relay-domains
as well if your sendmail refuses to relay the mail coming from your otehr PC's. Mine (roughly) says
Eric
|
|
1 members found this post helpful.
|
06-05-2006, 08:01 AM
|
#6
|
Member
Registered: Oct 2004
Location: Norway
Distribution: Slackware, CentOS
Posts: 641
Original Poster
Rep:
|
Thanksmuch - again. It's all so easy once it's been done for the first time
Seems like /etc/mail/sendmail.cf refuses to get the SMART_HOST field (DS) - can I just edit that manually, or is it left out for a reason that I should fix somewhere?
-Y1
|
|
|
06-05-2006, 08:53 AM
|
#7
|
Slackware Contributor
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559
|
Quote:
dnl define(`SMART_HOST',`majestix')
|
The "dnl" indicates the start of a comment line... whatever follows that will not show up in your sendmail.cf once you've generated it using m4. Look at my original example, it did not contain "dnl " (dnl stands for "delete until new line")
Eric
|
|
|
06-05-2006, 09:02 AM
|
#8
|
Member
Registered: Oct 2004
Location: Norway
Distribution: Slackware, CentOS
Posts: 641
Original Poster
Rep:
|
Referring back to the "intelligent" comment in the initial post and rest my case
Apparently the devil is in the detail - missed that one completely. Thanks a bunch again.
-Y1
|
|
|
06-05-2006, 09:36 AM
|
#9
|
Member
Registered: Oct 2004
Location: Norway
Distribution: Slackware, CentOS
Posts: 641
Original Poster
Rep:
|
Still not quite there - this seems to be complicated stuff.
I've got all the clients to happily forward the email to the server (majestix), and likewise, the server happily accepts these connections and deals with it on behalf of all the machines in the network.
However, when the server(majestix) on yallanet.com tries to connect to the VPS server on mailserver.example.com, it all goes haywire. I have added the internal mailservers (majestix) static, public IP address to the VPS servers /etc/relayhosts in order for it to accept relay from majestix.
The result bounces back like this:
Code:
From MAILER-DAEMON@majestix.yallanet.com Mon Jun 5 16:17:58 2006
Return-Path: <MAILER-DAEMON@majestix.yallanet.com>
Date: Mon, 5 Jun 2006 16:17:58 +0200
From: Mail Delivery Subsystem <MAILER-DAEMON@majestix.yallanet.com>
To: <user@asterix.yallanet.com>
Content-Type: multipart/report; report-type=delivery-status;
boundary="k55EHwHZ009456.1149517078/majestix.yallanet.com"
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)
Status: RO
Part 1:
The original message was received at Mon, 5 Jun 2006 16:17:56 +0200
from asterix.yallanet.com [192.168.1.105]
----- The following addresses had permanent fatal errors -----
<user@yallanet.com>
(reason: 550-Verification failed for <user@asterix.yallanet.com>)
----- Transcript of session follows -----
... while talking to mailserver.example.com.:
>>> DATA
<<< 550-Verification failed for <user@asterix.yallanet.com>
<<< 550-unrouteable mail domain "asterix.yallanet.com"
<<< 550 Sender verify failed
550 5.1.1 <user@yallanet.com>... User unknown
<<< 503 valid RCPT command must precede DATA
Part 2:
Content-Type: message/delivery-status
Part 3:
Content-Type: message/rfc822
From user@asterix.yallanet.com Mon Jun 5 16:17:56 2006
Return-Path: <user@asterix.yallanet.com>
From: Yalla-One <user@asterix.yallanet.com>
Date: Mon, 05 Jun 2006 16:17:57 +0200
To: user@yallanet.com
Subject: Second test email
User-Agent: nail 11.25 7/29/05
Content-Type: text/plain; charset=us-ascii
This is an email sent from client computer ASTERIX through server MAJESTIX to servint host mailserver.
example.com.
I hope it works.
lines 20-48/48 (END)
On the hosted VPS server, exim's reject-log corresponds:
Code:
2006-06-05 18:17:59 H=(majestix.yallanet.com) [1x3.2x3.1x.x1x] sender verify fail for <user@asterix.yallanet.com>: unrouteable mail domain "asterix.yallanet.com"
2006-06-05 18:17:59 H=(majestix.yallanet.com) [1x3.2x3.1x.x1x] F=<user@asterix.yallanet.com> rejected
RCPT <user@yallanet.com>: Sender verify failed
Thus I am assuming that at least one of the errors is that I need to get sendmail on majestix to rewrite the header to skip the hostname asterix ?
This is a normal cPanel/WHM setup if that helps...
I guess this is beginning to reach a complexity-level beyond what it is reasonable to expect my fellow Slackware-LQ users to be able to help with, but on the off-chance that I am a small configuration tweak away from reaching my goal, I post my failure here as a sort of a last resort
Thanks again for much appreciated help getting me this far
-Y1
Last edited by Yalla-One; 06-05-2006 at 09:42 AM.
|
|
|
06-05-2006, 09:59 AM
|
#10
|
Member
Registered: Oct 2004
Location: Norway
Distribution: Slackware, CentOS
Posts: 641
Original Poster
Rep:
|
Solved!
Nothing like a full day off with nothing to do to learn great new things. The problem is finally solved, thanks to Eric and Google.
By adding
Code:
MASQUERADE_AS(`yallanet.com')
MASQUERADE_DOMAIN(`yallanet.com')
FEATURE(`masquerade_entire_domain')
FEATURE(`masquerade_envelope')
to the sendmail-slackware.mc file, I got my sendmail to rewrite the header before communicating with the VPS server, and now everything is perfectly accepted.
What a motivating day
-Y1
|
|
|
06-05-2006, 10:05 AM
|
#11
|
Slackware Contributor
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559
|
I guess you should masquerade the internal host(s) your emails were sent from.
You can add these lines to your .mc file on the smarthost (majestix) and rebuild the sendmail.cf with it:
Code:
MASQUERADE_AS(yallanet.com)dnl
FEATURE(`allmasquerade')dnl
FEATURE(`masquerade_envelope')dnl
Then, all email will appear to come from "user@yallanet.com" no matter what host it was originating from. The domain yallanet.com must have an associated MX record in DNS so that return email can actually be delivered. Most ISP's allow incoming traffic at the smtp port 25 so in that case, your own server can handle the incoming emails (and then it will become time to think about your own internal IMAP server :-).
If not, you must rewrite the "MASQUERADE_AS(yallanet.com)dnl" into "MASQUERADE_AS(yourisp.com)dnl" so that return emails will be sent to your ISP where you can fetch them like you probably already are.
Hope this still makes any sense to you (and others reading).
Eric
|
|
|
06-05-2006, 10:27 AM
|
#12
|
Member
Registered: Oct 2004
Location: Norway
Distribution: Slackware, CentOS
Posts: 641
Original Poster
Rep:
|
Hi,
All return emails are going as they should to the servint VPS server, which is monitored and probably more stable than my home server sitting in the storage cabinet beneath my wife's sowing machine  So while I do have a static IP at home, I haven't opened port 25 in the firewall, as the MX-record for our domain externally points to servint VPS and internally points to majestix.
However, only one minor detail remains. When I at the prompt of my machine (asterix) type mailx user, mail is still delivered locally on asterix' /var/spool/mail/user, but if I type mailx user@yallanet.com or my_friend@his_domain.org it works as planned.
I have the line FEATURE(`always_add_domain')dnl in the config-file, but that doesn't seem to cut it.
Is there a command that forces all email delivery, also local, to be sent to majestix for further processing at the servint box?
-Y1
|
|
|
06-05-2006, 11:52 AM
|
#13
|
Slackware Contributor
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559
|
Well, local delivery if a user account exists, is just what Sendmail shouldbe doing of course. What you see if completely normal and desired behaviour. Remember, this is Linux, where each computer might as as well be called a server, with it's multiple accounts. The mail address without any domain appended, is per definition a local account.
Your only way out would be to start using full email addresses including a "@yallanet.com" domain part, so that mail for it will be directed to the smarthost, or define an alias for the local account "user" that points to "user@yallanet.com" - or create a ~/.forward file that basically does the same - forward all incoming local mail to the smarthost.
Eric
|
|
|
06-05-2006, 12:03 PM
|
#14
|
Member
Registered: Oct 2004
Location: Norway
Distribution: Slackware, CentOS
Posts: 641
Original Poster
Rep:
|
I know, but in a multi-host environment I don't want computer novices to have different emails depending on which computer they happen to be working from, so I added LOCAL_RELAY pointing to majestix which solved most of it.
Another thing to be aware of (which I haven't been able to solve yet, but has contributed significantly to the confusion) is that WHM/cPanel overwrites /etc/relayhosts each time a user POPs their email with POP3, which means that I need to find an alternate way to get exim to permanently read my accepted relay host IP address as /etc/relayhosts is clearly used for something else...
Another thing that would be neat would be if emails from root (which I now know is a protected user and thus not rewritten with the masquerading) could be totally rewritten as to appear from admin@example.com instead of root@host.example.com ... But that's for the next short holiday
-Y1
|
|
|
10-06-2006, 10:35 AM
|
#15
|
Senior Member
Registered: Feb 2005
Location: San Antonio, Texas
Distribution: Gentoo Hardened using OpenRC not Systemd
Posts: 1,495
Rep:
|
Quote:
Originally Posted by Yalla-One
For some reason, /etc/mail/sendmail.cf doesn't contain the DSmajestix field, even though I have the (supposedly) correct field in sendmail-slackware.mc.
Here's what I've done:
1. Modify defailt /usr/share/sendmail/cf/cf/sendmail-slackware.mc with :
Code:
dnl define(`SMART_HOST',`majestix')
(instead of mailserver.example.com
2. Run
Code:
m4 /usr/share/sendmail/cf/cf/sendmail-slackware.mc > /etc/mail/sendmail.cf
3. search for DS in /etc/mail/sendmail.cf:
Code:
# "Smart" relay host (may be null)
DS
What am I doing wrong here?
|
Shouldn't
Code:
dnl define(`SMART_HOST',`majestix')
be smtp.majestix.com or something similar?
|
|
|
All times are GMT -5. The time now is 12:56 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|