[Pkg-privacy-commits] [flashproxy] 17/65: add an end-to-end test to test all the packages at once on one machine
Ximin Luo
infinity0 at moszumanska.debian.org
Fri Aug 21 13:49:40 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch _volatile-rc
in repository flashproxy.
commit adeacea2b7f0d5ed2444e840fbe659d132401de1
Author: Ximin Luo <infinity0 at pwned.gg>
Date: Fri Feb 7 02:08:48 2014 +0000
add an end-to-end test to test all the packages at once on one machine
---
debian/flashproxy-end-to-end-test.sh | 87 ++++++++++++++++++++++++++++++++++++
1 file changed, 87 insertions(+)
diff --git a/debian/flashproxy-end-to-end-test.sh b/debian/flashproxy-end-to-end-test.sh
new file mode 100755
index 0000000..af07d6d
--- /dev/null
+++ b/debian/flashproxy-end-to-end-test.sh
@@ -0,0 +1,87 @@
+#!/bin/bash
+# End-to-end test for flashproxy client, facilitator and proxy all on one box.
+# NOTE: this will destroy existing facilitator config/data/logs !!!
+# NOTE: this does NOT test more complex reg methods like email and appspot.
+#
+# You should probably read through this script first. We make no attempt to
+# recover if things go wrong - the script will just abort and start from the
+# beginning next time - so manual cleanup might be required.
+#
+# The script installs flashproxy from APT, so you should make sure that you do
+# not have any pending changes before running this script. You can use reprepro
+# to setup a local APT repo, if you want to test packages you built yourself.
+#
+# You may also install missing packages, such as node-ws or even flashproxy
+# itself, from https://people.torproject.org/~infinity0/apt/
+
+set -e
+set -x
+
+function cleanup() {
+ cd
+ sudo a2dissite fp-facilitator.conf || true
+ sudo service apache2 stop
+ sudo aptitude -y purge flashproxy-client flashproxy-facilitator node-flashproxy
+ sudo rm -f /etc/apache2/sites-available/fp-facilitator.conf /etc/apache2/fp-facilitator.pem
+ sudo rm -f /usr/local/share/ca-certificates/flashproxy-e2e-test_ssl-cert-snakeoil.crt
+ sudo update-ca-certificates
+ sudo rm -rf /tmp/flashproxy-e2e-test
+}
+
+cleanup
+mkdir /tmp/flashproxy-e2e-test
+cd /tmp/flashproxy-e2e-test
+sudo aptitude -y install flashproxy-client flashproxy-facilitator node-flashproxy
+
+# generate facilitator www cert and install it as a root CA so stuff works
+openssl genrsa -passout pass:xxxx -des3 -out server.key 1024
+cp server.key server.key.orig
+openssl rsa -passin pass:xxxx -in server.key.orig -out server.key
+cat > openssl.cnf <<EOF
+[ req ]
+distinguished_name = req_distinguished_name
+[ req_distinguished_name ]
+commonName = Common Name (hostname, IP, or your name)
+commonName_default = localhost
+EOF
+echo "" | openssl req -config openssl.cnf -new -key server.key -out server.csr
+openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
+sudo cp server.key /etc/apache2/fp-facilitator.pem
+cat server.crt | sudo tee -a /etc/apache2/fp-facilitator.pem
+sudo ln -sf $PWD/server.crt /usr/local/share/ca-certificates/flashproxy-e2e-test_ssl-cert-snakeoil.crt
+sudo update-ca-certificates
+
+# configure facilitator
+sudo sed -i -e 's/RUN_DAEMON="no"/RUN_DAEMON="yes"/g' /etc/default/facilitator{,-reg-daemon}
+sudo sed -i -e 's/^#\(.*\)websocket\(.*\)/\1websocket\2/g' /etc/flashproxy/facilitator-relays
+
+sudo service facilitator start
+sudo service facilitator-reg-daemon start
+
+sudo cp /usr/share/flashproxy-facilitator/examples/fp-facilitator.conf /etc/apache2/sites-available/
+sudo sed -i -e 's/ServerName .*/ServerName localhost/g' /etc/apache2/sites-available/fp-facilitator.conf
+
+sudo a2enmod cgi # on debian this is necessary
+sudo a2enmod ssl headers
+sudo a2ensite fp-facilitator.conf
+sudo service apache2 restart
+
+# configure flashproxy-client
+cp /usr/share/doc/flashproxy-client/torrc .
+sed -i -e 's|./flashproxy-client|/usr/bin/flashproxy-client -f https://localhost --facilitator-pubkey /etc/flashproxy/reg-daemon.pub -4 --register-methods http|g' torrc
+echo "SocksPort 19050" >> torrc
+
+# start tor and node-flashproxy
+tor -f torrc & pid_tor=$!
+# by default, nodejs disallows self-signed certs even if they are a root CA, for some reason. this envvar bypasses this check
+NODE_TLS_REJECT_UNAUTHORIZED=0 flashproxy --facilitator https://localhost/ --unsafe_logging true & pid_flashproxy=$!
+
+echo "==== Waiting 60 seconds for Tor to connect"
+sleep 60
+curl --socks5 localhost:19050 https://check.torproject.org | grep -i congratulations
+
+echo "==== TEST SUCCESSFUL!!! CONGRATULATIONS"
+
+echo "==== Now cleaning up and removing all traces of the test... "
+kill $pid_tor $pid_flashproxy
+cleanup
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/flashproxy.git
More information about the Pkg-privacy-commits
mailing list