blob: 1d3d4a8a4132b639393dfc669b7857598b9e5ff1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
## vim:ft=zsh:foldmethod=marker
local host
host=$1
if [ "$host" = "${host%%.debian.org}" ]; then
host="$host.debian.org"
fi
echo $host
preexec $host;
ssh $host -t '
check() {
sudo /usr/sbin/samhain -t check -i -p err -s none -l none -m none
};
if [ -x /usr/sbin/samhain ]; then
t="`tempfile`";
trap "rm -f $t" 0 1 2 5 15;
check > "$t" 2>&1;
if [ "`grep "^CRIT" "$t" | wc -l`" != 0 ]; then
echo "samhain db errors found:";
sed -e "s/.*path=<\([^>]*\)>, .*/\1/" "$t";
echo;
echo "Enter 'y' to continue upgrade and update samhaindb for `hostname`";
read ans;
[ "$ans" = "y" ] || exit;
echo Updating samhain db...
if [ -e /var/state/samhain/samhain_file ] || [ -e /var/lib/samhain/samhain_file ]; then
sudo -H samhain --foreground -t update -p none -s none -l none -m none
else
sudo -H samhain --foreground -t init -p none -s none -l none -m none
fi
grep -q OK /var/cache/dsa/nagios/samhain || sudo dsa-update-samhain-status
echo done.
fi;
fi
';
|