0

Create key and certificate:

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt
Can't open /usr/lib/ssl/openssl.cnf for reading, No such file or directory
140713226073408:error:02001002:system library:fopen:No such file or directory:../crypto/bio/bss_file.c:69:fopen('/usr/lib/ssl/openssl.cnf','r')
140713226073408:error:2006D080:BIO routines:BIO_new_file:no such file:../crypto/bio/bss_file.c:76:

Reinstall it with:

apt install openssl --reinstall

Check the file with:

ls -al  /usr/lib/ssl/openssl.cnf
lrwxrwxrwx 1 root root 20 Mar 19 02:25 /usr/lib/ssl/openssl.cnf -> /etc/ssl/openssl.cnf
ls -al /etc/ssl/openssl.cnf
ls: cannot access '/etc/ssl/openssl.cnf': No such file or directory

How can solve the issue then?

showkey
  • 85
  • 1
  • 1
  • 14
  • https://serverfault.com/questions/82801/linux-how-to-restore-config-file-using-apt-get-aptitude , https://unix.stackexchange.com/questions/277193/how-to-reinstall-configuration-file , https://askubuntu.com/questions/66533/how-can-i-restore-configuration-files – A.B Apr 10 '22 at 13:07

2 Answers2

2

Download the file from https://github.com/openssl/openssl/blob/master/apps/openssl.cnf, maybe changing the branch to suit your version (as retrieved with openssl version).

Save it as /etc/ssl/openssl.cnf.

Alternatively, you could search your system for the file with:

find / -iname openssl.cnf

If you are lucky enough to find it, many of the openssl commands accept the -config option to point to an alternative file; or you could simply move it to it's correct home.

garethTheRed
  • 4,009
  • 13
  • 20
0
  1. url address

The url should be https://raw.githubusercontent.com/openssl/openssl/master/apps/openssl.cnf.

  1. target directory

It should be /usr/lib/ssl/openssl.cnf instead of /etc/ssl/openssl.cnf.

curl -k  https://raw.githubusercontent.com/openssl/openssl/master/apps/openssl.cnf       
-o  /usr/lib/ssl/openssl.cnf
showkey
  • 85
  • 1
  • 1
  • 14