Coder Social home page Coder Social logo

vmproxy's Introduction

Vagrant VPN Proxy

This will create a small vagrant machine running a caching proxy server and the openconnect VPN client. The goal is to proxy web traffic over a VPN connection (e.g. to connect to private corporate websites while on a public network).

Sounds good! How do I get this thing up and running?

New Installation

  1. Install Vagrant and VirtualBox, as we depend on these.

  2. Clone the repo

$ git clone https://github.com/dyoung522/vmproxy
$ cd vmproxy
  1. Prep the VPN configuration file; .env
$ cp env.sample .env
$ chmod 0600 .env
  1. Modify the .env file as appropriate. It should be self-explanatory, but make sure you have at least the top three variables set:
export VPN_URL='https://your.vpn.url'
export VPN_USER='your-username'
export VPN_PASS='your-password'
# The rest are optional
export VPN_TIMEOUT=60
export VPN_LOGFILE='vpn.log'
  1. Copy proxy.yml.example to proxy.yml and modify it appropriately, here's the basic syntax:
# a list of hosts we should always proxy for
proxy:
  - '*.proxied-domain.com'
  - 'always-proxy-me.example.com'

# an optional list of hosts we should never proxy for, use this to override hosts in proxied domains
direct:
  - 'never-proxy-me.proxied-domain.com'

# What should we default to, 'proxy' or 'direct'? if unset, the default is 'direct'
default: direct
  1. Copy do-not-cache.txt.sample to do-not-cache.txt and modify it for your needs. This file specifies any domains you do not wish to be cached by the proxy server (e.g. a local development domain).

  2. Launch the VM

vagrant up

Upgrading from a previous release

  1. Run vagrant destroy -- this ensures you get the latest provisioning
  2. Then run vagrant up as usual

That's it!

Your proxy server is now up and running at 192.168.50.100:3128. In case something goes wrong, you can check logs/vpn.log for additional information.

Great! Now, how do I use it?

There are two ways:

  1. You can redirect web-traffic to your proxy server via a browser plugin:

Most modern browsers have plugins/extensions available online for this very purpose, so find one you like. Personally, I like Proxy SwitchyOmega for chrome, but you can use whatever works for you.

Configure it to point your Proxy Server running at 192.168.50.100:3128

  1. Configure autoproxy by either pointing your browser proxy or system network configuration at http://192.168.50.100/proxy.pac.

Under OS X, you can do this in System Preferences -> Network -> [network adaptor] -> Advanced -> Proxies -> Automatic Proxy Configuration

That's it!

What you should know...

  • The VPN client logs to log/vpn.log (by default), so check for problems there first.
  • The VPN client will attempt to reconnect after 60 seconds (or whatever you've set $VPN_TIMEOUT to be) of being disconnected... forever
  • To stop the proxy altogether, run vagrant halt
  • To restart it, run vagrant up

Known Issues

  • If you encounter a CHEF error regarding "shared folders" while starting the VM, you'll need to remove the vagrant synced_folders file...

    rm .vagrant/machines/default/virtualbox/synced_folders
  • Sometimes the OpenConnect VPN client loses it's ability to obtain a valid certificate and gets stuck. If you see errors in your vpn.log along those lines, run vagrant reload and that typically clears it up.

  • If you find more, please submit an issue

I want to help make this faster/stronger/better!

That's great, any positive contributions are welcome!

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

vmproxy's People

Contributors

cboracle avatar dyoung522 avatar jswright61 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vmproxy's Issues

Provisioner Create Pac throws an error

When upgrading to the latest version.

    >$ vagrant halt
    >$ git pull
    >$ vagrant up

…Extraneous output omitted

    ==> default: Running provisioner: Create PAC (shell)...
        default: Running: /var/folders/hy/wm6746w10ds4fk9lrndz5zs80000gn/T/vagrant-shell20150217-77707-4yrawv.rb
    ==> default: stdin: is not a tty
    ==> default: /tmp/vagrant-shell:30:in `initialize'
    ==> default: :
    ==> default: No such file or directory - /usr/share/nginx/html/proxy.pac
    ==> default:  (
    ==> default: Errno::ENOENT
    ==> default: )
    ==> default:    from /tmp/vagrant-shell:30:in `open'
    ==> default:    from /tmp/vagrant-shell:30:in `<main>'
    The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

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.