- v20230405: Add an override OpenSSL3 configuration to get around
routines::unsafe legacy renegotiation disablederror. - v20230402: Update to
s6-overlayversion 3. Latestvpnc-script - v20220603: Add a
build.shscript. Set s6-overlay version to 2.2.0.3. Update to version 3 pending. - v20210813: Fix mount vpnpassd typo in
docker-compose.yml. Add a note regarding password editing withvim. - v20210405: Set dynamic token through mounted file to
/vpn/tokenfor 2FA users. RenamePASSWORD1andPASSWORD2toPASSWORDandTOKEN, respectively. Adddnsmasq. - v20201208: Replace
brook+ufwcombo with3proxy. Reduce image size significantly. - v20201116: Enable IPv6to4 fallback.
- v20201109: Use
s6-overlayinstead ofrunit. This change allow setting an environment variable through a file via prefixFILE__. - v20200115: Use
brookfor SOCKS5 instead of HTTP onprivoxy. - v20190924: Initial version.
An s6-overlayed Alpine Linux container with:
- VPN connection to your corporate network via
openconnect.openconnectcan connect to AnyConnect, Pulse and PAN. - Proxy server with 3proxy
dnsmasqto resolve internal domains.- The container starts in
privilegedmode in order to avoid theread-only file systemerror. Please proceed with your own risk.
Use build.sh with an s6-overlay version. This version parameter is optional.
sh build.sh 3.1.4.2Or, build the image with docker with BuiltKit enabled:
DOCKER_BUILDKIT=1 docker build --build-arg S6_OVERLAY_VERSION="3.1.4.2" -t ducmthai/openconnect:latest .Alternatively, use docker-compose build:
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose build --build-arg S6_OVERLAY_VERSION="3.1.4.2"The main configuration file, contain the following values:
SERVER: VPN endpointUSERNAME: Login usernamePASSWORD: Login primary passwordDYNAMIC_TOKEN:trueif dynamic OTP is required,falseotherwise.PROXY_USER: Proxy username (optional).PROXY_PASS: Proxy password.KEEP_ALIVE_ENDPOINT: An endpoint (can be internal or external) to keep the VPN connection alive
The environment variables needed for exposing the proxy to the local network:
PROXY_PORT: If set, the SOCKS5 proxy is enabled and exposed through this portHTTP_PROXY_PORT: If set, the HTTP proxy is enabled and exposed through this portLOCAL_NETWORK: The CIDR mask of the local IP addresses (e.g. 192.168.0.1/24, 10.1.1.0/24) which will be acessing the proxy. This is so the response to a request can be returned to the client (i.e. your browser).OPENSSL_CONF: Custom OpenSSL3 configuration. Default value is/etc/ssl/openssl.cnf. This custom configuraton helps avoidingroutines::unsafe legacy renegotiation disablederror with certain corporate VPN setups. If you don't wantUnsafeLegacyRenegotiation, simply remove or comment out this variable. Reference.EXT_IP: Your external IP. Used only for healthcheck. You can get your current external IP on ifconfig.co
These variables can be specified in the command line or in the .env file in the case of docker-compose.
Passwords can be set using a FILE__ prefixed environment variable where its value is path to the file contains the password:
FILE__PASSWORD=/vpn/passwdBefore starting the container, please create a docker network for it:
docker network create openconnect --subnet=10.30.0.1/16docker build -t ducmthai/openconnect .
docker run -d \
--cap-add=NET_ADMIN \
--device=/dev/net/tun \
--name=vpn_proxy \
--dns=1.1.1.1 --dns=1.0.0.1 \
--privileged=true \
--restart=always \
-e "PROXY_PORT=3128" \
-e "HTTP_PROXY_PORT=3129" \
-e "LOCAL_NETWORK=192.168.0.1/24" \
-e "FILE__PASSWORD=/vpn/passwd" \
-e "OPENSSL_CONF=/etc/ssl/openssl.cnf" \
-e "EXT_IP=<get_yours_at_ifconfig.co/ip> \
-v /etc/localtime:/etc/localtime:ro \
-v "$(pwd)"/vpn.config:/vpn/vpn.config:ro \
-v "$(pwd)"/vpnpasswd:/vpn/passwd:ro \
-v "$(pwd)"/vpntoken:/vpn/token \
-p 3128:3128 \
-p 3129:3129 \
ducmthai/openconnect:latestA docker-compose.yml file is also provided:
docker-compose up -dToken is taken from the file /vpn/token within the container. If DYNAMIC_TOKEN is true then the container clears the file after reading. To supply the dynamic OTP, simply do this outside the container:
echo OTP_HERE > ./vpntokenSet your proxy to socks5://127.0.0.1:${PROXY_PORT}. Use Socks5 username and password if set.
- Raspberry Pi 4 B+ (4GB model)
- WSL 2 + Docker WSL2 + Proxifier
