title: OperationalError: SSL SYSCALL error: Connection reset by peer
body: <p>I am trying to connect to a Postgres server using Python.</p>
  <pre><code>import psycopg2
  
  
  conn = psycopg2.connect(
      host=&quot;ec2-blablabla.compute-1.amazonaws.com&quot;,
      database=&quot;postgres&quot;,
      user=&quot;myuser&quot;,
      password=&quot;mypassword&quot;,
      port = 5432,
      sslmode ='prefer',
      sslcompression = 0
  )
  cur = conn.cursor()
  </code></pre>
  <p>I get the following error:</p>
  <blockquote>
  <p>OperationalError: SSL SYSCALL error: Connection reset by peer
  FATAL:  no pg_hba.conf entry for host &quot;207.100.100.100&quot;, user &quot;myuser&quot;, database &quot;postgres&quot;, SSL off</p>
  </blockquote>
  <p>I am able to connect to this server from my IP using pgadmin and same ssl settings as I set in Python code. What could be the issue here?</p>
  <p><a href="https://stackoverflow.com/questions/1406025/no-pg-hba-conf-entry-for-host">no pg_hba.conf entry for host</a>
  I cannot modify pg_hba.conf so if there is any other way, please let me know!!</p>