docker-openvpn icon indicating copy to clipboard operation
docker-openvpn copied to clipboard

WARNING: Your certificate has expired!

Open VictorKrasnov opened this issue 3 years ago • 7 comments

How to recreate server certificate?

VictorKrasnov avatar May 25 '22 08:05 VictorKrasnov

I've recreated everything. But I can't retrieve new keys:

docker-compose run --rm openvpn ovpn_getclient $CLIENTNAME > $CLIENTNAME.ovpn

The result of this command is empty file...

VictorKrasnov avatar May 25 '22 09:05 VictorKrasnov

It says here that you can renew the certificate and then it should work again. Any idea what commands that should be in the context of the docker container? https://forums.openvpn.net/viewtopic.php?t=34389

guysoft avatar Jul 09 '23 14:07 guysoft

Ok, managed to find the commands here: https://github.com/angristan/openvpn-install/issues/1002

They need to be adapted to work on the docker container.

Something along the lines of:

mv /etc/openvpn//pki/reqs/your-host-name.com.req your-host-name.com.req.backup
mv /etc/openvpn//pki/private/your-host-name.com.key your-host-name.com.key.backup
mv /etc/openvpn//pki/issued/your-host-name.com.crt your-host-name.com.crt.backup
mv /etc/openvpn/your-host-name.com.crt your-host-name.com.crt.backup
mv /etc/openvpn/your-host-name.com.key your-host-name.com.key.backup

cd /etc/openvpn
easyrsa build-server-full your-host-name.com nopass
cp /etc/openvpn/pki/issued/your-host-name.com.crt /etc/openvpn
cp /etc/openvpn//pki/private/your-host-name.com.key /etc/openvpn

guysoft avatar Jul 09 '23 18:07 guysoft

Ok, managed to find the commands here: angristan/openvpn-install#1002

They need to be adapted to work on the docker container.

Something along the lines of:

mv /etc/openvpn//pki/reqs/your-host-name.com.req your-host-name.com.req.backup
mv /etc/openvpn//pki/private/your-host-name.com.key your-host-name.com.key.backup
mv /etc/openvpn//pki/issued/your-host-name.com.crt your-host-name.com.crt.backup
mv /etc/openvpn/your-host-name.com.crt your-host-name.com.crt.backup
mv /etc/openvpn/your-host-name.com.key your-host-name.com.key.backup

cd /etc/openvpn
easyrsa build-server-full your-host-name.com nopass
cp /etc/openvpn/pki/issued/your-host-name.com.crt /etc/openvpn
cp /etc/openvpn//pki/private/your-host-name.com.key /etc/openvpn

Tks!! it worked for me.

lmovse avatar Jul 26 '23 10:07 lmovse

the latest docker version is easy to renew certificate, command like blow:

mv /etc/openvpn/pki/reqs/your-host-name.com.req your-host-name.com.req.backup
mv /etc/openvpn/pki/private/your-host-name.com.key your-host-name.com.key.backup
mv /etc/openvpn/pki/issued/your-host-name.com.crt your-host-name.com.crt.backup

cd /etc/openvpn 
easyrsa build-server-full your-host-name.com nopass

lmovse avatar Jul 26 '23 10:07 lmovse

it worked for me thanks

yavitvas avatar Sep 05 '23 14:09 yavitvas