Giter Site home page Giter Site logo

curve25519xsalsa20poly1305 / docker-openvpn-socks5 Goto Github PK

View Code? Open in Web Editor NEW
57.0 0.0 16.0 4 KB

Converts OpenVPN connection to SOCKS5 proxy server in Docker

License: Do What The F*ck You Want To Public License

Dockerfile 21.28% Go 49.81% Shell 28.90%

docker-openvpn-socks5's Introduction

OpenVPN Docker Tunnel to SOCKS5 Server

Convers OpenVPN connection to SOCKS5 server in Docker. This allows you to have multiple OpenVPN to SOCKS5 proxies in different containers and expose to different host ports.

Supports latest Docker for both Windows, Linux, and MacOS.

Related Projects

What it does?

  1. It reads in an OpenVPN configuration file (.ovpn) from a mounted file, specified through OPENVPN_CONFIG environment variable.
  2. It starts the OpenVPN client program to establish the VPN connection.
  3. It starts the SOCKS5 server and listen on container-scoped port 1080 on default. SOCKS5 authentication can be enabled with SOCKS5_USER and SOCKS5_PASS environment variables. SOCKS5_PORT can be used to change the default port.
  4. It optionally executes the user specified CMD line from docker run positional arguments (see Docker doc). The program will use the VPN connection inside the container.
  5. If user has provided CMD line, and DAEMON_MODE environment variable is not set to true, then after running the CMD line, it will shutdown the OpenVPN client and terminate the container.

How to use?

Since it extends the openvpn-tunnel (GitHub) image, everything in openvpn-tunnel's document are still applicable on this image. Therefore, here we only provide an example that starts a daemon server that connects to VPN defined in file ./vpn.ovpn on host machine, and expose the SOCKS5 to host-scoped port at 7777.

# Unix
SET NAME="mysocks5"
PORT="7777"
USER="myuser"
PASS="mypass"
docker run --name "${NAME}" -dit --rm --device=/dev/net/tun --cap-add=NET_ADMIN \
    -v "${PWD}":/vpn:ro -e OPENVPN_CONFIG=/vpn/vpn.ovpn \
    -p "${PORT}":1080 \
    -e SOCKS5_USER="${USER}" \
    -e SOCKS5_PASS="${PASS}" \
    curve25519xsalsa20poly1305/openvpn-socks5

# Windows
SET NAME="mysocks5"
SET PORT="7777"
SET USER="myuser"
SET PASS="mypass"
docker run --name "%NAME%" -dit --rm --device=/dev/net/tun --cap-add=NET_ADMIN ^
    -v "%CD%":/vpn:ro -e OPENVPN_CONFIG=/vpn/vpn.ovpn ^
    -p "%PORT%":1080 ^
    -e SOCKS5_USER="%USER%" ^
    -e SOCKS5_PASS="%PASS%" ^
    curve25519xsalsa20poly1305/openvpn-socks5

Then on your host machine test it with curl:

# Unix & Windows
curl ifconfig.co/json -x socks5h://myuser:[email protected]:7777

To stop the daemon, run this:

# Unix
NAME="mysocks5"
docker stop "${NAME}"

# Windows
SET NAME="mysocks5"
docker stop "%NAME%"

Contributing

Please feel free to contribute to this project. But before you do so, just make sure you understand the following:

1. Make sure you have access to the official repository of this project where the maintainer is actively pushing changes. So that all effective changes can go into the official release pipeline.

2. Make sure your editor has EditorConfig plugin installed and enabled. It's used to unify code formatting style.

3. Use Conventional Commits 1.0.0-beta.2 to format Git commit messages.

4. Use Gitflow as Git workflow guideline.

5. Use Semantic Versioning 2.0.0 to tag release versions.

License

Copyright © 2019 curve25519xsalsa20poly1305 <[email protected]>

This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See the COPYING file for more details.

docker-openvpn-socks5's People

Contributors

curve25519xsalsa20poly1305 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-openvpn-socks5's Issues

different socks5 proxy ips for different client containers

I wanted to run multiple instances of client containers and have each of them have their entire network routed through a different socks5 proxy ( i will be providing each of them like this :::), is this possible using openVPN? if so how can i do it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.