This is a docker image of an OpenVPN client based on Alpine, tied to a different services. It is useful to isolate network changes (so the host is not affected by the modified routing).
This supports directory style (where the certificates are not bundled together in one .ovpn file) and those that contains update-resolv-conf
Here are some example snippets to help you get started creating a container.
---
version: "2.1"
services:
openvpn-client-socks-ssh:
image: davideciarmi/docker-openvpn-client-socks-ssh
cap_add:
- NET_ADMIN
privileged: true
environment:
#- DEBUG=true
#SETTINGS ROUTING - FORWARDING:
- HOST_ROUTES=192.168.99.0/24 #Create a route to 192.168.99.0/24, because i have a ip 172.17.0.2, and after a VPN, i can't redirect ports to ip 192.168.99.1.
#redirect ports below to this host, VPNIP:3389 -> 192.168.99.1:3389
- PORT_FORWARD_HOST=192.168.99.1
- PORT_FORWARD_PORTS=5900,3389
#SETTINGS SSHD
#allow to edit runtime the file /etc/ssh/sshd_config (not ReadOnly!)
- SSH_SETTINGS=StrictModes no,LogLevel INFO
# Other all default configs in https://github.com/panubo/docker-sshd
- MOTD=Welcome in VPN SSH Server
- SSH_ENABLE_ROOT=true
volumes:
# entrypoint: Scripts to run on startup, each .sh file in this directory is executed.
- ${DIR_CONFIGS}/entrypoint/:/etc/entrypoint.d/
#OpenVpn with ovpn files
- ${DIR_CONFIGS}/openvpn/:/etc/openvpn/:ro
#SSHD
- ${DIR_CONFIGS}/ssh/sshd_config:/etc/ssh/sshd_config:ro
- ${DIR_CONFIGS}/ssh/keys:/etc/ssh/keys
ports:
- 22:22 #port for SSH
- 1080:1080 #port for SOCKS5
restart: unless-stopped
Then connect to SOCKS proxy through through localhost:1080 / local.docker:1080. For example:
curl --proxy socks5h://local.docker:1080 ipinfo.io
You can easily convert this to an HTTP proxy using http-proxy-to-socks, e.g.
hpts -s 127.0.0.1:1080 -p 8080
Content type
Image
Digest
sha256:f16f7fe67…
Size
17 MB
Last updated
about 4 years ago
docker pull davideciarmi/openvpn-client-socks-ssh