Skip to content

Commit 59644d9

Browse files
committed
Replace hardlinking of crl.pem with a copy
easyrsa gen-crl does not modify the crl.pem in place but rather remove the old file and create a new one, which means any hardlink to it will get broken again at each invocation of easyrsa gen-crl. If hardlink to this file is not going to work anyway and we still need it to be readable by OpenVPN, we're better off copying it and chmod-ing it every time a new one is detected on container start, using the conditional expression file1 -nt file2.
1 parent dcf3791 commit 59644d9

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

bin/ovpn_run

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,14 @@ if [ "$OVPN_DEFROUTE" != "0" ] || [ "$OVPN_NAT" == "1" ] ; then
7474
setupIptablesAndRouting
7575
fi
7676

77-
# Use a hacky hardlink as the CRL Needs to be readable by the user/group
77+
# Use a copy of crl.pem as the CRL Needs to be readable by the user/group
7878
# OpenVPN is running as. Only pass arguments to OpenVPN if it's found.
79-
if [ -r "$EASYRSA_PKI/crl.pem" ]; then
80-
if [ ! -r "$OPENVPN/crl.pem" ]; then
81-
ln "$EASYRSA_PKI/crl.pem" "$OPENVPN/crl.pem"
82-
chmod 644 "$OPENVPN/crl.pem"
83-
fi
79+
if [ "$EASYRSA_PKI/crl.pem" -nt "$OPENVPN/crl.pem" ]; then
80+
cp -f "$EASYRSA_PKI/crl.pem" "$OPENVPN/crl.pem"
81+
chmod 644 "$OPENVPN/crl.pem"
82+
fi
83+
84+
if [ -r "$OPENVPN/crl.pem" ]; then
8485
addArg "--crl-verify" "$OPENVPN/crl.pem"
8586
fi
8687

0 commit comments

Comments
 (0)