-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HADOOP-19306. Support user defined auth Callback in SaslRpcServer. #7140
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
Conversation
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
I'm not knowledgeable enough of this code to review it |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.HADOOP_SECURITY_SASL_MECHANISM_DEFAULT; | ||
import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.HADOOP_SECURITY_SASL_MECHANISM_KEY; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling these values constants is very misleading.
Something like SSLMechanismFactory, SSLMechanismHolder or similar would be a more fitting name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, let's call it SaslMechanismFactory
.
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
Will try rebasing this. |
7372589
to
11ac338
Compare
💔 -1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Nicholas for the PR!
/** | ||
* SASL related constants. | ||
*/ | ||
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we open this open for YARN too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jojochuang , good point! We should also add hbase.
LOG.debug("{} = {} (env)", SASL_MECHANISM_ENV, envValue); | ||
|
||
// conf | ||
final Configuration conf = new Configuration(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a little concerned about this one.
If an application loads configuration from a custom path, SaslMechanismFactory initialized this way will load configurations from default path, and results in unexpected behavior to the user.
And that is a potential security issue. I had some grief over similar problems before, see: HADOOP-13638
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I seems to recall similar pr B41A oblem so that I did not use conf previously. Cc @stoty
@jojochuang , If we use new Configuration(false)
, the value is not set when the application loads configuration from a custom path. That application must set env variable. Is it okay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't follow the issue here.
Is it about adding config files to the classpath dynamically ?
Is SaslMechanismFactory reading the Configuration too early ?
It should be possble (with more changes) to load the mechanism lazily, when SASL is used first.
IMO having to configure this from an environment variable would be an operational nightmare.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be possble (with more changes) to load the mechanism lazily, when SASL is used first.
The is already loaded mechanism lazily. The class won't be loaded unless it is used.
In our case, it should be fine since conf will be loaded during a SASL server/client is being created. The conf path must be set at that time. (UserGroupInformation
has a different story since it may have to logged in before starting a server/client.)
IMO having to configure this from an environment variable would be an operational nightmare.
Hadoop security tends to use environment variable since conf may not available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest of PR looks good to me. This part I'm not sure. So what about the normal case, like YARN Resource Manager, do they also get the value from env variable? Then what's the use of the configuration object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... So what about the normal case, like YARN Resource Manager, do they also get the value ?
They can get it either from env variable or from conf.
Then what's the use of the configuration object?
@stoty has pointed that env variable is inconvenient since the other RPC parameters are specified using conf. He has tested it with existing code. BTW, he is working on changing HBase asyncfs for the configurable SASL mechanism.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jojochuang , @stoty , unfortunately, UserGroupInformation is statically referring to SaslMechanismFactory
(via SaslRpcServer.AuthMethod
) as @steveloughran discovered. We may need to remove the conf support from SaslMechanismFactory
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are able to use reflection to implement lazy loading of SaslMechanismFactory
; see #7173
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslConstants.java
Show resolved
Hide resolved
.../src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslDataTransferServer.java
Outdated
Show resolved
Hide resolved
💔 -1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
@jojochuang , @stoty , thanks a lot for reviewing this! |
@szetszwo now all my test run logs are full of stuff
stack trace from the debugger implies this is UGI.initialize() calling SaslRpcServer, whose
Please downgrade to debug ASAP. thanks |
@steveloughran , thanks for letting me know.
|
Filed HADOOP-19342. |
Description of PR
HADOOP-19306
Similar to HDFS-17576, SaslRpcServer should support CustomizedCallbackHandler.
How was this patch tested?
Added new test cases
For code changes:
LICENSE
,LICENSE-binary
,NOTICE-binary
files?