Force ssl connection

From: Muhammad Bashir Al-Noimi <mbnoimi(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Force ssl connection
Date: 2013-07-09 00:32:26
Message-ID: 51DB5A1A.6010902@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Howdy,

I want to prevent any Postgresql database connection other than SSL but
it didn't work and my client can connect without SSL!

* How can fix this issue?

P.S. To force SSL connection I made the following steps:

On server side (ubuntu 12.10 x64 - Postgresql 9.1)
1) Created server.key and server.crt
2) Modified pg_hba.conf and added "hostnossl all all 0.0.0.0/0 reject"
3) Modified postgresql.conf "ssl = on"
4) Restarted the server

On client side (Qt 5.1)
db.setDatabaseName("mydb");
db.setHostName("localhost");
db.setUserName("postgres");
db.setPassword("****");
db.setPort(5432);
db.setConnectOptions("requiressl=1");
if (!db.open()) {
qDebug() << "Unable to connect!";
}

--
Best Regards,
Muhammad Bashir Al-Noimi

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2013-07-09 00:46:29 Re: Force ssl connection
Previous Message Michael Paquier 2013-07-08 22:46:29 Re: Longest Common Subsequence in Postgres - Algorithm Challenge