From c05388f3d798e441e1fdf59759c71683ae392068 Mon Sep 17 00:00:00 2001 From: deajan Date: Sun, 23 Jun 2013 13:44:48 +0200 Subject: [PATCH] Uploaded ssh command filter --- obackup_ssh_filter.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 obackup_ssh_filter.sh diff --git a/obackup_ssh_filter.sh b/obackup_ssh_filter.sh new file mode 100755 index 0000000..12a85da --- /dev/null +++ b/obackup_ssh_filter.sh @@ -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 + +