Repository: mobtitude/docker-vpn-pptp Branch: master Commit: 525e1c13ae4c Files: 6 Total size: 3.9 KB Directory structure: gitextract_t2szqfo3/ ├── Dockerfile ├── LICENSE ├── README.md ├── entrypoint.sh └── etc/ ├── ppp/ │ └── pptpd-options └── pptpd.conf ================================================ FILE CONTENTS ================================================ ================================================ FILE: Dockerfile ================================================ FROM ubuntu:16.04 MAINTAINER Przemek Szalko ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && apt-get install -y pptpd iptables COPY ./etc/pptpd.conf /etc/pptpd.conf COPY ./etc/ppp/pptpd-options /etc/ppp/pptpd-options COPY entrypoint.sh /entrypoint.sh RUN chmod 0700 /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] CMD ["pptpd", "--fg"] ================================================ FILE: LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 mobtitude Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # VPN (PPTP) for Docker This is a docker image with simple VPN (PPTP) server with _chap-secrets_ authentication. PPTP uses _/etc/ppp/chap-secrets_ file to authenticate VPN users. You need to create this file on your own and link it to docker when starting a container. Example of _chap-secrets_ file: ```` # Secrets for authentication using PAP # client server secret acceptable local IP addresses username * password * ```` ## Starting VPN server To start VPN server as a docker container run: ```` docker run -d --privileged -p 1723:1723 -v {local_path_to_chap_secrets}:/etc/ppp/chap-secrets mobtitude/vpn-pptp ```` Edit your local _chap-secrets_ file, to add or modify VPN users whenever you need. When adding new users to _chap-secrets_ file, you don't need to restart Docker container. ## Connecting to VPN service You can use any VPN (PPTP) client to connect to the service. To authenticate use credentials provided in _chap-secrets_ file. ## Troubleshooting ### Docker 1.7.x and connection issues After upgrading from Docker 1.3.0 to Docker 1.7.1 the containers started from image `mobtitude/vpn-pptp` stopped accepting connections to VPN without any reason. Connections were dropped after timeout. It looked like Docker deamon didn't forward packets for GRE protocol to container. One of the possible solutions is to start container with networking mode set to host by adding param `--net=host` to run command: ```` docker run -d --privileged --net=host -v {local_path_to_chap_secrets}:/etc/ppp/chap-secrets mobtitude/vpn-pptp ```` **Note:** Before starting container in `--net=host` mode, please read how networking in `host` mode works in Docker: https://docs.docker.com/reference/run/#mode-host ================================================ FILE: entrypoint.sh ================================================ #!/bin/sh set -e # enable IP forwarding sysctl -w net.ipv4.ip_forward=1 # configure firewall iptables -t nat -A POSTROUTING -s 10.99.99.0/24 ! -d 10.99.99.0/24 -j MASQUERADE iptables -A FORWARD -s 10.99.99.0/24 -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j TCPMSS --set-mss 1356 iptables -A INPUT -i ppp+ -j ACCEPT iptables -A OUTPUT -o ppp+ -j ACCEPT iptables -A FORWARD -i ppp+ -j ACCEPT iptables -A FORWARD -o ppp+ -j ACCEPT exec "$@" ================================================ FILE: etc/ppp/pptpd-options ================================================ name pptpd refuse-pap refuse-chap refuse-mschap require-mschap-v2 require-mppe-128 # Network and Routing ms-dns 8.8.8.8 ms-dns 8.8.4.4 proxyarp nodefaultroute # Logging # debug # dump # Miscellaneous lock nobsdcomp novj novjccomp nologfd ================================================ FILE: etc/pptpd.conf ================================================ option /etc/ppp/pptpd-options #debug #stimeout 10 logwtmp #bcrelay eth1 #delegate #connections 100 localip 10.99.99.1 remoteip 10.99.99.100-200