I have two machines (Ubuntu) running identical code to connect to a websocket via SSL.
On one machine it works perfectly (OpenSSL was installed via the Ubuntu package manager).
However, the second machine I built OpenSSL from source and now get an error whilst trying to establish the handshake:
OpenSSL failed - error:0A000086:SSL routines::certificate verify failed
My assumption is OpenSSL requires a file which the second machine cannot find due to the build from source?
This is a list of what I did:
I git-cloned the OpenSSL source and ran these instructions to build/install:
cd openssl
./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl -d shared no-asm no-ssl2 -g3 -ggdb -gdwarf-4 -fno-inline -O0 -fno-omit-frame-pointer -static
make
make install
CMake complained it couldn't find OpenSSL and recommended I set OPENSSL_ROOT_DIR
. Below is the path where my libs were installed, so I set this:
set (OPENSSL_ROOT_DIR /usr/local/ssl/lib64/)
which seemed to work in terms of cmake, compiling and linking.
Below is all my CMake lines relating to OpenSSL:
set (OPENSSL_USE_STATIC_LIBS TRUE)
set (OPENSSL_ROOT_DIR /usr/local/ssl/lib64/)
if (NOT OPENSSL_FOUND)
find_package(OpenSSL REQUIRED)
endif()
add_definitions(${OPENSSL_DEFINITIONS})
target_include_directories(my_project PUBLIC $<BUILD_INTERFACE:${OPENSSL_INCLUDE_DIR}>)
target_link_libraries(my_project PRIVATE ${OPENSSL_LIBRARIES})
What have I missed/not set?
UPDATE: