-
Notifications
You must be signed in to change notification settings - Fork 119
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
Getting Unknown authType: GENERIC when connecting to postgres #1983
Comments
Hi @tamirhad, It looks like the DataProc runtime has changed the default crypto library used in Java from whatever is built into the VM to Conscrypt. As a work-around, you might look for a way to instruct your DataProc app to use default JVM crypto libraries, or the BouncyCastle instead of Conscript. I will try to reproduce this problem outside of DataProc by running the connector with the Conscrypt crypto library. -Jonathan |
@tamirhad I was able to write an integration test that connected successfully to a real Cloud SQL instance using the Google Conscript crypto library for Java. This evidence suggests that the problem is not with the crypto library. There is something curious I noticed in the log you posted:
This IP address is in the metadata for the Cloud SQL instance. Is this the private IP address that you expect, or is possible that there is something funny with that IP Address? |
@hessjcg Thanks for looking into it so quickly! I masked the ip address due to privacy reasons. The real ip is also private ip but from the class A range (10.x.x.x). |
@tamirhad Ok, that makes a lot more sense, thanks for clarifying. I think you are right that this is an incompatibility between OpenJDK and Conscript's use of I'm going to retry my test case using Conscrypt crypto with IAM Authentication enabled, and then implement the workaround described in Conscrypt #1033 |
I was able to reproduce the exception by modifying my local JDK to use Conscrypt as the primary crypto provider. I edited the JDK file
to
Then I ran Unfortunately, due to the fact that the JVM needs to be manually configured to prioritize the Conscrypt JCE implementation, I don't think there is a good way to automate the tests for this fix. |
… (#1993) This is a workaround for an underlying bug in the Google Conscrypt crypto library google/conscrypt #1033. The root cause is that the Conscrypt and OpenJDK X509 certificate libraries sometimes interpret the AuthType field differently: Conscrypt finds 'GENERIC' auth type when OpenJDK finds 'UNKNOWN' auth type. This causes certificate validation to fail. The workaround implemented here is to add a delegate TrustManager that replaces 'GENERIC' auth type with 'UNKNOWN' auth type so that the Conscrypt crypto plays nice with the JDK crypto. See comment on #1033. I manually tested this on a modified JVM that used Conscrypt as it's primary crypto library. The integration tests passed. I have not found a good way to make this test part of the test suite. Fixes #1983
Bug Description
When trying to connect to postgresql running on cloudSQL I am getting the following error:
javax.net.ssl.SSLHandshakeException: Unknown authType: GENERIC
I came across this issue when looking at the stacktrace: google/conscrypt#1033 but I couldnt find any workaround.
The code is running perfectly when executed on my Mac, but when running on DataProc I am getting this error.
Example code (or command)
No response
Stacktrace
Steps to reproduce?
...
Environment
Additional Details
No response
The text was updated successfully, but these errors were encountered: