| 1 |
#! /bin/sh |
| 2 |
# integrit - file integrity verification system |
| 3 |
# Copyright (C) 2006 Ed L. Cashin |
| 4 |
# |
| 5 |
# This program is free software; you can redistribute it and/or |
| 6 |
# modify it under the terms of the GNU General Public License |
| 7 |
# as published by the Free Software Foundation; either version 2 |
| 8 |
# of the License, or (at your option) any later version. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program; if not, write to the Free Software |
| 17 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 |
# |
| 19 |
# $Header: /cvsroot/integrit/integrit/examples/install_db,v 1.7 2006/04/07 09:41:13 wavexx Exp $ |
| 20 |
|
| 21 |
# install_db - rotate integrity database on host "foo" and install new one |
| 22 |
# |
| 23 |
# copies new integrity database (e.g. for tripwire, aide, or integrit) |
| 24 |
# from the localhost to host foo (the secure db server), doing |
| 25 |
# checksums to verify that the install went OK. |
| 26 |
# |
| 27 |
# edit before using! Note that it assumes there's an "integrit" group |
| 28 |
# on the remote host. |
| 29 |
# |
| 30 |
|
| 31 |
db=$1 |
| 32 |
host=foo |
| 33 |
|
| 34 |
if [ "$db" = "" ] || [ ! -r $db ]; then |
| 35 |
echo usage: $0 dbfile 1>&2 |
| 36 |
exit 1 |
| 37 |
fi |
| 38 |
dbdir=`dirname $db` |
| 39 |
dbfile=`basename $db` |
| 40 |
|
| 41 |
cd $dbdir && md5sum $dbfile && tar cf - $dbfile \ |
| 42 |
| ssh -l root $host "cd /usr/share/i-db && mv $dbfile $dbfile.1 && tar xvf - && echo checksum ... && md5sum $dbfile && chown root:integrit $dbfile && chmod 640 $dbfile" |