title: OpenSSL without -CApath for APNs
body: <p>I'm trying to verify my .pem certificate and connect to Apple's APN gateway to see if it's working correctly. However, when I run  </p>
  
  <pre><code>$ openssl s_client -connect gateway.push.apple.com:2195 -cert data/certs/production.pem -debug -showcerts
  </code></pre>
  
  <p>I get an error like this:</p>
  
  <pre><code>error 20 at 0 depth lookup:unable to get local issuer certificate
  </code></pre>
  
  <p>My OpenSSL dir is located here: </p>
  
  <pre><code>$ openssl version -d
  OPENSSLDIR: "/usr/lib/ssl"
  </code></pre>
  
  <p>So when I explicitly point the directory in the command line (-CApath) suddenly it seems to be working:</p>
  
  <pre><code>$ openssl s_client -connect gateway.push.apple.com:2195 -cert data/certs/production.pem -debug -showcerts -CApath /usr/lib/ssl/certs/
  Verify return code: 0 (ok)
  </code></pre>
  
  <p>I've tried running <code>c_rehash /usr/lib/ssl/certs</code>, but it didn't change anything. What am I doing wrong? I'd like it to run without pointing to the -CApath everytime, because I suspect this is the reason why my push notifications are not being sent.</p>