You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "Aaron T. Myers (JIRA)" <ji...@apache.org> on 2012/09/06 00:44:07 UTC
[jira] [Created] (HDFS-3893) QJM: Make QJM work with security
enabled
Aaron T. Myers created HDFS-3893:
------------------------------------
Summary: QJM: Make QJM work with security enabled
Key: HDFS-3893
URL: https://issues.apache.org/jira/browse/HDFS-3893
Project: Hadoop HDFS
Issue Type: Sub-task
Components: name-node, security
Affects Versions: QuorumJournalManager (HDFS-3077)
Reporter: Aaron T. Myers
Assignee: Aaron T. Myers
Currently the QJM does not work when security is enabled. The quorum cannot be formatted, the NN and SBN cannot communicate with the JNs, and JNs cannot synchronize edit logs with each other.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (HDFS-3893) QJM: Make QJM work with security
enabled
Posted by "Todd Lipcon (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HDFS-3893?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13449498#comment-13449498 ]
Todd Lipcon commented on HDFS-3893:
-----------------------------------
Looks pretty good.
Only one more question which may belie my ignorance:
We have the following annotation on the QJournalProtocol:
{code}
@KerberosInfo(
serverPrincipal = DFSConfigKeys.DFS_JOURNALNODE_USER_NAME_KEY,
clientPrincipal = DFSConfigKeys.DFS_NAMENODE_USER_NAME_KEY)
{code}
How does that interact with the new service-level ACL that you've added? Also, what is the behavior of the ACL when it is not present in hadoop-policy.xml (eg if a user just upgrades from an earlier version). We need to make sure that the defaults are all set up such that non-superusers don't have IPC access to the JNs. Either that or we need to add a authorization check in each RPC that it is an allowed requester (like we do for the HTTP authorization).
Put another way, this patch looks good in terms of making sure the JN _works_ with security on, but just want to double check a few things to ensure that it is _secure_ when security is turned on.
> QJM: Make QJM work with security enabled
> ----------------------------------------
>
> Key: HDFS-3893
> URL: https://issues.apache.org/jira/browse/HDFS-3893
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: name-node, security
> Affects Versions: QuorumJournalManager (HDFS-3077)
> Reporter: Aaron T. Myers
> Assignee: Aaron T. Myers
> Attachments: HDFS-3893.patch, HDFS-3893.patch
>
>
> Currently the QJM does not work when security is enabled. The quorum cannot be formatted, the NN and SBN cannot communicate with the JNs, and JNs cannot synchronize edit logs with each other.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (HDFS-3893) QJM: Make QJM work with security
enabled
Posted by "Aaron T. Myers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HDFS-3893?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13450069#comment-13450069 ]
Aaron T. Myers commented on HDFS-3893:
--------------------------------------
To be explicit, it is not the case that one needs a value for the new ACL set in hadoop-policy.xml. It is the case, however, that we do need to have an ACL for this protocol. That's taken care of by the change in HDFSPolicyProvider that's in this patch.
> QJM: Make QJM work with security enabled
> ----------------------------------------
>
> Key: HDFS-3893
> URL: https://issues.apache.org/jira/browse/HDFS-3893
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: name-node, security
> Affects Versions: QuorumJournalManager (HDFS-3077)
> Reporter: Aaron T. Myers
> Assignee: Aaron T. Myers
> Attachments: HDFS-3893.patch, HDFS-3893.patch
>
>
> Currently the QJM does not work when security is enabled. The quorum cannot be formatted, the NN and SBN cannot communicate with the JNs, and JNs cannot synchronize edit logs with each other.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (HDFS-3893) QJM: Make QJM work with security
enabled
Posted by "Aaron T. Myers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HDFS-3893?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Aaron T. Myers resolved HDFS-3893.
----------------------------------
Resolution: Fixed
Fix Version/s: QuorumJournalManager (HDFS-3077)
Hadoop Flags: Reviewed
Thanks a lot for the review, Todd. I've just committed this to the HDFS-3077 branch.
> QJM: Make QJM work with security enabled
> ----------------------------------------
>
> Key: HDFS-3893
> URL: https://issues.apache.org/jira/browse/HDFS-3893
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: name-node, security
> Affects Versions: QuorumJournalManager (HDFS-3077)
> Reporter: Aaron T. Myers
> Assignee: Aaron T. Myers
> Fix For: QuorumJournalManager (HDFS-3077)
>
> Attachments: HDFS-3893.patch, HDFS-3893.patch
>
>
> Currently the QJM does not work when security is enabled. The quorum cannot be formatted, the NN and SBN cannot communicate with the JNs, and JNs cannot synchronize edit logs with each other.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (HDFS-3893) QJM: Make QJM work with security
enabled
Posted by "Aaron T. Myers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HDFS-3893?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Aaron T. Myers updated HDFS-3893:
---------------------------------
Attachment: HDFS-3893.patch
Here's a patch which addresses the issue. The gist is simply that we had the wrong principals configured in a few places, and in a few other places we were making RPCs or authenticated HTTP requests without providing any credentials.
No tests are included since security must be enabled to test this. I tested this manually by ensuring that all of the following works when security is enabled with the patch, but not without:
# Formatting an NN which is using the QJM.
# An NN is able to fetch edits files from the JNs.
# When the JNs get out of sync, the JNs are able to fetch edits from each other during recovery.
# The standby NN is able to fetch edits from the JNs.
Additionally, I also ran all of the existing QJM tests with this patch applied, and confirmed that they all passed.
> QJM: Make QJM work with security enabled
> ----------------------------------------
>
> Key: HDFS-3893
> URL: https://issues.apache.org/jira/browse/HDFS-3893
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: name-node, security
> Affects Versions: QuorumJournalManager (HDFS-3077)
> Reporter: Aaron T. Myers
> Assignee: Aaron T. Myers
> Attachments: HDFS-3893.patch
>
>
> Currently the QJM does not work when security is enabled. The quorum cannot be formatted, the NN and SBN cannot communicate with the JNs, and JNs cannot synchronize edit logs with each other.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (HDFS-3893) QJM: Make QJM work with security
enabled
Posted by "Todd Lipcon (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HDFS-3893?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13449282#comment-13449282 ]
Todd Lipcon commented on HDFS-3893:
-----------------------------------
- Can you refactor the code which lists all of the NN principals in the configuration into a new method in {{HAUtil}} perhaps? eg {{HAUtil.getAllNamenodePrincipals}}? Or if it seems better, one that returns a list of Configurations, one for each NN in the cluster? {{HAUtil.getAllNameNodeConfs()}}. Seems like a lot of code to inline here in the context of this servlet.
- Can you explain why we have two different principals, one for RPC and one for SPNEGO? i.e what is "DFS_JOURNALNODE_INTERNAL_SPNEGO_USER_NAME_KEY"? I know I put it there in the first place, but I was just cargo-culting and could stand to learn something here.
- The SecurityUtil stuff in {{EditLogFileInputStream}} is a little gross. I wouldn't expect to see it at this layer, especially not with the login user. I think a slight improvement would be {{UserGroupInformation.getCurrentUser().doAs()}} so that we support non-login-user access if a daemon has multiple principals associated. Better would be to figure out who the callers are and make sure that their main loops are properly authenticated (eg how EditLogTailer has a {{doAs}} around its loop).
- In the NN, do we also need to add login calls for {{initializeSharedEdits}} and {{bootstrapStandby}}?
> QJM: Make QJM work with security enabled
> ----------------------------------------
>
> Key: HDFS-3893
> URL: https://issues.apache.org/jira/browse/HDFS-3893
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: name-node, security
> Affects Versions: QuorumJournalManager (HDFS-3077)
> Reporter: Aaron T. Myers
> Assignee: Aaron T. Myers
> Attachments: HDFS-3893.patch
>
>
> Currently the QJM does not work when security is enabled. The quorum cannot be formatted, the NN and SBN cannot communicate with the JNs, and JNs cannot synchronize edit logs with each other.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (HDFS-3893) QJM: Make QJM work with security
enabled
Posted by "Todd Lipcon (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HDFS-3893?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13450072#comment-13450072 ]
Todd Lipcon commented on HDFS-3893:
-----------------------------------
Gotcha, +1 then, thanks for the hard work on this.
> QJM: Make QJM work with security enabled
> ----------------------------------------
>
> Key: HDFS-3893
> URL: https://issues.apache.org/jira/browse/HDFS-3893
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: name-node, security
> Affects Versions: QuorumJournalManager (HDFS-3077)
> Reporter: Aaron T. Myers
> Assignee: Aaron T. Myers
> Attachments: HDFS-3893.patch, HDFS-3893.patch
>
>
> Currently the QJM does not work when security is enabled. The quorum cannot be formatted, the NN and SBN cannot communicate with the JNs, and JNs cannot synchronize edit logs with each other.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (HDFS-3893) QJM: Make QJM work with security
enabled
Posted by "Aaron T. Myers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HDFS-3893?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13449843#comment-13449843 ]
Aaron T. Myers commented on HDFS-3893:
--------------------------------------
bq. How does that interact with the new service-level ACL that you've added?
Unfortunately, the service-level ACL _has_ to be configured in order for this to work. The first few lines in ServiceAuthorizationManager#authorize are:
{code}
AccessControlList acl = protocolToAcl.get(protocol);
if (acl == null) {
throw new AuthorizationException("Protocol " + protocol +
" is not known.");
}
{code}
After that, we get the info on the expected client principal from the protocol annotation:
{code}
KerberosInfo krbInfo = SecurityUtil.getKerberosInfo(protocol, conf);
...
String clientKey = krbInfo.clientPrincipal();
...
clientPrincipal = SecurityUtil.getServerPrincipal(conf.get(clientKey), addr);
{code}
Finally, we authorize the user by ensuring that the user matches the clientPrincipal if present in the annotation _and_ that they're allowed by the ACL:
{code}
if((clientPrincipal != null && !clientPrincipal.equals(user.getUserName())) ||
!acl.isUserAllowed(user)) {
AUDITLOG.warn(AUTHZ_FAILED_FOR + user + " for protocol=" + protocol
+ ", expected client Kerberos principal is " + clientPrincipal);
throw new AuthorizationException("User " + user +
" is not authorized for protocol " + protocol +
", expected client Kerberos principal is " + clientPrincipal);
}
{code}
So, I think the code is good as-is, i.e. only super users can access this protocol interface.
> QJM: Make QJM work with security enabled
> ----------------------------------------
>
> Key: HDFS-3893
> URL: https://issues.apache.org/jira/browse/HDFS-3893
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: name-node, security
> Affects Versions: QuorumJournalManager (HDFS-3077)
> Reporter: Aaron T. Myers
> Assignee: Aaron T. Myers
> Attachments: HDFS-3893.patch, HDFS-3893.patch
>
>
> Currently the QJM does not work when security is enabled. The quorum cannot be formatted, the NN and SBN cannot communicate with the JNs, and JNs cannot synchronize edit logs with each other.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (HDFS-3893) QJM: Make QJM work with security
enabled
Posted by "Aaron T. Myers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HDFS-3893?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Aaron T. Myers updated HDFS-3893:
---------------------------------
Attachment: HDFS-3893.patch
Thanks a lot for the review, Todd. Here's a patch which should address your comments.
bq. Can you refactor the code which lists all of the NN principals in the configuration into a new method in HAUtil perhaps? eg HAUtil.getAllNamenodePrincipals? Or if it seems better, one that returns a list of Configurations, one for each NN in the cluster? HAUtil.getAllNameNodeConfs(). Seems like a lot of code to inline here in the context of this servlet.
Refactored this into DFSUtil#getAllNnPrincipals. I put it in DFSUtil since it's not really HA-specific.
bq. Can you explain why we have two different principals, one for RPC and one for SPNEGO? i.e what is "DFS_JOURNALNODE_INTERNAL_SPNEGO_USER_NAME_KEY"? I know I put it there in the first place, but I was just cargo-culting and could stand to learn something here.
The issue is that the HTTP server _must_ log in as a principal whose first component is "HTTP". This is part of the SPNEGO spec, and cannot be deviated from. I suppose we could have the JN do all of its other work as the "HTTP" principal, but that seems a little bizarre.
bq. The SecurityUtil stuff in EditLogFileInputStream is a little gross. I wouldn't expect to see it at this layer, especially not with the login user. I think a slight improvement would be UserGroupInformation.getCurrentUser().doAs() so that we support non-login-user access if a daemon has multiple principals associated. Better would be to figure out who the callers are and make sure that their main loops are properly authenticated (eg how EditLogTailer has a doAs around its loop).
Changed it to use the current user instead of the login user.
bq. In the NN, do we also need to add login calls for initializeSharedEdits and bootstrapStandby?
BootstrapStandby was already taking care of this, but you're right that it now needs to be there for the initializeSharedEdits command. The latest patch fixes this. Good catch.
> QJM: Make QJM work with security enabled
> ----------------------------------------
>
> Key: HDFS-3893
> URL: https://issues.apache.org/jira/browse/HDFS-3893
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: name-node, security
> Affects Versions: QuorumJournalManager (HDFS-3077)
> Reporter: Aaron T. Myers
> Assignee: Aaron T. Myers
> Attachments: HDFS-3893.patch, HDFS-3893.patch
>
>
> Currently the QJM does not work when security is enabled. The quorum cannot be formatted, the NN and SBN cannot communicate with the JNs, and JNs cannot synchronize edit logs with each other.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira