Discussion:
[rancid] Setting up Rancid on FreeBSD 10.1
Andrew S. Meyer
2015-03-22 19:25:13 UTC
Permalink
Hi everyone,
I seem to be having some difficulty getting rancid to send emails on FBSD 10.1 using postfix or sendmail (built-in). I have configured postfix to relay to another mail server in my setup but doesn't seem to do it when I have the rancid cronjob setup to run. Although if I run the following command uname -a | mail -s "`uname -n`: Test mail config" ***@tld.com<mailto:***@tld.com> it works just fine. I can run this command as any user and it works, but the automated emails do not for the rancid user. Has anyone else run into this? If so how do you fix it? I'm almost done with my rancid setup.

Here is my postfix config

***@monitoring1:~ # postconf -n
postconf: warning: /usr/local/etc/postfix/main.cf, line 573: overriding earlier entry: alias_maps=dbm:/etc/mail/aliases
alias_maps = hash:/etc/mail/aliases
command_directory = /usr/local/sbin
config_directory = /usr/local/etc/postfix
daemon_directory = /usr/local/libexec/postfix
data_directory = /var/db/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory = /usr/local/share/doc/postfix
inet_protocols = ipv4
mail_owner = postfix
mailq_path = /usr/local/bin/mailq
manpage_directory = /usr/local/man
mynetworks_style = host
newaliases_path = /usr/local/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = /usr/local/share/doc/postfix
relayhost = [192.168.220.56]
sample_directory = /usr/local/etc/postfix
sendmail_path = /usr/local/sbin/sendmail
setgid_group = maildrop
unknown_local_recipient_reject_code = 550
***@monitoring1:~ #

/var/log/maillog output
Mar 22 14:15:00 monitoring1 postfix/local[1513]: warning: /usr/local/etc/postfix/main.cf, line 573: overriding earlier entry: alias_maps=dbm:/etc/mail/aliases
Mar 22 14:15:00 monitoring1 postfix/local[1513]: warning: database /etc/mail/aliases.db is older than source file /etc/mail/aliases
Mar 22 14:15:00 monitoring1 postfix/local[1513]: 0E2DC7590B: to=<***@monitoring1.borg.priv>, orig_to=<rancid>, relay=local, delay=0.02, delays=0.01/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Mar 22 14:15:00 monitoring1 postfix/qmgr[632]: 0E2DC7590B: removed
Mar 22 14:20:00 monitoring1 postfix/sendmail[1586]: warning: /usr/local/etc/postfix/main.cf, line 573: overriding earlier entry: alias_maps=dbm:/etc/mail/aliases
Mar 22 19:20:00 monitoring1 postfix/postdrop[1588]: warning: /usr/local/etc/postfix/main.cf, line 573: overriding earlier entry: alias_maps=dbm:/etc/mail/aliases
Mar 22 14:20:00 monitoring1 postfix/cleanup[1594]: warning: /usr/local/etc/postfix/main.cf, line 573: overriding earlier entry: alias_maps=dbm:/etc/mail/aliases
Mar 22 14:20:00 monitoring1 postfix/pickup[631]: 096427590B: uid=1002 from=<rancid>
Mar 22 14:20:00 monitoring1 postfix/trivial-rewrite[1595]: warning: /usr/local/etc/postfix/main.cf, line 573: overriding earlier entry: alias_maps=dbm:/etc/mail/aliases
Mar 22 14:20:00 monitoring1 postfix/cleanup[1594]: 096427590B: message-id=<***@monitoring1.borg.priv>
Mar 22 14:20:00 monitoring1 postfix/qmgr[632]: 096427590B: from=<***@monitoring1.borg.priv>, size=622, nrcpt=1 (queue active)
Mar 22 14:20:00 monitoring1 postfix/local[1597]: warning: /usr/local/etc/postfix/main.cf, line 573: overriding earlier entry: alias_maps=dbm:/etc/mail/aliases
Mar 22 14:20:00 monitoring1 postfix/local[1597]: warning: database /etc/mail/aliases.db is older than source file /etc/mail/aliases
Mar 22 14:20:00 monitoring1 postfix/local[1597]: 096427590B: to=<***@monitoring1.borg.priv>, orig_to=<rancid>, relay=local, delay=0.02, delays=0.01/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Mar 22 14:20:00 monitoring1 postfix/qmgr[632]: 096427590B: removed
***@monitoring1:~ #


As for rancid - here is what I have setup:


LIST_OF_GROUPS="NetworkDevices"
MAILDOMAIN="@borg.local"; export MAILDOMAIN

I have run rancid-cvs to set it all up.

Here is the crontab for rancid. I have it setup to check and email me so often to do some testing. I DO plan to change this once completed:

[***@monitoring1 ~]$ crontab -l
1,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/bin/rancid-run #hourly router dump
1,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/bin/find /usr/local/var/rancid/logs -type -f -mtime +2 -exec rm -rf {} \;
[***@monitoring1 ~]$

Also,
Has anyone started using Rancid 3.0 yet? If so how hard is it to setup?


Andrew
Nick Hilliard
2015-03-22 20:54:57 UTC
Permalink
Has anyone else run into this? If so how do you fix it? I’m almost done
with my rancid setup.
this is a mail configuration problem rather than a rancid problem. Looks
to me like there could be a problem with your mail aliases.
alias_maps=dbm:/etc/mail/aliases
this looks like a mistake in your postfix config.
Mar 22 14:15:00 monitoring1 postfix/local[1513]: warning: database
/etc/mail/aliases.db is older than source file /etc/mail/aliases
you need to run:

# postalias /etc/mail/aliases
delay=0.02, delays=0.01/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
looks like the mail was delivered to /var/mail/rancid.
Here is the crontab for rancid. I have it setup to check and email me so
bear in mind that if you are polling devices with nvram, rancid will issue
a configuration write. On some types of kit, this can cause the nvram to
wear out after a couple of years.

Nick

Loading...