blob: 90193beccaa66ac2b9769cc5caa1f434b7b87af3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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"
|