geom_gate userland utility improvements
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

49 lines
911 B

  1. #!/bin/sh
  2. # Written by Simon Josefsson.
  3. # Start sshd, invoke parameters, saving exit code, kill sshd, and
  4. # return exit code.
  5. srcdir=${srcdir:-$PWD}
  6. SSHD=${SSHD:-/usr/sbin/sshd}
  7. cmd="./ssh2${EXEEXT}"
  8. srcdir=`cd "$srcdir"; pwd`
  9. PRIVKEY=$srcdir/etc/user
  10. export PRIVKEY
  11. PUBKEY=$srcdir/etc/user.pub
  12. export PUBKEY
  13. if test -n "$DEBUG"; then
  14. libssh2_sshd_params="-d -d"
  15. fi
  16. chmod go-rwx "$srcdir"/etc/host*
  17. $SSHD -f /dev/null -h "$srcdir"/etc/host \
  18. -o 'Port 4711' \
  19. -o 'Protocol 2' \
  20. -o "AuthorizedKeysFile $srcdir/etc/user.pub" \
  21. -o 'UsePrivilegeSeparation no' \
  22. -o 'StrictModes no' \
  23. -D \
  24. $libssh2_sshd_params &
  25. sshdpid=$!
  26. trap "kill ${sshdpid}; echo signal killing sshd; exit 1;" EXIT
  27. : "started sshd (${sshdpid})"
  28. sleep 3
  29. : Invoking $cmd...
  30. eval $cmd
  31. ec=$?
  32. : Self-test exit code $ec
  33. : "killing sshd (${sshdpid})"
  34. kill "${sshdpid}" > /dev/null 2>&1
  35. trap "" EXIT
  36. exit $ec