Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Openssl key generation on OS X failing

I am attempting to run our unit tests on a new clean mac for a Spring project. One test requires the generation of ssl keys.

I have installed openssl via homebrew but the error continues to persist.

Please see error below:

Using configuration from /Users/myuser/workspace/project/webapp/target/test-data/clientvpn/acc1/openssl.conf
default is an unsupported message digest type
13499:error:02001002:system library:fopen:No such file or directory:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-59/src/crypto/bio/bss_file.c:126:fopen('./index.txt.attr','rb')
13499:error:2006D080:BIO routines:BIO_new_file:no such file:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-59/src/crypto/bio/bss_file.c:129:
13499:error:0E078072:configuration file routines:DEF_LOAD:no such file:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-59/src/crypto/conf/conf_def.c:197:
like image 244
robinjohnobrien Avatar asked Jan 05 '16 13:01

robinjohnobrien


2 Answers

I have solved the issue with many google searches and consultation with a colleague who has also recently moved to a mac.

The symlinks for the new openssl where not created when homebrew did the installation. If you run brew link openssl you will receive the following message Warning: openssl is keg-only and must be linked with --force

This leads the the solution. Homebrew needs to be explicitly told to create the correct links.

brew link --force openssl

If you now check which openssl you will notice it points to the brew installed version /usr/local/bin/openssl

like image 159
robinjohnobrien Avatar answered Oct 25 '22 04:10

robinjohnobrien


This worked for me on Montery (12.2)

brew install openssl
brew link openssl # outputs :

Warning: Refusing to link macOS provided/shadowed software: openssl@3
If you need to have openssl@3 first in your PATH, run:
  echo 'export PATH="/usr/local/opt/openssl@3/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@3 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@3/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@3/include"

For pkg-config to find openssl@3 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl@3/lib/pkgconfig"

I was just using the command so I did :

echo 'export PATH="/usr/local/opt/openssl@3/bin:$PATH"' >> ~/.zshrc

That worked, old output :

➜  ca git:(master) openssl version
LibreSSL 2.8.3

After:

➜  ca git:(master) source ~/.zshrc
➜  ca git:(master) openssl version
OpenSSL 3.0.1 14 Dec 2021 (Library: OpenSSL 3.0.1 14 Dec 2021)

Note : the other options that may be needed depending on your needs. Note 2 : my default shell is zsh, add it to your bashrc if you use bash, or to your shell of choice and it's PATH.

like image 36
Vincent Gerris Avatar answered Oct 25 '22 02:10

Vincent Gerris