1
0
mirror of https://github.com/deajan/obackup.git synced 2024-11-12 19:03:42 +01:00
obackup/obackup_ssh_filter.sh

48 lines
803 B
Bash
Raw Normal View History

2013-06-23 13:44:48 +02:00
#!/bin/bash
##### Obackup ssh command filter
2013-06-23 13:53:22 +02:00
## If enabled, execution of "sudo" command will be allowed.
SUDO_EXEC=yes
## Paranoia option. Don't change this unless you read the documentation and still feel concerned about security issues.
2013-06-23 13:44:48 +02:00
RSYNC_EXECUTABLE=rsync
function Go
{
$SSH_ORIGINAL_COMMAND
}
case ${SSH_ORIGINAL_COMMAND%% *} in
"$RSYNC_EXECUTABLE")
Go ;;
"mysqldump")
Go ;;
"find")
Go ;;
"du")
Go ;;
"sudo")
2013-06-23 13:53:22 +02:00
if [ "$SUDO_EXEC" == "yes" ]
2013-06-23 13:44:48 +02:00
then
2013-06-23 13:53:22 +02:00
if [[ "$SSH_ORIGINAL_COMMAND" == "sudo $RSYNC_EXECUTABLE"* ]]
then
Go
elif [[ "$SSH_ORIGINAL_COMMAND" == "sudo du"* ]]
then
Go
elif [[ "$SSH_ORIGINAL_COMMAND" == "sudo find"* ]]
then
Go
else
echo "Sudo command not allowed."
fi
2013-06-23 13:44:48 +02:00
else
2013-06-23 13:53:22 +02:00
echo "Sudo command not enabled."
2013-06-23 13:44:48 +02:00
fi
;;
*)
echo "Not allowed."
esac