Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] OpenSearch ODBC client will not connect to OpenSearch cluster #8

Open
dredwilliams opened this issue Nov 11, 2021 · 38 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@dredwilliams
Copy link

dredwilliams commented Nov 11, 2021

Describe the bug
OpenSearch ODBC client will not connect to OpenSearch cluster.

Using the 'Test' button in the ODBC Data Sources Configuration dialog, I get the "Connection error: SQL plugin is not available, please install the SQL plugin to use this driver" error message. Using curl with the same parameters in a WSL window on the same system works as expected.

Tracing through the code, this message is generated in the CheckSQLPluginAvailability() method in opensearch_communication.cpp. Based on what I can see in the log on the Windows side (see below), it is being triggered by an exception thrown in the ParseErrorResponse() method -- which probably means it is getting a non-JSON response to parse. The problem is, I can't see what that response is -- I can only sometimes get the OpenSearch logs to show a connection (though communication is confirmed using tcpdump on the server side), much less tell me what it is sending back. The root log level of the node I'm trying to connect to is set to DEBUG ... I've tried to set to TRACE, but couldn't sift any additional useful information out -- but if y'all can tell me what to search for, I'll set it to TRACE again and send the results.

When using curl to test, I can see messages from o.o.s.l.p.RestSqlAction showing the query received, but not when I test the ODBC driver -- which makes me wonder if the driver is sending the appropriate API call at all? Again, I can't see enough in the logs to answer this question.

I see similar issues raised in several different threads in the forums, with the frequent cause being SSL configuration, possible certificate issues, but (as you see below) I've worked through those issues to make sure I've got those bases covered. I installed the cluster's Root CA in the windows trusted authorities keystore, and verified using a browser that the cluster's cert is accepted.

To Reproduce
Steps to reproduce the behavior:

  1. Download ODBC driver (see issue Publish download links for ODBC and JDBC drivers sql#244 )
  2. Install driver and open ODBC Data Sources (64 bit) tool
  3. Enter parameters (see screenshot below) on main screen, selecting 'SSL' from advanced options sub-dialog (hostname validation is not set, but appears to make no difference)
  4. Click the 'test' button
  5. Error dialog pops up after timeout period (see below)
  6. Logs from the Windows side are also below

Expected behavior
The ODBC driver should connect with the OpenSearch cluster

Plugins
These are the plugins currently installed:

opensearch-alerting
opensearch-anomaly-detection
opensearch-asynchronous-search
opensearch-cross-cluster-replication
opensearch-index-management
opensearch-job-scheduler
opensearch-knn
opensearch-notebooks
opensearch-performance-analyzer
opensearch-reports-scheduler
opensearch-security
opensearch-sql

Screenshots
Configuration Dialog:
image

Error Dialog:
image

Windows Log:

opensearch[OpenSearchCommunication::LogMsg]832: Verifying connection options.
opensearch[OpenSearchCommunication::LogMsg]832: Required connection option are valid.
opensearch[OpenSearchCommunication::LogMsg]832: Starting DB connection.
opensearch[OpenSearchCommunication::LogMsg]832: Attempting to establish DB connection.
opensearch[OpenSearchCommunication::LogMsg]832: 
opensearch[OpenSearchCommunication::LogMsg]832: Checking for SQL plugin status.
opensearch[OpenSearchCommunication::LogMsg]832: Parsing error response (with schema validation)
opensearch[OpenSearchCommunication::LogMsg]832: Unexpected exception thrown from the server, the SQL plugin is not installed or in unhealthy status.
opensearch[OpenSearchCommunication::LogMsg]832: SQL plugin is not available, please install the SQL plugin to use this driver.
opensearch[OpenSearchCommunication::LogMsg]832: Dropping DB connection.
connection[CC_set_error_statements]564: entering self=0000025EB7BD36E0
connection[CC_log_error]652: CONN ERROR: func=LIBOPENSEARCH_connect, desc='', errnum=202, errmsg='Connection error: [OpenSearch][SQL ODBC Driver][SQL Plugin] Connection error: SQL plugin is not available, please install the SQL plugin to use this driver.'
connection[CC_log_error]655:             ------------------------------------------------------------
connection[CC_log_error]658:             henv=0000025EB7BAD060, conn=0000025EB7BD36E0, status=0, num_stmts=16
connection[CC_log_error]660:             opensearchconn=0000000000000000, stmts=0000025EB7BA2140, lobj_type=-999
connection[CC_log_error]652: CONN ERROR: func=OPENSEARCHAPI_DriverConnect, desc='Error from CC_Connect', errnum=202, errmsg='Connection error: [OpenSearch][SQL ODBC Driver][SQL Plugin] Connection error: SQL plugin is not available, please install the SQL plugin to use this driver.'
connection[CC_log_error]655:             ------------------------------------------------------------
connection[CC_log_error]658:             henv=0000025EB7BAD060, conn=0000025EB7BD36E0, status=0, num_stmts=16
connection[CC_log_error]660:             opensearchconn=0000000000000000, stmts=0000025EB7BA2140, lobj_type=-999
odbcapi30w[SQLGetDiagRecW]208: entering
opensearch[OPENSEARCHAPI_GetDiagRec]50: entering type=2 rec=1
 environ.c[OPENSEARCHAPI_ConnectError]239: entering hdbc=0000025EB7BD36E0 <512>
connection[CC_get_error]629: entering
connection[CC_get_error]641: leaving
 environ.c[OPENSEARCHAPI_ConnectError]256: CC_get_error: status = 202, msg = #Connection error: [OpenSearch][SQL ODBC Driver][SQL Plugin] Connection error: SQL plugin is not available, please install the SQL plugin to use this driver.#
 environ.c[OPENSEARCHAPI_ConnectError]343: 	     szSqlState = '08001',len=156, szError='Connection error: [OpenSearch][SQL ODBC Driver][SQL Plugin] Connection error: SQL plugin is not available, please install the SQL plugin to use this driver.'
opensearch[OPENSEARCHAPI_GetDiagRec]71: leaving 0
win_unicod[utf8_to_ucs2_lf]254: ilen=156 bufcount=512 ocount=156
odbcapi30.[SQLFreeHandle]230: entering
connection[OPENSEARCHAPI_FreeConnect]218: entering...hdbc=0000025EB7BD36E0
connection[CC_Destructor]325: entering self=0000025EB7BD36E0
connection[CC_cleanup]424: entering self=0000025EB7BD36E0
connection[CC_set_error_statements]564: entering self=0000025EB7BD36E0
connection[CC_log_error]652: CONN ERROR: func=CC_cleanup, desc='', errnum=1, errmsg='Connection not open'
connection[CC_log_error]655:             ------------------------------------------------------------
connection[CC_log_error]658:             henv=0000025EB7BAD060, conn=0000025EB7BD36E0, status=0, num_stmts=16
connection[CC_log_error]660:             opensearchconn=0000000000000000, stmts=0000025EB7BA2140, lobj_type=-999
connection[CC_cleanup]439: after LIBOPENSEARCH_disconnect
dlg_specif[CC_conninfo_init]463: entering opt=1
connection[CC_cleanup]505: leaving
connection[CC_Destructor]332: after CC_Cleanup
connection[CC_Destructor]343: after free statement holders
connection[CC_Destructor]354: leaving
connection[OPENSEARCHAPI_FreeConnect]236: leaving...
odbcapi30.[SQLFreeHandle]230: entering
 environ.c[OPENSEARCHAPI_FreeEnv]80: entering env=0000025EB7BAD060
 environ.c[EN_Destructor]453: entering self=0000025EB7BAD060
 environ.c[EN_Destructor]476: clearing conns count=128
 environ.c[EN_Destructor]488: leaving rv=1
 environ.c[OPENSEARCHAPI_FreeEnv]83:    ok

Host/Environment (please complete the following information):
Client - Windows 10 (latest updates)
ODBC Driver - tested with versions 1.1.0.1 and 1.2 - same behavior
Cluster - OpenSearch 1.1.0 (tarball) running on Debian 11 & Fedora 34 hosts (the host parameter was pointed to a Debian host)

Additional context
I'm curious if the 299 Deprecation warning is interfering with the exchange between the ODBC driver and the cluster, but I cannot find a way to shut it off to validate that hypothesis.

@dredwilliams dredwilliams added the bug Something isn't working label Nov 11, 2021
@dredwilliams dredwilliams changed the title [BUG] [BUG] OpenSearch ODBC client will not connect to OpenSearch cluster Nov 11, 2021
@chloe-zh
Copy link
Contributor

We currently are working on the release of ODBC and JDBC drivers for OpenSearch. The release should be working fine with your opensearch cluster. Another workaround is to get the latest installer directly from the source code / GitHub actions cicd workflows, which is not a stable and officially released one though.

@dredwilliams
Copy link
Author

@chloe-zh I'm glad it's being worked, but I pulled the installer that was created at 3pm EST yesterday (commit 65f449b) in the "OpenSearch ODBC Driver" workflow -- same result. The config dialog had a version 1.2.0.0. The logs on the Windows side show nothing different.

@chloe-zh
Copy link
Contributor

Could you check the error log from opensearch side, that would be helpful! Thanks!

@dredwilliams
Copy link
Author

dredwilliams commented Nov 11, 2021

I turned logging up to TRACE

rootLogger.level = trace

in log42j.properties ... and got these two messages in the cluster.log:

[2021-11-11T17:25:51,995][TRACE][o.o.h.AbstractHttpServerTransport] [poggin] Http channel accepted: Netty4HttpChannel{localAddress=/10.0.0.66:9200, remoteAddress=/10.0.0.7:62739}

[2021-11-11T17:25:52,035][TRACE][o.o.h.AbstractHttpServerTransport] [poggin] Http channel accepted: Netty4HttpChannel{localAddress=/10.0.0.66:9200, remoteAddress=/10.0.0.7:62740}

I can find no other trace of the attempt ... but again, I verified that there was data exchanged between the two systems using tcpdump.

Are there any other logging settings I should adjust, or additional places to look?

@dredwilliams
Copy link
Author

UPDATE: I spun up a new cluster for testing purposes, and disabled SSL on the public API (port 9200) -- the ODBC driver connected just fine -- so it is an SSL issue. I turn on SSL and it behaves as described before.

I have loaded (and verified) the CA for the server certificate into the Windows trusted authorities keystore:

  • I can pull up the cluster in a browser with no warnings about insecure certificates
  • I can use 'curl' in a WSL window on the same system with no warnings

So -- it appears that the ODBC driver SSL routines are not respecting/using the system CA store? Am I missing something?

@adcalsie2
Copy link

I'm having the same problems in an open distro cluster. Waiting for solution

@diego2glez
Copy link

@chloe-zh

I'm been experiencing this SSL connection problem since to many OpenDistro versions before.
Seems that this never worked?

@dredwilliams
Copy link
Author

@chloe-zh - Is there any more information I can provide that will help narrow this down?

@davidcui1225
Copy link
Contributor

We have a release for the SQL Drivers including the ODBC client that is launching this week- that is expected to resolve this bug

@dredwilliams
Copy link
Author

@davidcui1225 - if you want me to test, let me know when there is something I can download -- I'd love to get this issue fixed!

@dredwilliams
Copy link
Author

@davidcui1225 - How far down the queue is this to work on? I just downloaded the latest artifact and get the same errors.

@dredwilliams
Copy link
Author

Unfortunately, I'm not seeing any action on resolving either of these issues (this one or #19) -- is there anything I can do to assist?

@anonyiv
Copy link

anonyiv commented Feb 5, 2022

It is a bug related to ssl, you can fix it with the following configuration in opensearch.yml:
plugins.security.ssl.http.clientauth_mode: NONE

@dredwilliams
Copy link
Author

Not totally sure what this does, but it seems that it would either disable SSL for the client connection or disable authentication (or both) -- neither of which is acceptable in my environment. Is this truly the only solution?

@anirudha
Copy link
Collaborator

anirudha commented Feb 8, 2022

we are prioritizing this for an immediate fix and release

@penghuo
Copy link
Collaborator

penghuo commented Mar 2, 2022

Fix in opensearch-project/sql#449

@dredwilliams
Copy link
Author

@penghuo - I don't see anything in opensearch-project/sql#449 that would have impacted this issue. First, I'm not even to the point where I can use Power BI -- and the issue isn't whether I can validate with a certificate, it's whether SSL is even used for the connection.

Am I missing something?

@Yury-Fridlyand
Copy link
Collaborator

opensearch-project/sql#449 has a fix for the Power BI connector.
The fix for the driver would be published soon.

MaxKsyunz referenced this issue in Bit-Quill/opensearch-project-sql Mar 9, 2022
…pensearch-project#696 and 317 all together.

Signed-off-by: Yury Fridlyand <yuryf@bitquilltech.com>
Yury-Fridlyand referenced this issue in Bit-Quill/opensearch-project-sql Mar 9, 2022
…oject#302, opensearch-project#783, opensearch-project#696 and 317 all together.

Signed-off-by: Yury Fridlyand <yuryf@bitquilltech.com>
MaxKsyunz referenced this issue in Bit-Quill/opensearch-project-sql Mar 10, 2022
…pensearch-project#696 and 317 all together.

Signed-off-by: Yury Fridlyand <yuryf@bitquilltech.com>
penghuo referenced this issue in opensearch-project/sql Mar 10, 2022
…gether. (#479)

Signed-off-by: Yury Fridlyand <yuryf@bitquilltech.com>
opensearch-trigger-bot bot referenced this issue in opensearch-project/sql Mar 10, 2022
…gether. (#479)

Signed-off-by: Yury Fridlyand <yuryf@bitquilltech.com>
(cherry picked from commit 646ce3c)
joshuali925 referenced this issue in opensearch-project/sql Mar 10, 2022
…gether. (#479) (#481)

Signed-off-by: Yury Fridlyand <yuryf@bitquilltech.com>
(cherry picked from commit 646ce3c)

Co-authored-by: Yury-Fridlyand <88679692+Yury-Fridlyand@users.noreply.github.com>
@dredwilliams
Copy link
Author

What is the expected release date for a new ODBC driver? I still see the 1.1.0.1 version available on the downloads page.

@joshuali925
Copy link
Member

linking release issue: opensearch-project/opensearch-build#1872
@mengweieric is working on this release

@joshuali925
Copy link
Member

the new drivers (1.4.0.0) are released under bottom of https://opensearch.org/artifacts, let us know if they still have issues

@dharminfadia
Copy link

dharminfadia commented May 20, 2022

the new drivers (1.4.0.0) are released under bottom of https://opensearch.org/artifacts, let us know if they still have issues

Hello @joshuali925
image
latest Driver is install still having same issue

image

I am using Opensearch version is 1.2.4 but still facing issue .

@forestmvey
Copy link
Collaborator

I tested odbc driver versions 1.3.0.0 and 1.4.0.0 and both still ignore the UseSSL flag. When setting
opendistro_security.ssl.http.enabled false on my active node I was able to make a valid connection with both versions when the UseSSL flag has been set.

odbc_test_ssl_1 4 0 0

@anonyiv
Copy link

anonyiv commented May 24, 2022

@forestmvey
@dharminfadia

works correctly
the endpoint must be https enable the advanced option "Enable SSL"

image

image

@acarbonetto
Copy link
Collaborator

@atarhel did you have the config opendistro_security.ssl.http.enabled false set on your node? Is there any other custom configuration on your OS service?
I'm curious to know why it works for you

@anonyiv
Copy link

anonyiv commented May 25, 2022

@atarhel did you have the config opendistro_security.ssl.http.enabled false set on your node? Is there any other custom configuration on your OS service?

I'm curious to know why it works for you

No, I have also tested it with the AWS opensearch service in the cloud, it works without problems.
can you put more information to help you?
check your opensearch log, the odbc driver allows you to enable debug.

@forestmvey
Copy link
Collaborator

forestmvey commented May 25, 2022

Further testing on the ODBC driver version 1.4.0.0 has highlighted some UI issues around the UseSSL flag. When using the prefix https:// a user can connect to a SSL enabled node regardless of the UseSSL flag. If the user does not specify a protocol then the connection will always default to not using SSL. Some sort of error message or UI change should notify a user when the UseSSL flag status does not match a specified host connection protocol. I have outlined the functionality in these truth tables:

odbc_driver_ssl_truth_table drawio

Driver connecting to SSL enabled node with UseSSL flag set:

odbc_ssl_enabled_config
odbc_ssl_enabled_connect

Driver connecting to SSL enabled node with UseSSL flag not set:

odbc_ssl_disabled_config
odbc_ssl_disabled_connect

@acarbonetto
Copy link
Collaborator

Thanks @forestmvey @atarhel seems like a UI issue, not a config or setup issue.
Sounds like we should update the checkbox somehow. I'd propose one of a couple of options:

  1. Remove the checkbox completely and expect the protocol to be included in the URL (or default to http://)
  2. Disable the checkbox when a protocol is specified in the URL
  3. Keep the checkbox, but report an error when the checkbox does not correspond to the URL protocol (error when Enable SSL & http:// is included, or when Not Enable SSL & https:// is included).

@MaxKsyunz
Copy link
Collaborator

My preferences is option 2 -- it's the most user-friendly.

While we are there, HostVerification should be disabled unless HTTPS is used.

@joshuali925
Copy link
Member

Thanks @forestmvey that's helpful. So basically "UseSSL" is ignored right now, as a workaround user just have to use consistent protocol in host and node set up

I agree with option 2 as well, since UseSSL seems redundant if user already put https

@ChristineChetty11
Copy link

Having same issue with current setup:
AWS Managed Opensearch, V1.2

What I want to point out is that I could not use the sql plugin from my lambda function since the path was actually '_opendistro/_sql' not '_plugins/_sql' as it should be.. Maybe this is related somehow?

@acarbonetto
Copy link
Collaborator

It should be checking _opendistro/_sql when using opendistro. It falls back to the alternate path when the first one fails.

@forestmvey
Copy link
Collaborator

@joshuali925 I have created a demo for the fix on this issue with PR-653

odbc_ssl_compliance_fix_demo.mp4

ps48 referenced this issue in opensearch-project/sql Jul 28, 2022
* Disable flaky test in JdbcTestIT. (#475)

Signed-off-by: penghuo <penghuo@gmail.com>

* Update dependency opensearch-ml-client group name (#477)

Signed-off-by: jackieyanghan <jkhanjob@gmail.com>

* Collected fixes related to bugs #280, #302, #783, #696 and 317 all together. (#479)

Signed-off-by: Yury Fridlyand <yuryf@bitquilltech.com>

* Add JDK 8 to CI Matrix  (#483) (#484)

* fixed references in java 8 and added to ci matrix
* filter test that fails due to jdk 8 bug
* use different degree to radian conversion for difference in jdk
* skip date time format tests that cause error due to jdk bug
* only disable DateTime unit test on Java 8

Bypassing failed DCO check

Signed-off-by: David Cui <davidcui@amazon.com>
(cherry picked from commit b6fccbd)

Co-authored-by: David Cui <53581635+davidcui1225@users.noreply.github.com>

* Add parse docs to PPL commands index (#486) (#487)

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* Add 1.3.0 release notes (#492)

Signed-off-by: Eugene Lee <eugenesk@amazon.com>

* Add Kmeans and AD command documentation (#493) (#497)

Signed-off-by: jackieyanghan <jkhanjob@gmail.com>
(cherry picked from commit ee4bce0)

* Bump version to 1.3.1

Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com>

* Bump ml

Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com>

* Add new zip

Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com>

* Updated release drafter

Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com>

* Remove checked-in ml-commons dependency (#529)

Signed-off-by: jackieyanghan <jkhanjob@gmail.com>

* Bump workbench to 1.3.1 (#540)

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* Bug Fix, return default ID when log4j ThreadContext is empty (#538) (#539) (#543)

Signed-off-by: penghuo <penghuo@gmail.com>
(cherry picked from commit 54b7257)

* Incremented version to 1.3.2. (#593)

Signed-off-by: Zelin Hao <zelinhao@amazon.com>
Signed-off-by: Joshua Li <joshuali925@gmail.com>

Co-authored-by: Joshua Li <joshuali925@gmail.com>

* Version bump 1.3.3

Signed-off-by: pgodithi <pgodithi@amazon.com>

* [1.3] Bump spring-beans to 5.2.20 (#632)

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* Version bump 1.3.3

Signed-off-by: pgodithi <pgodithi@amazon.com>

* Incremented version to 1.3.4. (#681)

* Incremented version to 1.3.4.

Signed-off-by: Zelin Hao <zelinhao@amazon.com>

* bump jackson to 2.13.2

Signed-off-by: Joshua Li <joshuali925@gmail.com>

Co-authored-by: Joshua Li <joshuali925@gmail.com>

Co-authored-by: Peng Huo <penghuo@gmail.com>
Co-authored-by: Jackie Han <41348518+jackiehanyang@users.noreply.github.com>
Co-authored-by: Yury-Fridlyand <88679692+Yury-Fridlyand@users.noreply.github.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: David Cui <53581635+davidcui1225@users.noreply.github.com>
Co-authored-by: Eugene Lee <eugenesk@amazon.com>
Co-authored-by: Sayali Gaikawad <gaiksaya@amazon.com>
Co-authored-by: Sayali Gaikawad <61760125+gaiksaya@users.noreply.github.com>
Co-authored-by: Joshua Li <joshuali925@gmail.com>
Co-authored-by: Zelin Hao <87548827+zelinh@users.noreply.github.com>
Co-authored-by: pgodithi <pgodithi@amazon.com>
Co-authored-by: Anirudha (Ani) Jadhav <anirudha@nyu.edu>
@lifayt
Copy link

lifayt commented Nov 4, 2022

I'm having this problem with AWS Managed OpenSearch, both on OpenDistro clusters as well as OpenSearch clusters (7.10 and 1.3 respectively).

Connection error: [OpenSearch][SQL ODBC Driver][SQL Plugin] Connection error: SQL plugin is not available, please install the SQL plugin to use this driver.

The above error shows up regardless of whether or not I configure the connection to use ssl or not. I can access the endpoint via HTTP just fine, but the ODBC connection always fails. Is there a workaround or alternate odbc driver I can use?

@dai-chen dai-chen transferred this issue from opensearch-project/sql Dec 14, 2022
@dlang14
Copy link

dlang14 commented Oct 3, 2023

Im having issues while using Amazon Opensearch Service 1.3 and opensearch-sql-odbc-driver 1.5. Ive tried everything from using Domain endpoint (VPC) name, custom url, using ports 443/9200/none, using http/https/none, enabling/disabling SSL, host verification on/off and no matter what I get:
Connection error: [Opensearch][SQL ODBC Driver][SQL Plugin] Connection error: Failed to establish connection to DB
I've proven connection to the opensearch cluster by using the browser on the EC2 with no issues. Any help/input would be much appreciated.

@andreaskulicke
Copy link

The solution described above worked for me: using "https://" and UseSSL flag. But only for V1.4.0.0. It didn't work for me with V1.5.0.0.

@apilip
Copy link

apilip commented Apr 24, 2024

There is still some issue with version 1.5.0 as described in here:
https://forum.opensearch.org/t/error-when-trying-to-connect-odbc-ssl/18924/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Status: No status
Development

No branches or pull requests