test_proxy.sh 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. # This file is in the public domain.
  3. TEST_DOMAIN="www.test"
  4. # Delete old files before starting test
  5. rm -rf /tmp/gnunet/test-gnunet-gns-testing/
  6. gnunet-arm -s -c test_gns_proxy.conf
  7. gnunet-gns-proxy-setup-ca -c test_gns_proxy.conf
  8. openssl genrsa -des3 -passout pass:xxxx -out server.pass.key 2048
  9. openssl rsa -passin pass:xxxx -in server.pass.key -out local.key
  10. rm server.pass.key
  11. openssl req -new -key local.key -out server.csr \
  12. -subj "/C=DE/O=GNUnet/OU=GNS/CN=test.local"
  13. openssl x509 -req -days 1 -in server.csr -signkey local.key -out local.crt
  14. openssl x509 -in local.crt -out local.der -outform DER
  15. HEXCERT=`xxd -p local.der | tr -d '\n'`
  16. #echo "This is the certificate the server does not use: $HEXCERT"
  17. OLDBOXVALUE="6 8443 52 3 0 0 $HEXCERT"
  18. openssl req -new -key local.key -out server.csr \
  19. -subj "/C=DE/O=GNUnet/OU=GNS/CN=test.local"
  20. openssl x509 -req -days 1 -in server.csr -signkey local.key -out local.crt
  21. openssl x509 -in local.crt -out local.der -outform DER
  22. HEXCERT=`xxd -p local.der | tr -d '\n'`
  23. #echo "This is the certificate the server does use: $HEXCERT"
  24. BOXVALUE="6 8443 52 3 0 0 $HEXCERT"
  25. cat local.crt > /tmp/server_cacert.pem
  26. cat local.key >> /tmp/server_cacert.pem
  27. gnunet-identity -C test -c test_gns_proxy.conf
  28. gnunet-namestore -p -z "test" -a -n www -t A -V 127.0.0.1 -e never -c test_gns_proxy.conf
  29. gnunet-namestore -p -z "test" -a -n www -t LEHO -V "test.local" -e never -c test_gns_proxy.conf
  30. gnunet-namestore -p -z "test" -a -n www -t BOX -V "$OLDBOXVALUE" -e never -c test_gns_proxy.conf
  31. gnunet-namestore -p -z "test" -a -n www -t BOX -V "$BOXVALUE" -e never -c test_gns_proxy.conf
  32. gnunet-arm -i gns-proxy -c test_gns_proxy.conf
  33. #gnurl --socks5-hostname 127.0.0.1:7777 https://www.test -v --cacert /tmp/proxy_cacert.pem
  34. ./test_gns_proxy -A /tmp/proxy_cacert.pem -S /tmp/server_cacert.pem -p 8443 -c test_gns_proxy.conf
  35. RES=$?
  36. rm /tmp/proxy_cacert.pem
  37. rm /tmp/server_cacert.pem
  38. gnunet-arm -e test_gns_proxy.conf
  39. if test $RES != 0
  40. then
  41. echo "Failed"
  42. exit 1
  43. fi