-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathentrypoint.sh
More file actions
31 lines (24 loc) · 763 Bytes
/
entrypoint.sh
File metadata and controls
31 lines (24 loc) · 763 Bytes
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
#!/bin/bash
REMOTE_PORT=${REMOTE_PORT:-3389}
function prepend() {
while read -r line; do
echo "$1 $line"
done
}
function wait-for-tunsnx() {
while ! ip addr show dev tunsnx > /dev/null 2>&1; do
sleep 1
done
}
socat -d -d TCP4-LISTEN:3389,fork,reuseaddr "TCP4:${REMOTE_HOST:?Missing REMOTE_HOST}:${REMOTE_PORT}" 2>&1 | prepend "SOCAT:" &
trap "echo Stopping; exit 0" SIGTERM SIGINT
wait-for-tunsnx && /usr/sbin/danted -f /etc/danted.conf | prepend "DANTE:" &
snxconnect ${DEBUG:+-D} \
-H access.svea.com \
-F Login/Login \
-R ssl_vpn_Svea_VPN_Login \
-E SNX/extender \
-U "${USERNAME:?Missing username}" \
${SAVE_COOKIES:+ -c /data/cookies --save-cookies} \
${PASSWORD:+ -P "$PASSWORD"} &
wait $!