Coder Social home page Coder Social logo

vpn-proxy's Introduction

vpn-proxy

Docker container with squid proxy and openvpn client.

The container is listening on port 3128. So you can use the container to route only specific traffic through a vpn.

Therefore you might want to use a proxy.pac as system wide proxy. (Example provided in this repo)

Usage with shell script (and zenity)

Note about DNS inside the container

I have no clue how to automatically get the correct dns entries within the /etc/resolv.conf. So I use my workaround to provide the correct dns entries an the start of the container.

--dns=1.2.3.4

Starting the container and connecting to vpn

Provide an openvpn configuration file. Please put the key file (if available) in the same directory an reference it within the config file. Make the shell script executable and put into your $HOME/bin dir to run the script from everywhere. (Tested on Linux Mint)

Run the shell script.

vpn

Disconnecting from vpn and stopping the container

Simply run the shell script again.

vpn

Usage with docker only

Starting the container and connecting to vpn

First start the container.

docker run -d --cap-add=NET_ADMIN \
         --device /dev/net/tun \
         --name openvpn \
         -v $DIR:/vpn \
         -p "3128:3128" \
         --dns=8.8.4.4 \
         --dns=8.8.8.8 \
         --dns=192.168.22.1 \
         --dns=192.168.22.3 \
    tsari/openvpn

If the container already exist start it with.

docker start openvpn

Then start the openvpn client within the running container.

docker exec -it openvpn openvpn --cd /vpn --config /vpn/YOUR_CONFIG_FILE

Disconnecting from vpn and stopping the container

Simply use ctrl+c and docker stop openvpn afterwards.

Postscriptum

I know there might be better ways to achieve the goal getting an open vpn client running in a squid container. But this works for me. You don't have to use it ;)

vpn-proxy's People

Contributors

tsari avatar

Watchers

 avatar

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.