diff --git a/docker-compose.yml b/docker-compose.yml index 4025d93..bf62a53 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,19 +1,9 @@ -version: '2' +version: "3.6" services: - - proxy: - build: . - ports: - - "127.0.0.1:13194:13194" - #- "127.0.0.1:13194:13194/udp" - # UDP did not work, probably because the source port changes all the time - #command: -v UDP4-RECVFROM:13194,fork UDP4-SENDTO:172.17.0.1:1194 - command: TCP-LISTEN:13194,fork TCP:172.17.0.1:1194 - restart: always - openvpn: - image: kylemanna/openvpn + container_name: openvpn + image: kylemanna/openvpn:2.3 volumes: - .:/local - ./config:/etc/openvpn @@ -22,7 +12,21 @@ services: - NET_ADMIN environment: dest: docker-for-mac.ovpn - DEBUG: '1' + DEBUG: "1" command: /local/helpers/run.sh restart: always + openvpn-proxy: + container_name: openvpn-proxy + image: alpine/socat:1.0.2 + ports: + - "127.0.0.1:13194:13194" + command: TCP-LISTEN:13194,fork TCP:172.17.0.1:1194 + restart: always + depends_on: + - openvpn + +networks: + default: + driver: bridge + name: docker-for-mac-openvpn \ No newline at end of file diff --git a/helpers/run.sh b/helpers/run.sh index a05ba64..d83c6ee 100755 --- a/helpers/run.sh +++ b/helpers/run.sh @@ -3,20 +3,17 @@ dest=${dest:-docker.ovpn} if [ ! -f "/local/$dest" ]; then - echo "*** REGENERATING ALL CONFIGS ***" set -ex - #rm -rf /etc/openvpn/* ovpn_genconfig -u tcp://localhost sed -i 's|^push|#push|' /etc/openvpn/openvpn.conf echo localhost | ovpn_initpki nopass easyrsa build-client-full host nopass ovpn_getclient host | sed ' s|localhost 1194|localhost 13194|; - s|redirect-gateway.*|route 172.16.0.0 255.240.0.0|; + s|redirect-gateway.*|route 172.24.0.0 255.255.0.0|; ' > "/local/$dest" fi -# Workaround for https://github.com/wojas/docker-mac-network/issues/6 /sbin/iptables -I FORWARD 1 -i tun+ -j ACCEPT exec ovpn_run