routines::unsafe legacy renegotiation disabled
error.s6-overlay
version 3. Latest vpnc-script
build.sh
script. Set s6-overlay version to 2.2.0.3. Update to version 3 pending.docker-compose.yml
. Add a note regarding password editing with vim.
/vpn/token
for 2FA users. Rename PASSWORD1
and PASSWORD2
to PASSWORD
and TOKEN
, respectively. Add dnsmasq
.brook
+ ufw
combo with 3proxy
. Reduce image size significantly.s6-overlay
instead of runit
. This change allow setting an environment variable through a file via prefix FILE__
.brook
for SOCKS5 instead of HTTP on privoxy
.An s6-overlayed Alpine Linux container with:
openconnect
. openconnect
can connect to AnyConnect, Pulse and PAN.dnsmasq
to resolve internal domains.privileged
mode in order to avoid the read-only file system
error. 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.2
Or, 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"
vpn.config
The main configuration file, contain the following values:
SERVER
: VPN endpointUSERNAME
: Login usernamePASSWORD
: Login primary passwordDYNAMIC_TOKEN
: true
if dynamic OTP is required, false
otherwise.PROXY_USER
: Proxy username (optional).PROXY_PASS
: Proxy password.KEEP_ALIVE_ENDPOINT
: An endpoint (can be internal or external) to keep the VPN connection aliveThe 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 avoiding routines::unsafe legacy renegotiation disabled
error with certain corporate VPN setups. If you don't want UnsafeLegacyRenegotiation
, 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.coThese 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/passwd
Before starting the container, please create a docker network for it:
docker network create openconnect --subnet=10.30.0.1/16
docker run
docker 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:latest
docker-compose
A docker-compose.yml
file is also provided:
docker-compose up -d
Token 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 > ./vpntoken
Set your proxy to socks5://127.0.0.1:${PROXY_PORT}. Use Socks5 username and password if set.