Discussion:
[rancid] Rancid & email generation
Gerhard Mourani
2013-01-09 18:51:40 UTC
Permalink
Hello list,

I've some difficulty receiving emails generated by Rancid in my inbox. Mail in general is working fine on the Linux OS and I can send other email without problem. Here my setup.

In my /etc/rancid.conf file, I've group called Cisco as follow:
LIST_OF_GROUPS="Cisco"

/etc/aliases, has Rancid entry as follow:
rancid-admin-cisco: rancid-cisco
rancid-cisco: root
rancid-admin: root
rancid: root
root: ***@domain.ca<mailto:***@domain.ca>

I use exim as mailer and has the following in /etc/exim.conf
begin rewrite
*@*.domain.ca ***@domain.ca<mailto:***@domain.ca>
The above mean to rewrite everything before @ and after @.domain.ca to ***@domain.ca<mailto:***@domain.ca> (i.e. rewrite rancid-***@host1.domain.ca<mailto:rancid-***@host1.domain.ca> to ***@domain.ca)

My problem is that Rancid try to send the email to ***@domain.ca<mailto:***@domain.ca> instead of ***@domain.ca<mailto:***@domain.ca> (From: ***@domain.ca<mailto:***@domain.ca> To: ***@domain.ca<mailto:***@domain.ca>) and I can't see why. However, if I run -> /usr/bin/rancid-run -m ***@domain.ca<mailto:***@domain.ca>, it work and I receive the email.

Gerhard,
Jethro R Binks
2013-01-09 21:49:29 UTC
Permalink
(I have slightly re-written your original question to make it clearer to
me for answering)
Post by Gerhard Mourani
rancid-admin-cisco: rancid-cisco
rancid-cisco: root
rancid-admin: root
rancid: root
I use exim as mailer and has the following in /etc/exim.conf
begin rewrite
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-***@host1.domain.ca, this matches the rewrite
rule and gets converted to ***@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
Post by Gerhard Mourani
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 '***@domain.ca', as
the rewriting rule will match from '***@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 = ***@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.
Gerhard Mourani
2013-01-10 13:57:58 UTC
Permalink
Thanks Jethro,

That's helped a lot. I've changed the Exim rewrite rule (rewrite *@*.domain.ca ***@domain.ca) to make it rewrite sender addresses only (rewrite *@*.domain.ca ***@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-***@host1.domain.ca.

Unfortunately, rancid-***@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 ***@domain.ca (root: ***@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-***@shrubbery.net [mailto:rancid-discuss-***@shrubbery.net] On Behalf Of Jethro R Binks
Sent: January-09-13 4:49 PM
To: rancid-***@shrubbery.net
Subject: Re: [rancid] Rancid & email generation

(I have slightly re-written your original question to make it clearer to me for answering)
Post by Gerhard Mourani
rancid-admin-cisco: rancid-cisco
rancid-cisco: root
rancid-admin: root
rancid: root
I use exim as mailer and has the following in /etc/exim.conf begin
My problem is that Rancid try to send the email to
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 '***@domain.ca', as the rewriting rule will match from '***@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 = ***@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.
Jethro R Binks
2013-01-10 14:14:47 UTC
Permalink
We'll take this discussion offlist as it appears not rancid related
directly.

Jethro.
Post by Gerhard Mourani
Thanks Jethro,
Gerhard,
-----Original Message-----
Sent: January-09-13 4:49 PM
Subject: Re: [rancid] Rancid & email generation
(I have slightly re-written your original question to make it clearer to me for answering)
Post by Gerhard Mourani
rancid-admin-cisco: rancid-cisco
rancid-cisco: root
rancid-admin: root
rancid: root
I use exim as mailer and has the following in /etc/exim.conf begin
My problem is that Rancid try to send the email to
and I receive the email.
You shouldn't use rewriting for routing of messages - the feature is intended to 'tidy up' and make addresses canonical.
driver = redirect
domains = *.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
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
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.

Loading...