MacOS – SSL error with mbsync

macosssl

I installed isync[1] on my personal Macbook, which runs OSX 10.11. I used the exact same .mbsyncrc file I wrote for my Macbook at work.

The setup works fine on my work machine. However when using the mbsync command on the personal machine, I get the following output:

SSL error connecting imap.gmail.com (74.125.133.109:993):
error:00000014:lib(0):func(0):SSL lib

The work macbook runs a fresh install of OSX 10.11 and Homebrew. The personal one also runs OSX 10.11 and Homebrew, but has known several upgrades since 2013 (it was mountain lion at the time).

Are you aware of any difference between fresh installs and upgrades, that could lead to this kind of error?

Links

  1. http://isync.sourceforge.net/

Best Answer

This is a certificate issue. In my .mbsyncrc, I included as CertificateFile the entire certificate chain (Gmail -> Google, Google -> GeoTrust, GeoTrust -> Equifax). This started intermittently throwing the error you're describing around the time I fixed the curl SSL issue.

To fix it, use only the Gmail certificate in your .mbsyncrc. If you're unsure which of the certificates is the Gmail one, run:

openssl s_client -connect imap.gmail.com:993 -showcerts 2>&1 < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | head -n 27 > gmail.crt

and use the resulting gmail.crt file.