Distroless Image of OCSERV Engine for secure and scalable VPN infrastructure
359
Built by Stanislav Garifullin
How to run:
modprobe tun
podman run -it --rm -p 443:443 --cap-add NET_ADMIN --device /dev/net/tun --security-opt label=disable -v ./config:/etc/ocserv:Z scorsair/ocserv:1.4.1
Dockerfile:
# Step 1
FROM ubuntu:24.04 as build
ENV DEBIAN_FRONTEND=noninteractive
ENV OCSERV_VER=1.4.1
ENV INSTALL_DIR=/root/install
ENV TMP_DIR=/root/tmp
RUN apt update -y && \
apt-get install -y libpam0g-dev liblz4-dev libseccomp-dev \
libnl-route-3-dev libkrb5-dev libradcli-dev \
libcurl4-gnutls-dev libcjose-dev libjansson-dev liboath-dev \
libprotobuf-c-dev libtalloc-dev protobuf-c-compiler \
gperf iperf3 lcov libuid-wrapper libpam-wrapper libnss-wrapper \
libsocket-wrapper gss-ntlmssp haproxy iputils-ping freeradius \
gawk gnutls-bin iproute2 jq tcpdump ipcalc libgeoip-dev curl \
pax-utils nettle-dev autoconf libgnutls28-dev libev-libevent-dev \
libreadline-dev libnss-nis
RUN cd /tmp && \
curl -k -LO https://gitlab.com/openconnect/ocserv/-/archive/${OCSERV_VER}/ocserv-${OCSERV_VER}.tar.gz && \
tar -xf ocserv-${OCSERV_VER}.tar.gz && \
cd ocserv-${OCSERV_VER} && \
./autogen.sh && ./configure && make && make install DESTDIR=${INSTALL_DIR}
RUN mkdir -p ${INSTALL_DIR}/usr/lib && \
find ${INSTALL_DIR}/usr/local/bin/ ${INSTALL_DIR}/usr/local/sbin/ -type f | xargs -i lddtree -l --copy-to-tree=${TMP_DIR} {} && \
find ${TMP_DIR}/lib -type f -exec cp {} ${INSTALL_DIR}/usr/lib/ \; && \
rm -f ${INSTALL_DIR}/usr/lib/libc.* && find /root/install -type f && echo "test"
# Step 2
FROM gcr.io/distroless/base-debian13:latest
ENV INSTALL_DIR=/root/install
ENV LD_LIBRARY_PATH="/usr/lib/:/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH"
COPY --from=build ${INSTALL_DIR}/usr/local /usr/local
COPY --from=build ${INSTALL_DIR}/usr/lib /usr/lib
COPY --from=build /etc/radcli /etc/radcli
WORKDIR /etc/ocserv
EXPOSE 443/tcp
EXPOSE 443/udp
ENTRYPOINT ["/usr/local/sbin/ocserv"]
CMD ["-c", "/etc/ocserv/ocserv.conf", "-f"]
USER 0:65534
Content type
Image
Digest
sha256:9bc3a84a4…
Size
9.8 MB
Last updated
10 days ago
docker pull scorsair/ocserv:1.5.0-busybox