From: Moby on 12 Feb 2010 21:30 I have a weird requirement. Say I am the backup MX for a domain. If I get email from any machine for domain A, I want to deliver it as per my virtusertable rules (this part is working - I add the appropriate entires in my virtusertable and also add the domain name to my local-host-names). However, if people on specific hosts using my mail server send email to the domain, I want it sent out, as per MX lookup rules etc (assuming primary MX is up and running). How can I do this? The crux of the matter appear to be: 1) In order to be able to accept mail for the domain, I have to add it to my local-host-names. 2) Once added to my local-host-names, my server always accepts mail for the domain and does not do an MX lookup. I need to be able to have my sendmail server accept mail for the domain locally ~except~ when the mail originates from certain specific machines - can this be done with sendmail? Thanks in advance for any help. --Moby
From: Bruce Esquibel on 13 Feb 2010 09:55 Moby <moby(a)mobsternet.com> wrote: > I have a weird requirement. Say I am the backup MX for a domain. If I > get email from any machine for domain A, I want to deliver it as per my > virtusertable rules (this part is working - I add the appropriate > entires in my virtusertable and also add the domain name to my > local-host-names). However, if people on specific hosts using my mail > server send email to the domain, I want it sent out, as per MX lookup > rules etc (assuming primary MX is up and running). How can I do this? Hmm, if you add in: FEATURE(`relay_based_on_MX') to the sendmail.mc (and generate the .cf), you don't need to add the domain to the local-host-names. But I'm not sure if virtusertable is used by doing that. I've used the access file for domains with a couple email addresses like this: To:info(a)domain.com RELAY To:sales(a)domain.com RELAY To:domain.com DROP So if we're acting as secondary MX for domain.com and get any mail for them, only the stuff for info@ and sales@ get sent, everything else dropped. I know this isn't an answer (yes it is a weird question) but it's a different path to try. Just sure if its added to local-host-names, you aren't going to be a secondary mailer anymore, so you have to avoid that. -bruce bje(a)ripco.com
From: Moby on 13 Feb 2010 13:01 On 02/13/2010 08:55 AM, Bruce Esquibel wrote: > Moby <moby(a)mobsternet.com> wrote: >> I have a weird requirement. Say I am the backup MX for a domain. If I >> get email from any machine for domain A, I want to deliver it as per my >> virtusertable rules (this part is working - I add the appropriate >> entires in my virtusertable and also add the domain name to my >> local-host-names). However, if people on specific hosts using my mail >> server send email to the domain, I want it sent out, as per MX lookup >> rules etc (assuming primary MX is up and running). How can I do this? > > Hmm, if you add in: > > FEATURE(`relay_based_on_MX') > > to the sendmail.mc (and generate the .cf), you don't need to add the domain > to the local-host-names. > > But I'm not sure if virtusertable is used by doing that. I've used the > access file for domains with a couple email addresses like this: > > To:info(a)domain.com RELAY > To:sales(a)domain.com RELAY > To:domain.com DROP > > So if we're acting as secondary MX for domain.com and get any mail for them, > only the stuff for info@ and sales@ get sent, everything else dropped. > > I know this isn't an answer (yes it is a weird question) but it's a > different path to try. Just sure if its added to local-host-names, you > aren't going to be a secondary mailer anymore, so you have to avoid that. > > -bruce > bje(a)ripco.com Thanks Bruce, I will see where the route of using FEATURE(`relay_based_on_MX`) takes me. I think my requirement falls, more or less, within the purview of "source based" routing - I basically want to route the email differently depending on what machine it comes from. I was hoping Sendmail had support for something like that . Thanks for the tips again. --Moby
From: ska on 17 Feb 2010 05:22 Moby wrote: > I have a weird requirement. Say I am the backup MX for a domain. If I > get email from any machine for domain A, I want to deliver it as per my > virtusertable rules (this part is working - I add the appropriate > entires in my virtusertable and also add the domain name to my > local-host-names). However, if people on specific hosts using my mail > server send email to the domain, I want it sent out, as per MX lookup > rules etc (assuming primary MX is up and running). How can I do this? > > The crux of the matter appear to be: > 1) In order to be able to accept mail for the domain, I have to add it > to my local-host-names. > 2) Once added to my local-host-names, my server always accepts mail for > the domain and does not do an MX lookup. > > I need to be able to have my sendmail server accept mail for the domain > locally ~except~ when the mail originates from certain specific machines > - can this be done with sendmail? What I don't get is: If you can deliver the mails locally, why sending it to the primary MX? Actually your requirement is a bit stronger: "accept mail for the domain locally ~except~ when the mail originates from certain specific machines ~or~ when the primary MX is down." So, you can deliver locally, but want to forward anyway? How do you differ at all between the case of "primary is up -> relay to it" and "primary is down -> deliver locally"? -ska
From: Moby on 18 Feb 2010 10:02
On 02/17/2010 04:22 AM, ska wrote: > Moby wrote: >> I have a weird requirement. Say I am the backup MX for a domain. If I >> get email from any machine for domain A, I want to deliver it as per my >> virtusertable rules (this part is working - I add the appropriate >> entires in my virtusertable and also add the domain name to my >> local-host-names). However, if people on specific hosts using my mail >> server send email to the domain, I want it sent out, as per MX lookup >> rules etc (assuming primary MX is up and running). How can I do this? >> >> The crux of the matter appear to be: >> 1) In order to be able to accept mail for the domain, I have to add it >> to my local-host-names. >> 2) Once added to my local-host-names, my server always accepts mail for >> the domain and does not do an MX lookup. >> >> I need to be able to have my sendmail server accept mail for the domain >> locally ~except~ when the mail originates from certain specific machines >> - can this be done with sendmail? > > What I don't get is: If you can deliver the mails locally, why sending > it to the primary MX? > > Actually your requirement is a bit stronger: > "accept mail for the domain locally > ~except~ when the mail originates from certain specific machines > ~or~ when the primary MX is down." > > So, you can deliver locally, but want to forward anyway? > > How do you differ at all between the case of "primary is up -> relay > to it" and "primary is down -> deliver locally"? > > -ska Thanks for the posting ska. Here is the usage scenario where I have needed this type of functionality: Primary MX points to a hosted spam control service, say on host A. host A runs some proprietary software over which I do not have control. During normal operation, host A is configured to send all mail to "regular" mail server, say host B (this "sending" is handled by proprietary software - no MX lookups are involved). When host B has an outage, host A is reconfigured to send all mail to my machine (say host C) which is running sendmail. In order for me to allow to sendmail on host C to accept mail from host A, I have to add the domain name to my local-host-names. Also I have to deliver the mail to my own imap software (cyrus fwiw) and allow users to come in via a web front end (horde, fwiw). My machine, viz host C, accumulates a lot of messages during the outage window of host B. When host B comes up, the primary MX host A is reconfigured to stop sending mail to my host C and start sending it back to the regular host B. Users would like to be able to forward mail from my host C (via the web interface) to their usual account (basically forwarded mail should now go from my machine back to host A and it will now send it to host B). However, because the domain name is still in my local-host-names, the mail just comes right back to my host instead of being sent out to host A. The way I get to work right now is to manually add/remove the domain name to my local-domain-names every time an outage stars/ends. What I would like to achieve is the following: 1) Have sendmail on my host C accept and deliver mail locally for said domain should any mail come in from the "outside". 2) Deliver mail via MX lookup should mail originate from my network. I have two options I am looking into at the moment. 1) Have two sendmail's running on my end. One sendmail would be configured to deliver mail for said domains locally, and this sendmail will be handling all email coming in from the outside. Have another sendmail that is used by all of my own hosts and have this sendmail configured to not deliver mail for said domain locally but to do the usual MX lookup stuff. 2) Inject procmail into outbound mail and fiddle around with procmail to send mail directly for said domain to the host I need the mail sent to. I was hoping for an easier, "cleaner" solution where I do not have to inject procmail processing into outbound mail and also do not need to fire up another sendmail. Thanks again, --Moby |