To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 3902f529 authored by Axel Beckert's avatar Axel Beckert

Remote check working, local check with optional summary

parent 21d40660
*~
hosts
......@@ -56,17 +56,34 @@ chomp($hostname);
# Commandline parsing
my $debug = 0;
if ($ARGV[0] and ($ARGV[0] eq '-d' or $ARGV[0] eq '-debug')) {
$debug = 1;
my $verbose = 0;
foreach my $param (@ARGV) {
if ($param eq '-d' or $param eq '--debug') {
$debug = 1;
}
if ($param eq '-v' or $param eq '--verbose') {
$verbose = 1;
}
}
my $found = 0;
foreach my $glob (sort keys %ioc) {
my $incident = $ioc{$glob};
my @files = glob($glob);
foreach my $file (@files) {
if (-e $file) {
print "$hostname $incident: ".`ls -ld '$file'`
unless ($incident eq 'DEBUG' and $debug != 1);
unless ($incident eq 'DEBUG' and $debug != 1) {
print "$hostname $incident: ".`ls -ld '$file'`;
$found++;
}
}
}
}
if ($verbose) {
if ($found == 0) {
print "$hostname: CLEAN\n";
} else {
print "$hostname: FOUND $found IOCs\n";
}
}
#!/bin/sh
if [ -f hosts ]; then
hosts=$(egrep -v '^#' hosts);
fi
params=''
for host in "$@"; do
if [ "$host" = '-v' -o "$host" = "-d" ]; then
params="$params $host"
else
hosts="$hosts $host";
fi
done
if [ -z "$hosts" ]; then
hosts=localhost
fi
hash=$(sha256sum ioc-local-check.pl | awk '{print $1}')
for host in $hosts; do
scp -qp ioc-local-check.pl root@$host:/tmp/
ssh root@$host '[ $(sha256sum /tmp/ioc-local-check.pl | awk '\''{print $1}'\'') = '"$hash"' ] && perl /tmp/ioc-local-check.pl '"$params"'; [ $(sha256sum /tmp/ioc-local-check.pl | awk '\''{print $1}'\'') = '"$hash"' ] || echo $(hostname): WARNING: /tmp/ioc-local-check.pl modified!'
done
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment