我正在尝试使用 创建一个新的 SSL 证书openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt
。
我收到此输出错误:
Can't open /usr/lib/ssl/openssl.cnf for reading, No such file or directory
140188383974784:error:02001002:system library:fopen:No such file or directory:../crypto/bio/bss_file.c:74:fopen('/usr/lib/ssl/openssl.cnf','r')
140188383974784:error:2006D080:BIO routines:BIO_new_file:no such file:../crypto/bio/bss_file.c:81:
Generating a RSA private key
...................................+++++
....................................................................+++++
writing new private key to '/etc/ssl/private/apache-selfsigned.key'
-----
unable to find 'distinguished_name' in config
problems making Certificate Request
140188383974784:error:0E06D06A:configuration file routines:NCONF_get_string:no conf or environment variable:../crypto/conf/conf_lib.c:272:
我怎样才能解决这个问题 ?
答案1
该/usr/lib/ssl/openssl.cnf
文件(应该是 的符号链接/etc/ssl/openssl.cnf
)丢失,因此 openssl 无法读取其配置。我不确定您是如何删除它的,但我认为最可靠的解决方案是使用openssl
以下命令重新安装该软件包(我假设您使用的是基于 Debian 的系统):
sudo apt install openssl --reinstall