Giter Club home page Giter Club logo

docker-vpn-openconnect's Introduction

I created this repo because there are times, I just want a CLI interface into my company so I can ssh to a couple servers and want to avoid connecting my entire PC to the company network

So, I have create a config for "OpenConnect" which is compatible with "Cisco Anyconnect" which will allow my Docker container to connect to my Company's vpn and give me a shell prompt where I can ssh to any host in my company.

Build

Requirements

docker install I use windows 10 - https://docs.docker.com/docker-for-windows/install/ and I also use Windows 10 Linx subsystem "WSL2" https://docs.microsoft.com/en-us/windows/wsl/install-win10

Pull the lates version of the image

docker pull docker.pkg.github.com/eperry/docker-vpn-openconnect/openconnect:latest

OR Build the container (Reccomended)

copy the default config file ( Minimum of what I us, your config maybe different )

cp openconnect-config.example openconnect-config

Build the container

docker build --rm=true -t eperry:openconnect .

RUN The container and capture the Container id

export CID=`docker run -d --rm --privileged -e VPNSERVER='https://YOURSERVER" eperry:openconnect`

Attached to the Docker container, on the "OpenConnect" screen

docker exec -it $CID screen -r -p 'OpenConnect'

Now you can, CTL-a 1 to swtich to a pre-setup bash prompt or use screen to create more windows

Kill the container

The container should terminiate on logout but if you want to be sure

docker kill $CID

enhance your config file

user=<yourid>
authgroup="General Access" 
quiet
no-dtls

Something cool

Lets now spawn up a proxy server to browe the VPN'd network. Now I could have done it all in one container. But this way you can spawn any container and re-use the connection:wq

deploy and connect the vpn

export CID=`docker run -d --rm --privileged -e VPNSERVER='https://YOURVPNSITE' -p 8888:8888 --name openconnect eperry:openconnect

NOTE notice the "-p 8888:8888" this is for the next step proxy server

Spawn a proxy server

Now we are going to share the network namespace when we spawn up another docker container.

docker run -d --name='tinyproxy' --network=container:openconnect --rm dannydirect/tinyproxy:latest ANY

Set your proxy.

Now configure your proxy server in your brower to localhost:8888 or run it via the cli

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --proxy-server="172.30.221.55:8888"

Now you can use your brower over the VPN thought the proxy server

docker-vpn-openconnect's People

Contributors

eperry avatar

Watchers

 avatar  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.