[rancid] Rancid & email generation
Jethro R Binks
jethro.binks at strath.ac.uk
Thu Jan 10 14:14:47 UTC 2013
We'll take this discussion offlist as it appears not rancid related
directly.
Jethro.
On Thu, 10 Jan 2013, Gerhard Mourani wrote:
> Thanks Jethro,
>
> That's helped a lot. I've changed the Exim rewrite rule (rewrite *@*.domain.ca monitoring at domain.ca) to make it rewrite sender addresses only (rewrite *@*.domain.ca monitoring at domain.ca Ffrs) because I want flexibility in final recipient email address and that part worked now. I can see that Rancid try to send the email to rancid-cisco at host1.domain.ca.
>
> Unfortunately, rancid-cisco at host1.domain.ca is not a valid email address and that`s why aliases file should redirect it to root (rancid-cisco: root) which send it to myemail at domain.ca (root: myemail at domain.ca). This part is not working, therefore I suspect Exim to not read the /etc/aliases file for some unknown reasons. So this is an Exim problem.
>
> Gerhard,
>
> -----Original Message-----
> From: rancid-discuss-bounces at shrubbery.net [mailto:rancid-discuss-bounces at shrubbery.net] On Behalf Of Jethro R Binks
> Sent: January-09-13 4:49 PM
> To: rancid-discuss at shrubbery.net
> Subject: Re: [rancid] Rancid & email generation
>
> (I have slightly re-written your original question to make it clearer to me for answering)
>
> On Wed, 9 Jan 2013, Gerhard Mourani wrote:
>
> > /etc/aliases, has Rancid entry as follow:
> > rancid-admin-cisco: rancid-cisco
> > rancid-cisco: root
> > rancid-admin: root
> > rancid: root
> > root: myemail at domain.ca
> >
> > I use exim as mailer and has the following in /etc/exim.conf begin
> > rewrite *@*.domain.ca monitoring at domain.ca
> >
> > The above mean to rewrite everything before @ and after @.domain.ca to
> > monitoring at domain.ca (i.e. rewrite
> >
> > rancid-cisco at host1.domain.ca -> monitoring at domain.ca
> >
> > My problem is that Rancid try to send the email to
> > monitoring at domain.ca instead of myemail at domain.ca (From: monitoring at domain.ca To:
> > monitoring at domain.ca) and I can't see why.
>
> I think this is the explanation:
>
> Exim's rewriting happens very early in its message processing, before any relevant alias processing might happen. So the address it is given will be something like rancid-cisco at host1.domain.ca, this matches the rewrite rule and gets converted to monitoring at domain.ca, as does any similar address. As you have it configured, this happens for all header fields and SMTP sender and recipient addresses. Once that rewriting has happened, the addresses no longer match in the alias file so doesn't convert to myemail at domain.ca.
>
> > However, if I run -> /usr/bin/rancid-run -m myemail at domain.ca, it work
> > and I receive the email.
>
> When you do this, you have explicitly provided the final recipient address you wanted, and it doesn't match the rewrite rule or the alias file entries, so it delivers as expected. If you are doing this as 'root' on 'host1.domain.ca', I imagine it arrives from 'monitoring at domain.ca', as the rewriting rule will match from 'root at host1.domain.ca'.
>
> You shouldn't use rewriting for routing of messages - the feature is intended to 'tidy up' and make addresses canonical.
>
> Instead, you probably want a router something like this:
>
> forward:
> driver = redirect
> domains = *.domain.ca
> data = myemail at domain.ca
>
> (I'm a bit rusty on writing these things from scratch - check the documentation and FAQ for more details.)
>
> As a quick fix, it might also work if you add the following to your
> aliases:
>
> monitoring: root
>
> which will catch your re-written address, but there are many factors about how you have your Exim configuration arranged that could affect alias processing.
>
> Jethro.
>
> . . . . . . . . . . . . . . . . . . . . . . . . .
> Jethro R Binks, Network Manager,
> Information Services Directorate, University Of Strathclyde, Glasgow, UK
>
> The University of Strathclyde is a charitable body, registered in Scotland, number SC015263.
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
>
. . . . . . . . . . . . . . . . . . . . . . . . .
Jethro R Binks, Network Manager,
Information Services Directorate, University Of Strathclyde, Glasgow, UK
The University of Strathclyde is a charitable body, registered in
Scotland, number SC015263.
More information about the Rancid-discuss
mailing list