OpenSSL 作为 CA,无需触及 certs/crl/index/etc 环境
我认为我有正确的 OpenSSL 命令来签署证书,但我陷入了困境,并且我发现的教程使用了不同的参数格式(我使用的是 OpenSSL 0.9.8o 01 Jun 2010)。
openssl ca -cert cert.pem -keyfile key.pem
(私钥未加密,CSR 位于标准输入上。)
它给出此错误
Using configuration from /usr/lib/ssl/openssl.cnf
./demoCA/index.txt: No such file or directory
unable to open './demoCA/index.txt'
查看该配置文件:
[ ca ]
default_ca = CA_default # The default ca section
[ CA_default ]
dir = ./demoCA # Where everything is kept
certs = $dir/certs # Where the issued certs are kepp
crl_dir = $dir/crl # Where the issued crl are kept
database = $dir/index.txt # database index file.
我没有任何此设置。 我不想设置任何这些。
这是否是严格必要的,或者是否有“不打扰”选项?
我尝试创建空目录和文件,但我陷入了困境。我真正想要的是像上面这样的命令能够工作,输出在标准输出上,而不接触文件系统上的任何东西。
I think I have the right OpenSSL command to sign a certificate but I've gotten stuck and the tutorials I've found use a different argument format (I'm using OpenSSL 0.9.8o 01 Jun 2010).
openssl ca -cert cert.pem -keyfile key.pem
(Private key is not encryped and CSR is on stdin.)
It gives this error
Using configuration from /usr/lib/ssl/openssl.cnf
./demoCA/index.txt: No such file or directory
unable to open './demoCA/index.txt'
Looking at that configuration file:
[ ca ]
default_ca = CA_default # The default ca section
[ CA_default ]
dir = ./demoCA # Where everything is kept
certs = $dir/certs # Where the issued certs are kepp
crl_dir = $dir/crl # Where the issued crl are kept
database = $dir/index.txt # database index file.
I don't have any of this set up. I don't want to set any of this up.
Is it strictly nessecary, or is there a "don't bother" option?
I tried creating empty directories and files but I've got in a tangle. What I really want is for a command like the above to work, with the output on stdout, without touching anything on the filesystem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我不知道有什么“不用打扰”的选项,但以下是如何设置快速演示 CA:
现在您可以生成并签名密钥:
I don't know of any "don't bother" options, but here is how you can setup a quick demo CA:
Now you can generate and sign keys:
根据 snow6oy 的回答,这就是我所做的:
几个可能有用的可选标志:
-第1095天
(默认为30天)
-sha256
(RHEL 7 默认为 SHA-1)
Based on snow6oy's answer, here's what I did:
A couple optional flags that may be useful:
-days 1095
(The default is 30 days)
-sha256
(RHEL 7 defaults to SHA-1)
不要使用 ca 选项,而是尝试使用 -req 的 x509 选项。您可以添加 -CAfile 以指向您的权限。这将签署您的证书,而不向索引添加条目。这里有更多关于使用 x509 作为“迷你 CA”的信息。
https://www.openssl.org/ docs/manmaster/man1/openssl-x509.html#Micro-CA-Options
Rather than using the ca option try the x509 option with -req. You would add -CAfile to point to your authority. This will sign your certificate without adding entries to the index. There is more about using x509 as "mini CA" here.
https://www.openssl.org/docs/manmaster/man1/openssl-x509.html#Micro-CA-Options
根据您的情况,您可能希望加密您的私钥、使用不同的 X.509 扩展和/或可能进行其他更改。
我知道的生成证书的最简单方法如下。首先生成根(CA)证书(带有私钥):
然后可以创建最终用户证书(由根证书签名):
选项含义:
-x509
- 生成证书,而不是 CSR-subj
- 主题-days
- 到期前的天数-noenc
- 不加密私钥-CA
- 根 (CA)证书-CAkey
- 根 (CA) 私钥-extensions
- 添加到证书的 X.509 扩展(配置文件的部分);usr_cert
在证书中添加CA:FALSE
-out
- 输出证书-keyout
- 输出私钥其他一些方式可以找到 这里。
Depending on your case you might want to have your private keys encrypted, use different X.509 extensions, and/or possibly make other changes.
The simplest way to generate certificates I know is as follows. First generate a root (CA) certificate (with a private key):
Then you can create end-user certificates (signed by the root certificate):
The meaning of the options:
-x509
- generate a certificate, not CSR-subj
- subject-days
- the number of days until it expires-noenc
- don't encrypt the private key-CA
- the root (CA) certificate-CAkey
- the root (CA) private key-extensions
- X.509 extensions to add to the certificate (the section of the config file);usr_cert
addsCA:FALSE
to the certificate-out
- output certificate-keyout
- output private keySome other ways can be found here.