title: psql: SSL error: certificate verify failed
body: <p>I'm encountering a frustrating problem connecting to Heroku Postgres using <code>psql</code> and in <code>psycopg2</code>, on <code>sslmode=require</code>. </p>
  
  <p>When connecting with the next examples on debian (python 2.7.13) I'm encountering the same problem of </p>
  
  <pre><code>psql: SSL error: certificate verify failed
  </code></pre>
  
  <p>psql:</p>
  
  <pre><code>psql "host=&lt;MyHost&gt; sslmode=require" --port=5432 --username=&lt;MyUser&gt; --password
  </code></pre>
  
  <p>Psycopg2:</p>
  
  <pre><code>import psycopg2
  db_url =  "postgres://User:Pwd@Host:5432/DB?sslmode=require"
  psycopg2.connect(db_url)
  </code></pre>
  
  <p>I tried to change the <code>postgresql.conf</code> and <code>pg_hba.conf</code> as described here:
  <a href="https://stackoverflow.com/questions/48216570/psql-ssl-error-unknown-protocol">PSQL: SSL error: unknown protocol</a></p>
  
  <p>No Luck.</p>
  
  <p>My versions:</p>
  
  <pre><code>psycopg2=-2.6.2
  OpenSSL=1.1.0j  20 Nov 2018
  postgres=9.6
  </code></pre>