openvpn/Dockerfile

32 lines
719 B
Docker

FROM debian:stable-slim
RUN apt update && apt dist-upgrade -y
RUN apt install -y openvpn openvpn-auth-ldap easy-rsa
WORKDIR /etc/openvpn
## Default Certificates - Not Production Use
## Documentation: https://wiki.archlinux.org/title/Easy-RSA
RUN make-cadir easy-rsa/
WORKDIR easy-rsa
RUN ./easyrsa init-pki
RUN export EASYRSA_BATCH=1 && ./easyrsa build-ca nopass
RUN export EASYRSA_BATCH=1 && ./easyrsa build-server-full server nopass
RUN ./easyrsa gen-dh
RUN openvpn --genkey secret /etc/openvpn/server/ta.key
RUN ./easyrsa gen-crl
COPY server.conf /etc/openvpn/server.conf
ADD entrypoint.sh /entrypoint.sh
VOLUME ["/etc/openvpn"]
ENTRYPOINT ["/entrypoint.sh"]
CMD ["openvpn","/etc/openvpn/server.conf"]