From common-issues-return-150297-archive-asf-public=cust-asf.ponee.io@hadoop.apache.org Sun Mar 25 08:44:06 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id E030F18067E for ; Sun, 25 Mar 2018 08:44:05 +0200 (CEST) Received: (qmail 89996 invoked by uid 500); 25 Mar 2018 06:44:04 -0000 Mailing-List: contact common-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-issues@hadoop.apache.org Received: (qmail 89981 invoked by uid 99); 25 Mar 2018 06:44:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 Mar 2018 06:44:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 370041A033B for ; Sun, 25 Mar 2018 06:44:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -101.511 X-Spam-Level: X-Spam-Status: No, score=-101.511 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id ftTy_E5m0LPZ for ; Sun, 25 Mar 2018 06:44:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id D97FB5F3CD for ; Sun, 25 Mar 2018 06:44:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id B2A4FE00B4 for ; Sun, 25 Mar 2018 06:44:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 40AC8214F6 for ; Sun, 25 Mar 2018 06:44:00 +0000 (UTC) Date: Sun, 25 Mar 2018 06:44:00 +0000 (UTC) From: "Rushabh S Shah (JIRA)" To: common-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HADOOP-14445) Delegation tokens are not shared between KMS instances MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HADOOP-14445?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16= 412915#comment-16412915 ]=20 Rushabh S Shah commented on HADOOP-14445: ----------------------------------------- Thanks [~xiaochen] for the revision. [~daryn] shared his concerns offline that this patch is dependent on confi= g key and we will live with the baggage of 2 tokens forever. I will request him to review asap. But below are my review comments Mostly all are minor. +KMSClientProvider.java+ 1. {{KMSCP#addTokenToCredentials}} I don't agree with the method name. The method name suggests that we are j= ust adding token to credentials object. But we are doing much more in this method. I would add {{credentials.addToken}} line to calling method {{addDelegatio= nTokens}} and rename method {{addTokenToCredentials}} to something like {{c= reateLegacyKmsToken}} and add some javadoc to it saying that creating this token is dependent on= conf key {{KMS_CLIENT_COPY_LEGACY_TOKEN_KEY}}. +DelegationTokenAuthenticatedURL.java+ 1. Lets change the {{selectDelegationToken}} to {{getDelegationToken}}. In the base implementation, we are not implementing any Selector. We are just getting the token based on the service field. In {{KMSCP}} we can change the method name {{getKMSToken}} to {{selectKMST= oken}} because there we are implementing {{TokenSelector}}. +core-default.xml+ {quote}With the default value set to true, the client will locally duplicat= e the KMS_DELEGATION_TOKEN token and create a kms-dt token, all other parts= of the token remain the same. {quote} Technically this is not true. The service is also changed. I am sorry I _should have_ mentioned all the above comments in the previous= review. +TestKMS.java+ 1. This is unrelated to patch. Do we really want to stop kdc after every test ? 2. {{providersCreated}}: Should this be a list or just {{KeyProvider}} ? It will always create {{LoadBalancingKeyProivder}}=C2=A0which internally i= s a set of {{KeyProvider}}. {{LoadBalancingKMSCP}} never throws IOException back. It just swallows all= the {{IOException}} and just logs it. Maybe we might want to return MultipleIOException from {{LoadBalancingKMSC= P#close}}. Totally fine if we want to do it as a separate jira. But as far as this jira is concerned, we can get rid of {{MultipleIOExcept= ion}} related changes and can just change it to {{IOException}}. 3. {{testKMSHAZKDelegationTokenRenewCancel(final Text tokenKind)}} Unable to understand why were are calling {{setupConfForToken}} multiple t= imes. If we filter out all tokens other than passed {{tokenKind}}, then we can j= ust call {{setupConfForToken}} once at the start. That way the code will be more=C2=A0clean and=C2=A0_will only_ work on {{t= oken =3D=3D tokenKind}}. In short just one for loop, filter out the token at the start and test ren= ew, cancel and again renew(which should fail) in sequence. 4. {{testTokenCompatibilityOldRenewer}} This test ran for {{34.887}} on my local machine. I am sure majority of time was spent in sleeping for token to expire. Can we decrease the {{renewInterval}} period to less than 30 seconds (mayb= e 5 seconds or so). Also the test renewed the token 30 times. Is that expected ? Did you mean to renew after while the code came out of while loop ? =C2=A0 {quote}LOG.info("Rolling key {} via provider {} with tokenUGi.",keyName); kp.createKey("newkey", new KeyProvider.Options(conf)); {quote} The log line should be {{creating a new key}} instead of {{Rolling key}}. Let me know if any part is unclear. > Delegation tokens are not shared between KMS instances > ------------------------------------------------------ > > Key: HADOOP-14445 > URL: https://issues.apache.org/jira/browse/HADOOP-14445 > Project: Hadoop Common > Issue Type: Bug > Components: kms > Affects Versions: 2.8.0, 3.0.0-alpha1 > Environment: CDH5.7.4, Kerberized, SSL, KMS-HA, at rest encryptio= n > Reporter: Wei-Chiu Chuang > Assignee: Xiao Chen > Priority: Major > Attachments: HADOOP-14445-branch-2.8.002.patch, HADOOP-14445-bran= ch-2.8.patch, HADOOP-14445.002.patch, HADOOP-14445.003.patch, HADOOP-14445.= 004.patch, HADOOP-14445.05.patch, HADOOP-14445.06.patch, HADOOP-14445.07.pa= tch, HADOOP-14445.08.patch > > > As discovered in HADOOP-14441, KMS HA using LoadBalancingKMSClientProvide= r do not share delegation tokens. (a client uses KMS address/port as the ke= y for delegation token) > {code:title=3DDelegationTokenAuthenticatedURL#openConnection} > if (!creds.getAllTokens().isEmpty()) { > InetSocketAddress serviceAddr =3D new InetSocketAddress(url.getHo= st(), > url.getPort()); > Text service =3D SecurityUtil.buildTokenService(serviceAddr); > dToken =3D creds.getToken(service); > {code} > But KMS doc states: > {quote} > Delegation Tokens > Similar to HTTP authentication, KMS uses Hadoop Authentication for delega= tion tokens too. > Under HA, A KMS instance must verify the delegation token given by anothe= r KMS instance, by checking the shared secret used to sign the delegation t= oken. To do this, all KMS instances must be able to retrieve the shared sec= ret from ZooKeeper. > {quote} > We should either update the KMS documentation, or fix this code to share = delegation tokens. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-issues-help@hadoop.apache.org