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 25a7bcb4 authored by Axel Beckert's avatar Axel Beckert

Also let ioc-remote-check.sh exit with non-zero if something is found

parent 1f3ad74a
......@@ -21,7 +21,8 @@ systems via scp, calls it, and removes it again. Currently only
supports root logins via SSH. The usage of SSH keys for logging in is
assumed. It also checks if the script copied to the remote host has
been modified (via `sha256sum`) and does not delete it at the end of
the check it in that case.
the check it in that case. Exits with exit-code ≠ 0 if anything is
found on one of the host.
Both commands understand the `-v` and `-d` commandline options:
......
......@@ -29,8 +29,12 @@ else
fi
hash=$($localhashsumtool ioc-local-check.pl | awk '{print $1}')
globalexit=0
for host in $hosts; do
scp -qp ioc-local-check.pl root@$host:/tmp/
ssh -ax root@$host '[ $(sha256sum /tmp/ioc-local-check.pl | awk '\''{print $1}'\'') = '"$hash"' ] && perl /tmp/ioc-local-check.pl '"$params"'; if [ $(sha256sum /tmp/ioc-local-check.pl | awk '\''{print $1}'\'') != '"$hash"' ]; then echo "$(hostname): WARNING: /tmp/ioc-local-check.pl modified, not deleting"; else rm /tmp/ioc-local-check.pl; fi'
ssh -ax root@$host '[ $(sha256sum /tmp/ioc-local-check.pl | awk '\''{print $1}'\'') = '"$hash"' ] && perl /tmp/ioc-local-check.pl '"$params"'; RC=$?; if [ $(sha256sum /tmp/ioc-local-check.pl | awk '\''{print $1}'\'') != '"$hash"' ]; then echo "$(hostname): WARNING: /tmp/ioc-local-check.pl modified, not deleting"; else rm /tmp/ioc-local-check.pl; fi; exit $RC'
RC=$?
globalexit=$(echo ${globalexit}+${RC} | bc)
done
exit $globalexit
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