diff options
Diffstat (limited to 'images/obfsvpn-client')
-rw-r--r-- | images/obfsvpn-client/Dockerfile | 26 | ||||
-rwxr-xr-x | images/obfsvpn-client/start.sh | 16 |
2 files changed, 42 insertions, 0 deletions
diff --git a/images/obfsvpn-client/Dockerfile b/images/obfsvpn-client/Dockerfile new file mode 100644 index 0000000..d1c5b16 --- /dev/null +++ b/images/obfsvpn-client/Dockerfile @@ -0,0 +1,26 @@ +FROM golang:1.17 AS builder + +ENV SOURCE_PATH ${GOPATH}/src/0xacab.org/leap/obfsvpn +COPY . ${SOURCE_PATH}/ +WORKDIR ${SOURCE_PATH} +RUN make build-client && cp obfsvpn-client /obfsvpn-client + + +FROM alpine:3.14.1 + +ENV OBFS4_CERT "8nuAbPJwFrKc/29KcCfL5LBuEWxQrjBASYXdUbwcm9d9pKseGK4r2Tg47e23+t6WghxGGw" +# copy obfsvpn-client from builder +COPY --from=builder /obfsvpn-client /usr/bin/ +# Install openvpn +RUN apk --no-cache --no-progress upgrade && \ + apk --no-cache --no-progress add bash curl ip6tables iptables openvpn \ + shadow dumb-init tzdata && \ + addgroup -S vpn && \ + rm -rf /tmp/* + +COPY images/obfsvpn-client/start.sh /usr/bin/ + +VOLUME ["/vpn"] + +ENTRYPOINT ["dumb-init", "/usr/bin/start.sh"] + diff --git a/images/obfsvpn-client/start.sh b/images/obfsvpn-client/start.sh new file mode 100755 index 0000000..44fa013 --- /dev/null +++ b/images/obfsvpn-client/start.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# start the obfsvpn-client +/usr/bin/obfsvpn-client -c "$OBFS4_CERT" & + +# use the server container name as remote +if [ -z "$OBFS4_ENDPOINT" ]; then + sed -i "s/(^remote) .* ([[:digit:]])/\1 obfsvpn-server \2/1" \ + /vpn/client.ovpn +fi +openvpn --config /vpn/client.ovpn --socks-proxy localhost 8080 & + +ping -c5 10.8.0.1 + +exit $? + |