Chef knife SSL Validation error on FreeBSD

If you’re using Chef on FreeBSD you might stumble upon the following error message when using the knife command.

ERROR: SSL Validation failure connecting to host: api.opscode.com - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
ERROR: Could not establish a secure connection to the server.
Use `knife ssl check` to troubleshoot your SSL configuration.

There are some tickets in the bugtracker and some resources describing workarounds which did not work for me. However, setting the environment variable SSL_CERT_FILE on FreeBSD 10.1 worked for me.

% export SSL_CERT_FILE=/usr/local/etc/ssl/cert.pem
% knife ssl check

This also helps if you experience the same ssl error when using berkshelf.

Jens Grassel Written by:

Solving problems and burning chrome for fun and profit.