Hacker News new | past | comments | ask | show | jobs | submit login
Using Rsync and SSH (jdmz.net)
1 point by xparadigm on March 9, 2017 | hide | past | favorite | 1 comment



  changing the line (and what follows is just one line with badly similated
  line wrapping) from this: 

    ssh-dss AAAAB3NzaC1kc3MAAAEBAKYJenaYvMG3nHwWxKwlWLjHb77CT2hXwmC8Ap...

  to this [4]:

    from="10.1.1.1",command="/home/remoteuser/cron/validate-rsync" ssh-dss AAAAB3Nza...

  [...] script that looks something like this :

  #!/bin/sh

  case "$SSH_ORIGINAL_COMMAND" in
  *\&*)
  echo "Rejected"
  ;;
  *\(*)
  echo "Rejected"
  ;;
  # ...
  rsync\ --server*)
  $SSH_ORIGINAL_COMMAND
  ;;
  *)
  echo "Rejected"
  ;;
  esac
All this and later comments is why one should not use SSH for batch jobs, and for unsupervised rsync file transfer in particular. Using SSH as a transport makes too complex system, and the script above is a fine example of getting it almost correct, but not quite (not using STDERR and not signaling an error with exit code are but two things that are wrong with the script).

Wrapping rsync in stunnel (http://dozzie.jarowit.net/trac/wiki/RsyncSSL) is much saner approach.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: