Reverted back to creating tun device manually

This commit is contained in:
Quentin McGaw
2018-06-01 14:38:27 -04:00
parent f5b05cfc39
commit ede5979541
3 changed files with 13 additions and 6 deletions

View File

@@ -46,6 +46,14 @@ Cloudflare **DNS 1.1.1.1 over TLS** is used to connect to any PIA server for mul
## Setup ## Setup
1. Make sure you have your `/dev/net/tun` device setup on your host:
```bash
mkdir -p -m 755 /dev/net
mknod /dev/net/tun c 10 200
insmod /lib/modules/tun.ko
```
1. Create a network to be used by this container and other containers connecting to it with: 1. Create a network to be used by this container and other containers connecting to it with:
```bash ```bash
@@ -61,8 +69,9 @@ Cloudflare **DNS 1.1.1.1 over TLS** is used to connect to any PIA server for mul
1. Run the container with (at least change `/yourhostpath` to your actual path): 1. Run the container with (at least change `/yourhostpath` to your actual path):
```bash ```bash
docker run -d --restart=always --name=pia --cap-add=NET_ADMIN \ docker run -d --restart=always --name=pia \
--network=pianet -v /yourhostpath/auth.conf:/auth.conf:ro \ --cap-add=NET_ADMIN --device=/dev/net/tun --network=pianet \
-v /yourhostpath/auth.conf:/auth.conf:ro \
-e REGION=Germany -e PROTOCOL=udp -e ENCRYPTION=normal \ -e REGION=Germany -e PROTOCOL=udp -e ENCRYPTION=normal \
qmcgaw/private-internet-access qmcgaw/private-internet-access
``` ```

View File

@@ -5,6 +5,8 @@ services:
container_name: pia container_name: pia
cap_add: cap_add:
- NET_ADMIN - NET_ADMIN
devices:
- /dev/net/tun
networks: networks:
- pianet - pianet
volumes: volumes:

View File

@@ -7,10 +7,6 @@ echo "nameserver 127.0.0.1" > /etc/resolv.conf
echo "options ndots:0" >> /etc/resolv.conf echo "options ndots:0" >> /etc/resolv.conf
printf "DONE\nStarting Unbound to connect to Cloudflare DNS 1.1.1.1 at its TLS endpoint..." printf "DONE\nStarting Unbound to connect to Cloudflare DNS 1.1.1.1 at its TLS endpoint..."
unbound unbound
printf "DONE\nCreating TUN device..."
mkdir -p /dev/net
mknod /dev/net/tun c 10 200
chmod 600 /dev/net/tun
printf "DONE\nStarting OpenVPN using $PROTOCOL with $ENCRYPTION encryption\n" printf "DONE\nStarting OpenVPN using $PROTOCOL with $ENCRYPTION encryption\n"
cd /openvpn-$PROTOCOL-$ENCRYPTION cd /openvpn-$PROTOCOL-$ENCRYPTION
openvpn --config "$REGION.ovpn" --auth-user-pass /auth.conf openvpn --config "$REGION.ovpn" --auth-user-pass /auth.conf