bundles/sshmon: import from work repository

This commit is contained in:
Franzi 2020-11-09 20:31:06 +01:00
parent eaf268aea9
commit c7362df6c4
Signed by: kunsi
GPG key ID: 12E3D2136B818350
12 changed files with 773 additions and 0 deletions

View file

@ -0,0 +1,25 @@
#!/bin/bash
# ^^^^ Because we need Bash arrays.
set -e
UNKNOWN=3
unset command
declare -A command
. /etc/sshmon.cfg
if [[ -z "$SSH_ORIGINAL_COMMAND" ]]
then
echo "No command given" >&2
exit $UNKNOWN
fi
execute=${command["$SSH_ORIGINAL_COMMAND"]}
if [[ -z "$execute" ]]
then
echo "Unknown command" >&2
exit $UNKNOWN
fi
exec sh -c "$execute"