Merge pull request #281 from buchdag/crl-expire

Defaults easy_rsa CRL next update to 3650 days
This commit is contained in:
Kyle Manna 2017-06-17 09:15:27 -07:00 committed by GitHub
commit 1b8374f818
3 changed files with 20 additions and 0 deletions

View File

@ -17,6 +17,9 @@ 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`

View File

@ -17,6 +17,9 @@ 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`

View File

@ -25,6 +25,20 @@ sudo iptables -N DOCKER || echo 'Firewall already configured'
sudo iptables -I FORWARD 1 -j DOCKER
docker run -d -v $OVPN_DATA:/etc/openvpn --cap-add=NET_ADMIN --privileged -p 1194:1194/udp --name $NAME $IMG
#
# Test that easy_rsa generate CRLs with 'next publish' set to 3650 days.
#
crl_next_update="$(docker exec $NAME openssl crl -nextupdate -noout -in /etc/openvpn/crl.pem | cut -d'=' -f2 | tr -d 'GMT')"
crl_next_update="$(date -u -d "$crl_next_update" "+%s")"
now="$(docker exec $NAME date "+%s")"
crl_remain="$(( $crl_next_update - $now ))"
crl_remain="$(( $crl_remain / 86400 ))"
if (( $crl_remain < 3649 )); then
echo "easy_rsa CRL next publish set to less than 3650 days." >&2
exit 2
fi
#
# Generate a first client certificate and configuration using $CLIENT1 as CN then revoke it.
#