Skip to content

Commit 1b8374f

Browse files
authored
Merge pull request #281 from buchdag/crl-expire
Defaults easy_rsa CRL next update to 3650 days
2 parents e00a72a + 8d7bc7e commit 1b8374f

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ ENV EASYRSA /usr/share/easy-rsa
1717
ENV EASYRSA_PKI $OPENVPN/pki
1818
ENV EASYRSA_VARS_FILE $OPENVPN/vars
1919

20+
# Prevents refused client connection because of an expired CRL
21+
ENV EASYRSA_CRL_DAYS 3650
22+
2023
VOLUME ["/etc/openvpn"]
2124

2225
# Internally uses port 1194/udp, remap using `docker run -p 443:1194/tcp`

Dockerfile.aarch64

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ ENV EASYRSA /usr/share/easy-rsa
1717
ENV EASYRSA_PKI $OPENVPN/pki
1818
ENV EASYRSA_VARS_FILE $OPENVPN/vars
1919

20+
# Prevents refused client connection because of an expired CRL
21+
ENV EASYRSA_CRL_DAYS 3650
22+
2023
VOLUME ["/etc/openvpn"]
2124

2225
# Internally uses port 1194/udp, remap using `docker run -p 443:1194/tcp`

test/tests/revocation/run.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,20 @@ sudo iptables -N DOCKER || echo 'Firewall already configured'
2525
sudo iptables -I FORWARD 1 -j DOCKER
2626
docker run -d -v $OVPN_DATA:/etc/openvpn --cap-add=NET_ADMIN --privileged -p 1194:1194/udp --name $NAME $IMG
2727

28+
29+
#
30+
# Test that easy_rsa generate CRLs with 'next publish' set to 3650 days.
31+
#
32+
crl_next_update="$(docker exec $NAME openssl crl -nextupdate -noout -in /etc/openvpn/crl.pem | cut -d'=' -f2 | tr -d 'GMT')"
33+
crl_next_update="$(date -u -d "$crl_next_update" "+%s")"
34+
now="$(docker exec $NAME date "+%s")"
35+
crl_remain="$(( $crl_next_update - $now ))"
36+
crl_remain="$(( $crl_remain / 86400 ))"
37+
if (( $crl_remain < 3649 )); then
38+
echo "easy_rsa CRL next publish set to less than 3650 days." >&2
39+
exit 2
40+
fi
41+
2842
#
2943
# Generate a first client certificate and configuration using $CLIENT1 as CN then revoke it.
3044
#

0 commit comments

Comments
 (0)