Giter VIP home page Giter VIP logo

docker-compose-openvpn-pihole's Introduction

docker-compose-openvpn-pihole

OpenVPN + Pi-Hole +Docker-Compose

Projects Used:

Setup / Initialization

There is setup the user must do prior to using this, as follows:

  • Pi-Hole
  • OpenVPN
    • Server
    • Client

Pi-Hole

I came to this with a pre-configured pi-hole, so you'll want to go through that inside an Ubuntu container (note: you may need to hack up its install script to work around some containerization limitations) or outside. Copy the configuration to ./pihole/pihole directory. Note that the provided seupVars.conf and 01-pihole.conf are for reference only.

Next, edit .env file, such as the PIHOLE_WEBPW setting.

OpenVPN

There are two things to do for OpenVPN, the server settings and then clients.

The server can follow the setup for the upstream docker-openvpn project for both client and server.

In brief, however the steps are to configure the server and then clients. By way of disclaimer, @lisa came to the containerization of her configuration with a "bare metal" installation so the steps are not guaranteed. Refer to the upstream project for more thorough explanation.

In the documentation the VPN endpoint (that is, where clients connect) is vpn-endpoint.example.com. The client will be called client. The VPN client range will be 10.100.0.0/24 with the inside-docker network device as tun1.

OpenVPN Server

WARNING: This configuration will route ALL traffic over the VPN.

  1. Initialize the configuration with

     docker-compose run --rm openvpn ovpn_genconfig -u vpn-endpoint.example.com -N -z -d -s 10.100.0.0/24 -p "remote-gateway 10.100.0.1" -n 10.100.0.2
    
  2. Initialize the server's crypto (PKI) and when prompted, provide passphrases and then the VPN endpoint, vpn-endpoint.example.com (for "Common Name").

     docker-compose run --rm openvpn ovpn_initpki
    

OpenVPN Client

  1. Create a client certificate, providing the passphrases as appropriate during server configuration.

     docker-compose run --rm openvpn easyrsa build-client-full client
    
  2. Obtain the client configuration

     docker-compose run --rm openvpn ovpn_getclient client > client.ovpn
    

The client configuration can be distributed to the client at this time.

Controlling the Composition

Start the stack with docker-compose up -d once all configuration steps are complete, and stop via docker-compose down.

DISCLAIMER

This repository is provided "as-is" and without any warranty. It may cause data loss, or due to misconfiguration cause your software to be exposed to the Internet. By using the software you assume all risks.

docker-compose-openvpn-pihole's People

Contributors

lisa avatar

Watchers

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