summaryrefslogtreecommitdiff
path: root/tests/e2e/e2e-test-vpn.sh
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2017-05-04 19:05:26 +0200
committerKali Kaneko (leap communications) <kali@leap.se>2017-06-07 12:31:19 +0200
commitdd1e5083d99637d4118d12fa72605096d7b5e587 (patch)
treeb984e6fce19bd24a068a4c3ad1f36de051b0b23e /tests/e2e/e2e-test-vpn.sh
parent4da0958a7c87d9e68a5e9a9acf4bcbcc3a9d6ac2 (diff)
[tests] simple e2e vpn test
- Resolves: #8874
Diffstat (limited to 'tests/e2e/e2e-test-vpn.sh')
-rwxr-xr-xtests/e2e/e2e-test-vpn.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/e2e/e2e-test-vpn.sh b/tests/e2e/e2e-test-vpn.sh
new file mode 100755
index 00000000..90193bec
--- /dev/null
+++ b/tests/e2e/e2e-test-vpn.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+# Usage
+
+set -e
+
+PROVIDER='demo.bitmask.net'
+BCTL='bitmaskctl'
+LEAP_HOME="$HOME/.config/leap"
+
+username="tmp_user_$(date +%Y%m%d%H%M%S)"
+user="${username}@${PROVIDER}"
+pw="$(head -c 10 < /dev/urandom | base64)"
+
+# Stop any previously started bitmaskd
+# and start a new instance
+"$BCTL" stop
+
+[ -d "$LEAP_HOME" ] && rm -rf "$LEAP_HOME"
+
+"$BCTL" start
+
+
+# Register a new user
+"$BCTL" user create "$user" --pass "$pw"
+
+# Authenticate
+"$BCTL" user auth "$user" --pass "$pw" > /dev/null
+
+# Enable VPN
+"$BCTL" vpn enable
+
+# Get VPN cert
+"$BCTL" vpn get_cert "$user"
+
+"$BCTL" vpn start
+
+sleep 10
+
+"$BCTL" vpn status
+
+tests/e2e/check_ip vpn_on
+
+"$BCTL" vpn stop
+
+sleep 5
+
+tests/e2e/check_ip vpn_off
+
+echo "Succeeded - the vpn routed you through the expected address"