-#!/bin/bash
+#!/bin/sh
MTU=1439
TEST=$(basename $0 .sh)
PWD=$(dirname $0)
-PWD=/opt/ulvpn/bin
+#PWD=/opt/ulvpn/bin
CRYPTOMOD=$PWD/cryptomod.exe
SIMULATOR=$PWD/simulator.exe
# only red vpn
LRED=eth0://78:a1:35:10:10:10
RRED=eth0://78:a1:35:01:01:01
+ RCRY=0809
+ RPRO=080B
DEVS=$LRED
;;
soft)
LBLK=eth0://78:a1:35:20:20:20
RRED=lo://00:00:00:00:00:00
RBLK=eth0://78:a1:35:02:02:02
+ RCRY=0819
+ RPRO=081B
DEVS=$RBLK
;;
none)
ip link set dev ${DEV/:*} up
ip addr add 192.169.$N.1/24 dev ${DEV/:*}
sleep 1
- #tcpdump -v -i ${DEV/:*} &
+ #tcpdump -v -i ${DEV/:*} & pid=$!; pids="$pids $pid"
done
if [ "$CM" = soft ]; then
-s BYPASS_B2R -t $LRED/080D -r $LBLK/083D \
-s BYPASS_R2B -t $LBLK/082D -r $LRED/081D \
-s CONTROL -t $LRED/080E -r $LRED/081E \
- -s CROSS_CRYPTO_B2R -t $LRED/0809 -r $LBLK/0839 \
- -s CROSS_CRYPTO_R2B -t $LBLK/0829 -r $LRED/0819 \
+ -s CROSS_CRYPTO_B2R -t $LRED/0809 -r $LBLK/0809 \
+ -s CROSS_CRYPTO_R2B -t $LBLK/0809 -r $LRED/$RCRY \
-s PROVISIONING -t $LRED/080B -r $LRED/081B &
pid=$!
pids="$pids $pid"
sleep 1
- ps | awk '$2 == '$pid' {exit 1}' && { fail KO; exit 1; } || pass OK
+ ps | awk '$1 == '$pid' || $2 == '$pid' {exit 1}' && { fail KO; exit 1; } || pass OK
fi
if [ "$VPNBLK" ]; then
$VPN -v 1 -V 1 -l vpnblk.log \
-n tun \
$VPNBLK \
- -x $RBLK/0829 $RBLK/0839 \
+ -x $RBLK/0809 $RBLK/0809 \
-n red &
pid=$!
pids="$pids $pid"
sleep 1
- ps | awk '$2 == '$pid' {exit 1}' && { fail KO; exit 1; } || pass OK
+ ps | awk '$1 == '$pid' || $2 == '$pid' {exit 1}' && { fail KO; exit 1; } || pass OK
fi
if [ "$VPNRED" ]; then
$VPNRED \
-n udp \
-n black \
- -y $RRED/0809 $RRED/0819 &
+ -y $RRED/0809 $RRED/$RCRY &
pid=$!
pids="$pids $pid"
sleep 1
- ps | awk '$2 == '$pid' {exit 1}' && { fail KO; exit 1; } || pass OK
+ # fix for Android
+ ip rule add from all lookup main
+ ps | awk '$1 == '$pid' || $2 == '$pid' {exit 1}' && { fail KO; exit 1; } || pass OK
- launch provisioning software cryptomod
- $SIMULATOR -v1 -V1 -s PROVISIONING -r $LRED/080B -t $LRED/081B provisioning.eth && pass OK || { fail KO; exit 1; }
+ launch provisioning $CM cryptomod
+ $SIMULATOR -v1 -V1 -s PROVISIONING -r $RRED/080B -t $RRED/$RPRO provisioning.eth && pass OK || { fail KO; exit 1; }
fi
title press any key to stop