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

RATIS-1747. Support keyManager and trustManager in tlsConfig. #785

Merged
merged 4 commits into from
Nov 18, 2022

Conversation

ChenSammi
Copy link
Contributor

@ChenSammi
Copy link
Contributor Author

Hi @szetszwo , I see currently Ozone is using ratis 2.4.0 release. And it looks like ratis master(3.0) is not compatible with branch-2 in some API. Will we keep on maintaining both branch-2 and master(3.0) for ratis?

@ChenSammi
Copy link
Contributor Author

The failed UT TestWatchRequestWithGrpc is irrelevant. It passed in local.

@szetszwo
Copy link
Contributor

... Will we keep on maintaining both branch-2 and master(3.0) for ratis?

@ChenSammi , we should move Ozone to Ratis 3.0 soon.

Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

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

@ChenSammi , thanks a lot for working on this!

  • For historical reason, we have GrpcTlsConfig. We should deprecate it soon. Please don't add new API to it.
  • We should also update NettyUtils. Then, we may copy some utility methods to GrpcUtil and replace the gRPC code.

See https://issues.apache.org/jira/secure/attachment/13052291/785_review.patch

pom.xml Outdated
@@ -218,6 +218,8 @@
<test.exclude.pattern>_</test.exclude.pattern>
<!-- number of threads/forks to use when running tests in parallel, see parallel-tests profile -->
<testsThreadCount>4</testsThreadCount>

<bouncycastle.version>1.67</bouncycastle.version>
Copy link
Contributor

Choose a reason for hiding this comment

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

Use 1.70. IntelliJ reported some security vulnerabilities on 1.67.

Comment on lines 52 to 61
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>${bouncycastle.version}</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>${bouncycastle.version}</version>
</dependency>
Copy link
Contributor

Choose a reason for hiding this comment

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

Move org.bouncycastle dependencies to ratis-test and add

      <scope>test</scope>

Comment on lines 99 to 102
private final CertificatesConf trustCertificates;
private CertificatesConf trustCertificates;
private TrustManager trustManager;
Copy link
Contributor

Choose a reason for hiding this comment

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

Keep both fields final.

Comment on lines 114 to 128
private final PrivateKeyConf privateKey;
private PrivateKeyConf privateKey;
/** Certificates for the private key. */
private final CertificatesConf keyCertificates;
private CertificatesConf keyCertificates;
private KeyManager keyManager;
Copy link
Contributor

Choose a reason for hiding this comment

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

Keep all the fields final.

Comment on lines 23 to 24
import org.bouncycastle.util.io.pem.PemObject;
import org.bouncycastle.util.io.pem.PemReader;
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's move SecurityTestUtils to ratis-test. Then, we don't have to add org.bouncycastle dependencies to ratis-common.

Comment on lines 91 to 101
public TrustManager getSslTrustManager() {
return Optional.ofNullable(getTrustManager())
.map(TrustManagerConf::getTrustManager)
.orElse(null);
}

public KeyManager getSslKeyManager() {
return Optional.ofNullable(getKeyManager())
.map(KeyManagerConf::getKeyManager)
.orElse(null);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's don't add new API to GrpcTlsConfig, which will be deprecated soon. We should use the API from TlsConf.

@ChenSammi
Copy link
Contributor Author

Thanks @szetszwo . A new patch is uploaded to address the comments.

Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

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

+1 the change looks good.

@szetszwo
Copy link
Contributor

@ChenSammi , thanks a lot for the update! There is conflict. Could you resolve it?

@ChenSammi
Copy link
Contributor Author

Hi @szetszwo , could you help to merge it? I have re-based the patch against the master because there is some file conflict. There is one unit test failure which is irrelevant.

@szetszwo szetszwo merged commit 729d3dc into apache:master Nov 18, 2022
@ChenSammi
Copy link
Contributor Author

Thanks @szetszwo . Could you tell me how to publish a ratis 3.0 snapshot? so it can be used in Ozone master branch.

@szetszwo
Copy link
Contributor

@ChenSammi
Copy link
Contributor Author

I see. I don't have the committer privilege yet. @szetszwo , could you do me a favor and help to publish a 3.0 SNAPSHOT release at your convenient time?

@szetszwo
Copy link
Contributor

@ChenSammi , just have deployed 3.0.0-729d3dc-SNAPSHOT .

@ChenSammi
Copy link
Contributor Author

@szetszwo , thanks a lot.

szetszwo pushed a commit that referenced this pull request Nov 28, 2022
@szetszwo
Copy link
Contributor

@ChenSammi , also deployed 2.4.2-8b8bdda-SNAPSHOT.

symious pushed a commit to symious/ratis that referenced this pull request Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants