val-back-cmd.sh 870 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #! /bin/bash
  2. laptop_host="moving-computer-of-doom"
  3. remote_host="tiny-server-of-doom"
  4. if [ $HOSTNAME = $laptop_host ]; then
  5. case "$SSH_ORIGINAL_COMMAND" in
  6. *\&*|*\|*|*\;*|*\>*|*\<*|*\!*)
  7. exit 1
  8. ;;
  9. ## This needs to be set in /etc/rsnapshot.conf rsync_long_args
  10. /usr/bin/rsync\ --server\ --sender*)
  11. sudo $SSH_ORIGINAL_COMMAND
  12. ;;
  13. *)
  14. exit 1
  15. ;;
  16. esac
  17. elif [ $HOSTNAME = $remote_host ]; then
  18. case "$SSH_ORIGINAL_COMMAND" in
  19. *\&*|*\|*|*\;*|*\>*|*\<*|*\!*)
  20. exit 1
  21. ;;
  22. mount*)
  23. sudo $SSH_ORIGINAL_COMMAND
  24. ;;
  25. umount*)
  26. sudo $SSH_ORIGINAL_COMMAND
  27. ;;
  28. cryptsetup\ luksOpen*)
  29. sudo $SSH_ORIGINAL_COMMAND
  30. ;;
  31. cryptsetup\ luksClose*)
  32. sudo $SSH_ORIGINAL_COMMAND
  33. ;;
  34. rmdir*)
  35. sudo $SSH_ORIGINAL_COMMAND
  36. ;;
  37. mkdir*)
  38. sudo $SSH_ORIGINAL_COMMAND
  39. ;;
  40. rsnapshot*)
  41. sudo $SSH_ORIGINAL_COMMAND
  42. ;;
  43. *)
  44. exit 1
  45. ;;
  46. esac
  47. fi