-
rickyvaughn2
- OpenVpn Newbie
- Posts: 6
- Joined: Tue Jun 21, 2022 10:26 pm
error=certificate has expired
Tue Jun 21 17:27:05 2022 VERIFY ERROR: depth=0, error=certificate has expired: CN=server_abc, serial=123
I understand that there is something that expires around 10 years but this install is only 3 years old.
I created all keys at one time. All are getting the same error implying that the certificate has expired. If I create a new key, it has the same error. ALL of these systems that connect to this VPN are remote and unmanned. Is there anything I can do on the server that can fix this?
The whole error when I try to use the new key (same error on the old keys)
Tue Jun 21 17:29:51 2022 VERIFY ERROR: depth=0, error=certificate has expired: CN=server_abc, serial=123
Tue Jun 21 17:29:51 2022 OpenSSL: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
Tue Jun 21 17:29:51 2022 TLS_ERROR: BIO read tls_read_plaintext error
Tue Jun 21 17:29:51 2022 TLS Error: TLS object -> incoming plaintext read error
Tue Jun 21 17:29:51 2022 TLS Error: TLS handshake failed
-
TinCanTech
- OpenVPN Protagonist
- Posts: 11142
- Joined: Fri Jun 03, 2016 1:17 pm
Re: error=certificate has expired
Post
by TinCanTech » Tue Jun 21, 2022 10:42 pm
Your server certificate has expired but not your CA certificate, which means you can make a new server certificate and everything will be ticketty-boo, until your next certificate expires.
You could try the all new Easy-RSA command `show-expire`, if you have the new Easy-RSA (git/master only)
-
rickyvaughn2
- OpenVpn Newbie
- Posts: 6
- Joined: Tue Jun 21, 2022 10:26 pm
Re: error=certificate has expired
Post
by rickyvaughn2 » Wed Jun 22, 2022 2:35 pm
I really do not want to mess this up… I believe the cert is /etc/openvpn/server_abc.crt and the key is located at /etc/openvpn/server_abc.key
I ran the command: «openssl x509 -in certificate.crt -text -noout» and I see that it did expire on the 15th
I believe I need to do the following:
Export CSR from the expired certificate: «openssl x509 -x509toreq -in server.crt -signkey server.key -out new-server.csr»
Renew self-signed certificate: «openssl x509 -req -days 365 -in new-server.csr -signkey server.key -out new-server.crt»
Questions:
Can I go more than 365 days? (looks like it is limited to 398)
Will the new-server.crt need to overwrite the existing expired one?
Do these steps look correct to not wreck the existing connections to the VPN and get this back up?
I appreciate the help, this is not my primary skill set
-
TinCanTech
- OpenVPN Protagonist
- Posts: 11142
- Joined: Fri Jun 03, 2016 1:17 pm
Re: error=certificate has expired
Post
by TinCanTech » Wed Jun 22, 2022 5:07 pm
We support Easy-RSA.
-
rickyvaughn2
- OpenVpn Newbie
- Posts: 6
- Joined: Tue Jun 21, 2022 10:26 pm
Re: error=certificate has expired
Post
by rickyvaughn2 » Wed Jun 22, 2022 5:28 pm
lol, so I am doing this ALL wrong. Got it.
./easy-rsa renew /etc/openvpn/server.crt? (looks like no)
or this: «./easyrsa build-server-full serverName nopass»
If not, can you please point me in some direction?
-
rickyvaughn2
- OpenVpn Newbie
- Posts: 6
- Joined: Tue Jun 21, 2022 10:26 pm
Re: error=certificate has expired
Post
by rickyvaughn2 » Wed Jun 22, 2022 6:10 pm
I have no idea what I am doing and nothing is clear here. It seems I have to run init-pki, it is warning me that it is about to remove things. All this is fine?
To be clear, I am happy to pay for this to be done.
-
TinCanTech
- OpenVPN Protagonist
- Posts: 11142
- Joined: Fri Jun 03, 2016 1:17 pm
Re: error=certificate has expired
Post
by TinCanTech » Wed Jun 22, 2022 7:24 pm
rickyvaughn2 wrote: ↑
Wed Jun 22, 2022 6:10 pm
I am happy to pay for this to be done.
I am available, tincantech at protonmail dot com
Перевыпуск просроченного сертификата на OpenVPN -сервере
При подключении к OpenVPN-серверу неожиданно стала появляться ошибка
Mon Nov 19 05:42:24 2018 VERIFY ERROR: depth=1, error=certificate has expired: C=RU, ST=ru, L=Moscow, O=Domain, CN=Domain CA, emailAddress=cert@example.com
Mon Nov 19 05:42:24 2018 OpenSSL: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Mon Nov 19 05:42:24 2018 TLS_ERROR: BIO read tls_read_plaintext error
Mon Nov 19 05:42:24 2018 TLS Error: TLS object -> incoming plaintext read error
Mon Nov 19 05:42:24 2018 TLS Error: TLS handshake failed
После анализа выяснялось, что срок действия сертификата центра сертификации (ca.crt) OpenVPN сервера истек.
Для устранения этой ошибки перевыпускаем самоподписанный сертификат центра сертификации
[root@localhost keys]# openssl x509 -in ca.crt -days 3650 -out ca-new.crt -signkey ca.key
Getting Private key
где
ca.crt - просроченный сертификат
ca-new.crt - новый сертификат
ca.key - ключ сертификата
3650 - срок действия, в днях
Старый файл сертификата ca.key можно удалить, новый (ca-new.crt) переименовать в ca.crt
Проверяем
[root@localhost keys]# openssl verify -CAfile ca.crt client-username.crt
client-username.crt: OK
Далее, перевыпускаем сертификат сервера
[root@localhost keys]# cd ../
[root@localhost 2.0]# . ./vars
[root@localhost 2.0]# ./build-key-server server
и перезапускаем OpenVPN
[root@localhost keys]# service openvpn restart
Теперь, что бы пользователи смогли подключаться к OpenVPN-серверу надо что б они на ПК заменили старый сертификат центра сертификации ca.crt на новый
У блога появился хостинг, его любезно предоставила компания Облакотека. Облакотека — облачные сервисы для создания и управления виртуальной ИТ-инфраструктурой.
Если вам понравился мой блог и вы хотели бы видеть на нем еще больше полезных статей, большая просьба поддержать этот ресурс.
Если вы размещаете материалы этого сайта в своем блоге, соц. сетях, и т.д., убедительная просьба публиковать обратную ссылку на оригинал
I have a problem with CA certificate on openvpn, it has expired and clients cannot connect. I tried to create a new certificate with the ca.key, but it did not work.
Here is the command I used to create the new certificate: openssl x509 -in ca.crt -days 3650 -out ca_new.crt -signkey ca.key
After that I changed the openvpn file configuration to indicate that the new certificate is ca_new.crt.
Here is my config file:
port 1194 proto udp dev tun client-to-client ca easy-rsa/keys/ca_new.crt cert easy-rsa/keys/server.crt key easy-rsa/keys/server.key #crl-verify easy-rsa/keys/crl.pem dh easy-rsa/keys/dh1024.pem server 10.0.0.0 255.255.0.0 ifconfig-pool-persist ipp.txt client-config-dir ccd keepalive 10 120 #tls-auth easy-rsa/keys/ta.key 0 #cipher DES-EDE3-CBC comp-lzo max-clients 16129 user nobody group nobody persist-key persist-tun status status.log verb 3 tun-mtu 1500 mssfix 1392
When I check the new certificate using this command openssl verify -CAfile ca_new.crt server.crt
, I get this message,
server.crt: /C=FR/ST=Nord/L=Annoeullin/O=CALEO-CTC/CN=server/emailAddress=REDACTED@gmail.com error 10 at 0 depth lookup:certificate has expired OK
this is the status.log file :
OpenVPN CLIENT LIST Updated,Wed Sep 2 14:38:32 2015 Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since UNDEF,193.248.149.52:48211,343,3344,Wed Sep 2 14:38:21 2015 UNDEF,193.50.22.130:33870,341,4712,Wed Sep 2 14:38:16 2015 UNDEF,193.252.209.244:38024,343,7448,Wed Sep 2 14:38:04 2015 UNDEF,82.127.230.103:55210,343,7904,Wed Sep 2 14:38:01 2015 UNDEF,193.50.22.130:54559,341,12920,Wed Sep 2 14:37:35 2015 UNDEF,194.206.44.228:28159,343,4712,Wed Sep 2 14:38:16 2015 UNDEF,92.155.150.105:35158,343,1976,Wed Sep 2 14:38:29 2015 UNDEF,213.30.150.186:50232,343,3800,Wed Sep 2 14:38:21 2015 ...................... ...................... ...................... UNDEF,80.13.217.56:51206,342,5624,Wed Sep 2 14:38:12 2015 UNDEF,194.206.44.228:29930,343,3344,Wed Sep 2 14:38:22 2015 UNDEF,92.155.150.105:45657,343,2888,Wed Sep 2 14:38:23 2015 UNDEF,92.147.131.148:50109,343,9272,Wed Sep 2 14:37:53 2015 UNDEF,109.6.229.178:59124,343,12920,Wed Sep 2 14:37:39 2015 UNDEF,194.206.44.228:32420,343,13376,Wed Sep 2 14:37:34 2015 UNDEF,109.6.229.178:35403,343,2432,Wed Sep 2 14:38:26 2015 UNDEF,82.127.230.103:58576,343,12920,Wed Sep 2 14:37:39 2015 UNDEF,185.39.170.34:20415,343,7904,Wed Sep 2 14:38:02 2015 UNDEF,185.39.170.34:20407,343,11096,Wed Sep 2 14:37:46 2015 ROUTING TABLE Virtual Address,Common Name,Real Address,Last Ref GLOBAL STATS Max bcast/mcast queue length,0 END
on clients computers there is 4 files :
- client.crt - client.key - ca.crt - config.ovpn
How can I further troubleshoot the issue to figure out the problem? What is the problem?
Перевыпуск сертификата с истекшим сроком действия на сервере OpenVPN
При подключении к серверу OpenVPN внезапно появляется ошибка
Mon Nov 19 05:42:24 2018 VERIFY ERROR: depth=1, error=certificate has expired: C=RU, ST=ru, L=Moscow, O=Domain, CN=Domain CA, [email protected]
Mon Nov 19 05:42:24 2018 OpenSSL: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Mon Nov 19 05:42:24 2018 TLS_ERROR: BIO read tls_read_plaintext error
Mon Nov 19 05:42:24 2018 TLS Error: TLS object -> incoming plaintext read error
Mon Nov 19 05:42:24 2018 TLS Error: TLS handshake failed
После анализа выяснилось, что срок действия сертификата центра сертификации (ca.crt) сервера OpenVPN истек.
Чтобы исправить эту ошибку, мы перевыпускаем самоподписанный сертификат центра сертификации.
[[email protected] keys]# openssl x509 -in ca.crt -days 3650 -out ca-new.crt -signkey ca.key
Getting Private key
где
ca.crt - просроченный сертификат
ca-new.crt - новый сертификат
ca.key - ключ сертификата
3650 - срок действия, в днях
Старый файл сертификата ca.key можно удалить, новый (ca-new.crt) можно переименовать в ca.crt
проверка
[[email protected] keys]# openssl verify -CAfile ca.crt client-username.crt
client-username.crt: OK
Далее перевыпускаем сертификат сервера
[[email protected] keys]# cd ../
[[email protected] 2.0]# . ./vars
[[email protected] 2.0]# ./build-key-server server
и перезапустите OpenVPN
[[email protected] keys]# service openvpn restart
Теперь, чтобы пользователи могли подключаться к серверу OpenVPN, им необходимо заменить старый сертификат центра сертификации ca.crt на новый на своем ПК.
🔍 Простой поиск по базе знаний
Достаточно часто при использовании списка отозванных сертификатов через месяц становится невозможно установить связь с сервером OpenVPN. В логах OpenVPN появляется ошибка установления соединения с сервером:
TLS: Initial packet from [AF_INET]ХХ.ХХ.ХХ.ХХ:62889, sid=ba13f8a4 4c4aec28 VERIFY ERROR: depth=0, error=CRL has expired: CN=client1 OpenSSL: error:140890B2:SSL routines:SSL3_GET_CLIENT_CERTIFICATE:no certificate returned TLS_ERROR: BIO read tls_read_plaintext error TLS Error: TLS object -> incoming plaintext read error TLS Error: TLS handshake failed SIGUSR1[soft,tls-error] received, client-instance restarting
Причина — в превышении времени жизни списка отозванных сертификатов, который хранится в файле crl.pem (CRL — certificate revoke list). Проверить это можно выдав следующую команду:
$ sudo openssl crl -inform PEM -in /etc/openvpn/easy-rsa/keys/crl.pem -text -noout [sudo] пароль для user1: Certificate Revocation List (CRL): Version 1 (0x0) Signature Algorithm: sha256WithRSAEncryption Issuer: /C=RU/ST=RU/L=Moscow/O=ХХХХ/OU=ХХХХ/CN=ХХХХ/name=EasyRSA/emailAddress=хххх@yourmail.ru Last Update: Sep 10 09:26:36 2020 GMT Next Update: Sep 11 09:26:36 2021 GMT
Из вывода видно что не позднее 11 сентября необходимо перевыпустить список отозванных сертификатов. Иначе будет появляться эта ошибка.
Можно конечно перевыпустить список ещё на год, но лучше всё таки увеличить его срок жизни.
Время жизни списка отозванных сертификатов задается в файле /etc/openvpn/easy-rsa/openssl-1.0.0.cnf в следующей секции:
# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs # so this is commented out by default to leave a V1 CRL. # crl_extensions = crl_ext default_days = 3650 # how long to certify for default_crl_days= 365 # how long before next CRL default_md = sha256 # use public key default MD preserve = no # keep passed DN ordering
default_crl_days= 365 это и есть количество дней до перевыпуска списка отозванных сертификатов или время жизни этого списка. Открываем файл конфигурации любимым редактором, например nano:
$ sudo nano /etc/openvpn/easy-rsa/openssl-1.0.0.cnf
и изменяем default_crl_days= 365 на, например, default_crl_days= 3650. То-есть на 10 лет. Затем перевыпускаем сам список:
$ sudo su # cd /etc/openvpn/easy-rsa # openssl ca -gencrl -keyfile keys/ca.key -cert keys/ca.crt -out keys/crl.pem -config ./openssl-1.0.0.cnf # exit
Проверяем:
$ sudo openssl crl -inform PEM -in /etc/openvpn/easy-rsa/keys/crl.pem -text -noout [sudo] пароль для user1: Certificate Revocation List (CRL): Version 1 (0x0) Signature Algorithm: sha256WithRSAEncryption Issuer: /C=RU/ST=RU/L=Moscow/O=ХХХХ/OU=ХХХХ/CN=ХХХХ/name=EasyRSA/emailAddress=хххх@yourmail.ru Last Update: Sep 10 09:26:36 2020 GMT Next Update: Sep 11 09:26:36 2030 GMT
Все нормально и все должно работать.