2016-06-28 22:35:26 +02:00
|
|
|
#
|
|
|
|
# Dockerfile for ocserv
|
|
|
|
#
|
|
|
|
|
2017-09-01 13:38:21 +02:00
|
|
|
FROM alpine
|
2017-05-08 01:05:07 +02:00
|
|
|
MAINTAINER kev <noreply@easypi.pro>
|
2016-06-28 22:35:26 +02:00
|
|
|
|
2017-08-31 11:48:46 +02:00
|
|
|
ENV OCSERV_VERSION 0.11.8
|
2017-09-01 13:38:21 +02:00
|
|
|
ENV OCSERV_URL ftp://ftp.infradead.org/pub/ocserv/ocserv-$OCSERV_VERSION.tar.xz
|
2016-06-28 22:35:26 +02:00
|
|
|
|
2017-09-01 13:38:21 +02:00
|
|
|
RUN buildDeps=" \
|
|
|
|
curl \
|
|
|
|
g++ \
|
|
|
|
gnutls-dev \
|
|
|
|
gpgme \
|
|
|
|
libev-dev \
|
|
|
|
libnl3-dev \
|
|
|
|
libseccomp-dev \
|
|
|
|
linux-headers \
|
|
|
|
linux-pam-dev \
|
|
|
|
lz4-dev \
|
|
|
|
make \
|
|
|
|
readline-dev \
|
|
|
|
tar \
|
|
|
|
xz \
|
|
|
|
"; \
|
|
|
|
set -x \
|
|
|
|
&& apk add --update --virtual .build-deps $buildDeps \
|
|
|
|
&& curl -SL $OCSERV_URL -o ocserv.tar.xz \
|
|
|
|
&& curl -SL $OCSERV_URL.sig -o ocserv.tar.xz.sig \
|
|
|
|
&& gpg --keyserver pgp.mit.edu --recv-key 7F343FA7 \
|
|
|
|
&& gpg --keyserver pgp.mit.edu --recv-key 96865171 \
|
|
|
|
&& gpg --verify ocserv.tar.xz.sig \
|
|
|
|
&& mkdir -p /usr/src/ocserv \
|
|
|
|
&& tar -xf ocserv.tar.xz -C /usr/src/ocserv --strip-components=1 \
|
|
|
|
&& rm ocserv.tar.xz* \
|
|
|
|
&& cd /usr/src/ocserv \
|
|
|
|
&& ./configure \
|
|
|
|
&& make \
|
2016-06-28 22:35:26 +02:00
|
|
|
&& make install \
|
2017-09-01 13:38:21 +02:00
|
|
|
&& mkdir -p /etc/ocserv \
|
|
|
|
&& cp /usr/src/ocserv/doc/sample.config /etc/ocserv/ocserv.conf \
|
|
|
|
&& cd / \
|
|
|
|
&& rm -rf /usr/src/ocserv \
|
|
|
|
&& runDeps="$( \
|
|
|
|
scanelf --needed --nobanner /usr/local/sbin/ocserv \
|
|
|
|
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
|
|
|
|
| xargs -r apk info --installed \
|
|
|
|
| sort -u \
|
|
|
|
)" \
|
|
|
|
&& apk add --virtual .run-deps $runDeps gnutls-utils iptables \
|
|
|
|
&& apk del .build-deps \
|
|
|
|
&& rm -rf /var/cache/apk/*
|
|
|
|
|
|
|
|
RUN set -xe \
|
2016-06-28 22:35:26 +02:00
|
|
|
&& mkdir -p /etc/ocserv/certs \
|
2017-09-01 13:38:21 +02:00
|
|
|
&& mkdir -p /etc/ocserv/config-per-user \
|
|
|
|
&& mkdir -p /etc/ocserv/config-per-group \
|
|
|
|
&& mkdir -p /etc/ocserv/defaults \
|
|
|
|
&& touch /etc/ocserv/defaults/user.conf \
|
|
|
|
&& touch /etc/ocserv/defaults/group.conf \
|
|
|
|
&& touch /etc/ocserv/ocpasswd \
|
|
|
|
&& sed -i -e 's@\./sample.passwd@/etc/ocserv/ocpasswd@' \
|
|
|
|
-e 's@\.\./tests/@/etc/ocserv/@' \
|
|
|
|
-e 's@^#cert-group-oid =@cert-group-oid =@' \
|
|
|
|
-e 's@^#compression =.*@compression = true@' \
|
|
|
|
-e 's@^#config-per-@config-per-@' \
|
|
|
|
-e 's@^#default-@default-@' \
|
2016-06-29 10:30:45 +02:00
|
|
|
-e 's@^#enable-auth = "certificate"$@enable-auth = "certificate"@' \
|
2016-06-29 18:03:46 +02:00
|
|
|
-e 's@^default-domain@#&@' \
|
2017-09-01 13:38:21 +02:00
|
|
|
-e 's@^dns =.*@dns = 8.8.8.8@' \
|
|
|
|
-e 's@^max-clients =.*@max-clients = 0@' \
|
|
|
|
-e 's@^max-same-clients =.*@max-same-clients = 0@' \
|
2016-06-28 22:35:26 +02:00
|
|
|
-e 's@^route@#&@' \
|
2017-09-01 13:38:21 +02:00
|
|
|
-e 's@^try-mtu-discovery =.*@try-mtu-discovery = true@' \
|
|
|
|
/etc/ocserv/ocserv.conf
|
2016-06-28 22:35:26 +02:00
|
|
|
|
|
|
|
COPY init.sh /init.sh
|
|
|
|
COPY docker-entrypoint.sh /entrypoint.sh
|
|
|
|
|
|
|
|
VOLUME /etc/ocserv
|
2017-09-01 13:38:21 +02:00
|
|
|
WORKDIR /etc/ocserv
|
2016-06-28 22:35:26 +02:00
|
|
|
|
2017-09-01 17:54:33 +02:00
|
|
|
ENV VPN_DOMAIN=vpn.easypi.pro \
|
|
|
|
VPN_NETWORK=10.20.30.0 \
|
|
|
|
VPN_NETMASK=255.255.255.0 \
|
|
|
|
LAN_NETWORK=192.168.0.0 \
|
|
|
|
LAN_NETMASK=255.255.0.0 \
|
|
|
|
VPN_USERNAME=username \
|
|
|
|
VPN_PASSWORD=password \
|
2016-06-29 21:26:48 +02:00
|
|
|
TERM=xterm
|
2016-06-28 22:35:26 +02:00
|
|
|
|
|
|
|
EXPOSE 443/tcp 443/udp
|
|
|
|
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|