Add support for lvm to security script. Backup lvm configuration to /var/backup/lvm with other system backups. Disable lvm check until MKLVM is enabled by default. no objections on tech-userlevel@.

This commit is contained in:
haad 2009-01-27 10:32:18 +00:00
parent ac23346377
commit a4e585254c
3 changed files with 22 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: changelist,v 1.24 2001/10/13 14:22:11 lukem Exp $
# $NetBSD: changelist,v 1.25 2009/01/27 10:32:18 haad Exp $
#
# Locally added list of files which /etc/security backups up and
# checks for modifications, along with the list generated with
@ -10,4 +10,5 @@
# /etc/raid*.conf
# /etc/rc.d/*
# /etc/rc.conf.d/*
#
# /etc/lvm/archive/*
# /etc/lvm/backup/*

View File

@ -1,4 +1,4 @@
# $NetBSD: security.conf,v 1.20 2007/08/27 19:57:02 adrianp Exp $
# $NetBSD: security.conf,v 1.21 2009/01/27 10:32:18 haad Exp $
#
# /etc/defaults/security.conf --
# default configuration of /etc/security.conf
@ -23,6 +23,7 @@ check_mtree=YES
check_disklabels=YES
check_pkgs=YES
check_changelist=YES
check_lvm=NO
backup_dir=/var/backups
backup_uses_rcs=YES

View File

@ -1,6 +1,6 @@
#!/bin/sh -
#
# $NetBSD: security,v 1.105 2007/11/23 15:51:27 dholland Exp $
# $NetBSD: security,v 1.106 2009/01/27 10:32:18 haad Exp $
# from: @(#)security 8.1 (Berkeley) 6/9/93
#
@ -58,11 +58,11 @@ MPBYPATH=mpbypath.$$
LIST=list.$$
OUTPUT=output.$$
LABELS=labels.$$
LVM_LABELS=lvm.$$
PKGS=pkgs.$$
CHANGEFILES=changefiles.$$
SPECIALSPEC=specialspec.$$
# migrate_file old new
# Determine if the "${old}" path name needs to be migrated to the
# "${new}" path. Also checks if "${old}.current" needs migrating,
@ -895,6 +895,19 @@ if checkyesno check_disklabels; then
CHANGELIST="$LABELS $CHANGELIST"
fi
if checkyesno check_lvm; then
# generate list of existing LVM elements Physical Volumes, Volume Groups and Logical Volumes.
if [ -x /sbin/lvm ]; then
lvm pvdisplay -m >"$work_dir/lvm.pv" 2>/dev/null
lvm vgdisplay -m >"$work_dir/lvm.vg" 2>/dev/null
lvm lvdisplay -m >"$work_dir/lvm.lv" 2>/dev/null
fi
ls -1d $work_dir/lvm.* 2>/dev/null |
egrep -v '\.(backup|current)(,v)?$'>> $LVM_LABELS
CHANGELIST="$CHANGELIST $LVM_LABELS"
fi
# Check for changes in the list of installed pkgs
#
if checkyesno check_pkgs && [ -d $pkgdb_dir ]; then
@ -928,6 +941,8 @@ if checkyesno check_changelist ; then
echo "/etc/raid*.conf"
echo "/etc/rc.d/*"
echo "/etc/rc.conf.d/*"
echo "/etc/lvm/backup/*"
echo "/etc/lvm/archive/*"
# Add /etc/changelist
#