[rancid] Rancid & email generation

Jethro R Binks jethro.binks at strath.ac.uk
Wed Jan 9 21:49:29 UTC 2013


(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.


More information about the Rancid-discuss mailing list