├── Dockerfile ├── Makefile ├── README.md └── start-pritunl /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | 3 | MAINTAINER John Axel Eriksson 4 | 5 | RUN locale-gen en_US en_US.UTF-8 &&\ 6 | dpkg-reconfigure locales &&\ 7 | ln -sf /usr/share/zoneinfo/UTC /etc/localtime &&\ 8 | apt-get update -q &&\ 9 | apt-get upgrade -y -q &&\ 10 | apt-get dist-upgrade -y -q &&\ 11 | apt-get install -y software-properties-common python-software-properties &&\ 12 | add-apt-repository ppa:pritunl/ppa &&\ 13 | apt-get update -q &&\ 14 | apt-get install -y pritunl &&\ 15 | apt-get clean &&\ 16 | apt-get -y -q autoclean &&\ 17 | apt-get -y -q autoremove &&\ 18 | rm -rf /tmp/* 19 | 20 | ADD start-pritunl /bin/start-pritunl 21 | 22 | EXPOSE 9700 23 | EXPOSE 1194 24 | EXPOSE 11194 25 | 26 | ENTRYPOINT ["/bin/start-pritunl"] 27 | 28 | CMD ["/usr/bin/tail", "-f","/var/log/pritunl.log"] 29 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME=johnae/pritunl 2 | 3 | all: 4 | docker build -t $(IMAGE_NAME) . 5 | 6 | clean: 7 | docker rmi $(IMAGE_NAME) || true 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Pritunl as a Docker container 2 | 3 | Just build it or pull it from johnae/pritunl. Run it something like this: 4 | 5 | ``` 6 | docker run -d --privileged -p 1194:1194/udp -p 1194:1194/tcp -p 9700:9700/tcp johnae/pritunl 7 | ``` 8 | 9 | If you have a mongodb somewhere you'd like to use for this rather than starting the built-in one you can 10 | do so through the MONGODB_URI env var like this: 11 | 12 | ``` 13 | docker run -d --privileged -e MONGODB_URI=mongodb://some-mongo-host:27017/pritunl -p 1194:1194/udp -p 1194:1194/tcp -p 9700:9700/tcp johnae/pritunl 14 | ``` 15 | 16 | Then you can login to your pritunl web ui at https://docker-host-address:9700 17 | Username: pritunl Password: pritunl 18 | 19 | I would suggest using docker data volume for persistent storage of pritunl data, something like this: 20 | 21 | ```shell 22 | ## create the data volume 23 | docker run -v /var/lib/pritunl --name=pritunl-data busybox 24 | ## use the data volume when starting pritunl 25 | docker run --name pritunl --privileged --volumes-from=pritunl-data -e MONGODB_URI=mongodb://some-mongo-host:27017/pritunl -p 1194:1194/udp -p 1194:1194/tcp -p 9700:9700/tcp -e SERVICE_NAME=%H -e SERVICE_1194_ID=pritunl-vpn -e SERVICE_9700_ID=pritunl-web johnae/pritunl 26 | ``` 27 | 28 | Then you're on your own, but take a look at http://pritunl.com or https://github.com/pritunl/pritunl 29 | -------------------------------------------------------------------------------- /start-pritunl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | [ -d /dev/net ] || 5 | mkdir -p /dev/net 6 | [ -c /dev/net/tun ] || 7 | mknod /dev/net/tun c 10 200 8 | 9 | touch /var/log/pritunl.log 10 | touch /var/run/pritunl.pid 11 | /bin/rm /var/run/pritunl.pid 12 | 13 | ## start a local mongodb instance if no mongodb specified through env 14 | if [ -z "$MONGODB_URI" ]; then 15 | /usr/bin/mongod -f /etc/mongodb.conf & 16 | sleep 70 ## for mongo to allocate journals 17 | MONGODB_URI="mongodb://localhost:27017/pritunl" 18 | fi 19 | 20 | cat << EOF > /etc/pritunl.conf 21 | { 22 | "mongodb_uri": "$MONGODB_URI", 23 | "server_key_path": "/var/lib/pritunl/pritunl.key", 24 | "log_path": "/var/log/pritunl.log", 25 | "static_cache": true, 26 | "server_cert_path": "/var/lib/pritunl/pritunl.crt", 27 | "temp_path": "/tmp/pritunl_%r", 28 | "bind_addr": "0.0.0.0", 29 | "debug": false, 30 | "www_path": "/usr/share/pritunl/www", 31 | "local_address_interface": "auto", 32 | "port": 9700 33 | } 34 | EOF 35 | 36 | /usr/bin/pritunl start & 37 | [ "$1" ] && exec "$@" 38 | 39 | --------------------------------------------------------------------------------