Skip to content

Conversation

@dev-lpq
Copy link
Contributor

@dev-lpq dev-lpq commented Nov 16, 2023

🔍 Description

Backport apache/hive#4262

Issue References 🔗

This pull request fixes ##5713

Describe Your Solution 🔧

trustStorePassword is not a necessary parameter in connection URL. Connection can be established without it.

From the javadocs Link A password may be given to unlock the keystore (e.g. the keystore resides on a hardware token device), or to check the integrity of the keystore data. If a password is not given for integrity checking, then integrity checking is not performed.
In order to create an empty keystore, or if the keystore cannot be initialized from a stream, pass null as the stream argument.

Reference PR comes from HIVE-27271

Types of changes 🔖

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Test Plan 🧪

Behavior Without This Pull Request ⚰️

Behavior With This Pull Request 🎉

Related Unit Tests


Checklists

📝 Author Self Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • This patch was not authored or co-authored using Generative Tooling

📝 Committer Pre-Merge Checklist

  • Pull request title is okay.
  • No license issues.
  • Milestone correctly set?
  • Test coverage is ok
  • Assignees are selected.
  • Minimum number of approvals
  • No changes are requested

Be nice. Be informative.

…tore specified without trustStorePassword in the JDBC URL
@codecov-commenter
Copy link

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (23f32cf) 61.43% compared to head (c1011e4) 61.41%.

Files Patch % Lines
.../org/apache/kyuubi/jdbc/hive/KyuubiConnection.java 0.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5712      +/-   ##
============================================
- Coverage     61.43%   61.41%   -0.03%     
  Complexity       23       23              
============================================
  Files           607      607              
  Lines         35735    35737       +2     
  Branches       4896     4898       +2     
============================================
- Hits          21955    21948       -7     
+ Misses        11402    11400       -2     
- Partials       2378     2389      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@turboFei
Copy link
Member

This pr backport apache/hive@36bd69e

@turboFei turboFei changed the title Support client connection when transportMode=http,ssl=true, sslTrustStore specified without trustStorePassword in the JDBC URL Backport HIVE-27271: Client connection to HS2 fails when transportMode=http, s… …sl=true, sslTrustStore specified without trustStorePassword in the JDBC URL Nov 16, 2023
@turboFei turboFei changed the title Backport HIVE-27271: Client connection to HS2 fails when transportMode=http, s… …sl=true, sslTrustStore specified without trustStorePassword in the JDBC URL Backport HIVE-27271: Client connection to HS2 fails when transportMode=http, ssl=true, sslTrustStore specified without trustStorePassword in the JDBC URL Nov 16, 2023
try (FileInputStream fis = new FileInputStream(sslTrustStorePath)) {
sslTrustStore.load(fis, sslTrustStorePassword.toCharArray());
sslTrustStore.load(
fis, sslTrustStorePassword != null ? sslTrustStorePassword.toCharArray() : null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line is not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run mvn spotless:apply, automatically applies rule to a new line.

try (FileInputStream fis = new FileInputStream(trustStorePath)) {
sslTrustStore.load(fis, trustStorePassword.toCharArray());
sslTrustStore.load(
fis, trustStorePassword != null ? trustStorePassword.toCharArray() : null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line is not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run mvn spotless:apply, automatically applies rule to a new line.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks for the explantation

Copy link
Member

@turboFei turboFei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line is not needed

Refer: apache/hive#4262

@yaooqinn yaooqinn changed the title Backport HIVE-27271: Client connection to HS2 fails when transportMode=http, ssl=true, sslTrustStore specified without trustStorePassword in the JDBC URL [KYUUBI #5713] Backport HIVE-27271: Client connection to HS2 fails when transportMode=http, ssl=true, sslTrustStore specified without trustStorePassword in the JDBC URL Nov 16, 2023
@turboFei turboFei modified the milestones: v1.8.1, v1.7.4 Nov 17, 2023
@pan3793 pan3793 closed this in 0bcd107 Nov 17, 2023
pan3793 pushed a commit that referenced this pull request Nov 17, 2023
…en transportMode=http, ssl=true, sslTrustStore specified without trustStorePassword in the JDBC URL

# 🔍 Description
Backport apache/hive#4262
## Issue References 🔗

This pull request fixes ##5713

## Describe Your Solution 🔧

trustStorePassword is not a necessary parameter in connection URL. Connection can be established without it.

From the javadocs [Link](https://docs.oracle.com/javase/7/docs/api/java/security/KeyStore.html#load(java.io.InputStream,%20char%5B%5D)) A password may be given to unlock the keystore (e.g. the keystore resides on a hardware token device), or to check the integrity of the keystore data. If a password is not given for integrity checking, then integrity checking is not performed.
In order to create an empty keystore, or if the keystore cannot be initialized from a stream, pass null as the stream argument.

Reference PR comes from HIVE-27271

## Types of changes 🔖

- [x] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Test Plan 🧪

#### Behavior Without This Pull Request ⚰️

#### Behavior With This Pull Request 🎉

#### Related Unit Tests

---

# Checklists
## 📝 Author Self Checklist

- [ ] My code follows the [style guidelines](https://kyuubi.readthedocs.io/en/master/contributing/code/style.html) of this project
- [ ] I have performed a self-review
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html)

## 📝 Committer Pre-Merge Checklist

- [x] Pull request title is okay.
- [x] No license issues.
- [x] Milestone correctly set?
- [ ] Test coverage is ok
- [x] Assignees are selected.
- [x] Minimum number of approvals
- [x] No changes are requested

**Be nice. Be informative.**

Closes #5712 from dev-lpq/ssl_http_store.

Closes #5713

c1011e4 [pengqli] Support client connection when transportMode=http,ssl=true, sslTrustStore specified without trustStorePassword in the JDBC URL

Authored-by: pengqli <pengqli@cisco.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
(cherry picked from commit 0bcd107)
Signed-off-by: Cheng Pan <chengpan@apache.org>
pan3793 pushed a commit that referenced this pull request Nov 17, 2023
…en transportMode=http, ssl=true, sslTrustStore specified without trustStorePassword in the JDBC URL

# 🔍 Description
Backport apache/hive#4262
## Issue References 🔗

This pull request fixes ##5713

## Describe Your Solution 🔧

trustStorePassword is not a necessary parameter in connection URL. Connection can be established without it.

From the javadocs [Link](https://docs.oracle.com/javase/7/docs/api/java/security/KeyStore.html#load(java.io.InputStream,%20char%5B%5D)) A password may be given to unlock the keystore (e.g. the keystore resides on a hardware token device), or to check the integrity of the keystore data. If a password is not given for integrity checking, then integrity checking is not performed.
In order to create an empty keystore, or if the keystore cannot be initialized from a stream, pass null as the stream argument.

Reference PR comes from HIVE-27271

## Types of changes 🔖

- [x] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Test Plan 🧪

#### Behavior Without This Pull Request ⚰️

#### Behavior With This Pull Request 🎉

#### Related Unit Tests

---

# Checklists
## 📝 Author Self Checklist

- [ ] My code follows the [style guidelines](https://kyuubi.readthedocs.io/en/master/contributing/code/style.html) of this project
- [ ] I have performed a self-review
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html)

## 📝 Committer Pre-Merge Checklist

- [x] Pull request title is okay.
- [x] No license issues.
- [x] Milestone correctly set?
- [ ] Test coverage is ok
- [x] Assignees are selected.
- [x] Minimum number of approvals
- [x] No changes are requested

**Be nice. Be informative.**

Closes #5712 from dev-lpq/ssl_http_store.

Closes #5713

c1011e4 [pengqli] Support client connection when transportMode=http,ssl=true, sslTrustStore specified without trustStorePassword in the JDBC URL

Authored-by: pengqli <pengqli@cisco.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
(cherry picked from commit 0bcd107)
Signed-off-by: Cheng Pan <chengpan@apache.org>
@pan3793
Copy link
Member

pan3793 commented Nov 17, 2023

Thanks, merged to master/1.8.1/1.7.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants