run-experiment-ssh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/bash
  2. # Run an experiment using ssh to real hosts, not in dockers
  3. # We need these environment variables set:
  4. # ORAM_SSH_C_USERHOST: the user@host to ssh to for C
  5. # ORAM_SSH_C_SSHOPTS: any options to ssh you need to ssh to C
  6. # ORAM_SSH_C_DIR: the directory relative to the homedir where the prac
  7. # repo is checked out and built
  8. # ORAM_SSH_D_USERHOST: the user@host to ssh to for D
  9. # ORAM_SSH_D_SSHOPTS: any options to ssh you need to ssh to D
  10. # ORAM_SSH_D_IP: the IP address D can listen for connections on
  11. # ORAM_SSH_D_DIR: the directory relative to the homedir where the prac
  12. # repo is checked out and built
  13. # ORAM_SSH_E_USERHOST: the user@host to ssh to for E
  14. # ORAM_SSH_E_SSHOPTS: any options to ssh you need to ssh to E
  15. # ORAM_SSH_E_IP: the IP address E can listen for connections on
  16. # ORAM_SSH_E_DIR: the directory relative to the homedir where the prac
  17. # repo is checked out and built
  18. # Get the IP addresses
  19. Daddr=$ORAM_SSH_D_IP
  20. Eaddr=$ORAM_SSH_E_IP
  21. # The ORAM size
  22. size=26
  23. iters=128
  24. if [ "$1" != "" ]; then
  25. size="$1"
  26. fi
  27. if [ "$2" != "" ]; then
  28. iters="$2"
  29. fi
  30. echo ===== Running oram $size $iters
  31. date "+===== Start %s %F %T"
  32. # Run, saving the output
  33. savefileC=$$.C.out
  34. savefileD=$$.D.out
  35. savefileE=$$.E.out
  36. ssh -n $ORAM_SSH_C_SSHOPTS $ORAM_SSH_C_USERHOST "cd $ORAM_SSH_C_DIR && perl -lp -i -e 's/addrBits: (\d+)/addrBits: '$size'/; s/iters: (\d+)/iters: '$iters'/' config/config.yaml"
  37. ssh -n $ORAM_SSH_D_SSHOPTS $ORAM_SSH_D_USERHOST "cd $ORAM_SSH_D_DIR && perl -lp -i -e 's/addrBits: (\d+)/addrBits: '$size'/; s/iters: (\d+)/iters: '$iters'/' config/config.yaml"
  38. ssh -n $ORAM_SSH_E_SSHOPTS $ORAM_SSH_E_USERHOST "cd $ORAM_SSH_E_DIR && perl -lp -i -e 's/addrBits: (\d+)/addrBits: '$size'/; s/iters: (\d+)/iters: '$iters'/' config/config.yaml"
  39. ssh -n $ORAM_SSH_E_SSHOPTS $ORAM_SSH_E_USERHOST "cd $ORAM_SSH_E_DIR && $ORAM_NUMA_E stdbuf -o 0 java -cp bin:lib/* ui/CLI -protocol pirrtv -debbie_ip $Daddr -eddie_ip $Eaddr eddie > $savefileE 2>&1" &
  40. sleep 5
  41. ssh -n $ORAM_SSH_D_SSHOPTS $ORAM_SSH_D_USERHOST "cd $ORAM_SSH_D_DIR && $ORAM_NUMA_D stdbuf -o 0 java -cp bin:lib/* ui/CLI -protocol pirrtv -debbie_ip $Daddr -eddie_ip $Eaddr debbie > $savefileD 2>&1" &
  42. sleep 5
  43. ssh -n $ORAM_SSH_C_SSHOPTS $ORAM_SSH_C_USERHOST "cd $ORAM_SSH_C_DIR && $ORAM_NUMA_C stdbuf -o 0 java -cp bin:lib/* ui/CLI -protocol pirrtv -debbie_ip $Daddr -eddie_ip $Eaddr charlie > $savefileC 2>&1" &
  44. wait
  45. echo ===== C output
  46. ssh -n $ORAM_SSH_C_SSHOPTS $ORAM_SSH_C_USERHOST "cd $ORAM_SSH_C_DIR && cat $savefileC && rm -f $savefileC"
  47. echo ===== D output
  48. ssh -n $ORAM_SSH_D_SSHOPTS $ORAM_SSH_D_USERHOST "cd $ORAM_SSH_D_DIR && cat $savefileD && rm -f $savefileD"
  49. echo ===== E output
  50. ssh -n $ORAM_SSH_E_SSHOPTS $ORAM_SSH_E_USERHOST "cd $ORAM_SSH_E_DIR && cat $savefileE && rm -f $savefileE"
  51. date "+===== End %s %F %T"