EnterpriseDB / mongo_fdw

PostgreSQL foreign data wrapper for MongoDB
GNU Lesser General Public License v3.0
330 stars 70 forks source link

Unable to connect to server ebcause of TLS handshake failed but, SSL option is 'FALSE' #139

Closed WiertsemaTolbert closed 4 years ago

WiertsemaTolbert commented 4 years ago

Hello,

I am trying to connect to a Mongo server with authentication set to enabled. My CREATE SERVER statement:

CREATE SERVER mongo_server FOREIGN DATA WRAPPER mongo_fdw OPTIONS (address '192.168.10.15', port '27019', authentication_database 'admin', ssl 'false');

When I try to select records from the foreign table I get an error in PostgreSQL. The Mongo server output for this connection:

2020-10-15T17:34:12.670+0200 I NETWORK [conn11] Error receiving request from client: SSLHandshakeFailed: SSL handshake received but server is started without SSL support. Ending connection from 192.168.10.27:51025 (connection id: 11) 2020-10-15T17:34:12.670+0200 I NETWORK [conn11] end connection 192.168.10.27:51025 (3 connections now open)

When I lookup http://mongoc.org/libmongoc/current/mongoc_ssl_opt_t.html, it says:

Beginning in version 1.2.0, once a pool or client has any TLS options set, all connections use TLS, even if ssl=true is omitted from the MongoDB URI. Before, TLS options were ignored unless tls=true was included in the URI.

So, what do I need to add as option to ensure that TLS is not enabled?

Thanks!

Regards Klaasjan

WiertsemaTolbert commented 4 years ago

I removed authentication on the database and removed the option authentication_database and SSL. I can now connect to the server and get data however the data only contains NULL values.