bundlewrap/bundles/sshmon/files/sshmon

26 lines
367 B
Text
Raw Normal View History

#!/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"