For CentOS it's suggested to add the -lss3
flag to your compile line. Supporting link.
You can also try statically linking OpenSSL into your build, from the same link as above. Replacing the location of your *.a
files:
#!/bin/bash # Emerge openssl with static-libs to obtain all the *.a mkdir -p heartbleed.d cd heartbleed.d ar x /usr/lib/libssl.a ar x /usr/lib/libcrypto.a ar x /usr/lib/libgmp.a ar x /usr/lib/libz.a cd .. gcc -o heartbleed heartbleed.d/*.o heartbleed.c -ldl
If you're on Debian (for completeness I know this question is in relation to CentOS 6.x) then you'll have this problem. Then this link might help you with your problem, it provides the below solution:
$ gcc heartbleed.c -o heartbleed -Wl,-Bstatic -lssl -Wl,-Bdynamic -lssl3 -lcrypto $ uname -a Linux xxxxx Debian 3.2.54-2 x86_64 GNU/Linux $ ls -al heartbleed -rwxr-xr-x 1 x x357603 Apr 11 23:20 heartbleed
This link is kinda confusing, it presents the exact problem in 2013 but just says that they updated the header for compiling. So maybe triple check the header file for comments?
Another solution to your problem might be to answer the following. What version of OpenSSL does your network run? Here's an exerpt from HeartBleed.com
What versions of the OpenSSL are affected?
Status of different versions:
OpenSSL 1.0.1 through 1.0.1f (inclusive) are vulnerable OpenSSL 1.0.1g is NOT vulnerable OpenSSL 1.0.0 branch is NOT vulnerable OpenSSL 0.9.8 branch is NOT vulnerable
It was patched in OpenSSL version 1.0.1g: From the OpenSSL Security Advisory:
Affected users should upgrade to OpenSSL 1.0.1g. Users unable to immediately upgrade can alternatively recompile OpenSSL with -DOPENSSL_NO_HEARTBEATS.
You can recompile older versions with that flag if you can't upgrade.