[Interest] Force ssl connection by QPSQL
Muhammad Bashir Al-Noimi
mbnoimi at gmail.com
Tue Jul 9 00:44:42 CEST 2013
Howdy,
I want to prevent any Postgresql database connection otherthan SSL but
it didn't work and my client can connect without SSL!
* How can fix this issue?
The documentation doesn't mentioen anything about client side
certificate so I wonder:
* Do I need certificate file and key for Qt client?
P.S. To force SSL connection I made the following steps:
On server side (ubuntu 12.10 x64)
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
More information about the Interest
mailing list