summaryrefslogtreecommitdiff
path: root/test/auth.sh
blob: 1baf2bbdd6b485fee391acee56724edb7953a380 (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
#!/bin/bash

AESFILE=`mktemp`
AUTHFILE=`mktemp`

echo secret > $AESFILE

cat > $AUTHFILE <<EOF
T t
X x
EOF

trap 'rm -f $AESFILE $AUTHFILE' EXIT

ROOT=$(dirname $0)/..
PATH=$ROOT/bin:$PATH

tunnel add name T listen,addr=%2000 auth dump aes dial,addr=%3000
tunnel add name X listen,addr=%3000 /aes /auth dial,addr=%4000
tunnel set aesfile $AESFILE
tunnel set authfile $AUTHFILE
tunnel set tunnel.T.authuser T
tunnel set tunnel.X.authuser X
nc -l 4000 &
echo "Hello, World!" | nc -N localhost 2000
wait
tunnel clear
tunnel del T
tunnel del X