Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

GIRAPH-1251: Add optional SSLHandler for all Netty Communication #150

Closed
wants to merge 1 commit into from

Conversation

atanu1991
Copy link
Contributor

@atanu1991 atanu1991 commented Apr 19, 2021

GIRAPH-1251: Add optional SSLHandler for all Netty Communication
With this change its possible to encrypt all communication via Netty
with SSL Handler. It also exposes function to add custom authn and
authz checks on tls handshake complete. Once this flag is set, all
Netty traffic will be ensured to be encrypted.

Testing:

  • mvn clean verify passes.
  • When the sslEncrypt flag is off there were no changes to the existing workflow.
  • On enabling the flag (sslEncrypt) and having a custom
    SSL Event Handler, thhe performance was varied, on some test cases
    there was an improvement in perf (+25%), while few others showed
    ~30+% degrade. Initial tests didnt give any strong indications
    of severe performance degrade throghout.

@atanu1991 atanu1991 force-pushed the netty branch 4 times, most recently from 628570e to 55013ce Compare April 23, 2021 14:48
@dlogothetis
Copy link
Contributor

Can you add a high-level description of how the authentication mechanism works and also how this was tested?

Comment on lines 1350 to 1353
/** SSLConfigReader class - optional */
ClassConfOption<SSLConfigReader> SSL_CONFIG_READER_CLASS =
ClassConfOption.create("giraph.sslConfigReader",
null, SSLConfigReader.class,
"SSLConfigReader class - optional");

/** SSLEventHandler class - optional */
ClassConfOption<SSLEventHandler> SSL_EVENT_HANDLER_CLASS =
ClassConfOption.create("giraph.sslEventHandler",
null, SSLEventHandler.class,
"SSLEventHandler class - optional");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you describe in the documentation what these are?

import javax.net.ssl.SSLException;

/**
* Utility class for all SSL related functions
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this doesn't look like the typical utility class

extends ImmutableClassesGiraphConfigurable
{
/**
* Read certificate authority Path from Env variable
Copy link
Contributor

Choose a reason for hiding this comment

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

Regarding the naming of the methods, is the assumption that everything is is going to be read from environment variables? If not, maybe choose different naming?

* @param client whether it is the client or server involved
* @param sslHandler the SslHandler
*/
void handleOnSslHandshakeComplete(boolean client,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: name the boolean isClient?

* @param keyPath key file path
*/
public SslConfig(
boolean client, VerifyMode verifyMode, String caPath,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: name isClient?

Comment on lines 244 to 268
this.caPath = CA_PATH.get(conf);

if (sslConfigReader != null) {
String envVarTlsCAPath = sslConfigReader.readCAPathFromEnv();
if (envVarTlsCAPath != null) {
this.caPath = envVarTlsCAPath;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason for having both a Giraph option for the path and a Giraph option for the SslConfigReader class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed this logic

if (!future.isSuccess()) {
throw new SSLException("SSL Handshake failure", future.cause());
}
if (sslEventHandler != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why would we create a NettySSLHandler, if this is not defined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its not necessary to have sslEventHandler (onSslHandshakeComplete) event defined. Its required for facebook use case where we need to do custom authn and authz. If you want the default behavior then do nothing on onSslHandshakeComplete. So sslEventHandler is null by default

@atanu1991 atanu1991 force-pushed the netty branch 4 times, most recently from f8a452d to 8d715bb Compare May 1, 2021 01:38
@atanu1991
Copy link
Contributor Author

Can you add a high-level description of how the authentication mechanism works and also how this was tested?

In the summary you mean?

@atanu1991 atanu1991 force-pushed the netty branch 2 times, most recently from 5073094 to 675c7f1 Compare May 7, 2021 21:50
@atanu1991 atanu1991 changed the title GIRAPH-1251: Add SSLHandler for all Netty Communication (Initial diff) GIRAPH-1251: Add optional SSLHandler for all Netty Communication May 14, 2021
Copy link
Contributor

@dlogothetis dlogothetis left a comment

Choose a reason for hiding this comment

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

Can you add a high-level description of how the authentication mechanism works and also how this was tested?

In the summary you mean?

Yes, please add in the summary a description and also a summary of how this was tested. Please do run mvn clean verify as well.

Also, can you comment here about the optimizations you have identified, for instance, you mentioned not creating the ssl config multiple times.

@dlogothetis
Copy link
Contributor

Also, have we checked whether performance is impacted?

@atanu1991
Copy link
Contributor Author

Performance will be impacted quite a bit. The testing of that is something planned for next half. For now we have to block the migration,

@dlogothetis
Copy link
Contributor

dlogothetis commented May 14, 2021 via email

@atanu1991 atanu1991 force-pushed the netty branch 3 times, most recently from 7a35d43 to 3f196b2 Compare May 19, 2021 20:21
With this change its possible to encrypt all communication via Netty
with SSL Handler. It also exposes function to add custom authn and
authz checks on tls handshake complete. Once this flag is set, all
Netty traffic will be ensured to be encrypted.

Testing:

- mvn clean verify passes.
- When the sslEncrypt flag is off there were no changes to the existing workflow.
- On enabling the flag (sslEncrypt) and having a custom
SSL Event Handler, there was no performance hit. A standard set of tests were
run with and without this flag in the same enviornment and the results showed
-5% to 5% difference in total CPU time utilized by the jobs. This is within
acceptable limits and is normal variance.
@asfgit asfgit closed this in 2c63aa2 Jun 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants