Skip to content
This repository was archived by the owner on Jan 31, 2021. It is now read-only.

Commit 0d2d3fe

Browse files
committed
Add Pi-hole adblocking DNS server and configure VPN to use it
1 parent a65d232 commit 0d2d3fe

File tree

2 files changed

+54
-43
lines changed

2 files changed

+54
-43
lines changed

README.md

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,19 @@
1-
One click personal VPN server on [DigitalOcean](https://digitalocean.com) with automated OSX setup. The deployed VPN server includes automated updates of both the OS and VPN software, so you don't need to worry about managing a server.
1+
One click personal VPN server on [DigitalOcean](https://digitalocean.com) with automated OSX setup and DNS adblocking. The deployed VPN server includes automated updates of both the OS and software, so you don't need to worry about managing a server.
22

33
![](/static/overview.gif?raw=true)
44

55
## Features
66
* Personal IPSec VPN ([strongSwan](https://www.strongswan.org/)) deployed on DigitalOcean.
7-
* Graphical deployment with automated OSX VPN setup.
8-
* No separate software required - uses native OSX built in VPN.
9-
* Set it and forget it. Automated OS and VPN software updates.
10-
* Downloadable config file that can be used to setup VPN on other computers
7+
* Adblocking DNS ([Pi-hole](https://pi-hole.net/)) setup by default.
8+
* Web based deployment with automated OSX VPN setup.
9+
* No additional software required - uses native OSX VPN.
10+
* Automated OS and software updates.
11+
* Downloadable mobileconfig file for sharing access to this VPN with other computers and devices.
1112

12-
## Installation
13-
14-
### Binary
15-
The easiest way is to download a pre-built binary from the [GitHub Releases](https://github.com/dan-v/dosxvpn/releases) page. This is a packaged OSX app.
16-
17-
### Source
18-
1. Fetch the project with `go get`:
19-
20-
```sh
21-
go get github.com/dan-v/dosxvpn
22-
cd $GOPATH/src/github.com/dan-v/dosxvpn
23-
```
24-
25-
2. Run make to build (will need to install [platypus cli](http://www.sveinbjorn.org/platypus)). CLI and OSX app can then be found under build/osx/x86-64.
26-
27-
```sh
28-
make
29-
```
30-
31-
## CLI Usage
32-
33-
```bash
34-
go install github.com/dan-v/dosxvpn/cmd/...
35-
DIGITALOCEAN_ACCESS_TOKEN=... dosxvpn -cli
36-
```
37-
38-
Prints output like:
39-
```
40-
2017/04/05 15:58:57 Created DigitalOcean droplet 44882920
41-
2017/04/05 15:58:57 Waiting for SSH to start...
42-
2017/04/05 15:59:32 Getting VPN details...
43-
2017/04/05 15:59:51 Adding VPN to OSX...
44-
2017/04/05 15:59:55 ##############################
45-
2017/04/05 15:59:55 VPN IP: 10.10.10.10
46-
2017/04/05 15:59:55 ##############################
47-
```
13+
## Usage
14+
1. Download the latest pre-built binary from the [GitHub Releases](https://github.com/dan-v/dosxvpn/releases) page. This is a packaged OSX app.
15+
2. Open the app and run through the web based installation wizard to setup the VPN.
16+
3. Visit http://pi.hole/admin/ (password=dosxvpn) in your browser to modify DNS adblocking settings.
4817

4918
## How it works
5019
A web server is started on application launch and directs you to your web browser. It uses client OAuth authentication to request access to your DigitalOcean account (this permission is revoked after deployment). Once authenticated, a 512MB droplet is deployed running CoreOS that is configured to auto update on new releases. The OS is configured to launch a container ([dosxvpn/strongswan](https://hub.docker.com/r/dosxvpn/strongswan/)) on boot running [strongSwan](https://www.strongswan.org/).
@@ -61,3 +30,17 @@ A web server is started on application launch and directs you to your web browse
6130
* [jbowens/dochaincore](https://github.com/jbowens/dochaincore) - Deployment code was borrowed from this project
6231
* [vimagick/strongswan](https://github.com/vimagick/dockerfiles/tree/master/strongswan) - Using forked version of this docker image for VPN
6332
* [platypus](http://www.sveinbjorn.org/platypus) - Used to generate OSX app
33+
34+
### Building yourself
35+
1. Fetch the project with `go get`:
36+
37+
```sh
38+
go get github.com/dan-v/dosxvpn
39+
cd $GOPATH/src/github.com/dan-v/dosxvpn
40+
```
41+
42+
2. Run make to build (will need to install [platypus cli](http://www.sveinbjorn.org/platypus)). CLI and OSX app can then be found under build/osx/x86-64.
43+
44+
```sh
45+
make
46+
```

userdata.go

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,22 @@ coreos:
4848
4949
[Timer]
5050
OnCalendar=*-*-* 0/12:00:00
51+
- name: dummy-interface.service
52+
command: start
53+
content: |
54+
[Unit]
55+
Description=Creates a dummy local interface
56+
57+
[Service]
58+
User=root
59+
Type=oneshot
60+
ExecStart=/bin/sh -c "modprobe dummy; ip link set dummy0 up; ifconfig dummy0 1.1.1.1/32; echo 1.1.1.1 pi.hole >> /etc/hosts"
5161
- name: dosxvpn.service
5262
command: start
5363
content: |
5464
[Unit]
5565
Description=dosxvpn
56-
After=docker.service
66+
After=docker.service,dummy-interface.service
5767
5868
[Service]
5969
User=core
@@ -64,8 +74,26 @@ coreos:
6474
ExecStartPre=-/usr/bin/docker kill dosxvpn
6575
ExecStartPre=-/usr/bin/docker rm dosxvpn
6676
ExecStartPre=/usr/bin/docker pull dosxvpn/strongswan
67-
ExecStart=/usr/bin/docker run --name dosxvpn --privileged -p 500:500/udp -p 4500:4500/udp -v ipsec.d:/etc/ipsec.d -v strongswan.d:/etc/strongswan.d -v /lib/modules:/lib/modules -v /etc/localtime:/etc/localtime -e VPN_DOMAIN=$public_ipv4 dosxvpn/strongswan
77+
ExecStart=/usr/bin/docker run --name dosxvpn --privileged --net=host -v ipsec.d:/etc/ipsec.d -v strongswan.d:/etc/strongswan.d -v /lib/modules:/lib/modules -v /etc/localtime:/etc/localtime -e VPN_DNS=1.1.1.1 -e VPN_DOMAIN=$public_ipv4 dosxvpn/strongswan
6878
ExecStop=/usr/bin/docker stop dosxvpn
79+
- name: pihole.service
80+
command: start
81+
content: |
82+
[Unit]
83+
Description=pihole
84+
After=docker.service,dummy-interface.service
85+
86+
[Service]
87+
User=core
88+
Restart=always
89+
TimeoutStartSec=0
90+
KillMode=none
91+
EnvironmentFile=/etc/environment
92+
ExecStartPre=-/usr/bin/docker kill pihole
93+
ExecStartPre=-/usr/bin/docker rm pihole
94+
ExecStartPre=/usr/bin/docker pull diginc/pi-hole:alpine
95+
ExecStart=/usr/bin/docker run --name pihole --net=host -e ServerIP=1.1.1.1 -e WEBPASSWORD=dosxvpn diginc/pi-hole:alpine
96+
ExecStop=/usr/bin/docker stop pihole
6997
`
7098

7199
type userDataParams struct {

0 commit comments

Comments
 (0)