From 7042522796a33576c250ee04ffd917e91f8c5b17 Mon Sep 17 00:00:00 2001 From: Harold Paulson Date: Tue, 16 Mar 2021 21:58:15 -0700 Subject: [PATCH] start readme. adapt to sanoid style snaps --- README.md | 12 ++++++++++++ bin/vhost-audit.pl | 16 +++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index e69de29..3a1e9ab 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,12 @@ +#vhost-audit Web app + +Check websites for file alterations in ZFS snapshots. + +##Install + +cd /www/test.clem.sierraweb.com/htdocs/ +git clone git@gitea.sierraweb.com:haroldp/vhost-audit.git +cd vhost-audit +chmod 755 bin/*.pl +echo "/www/clementinebakery.com/htdocs" > sites.txt +./bin/cron.pl diff --git a/bin/vhost-audit.pl b/bin/vhost-audit.pl index e22caf2..bb7254e 100644 --- a/bin/vhost-audit.pl +++ b/bin/vhost-audit.pl @@ -10,13 +10,7 @@ use JSON; $DEBUG = 1; -$BAK_BASE = '/.zfs/snapshot/'; -@BAK_VERSIONS = ( - 'daily.0', - 'daily.1', - 'daily.2', - 'weekly.0' -); +@BAK_VERSIONS = glob qw( /.zfs/snapshot/autosnap* ); @SCRIPT_PATTERNS = ('.php$', '^.htaccess$', '.js$'); @@ -26,9 +20,9 @@ if (@ARGV) { chomp(my $site = $ARGV[0]); my $real_site = abs_path($site); foreach my $bak_vers ( @BAK_VERSIONS ) { - my $bak_site = $BAK_BASE . $bak_vers . $real_site; - if ( -e $BAK_BASE . $bak_vers ) { - my @bak_stat = stat($BAK_BASE . $bak_vers); + my $bak_site = $bak_vers . $real_site; + if ( -e $bak_vers ) { + my @bak_stat = stat($bak_vers); my $bak_date = $bak_stat[9]; $RESULTS{'data'}{$bak_date} = (); $RESULTS{'data'}{$bak_date}{'files'} = (); @@ -88,7 +82,7 @@ if (@ARGV) { close(DIFF); } else { - print STDERR ($BAK_BASE . $bak_vers . " does not exist\n"); + print STDERR ($bak_vers . " does not exist\n"); } } }