OpenSSL and stunnel are open-source C programs, which means we can compile them from source. Doing so is not difficult, but it is a bit fiddly, and I think that fiddliness can dissuade people and cause them to unnecessarily reach for a bloated package manager.
All the information in this blog post is “as of February 2019”, and applies to stunnel 5.50, OpenSSL 1.1.1, and macOS 10.14.
stunnel depends on OpenSSL, so we will compile and install OpenSSL first.
Compiling & Installing OpenSSL on MacOS
stunnel is going to look for
ssl.h, and to make it available we need to compile with the
shared flag. We probably don’t want to spray OpenSSL all over the system, so we will use
--prefix to specify an install location other than the default
$ ./Configure darwin64-x86_64-cc shared --prefix=/Users/hugh/somedir --openssldir=/Users/hugh/somedir no-ssl3
Now you can
make install. Many lines of output later, you will
Compiling & Installing stunnel on MacOS
OpenSSL at the ready, we can now move on to stunnel. We will tell stunnel about our newly minted copy of OpenSSL using the
$ ./configure --with-ssl=/Users/hugh/somedir --prefix=/Users/hugh/somedir
shared flag was not specified when compiling OpenSSL, then this is where you will hit the much-googled:
checking for TLS directory... not found configure: error: Could not find your TLS library installation dir Use --with-ssl option to fix this problem
We did used
shared, so we are good to go! Hit that
make button, followed by
make install, and you are the proud owner of a copy of stunnel compiled with OpenSSL!