An Alpine based docker image to setup an L2TP over IPsec VPN client w/ PSK (and optionally Socks5) within the container.
Setup environment variables for your credentials and config:
export VPN_SERVER='YOUR VPN SERVER IP OR FQDN'
export VPN_PSK='my pre shared key'
export VPN_USERNAME='myuser@myhost.com'
export VPN_PASSWORD='mypass'
export SCOKS5_ENABLE=0
Now run it (you can daemonize of course after debugging):
docker run --rm -it --privileged \
-e VPN_SERVER \
-e VPN_PSK \
-e VPN_USERNAME \
-e VPN_PASSWORD \
wuamin/alpine-l2tp-vpn-client
You can use .env
file:
source .env;docker run --rm -it --privileged --env-file .env -p ${SCOKS5_PORT}:1080 wuamin/alpine-l2tp-vpn-client
If you set SCOKS5_ENABLE
to 1
(default value is 0
), the container will run dante
at startup to provide a socks5 proxy (via VPN). Don not forget to expose port 1080.
export SCOKS5_ENABLE=0
export SCOKS5_PORT=1080
docker run --rm -it --privileged \
-e VPN_SERVER \
-e VPN_PSK \
-e VPN_USERNAME \
-e VPN_PASSWORD \
-e SCOKS5_ENABLE \
-p ${SCOKS5_PORT}:1080 \
wuamin/alpine-l2tp-vpn-client
On your VPN client localhost machine you may need to sudo modprobe af_key
if you're getting this error when starting:
pluto[17]: No XFRM/NETKEY kernel interface detected
pluto[17]: seccomp security for crypto helper not supported
This project is forked from l2tp-ipsec-vpn-client