0

I am trying to create a new SSL certificate with openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt.

I am getting this output error :

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:

How can I fix this ?

0

The /usr/lib/ssl/openssl.cnf file (which should be a symlink to /etc/ssl/openssl.cnf) is missing, so openssl can't read its config. I'm not sure how you managed to delete it, but I think the most surefire solution is to reinstall the openssl package with the following command (I'm assuming you're using a Debian-based system):

sudo apt install openssl --reinstall

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.