From 1eab8a8d5167eaf6b0e8b229041a3b4087b7b5ce Mon Sep 17 00:00:00 2001 From: kev Date: Sun, 14 Jun 2015 11:06:12 +0800 Subject: [PATCH] add tinc --- tinc/Dockerfile | 30 ++++++++++++++++++++++++++++ tinc/README.md | 44 +++++++++++++++++++++++++++++++++++++++++ tinc/docker-compose.yml | 9 +++++++++ 3 files changed, 83 insertions(+) create mode 100644 tinc/Dockerfile create mode 100644 tinc/README.md create mode 100644 tinc/docker-compose.yml diff --git a/tinc/Dockerfile b/tinc/Dockerfile new file mode 100644 index 0000000..af28ac2 --- /dev/null +++ b/tinc/Dockerfile @@ -0,0 +1,30 @@ +# +# Dockerfile for tinc +# + +FROM debian:jessie +MAINTAINER kev + +ENV NETNAME netname + +RUN apt-get update \ + && apt-get install -y net-tools tinc \ + && rm -rf /var/lib/apt/lists/* \ + && mkdir -p /etc/tinc/$NETNAME/hosts + +WORKDIR /etc/tinc/$NETNAME + +RUN /bin/echo -e 'Name=server\nAddressFamily=ipv4\nInterface=tun0' > tinc.conf \ + && /bin/echo -e 'Subnet=10.0.0.1\nSubnet=0.0.0.0/0' > hosts/server \ + && /bin/echo -e '\n' | tincd -n $NETNAME -K4096 \ + && /bin/echo -e 'ifconfig $INTERFACE 10.0.0.1 netmask 255.255.255.0' > tinc-up \ + && /bin/echo -e 'ifconfig $INTERFACE down' > tinc-down \ + && chmod +x tinc-up tinc-down + +VOLUME /etc/tinc +EXPOSE 655/udp + +CMD tincd --no-detach \ + --debug 3 \ + --net $NETNAME \ + --pidfile /run/tinc.$NETNAME.pid diff --git a/tinc/README.md b/tinc/README.md new file mode 100644 index 0000000..d4df07b --- /dev/null +++ b/tinc/README.md @@ -0,0 +1,44 @@ +[`tinc`][1] is a Virtual Private Network (VPN) daemon that uses tunnelling and +encryption to create a secure private network between hosts on the Internet. + +To use this image, you need to: + +- Have baisc knowledges of tinc +- Create a directory tree by hand [read this][2] +- Use `docker-compose` to manage + +## directory tree + +``` +~/fig/tinc/ +├── docker-compose.yml +└── tinc/ + ├── netname/ + │   ├── hosts/ + │   │   ├── client + │   │   ├── client-down + │   │   ├── client-up + │   │   └── server + │   ├── rsa_key.priv + │   ├── tinc.conf + │   ├── tinc-down + │   └── tinc-up + └── nets.boot +``` + +## docker-compose.yml + +``` +server: + image: vimagick/tinc + ports: + - "655:655/udp" + volumes: + - tinc:/etc/tinc + net: host + privileged: true + restart: always +``` + +[1]: http://tinc-vpn.org/ +[2]: https://www.digitalocean.com/community/tutorials/how-to-install-tinc-and-set-up-a-basic-vpn-on-ubuntu-14-04 diff --git a/tinc/docker-compose.yml b/tinc/docker-compose.yml new file mode 100644 index 0000000..e3402c7 --- /dev/null +++ b/tinc/docker-compose.yml @@ -0,0 +1,9 @@ +server: + image: vimagick/tinc + ports: + - "655:655/udp" + volumes: + - tinc:/etc/tinc + net: host + privileged: true + restart: always