diff --git a/Dockerfile.arm32v6 b/Dockerfile.arm32v6 new file mode 100644 index 0000000..cb63e94 --- /dev/null +++ b/Dockerfile.arm32v6 @@ -0,0 +1,54 @@ +FROM alpine AS builder + +# Download QEMU, see https://github.com/docker/hub-feedback/issues/1261 +ENV QEMU_URL https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-arm.tar.gz +RUN apk add curl && curl -L ${QEMU_URL} | tar zxvf - -C . --strip-components 1 + + +# Original credit: https://github.com/jpetazzo/dockvpn + +# Smallest base image +FROM arm32v6/ubuntu:18.04 + +LABEL maintainer="lawtancool" + +# Testing: pamtester +#RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories && \ +# apk add --update openvpn iptables bash easy-rsa openvpn-auth-pam google-authenticator pamtester && \ +# ln -s /usr/share/easy-rsa/easyrsa /usr/local/bin && \ +# rm -rf /tmp/* /var/tmp/* /var/cache/apk/* /var/cache/distfiles/* + +RUN apt-get update && apt-get install -y wget tar unzip build-essential libssl-dev iproute2 liblz4-dev liblzo2-dev libpam0g-dev libpkcs11-helper1-dev libsystemd-dev easy-rsa iptables pkg-config && \ + wget http://swupdate.openvpn.org/community/releases/openvpn-2.4.8.tar.gz && tar xvf openvpn-2.4.8.tar.gz && \ + wget https://github.com/Tunnelblick/Tunnelblick/archive/v3.8.2beta02.zip && unzip v3.8.2beta02.zip && \ + cp Tunnelblick-3.8.2beta02/third_party/sources/openvpn/openvpn-2.4.8/patches/*.diff openvpn-2.4.8 && \ + cd openvpn-2.4.8 && \ + patch -p1 < 02-tunnelblick-openvpn_xorpatch-a.diff && \ + patch -p1 < 03-tunnelblick-openvpn_xorpatch-b.diff && \ + patch -p1 < 04-tunnelblick-openvpn_xorpatch-c.diff && \ + patch -p1 < 05-tunnelblick-openvpn_xorpatch-d.diff && \ + patch -p1 < 06-tunnelblick-openvpn_xorpatch-e.diff && \ + ./configure --disable-systemd --enable-async-push --enable-iproute2 && \ + make && make install + +# Needed by scripts +ENV OPENVPN /etc/openvpn +ENV EASYRSA /usr/share/easy-rsa +ENV EASYRSA_PKI $OPENVPN/pki +ENV EASYRSA_VARS_FILE $OPENVPN/vars + +# Prevents refused client connection because of an expired CRL +ENV EASYRSA_CRL_DAYS 3650 + +VOLUME ["/etc/openvpn"] + +# Internally uses port 1194/udp, remap using `docker run -p 443:1194/tcp` +EXPOSE 1194 + +CMD ["ovpn_run"] + +ADD ./bin /usr/local/bin +RUN chmod a+x /usr/local/bin/* + +# Add support for OTP authentication using a PAM module +ADD ./otp/openvpn /etc/pam.d/ diff --git a/Dockerfile.arm32v7 b/Dockerfile.arm32v7 index 3377912..50392f8 100644 --- a/Dockerfile.arm32v7 +++ b/Dockerfile.arm32v7 @@ -1,3 +1,10 @@ +FROM alpine AS builder + +# Download QEMU, see https://github.com/docker/hub-feedback/issues/1261 +ENV QEMU_URL https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-arm.tar.gz +RUN apk add curl && curl -L ${QEMU_URL} | tar zxvf - -C . --strip-components 1 + + # Original credit: https://github.com/jpetazzo/dockvpn # Smallest base image diff --git a/Dockerfile.arm64v8 b/Dockerfile.arm64v8 index c200cb6..18662ab 100644 --- a/Dockerfile.arm64v8 +++ b/Dockerfile.arm64v8 @@ -1,3 +1,10 @@ +FROM alpine AS builder + +# Download QEMU, see https://github.com/docker/hub-feedback/issues/1261 +ENV QEMU_URL https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-arm.tar.gz +RUN apk add curl && curl -L ${QEMU_URL} | tar zxvf - -C . --strip-components 1 + + # Original credit: https://github.com/jpetazzo/dockvpn # Smallest base image diff --git a/hooks/post_push b/hooks/post_push new file mode 100644 index 0000000..1c4d1f3 --- /dev/null +++ b/hooks/post_push @@ -0,0 +1,9 @@ +#!/bin/bash + +# Use manifest-tool to create the manifest, given the experimental +# "docker manifest" command isn't available yet on Docker Hub. + +curl -Lo manifest-tool https://github.com/estesp/manifest-tool/releases/download/v0.9.0/manifest-tool-linux-amd64 +chmod +x manifest-tool + +./manifest-tool push from-spec multi-arch-manifest.yaml diff --git a/hooks/pre_build b/hooks/pre_build new file mode 100644 index 0000000..0a94f7e --- /dev/null +++ b/hooks/pre_build @@ -0,0 +1,5 @@ +#!/bin/bash + +# Register qemu-*-static for all supported processors except the +# current one, but also remove all registered binfmt_misc before +docker run --rm --privileged multiarch/qemu-user-static:register --reset diff --git a/multi-arch-manifest.yaml b/multi-arch-manifest.yaml new file mode 100644 index 0000000..b885338 --- /dev/null +++ b/multi-arch-manifest.yaml @@ -0,0 +1,21 @@ +image: lawtancool/docker-openvpn-xor:latest +manifests: + - image: lawtancool/docker-openvpn-xor:amd64 + platform: + architecture: amd64 + os: linux + - image: lawtancool/docker-openvpn-xor:arm32v6 + platform: + architecture: arm + os: linux + variant: v6 + - image: lawtancool/docker-openvpn-xor:arm32v7 + platform: + architecture: arm + os: linux + variant: v7 + - image: lawtancool/docker-openvpn-xor:arm64v8 + platform: + architecture: arm64 + os: linux + variant: v8