Uploaded ssh command filter

This commit is contained in:
deajan 2013-06-23 13:44:48 +02:00
parent 05ea27ac1b
commit c05388f3d7
1 changed files with 40 additions and 0 deletions

40
obackup_ssh_filter.sh Executable file
View File

@ -0,0 +1,40 @@
#!/bin/bash
##### Obackup ssh command filter
## Paranoia option. Only change this if you read the documentation and know what you're doing
RSYNC_EXECUTABLE=rsync
function Go
{
$SSH_ORIGINAL_COMMAND
}
case ${SSH_ORIGINAL_COMMAND%% *} in
"$RSYNC_EXECUTABLE")
Go ;;
"mysqldump")
Go ;;
"find")
Go ;;
"du")
Go ;;
"sudo")
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
;;
*)
echo "Not allowed."
esac