Re: Is there a tool or a deamon that documented a change in the /etc directory?

Previous thread: Re: zombies - half solved by Stephen Takacs on Wednesday, March 12, 2008 - 6:25 pm. (1 message)

Next thread: jetway board sensors (Fintek F71805F) by Geoff Steckel on Wednesday, March 12, 2008 - 8:45 pm. (3 messages)
To: misc <misc@...>
Date: Wednesday, March 12, 2008 - 7:37 pm

The problem is clear, I think.
But a simple example:
You are an operator for e.g. a OBSD Firewall.
Yesterday everything was ok,
Today a person phoned me and want that I open a tcp port for him. Ok I open.
Tomorrow, I notice problems that I never have had before. But I have forgotten
the new open port. Now it is nice to have a ChangeLog.

Because it is faster than restore an Backup.

To: misc <misc@...>
Date: Wednesday, March 12, 2008 - 8:38 pm

...and more productive, as you may be able to see what is wrong, rather
than simply roll back to what was...

This functionality is built into and turned on by default in OpenBSD.

If you set up the root user's e-mail to forward or otherwise be
delivered to your inbox every morning, you will find this is already
being done for you. If you didn't do this, you have a pile of these
things waiting for you to read through in /var/mail/root.

Every night, as part of the /etc/daily script, it looks for changes to
the files listed in /etc/changelist, and stores a backup of those files.
If it finds a change, it mails you a diff of that file in an insecurity
report. If you keep those, you have a very good record of the history
of changes on your machine.

Ta-da! Just what you asked for, by simply creating a /root/.forward
with just your e-mail address in it. :) Within a few days, you will
be reinventing this on every Unix machine you work with.

That being said... I'm also fond of this little entry in my
/etc/daily.local file:
TGZFILE=/backup/`date "+backup%Y-%m-%d"`.tgz
cd /
tar czf $TGZFILE etc var

On firewalls and DNS servers I have done this with, you get many
YEARS of this backup files on the spare space on a 40G drive.

Another trick that works well for firewalls is to have a script
which you use to synchronize the pf.conf (and other) files between
machines. I wrote one which:
* did a diff -u against the other machine
* Recorded that diff into a file, tossed the user into an editor
to both review and explain/document the diff
* Saved that file to /bkup/history
* copy the compared files AND the change log file to the other
machine and install them
* run pfctl -f on that other machine.

(this was all done in shell script and base tools, no packages
were added to the machine)

Yes, you could say I reinvented cvs for this, but I liked this
specialized script over a general CMS for a few reasons, including
the fact it stuffed the diff in your face and ...

To: misc <misc@...>
Date: Wednesday, March 12, 2008 - 8:00 pm

there was fairly recently a discussion about using rcs/cvs for
configuration files in /etc. check the archives.

--
jakemsr@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org

To: Stephan Andreas <alfons1991@...>
Cc: misc <misc@...>
Date: Wednesday, March 12, 2008 - 7:55 pm

You have a good idea there, and you are lucky that a solution exists.
Put your config files in cvs (or hg or svn). Last time this came up
someone said they had a cron job to push the latest committed configs
out to the machines periodically, which eventually helps you remember to
check in your changes. ;-)

--
Darrin Chandler | Phoenix BSD User Group | MetaBUG
dwchandler@stilyagin.com | http://phxbug.org/ | http://metabug.org/
http://www.stilyagin.com/ | Daemons in the Desert | Global BUG Federation

Previous thread: Re: zombies - half solved by Stephen Takacs on Wednesday, March 12, 2008 - 6:25 pm. (1 message)

Next thread: jetway board sensors (Fintek F71805F) by Geoff Steckel on Wednesday, March 12, 2008 - 8:45 pm. (3 messages)