大网数据广告活动
服务器运维问答

OpenVPN - Can client certificates and keys be created if you only have ca.crt

· 52CE 我爱测

All servers are debian 9 linux. I have 200 servers with openvpn installed, each with three to four clients (tunnel 2) clients ---> server1 (1 of 200) (also client for jumpserver) ---> jumpserver ---> main office server (client of…

问题原文

原帖链接 · Cruise5 · CC BY-SA 4.0

All servers are debian 9 linux. I have 200 servers with openvpn installed, each with three to four clients (tunnel 2)

clients ---> server1 (1 of 200) (also client for jumpserver) ---> jumpserver ---> main office server (client of jumpserver tunnel 1). So two tunnels. This post is about tunnel 2

server1: Files in /etc/openvpn/keys. They are same for all server1..n. They were copied from a usb disk.

ca.crt
dh2048.pem  
server.crt  
server.key  
ta.key

All the clients have the same ca.crt and ta.key (which matches with the server's ca.crt and ta.key files). All clients have different client.crt and client.key files as expected. They were generated in batch and copied over like servers.

I want to generate client.crt and client.key for 20 more clients. I issue is that I have no idea where the original easy-rsa folder with script, var file and pki folder is. It's not in the server. All I have are the end products were copied over to existing clients.

How can I generate certificate and keys for the new clients? If I start with easy-rsa again, then the public ca.crt would change. If I had to replace a server with new ca.crt, it wouldn't match anymore with the existing clients.

Edit: I have the original ca.crt and ca.key files. I want help with generating new client certificates and keys using easy-rsa.

已采纳解答

原帖链接 · Dan M · CC BY-SA 4.0

Install easyrsa as you would normally do. Something like:

  cd ~
  git clone https://github.com/OpenVPN/easy-rsa.git
  cd ~/easy-rsa/easyrsa3
  ./easyrsa init-pki

Initialize it. Something like:

  ./easyrsa \
    --batch \
    --dn-mode=org \
    --req-c=US \
    --req-st=Massachusetts \
    --req-city="Boston" \
    --req-org="The Great Certificate Company" \
    --req-email=[email omitted] \
    --req-ou="The Great Certificate Unit" \
    --req-cn=www.certco.com \
    build-ca nopass

Now replace the generated ~/easy-rsa/easyrsa3/pki/ca.crt and ~/easy-rsa/easyrsa3/pki/private/ca.key with your own ca.crt and ca.key double checking to make sure you do not replace the old key pair with the new key pair.

Now generate client certificates as you would normally do. They will be signed by your old ca.crt and ca.key and you should be all set.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2022-10-16)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。