You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ranger.apache.org by Lars Francke <la...@gmail.com> on 2018/07/04 12:29:49 UTC
Question about KMS HA
Hi,
we're running HDP 2.6.4 with Ranger 0.7 at a customer. We have an issue
when getting Delegation Tokens from KMS.
Ranger KMS is set up in HA mode according to the docs over here <
https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.6.4/bk_security/content/ranger_kms_multi_kms.html
>.
What happens is this:
Kind: kms-dt, Service: kms1:9292, Ident: (owner=foobar, renewer=foobar,
realUser=, issueDate=1530706632603, maxDate=1531311432603,
sequenceNumber=39, masterKeyId=2)
18/07/04 14:17:12 DEBUG KMSClientProvider$KMSTokenRenewer: Renewing
delegation token Kind: kms-dt, Service: kms1:9292, Ident: (owner=foobar,
renewer=foobar, realUser=, issueDate=1530706632603, maxDate=1531311432603,
sequenceNumber=39, masterKeyId=2)
18/07/04 14:17:12 DEBUG KMSUtil: Creating key provider with config key
hadoop.security.key.provider.path
18/07/04 14:17:12 DEBUG KMSClientProvider: Renewing delegation token null
with url:http://kms2:9292/kms/v1/, as:null
18/07/04 14:17:12 DEBUG UserGroupInformation: UGI: foobar@FOOBAR.COM
(auth:KERBEROS)
18/07/04 14:17:12 DEBUG UserGroupInformation: +LoginUGI: foobar@FOOBAR.COM
(auth:KERBEROS)
18/07/04 14:17:12 DEBUG UserGroupInformation: PrivilegedAction
as:foobar@FOOBAR.COM (auth:KERBEROS)
from:org.apache.hadoop.crypto.key.kms.KMSClientProvider.renewDelegationToken(KMSClientProvider.java:916)
18/07/04 14:17:12 DEBUG KerberosAuthenticator: JDK performed authentication
on our behalf.
18/07/04 14:17:12 DEBUG UserGroupInformation: PrivilegedActionException
as:foobar@FOOBAR.COM (auth:KERBEROS) cause:java.io.IOException: HTTP status
[403], message [Forbidden]
18/07/04 14:17:12 WARN LoadBalancingKMSClientProvider: KMS provider at [
http://kms2:9292/kms/v1/] threw an IOException!! java.io.IOException: HTTP
status [403], message [Forbidden]
at
org.apache.hadoop.util.HttpExceptionUtils.validateResponse(HttpExceptionUtils.java:169)
at
org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticator.doDelegationTokenOperation(DelegationTokenAuthenticator.java:301)
at
org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticator.renewDelegationToken(DelegationTokenAuthenticator.java:217)
at
org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticatedURL.renewDelegationToken(DelegationTokenAuthenticatedURL.java:415)
at
org.apache.hadoop.crypto.key.kms.KMSClientProvider$2.run(KMSClientProvider.java:920)
at
org.apache.hadoop.crypto.key.kms.KMSClientProvider$2.run(KMSClientProvider.java:917)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1869)
at
org.apache.hadoop.crypto.key.kms.KMSClientProvider.renewDelegationToken(KMSClientProvider.java:916)
at
org.apache.hadoop.crypto.key.kms.LoadBalancingKMSClientProvider$2.call(LoadBalancingKMSClientProvider.java:143)
at
org.apache.hadoop.crypto.key.kms.LoadBalancingKMSClientProvider$2.call(LoadBalancingKMSClientProvider.java:140)
at
org.apache.hadoop.crypto.key.kms.LoadBalancingKMSClientProvider.doOp(LoadBalancingKMSClientProvider.java:95)
at
org.apache.hadoop.crypto.key.kms.LoadBalancingKMSClientProvider.renewDelegationToken(LoadBalancingKMSClientProvider.java:140)
at
org.apache.hadoop.crypto.key.kms.KMSClientProvider$KMSTokenRenewer.renew(KMSClientProvider.java:184)
at org.apache.hadoop.security.token.Token.renew(Token.java:414)
at App.main(App.java:32)
18/07/04 14:17:12 DEBUG KMSClientProvider: Renewing delegation token null
with url:http://kms1:9292/kms/v1/, as:null
18/07/04 14:17:12 DEBUG UserGroupInformation: UGI: foobar@FOOBAR.COM
(auth:KERBEROS)
18/07/04 14:17:12 DEBUG UserGroupInformation: +LoginUGI: foobar@FOOBAR.COM
(auth:KERBEROS)
18/07/04 14:17:12 DEBUG UserGroupInformation: PrivilegedAction
as:foobar@FOOBAR.COM (auth:KERBEROS)
from:org.apache.hadoop.crypto.key.kms.KMSClientProvider.renewDelegationToken(KMSClientProvider.java:916)
18/07/04 14:17:12 DEBUG KerberosAuthenticator: JDK performed authentication
on our behalf.
New expiration: 1530793032703
Kind: kms-dt, Service: 140.11.73.46:9292, Ident: (owner=foobar,
renewer=foobar, realUser=, issueDate=1530706632603, maxDate=1531311432603,
sequenceNumber=39, masterKeyId=2)
We have written a super simple Java App to replicate this issue that
basically does this:
for (Token<? extends TokenIdentifier> token : creds.getAllTokens()) {
System.out.println("Token Renew");
System.out.println(token);
long expiration = token.renew(conf);
System.out.println("New expiration: " + expiration);
System.out.println(token);
}
As you can see: All we're trying to do is to renew a Token. Every once in a
while (~50%) we see this warning. The problem is when the initial
delegation token was awarded by KMS Server 1 but the renew goes to KMS
Server 2 we see the 403 Error from Server 2 before the
LoadBalancingKMSClientProvider
switches to KMS Server 1 where the renew works.
That seems weird to me. Should KMS2 not be able to renew a token issued by
KMS1?
I have a feeling that we might have an issue in our KMS HA setup.
Or is this normal behavior?
Thank you!
Cheers,
Lars
Re: Question about KMS HA
Posted by Lars Francke <la...@gmail.com>.
For anyone stumbling across this:
We found the issue. It turns out that (following the quoted docs) Ranger
KMS does not use a shared store for Delegation tokens.
It can be enabled using these properties:
hadoop.kms.authentication.zk-dt-secret-manager.enable = true
hadoop.kms.authentication.zk-dt-secret-manager.zkConnectionString
hadoop.kms.authentication.zk-dt-secret-manager.znodeWorkingPath
BUT there's a bug in Ranger 0.7 that causes this whole thing to fail due to
a NoSuchMethodError which has been fixed in Ranger 1.0 with <
https://issues.apache.org/jira/browse/RANGER-1527>
Cheers,
Lars
On Wed, Jul 4, 2018 at 2:29 PM, Lars Francke <la...@gmail.com> wrote:
> Hi,
>
> we're running HDP 2.6.4 with Ranger 0.7 at a customer. We have an issue
> when getting Delegation Tokens from KMS.
>
> Ranger KMS is set up in HA mode according to the docs over here <
> https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.6.4/
> bk_security/content/ranger_kms_multi_kms.html>.
>
> What happens is this:
>
> Kind: kms-dt, Service: kms1:9292, Ident: (owner=foobar, renewer=foobar,
> realUser=, issueDate=1530706632603, maxDate=1531311432603,
> sequenceNumber=39, masterKeyId=2)
> 18/07/04 14:17:12 DEBUG KMSClientProvider$KMSTokenRenewer: Renewing
> delegation token Kind: kms-dt, Service: kms1:9292, Ident: (owner=foobar,
> renewer=foobar, realUser=, issueDate=1530706632603, maxDate=1531311432603,
> sequenceNumber=39, masterKeyId=2)
> 18/07/04 14:17:12 DEBUG KMSUtil: Creating key provider with config key
> hadoop.security.key.provider.path
> 18/07/04 14:17:12 DEBUG KMSClientProvider: Renewing delegation token null
> with url:http://kms2:9292/kms/v1/, as:null
> 18/07/04 14:17:12 DEBUG UserGroupInformation: UGI: foobar@FOOBAR.COM
> (auth:KERBEROS)
> 18/07/04 14:17:12 DEBUG UserGroupInformation: +LoginUGI: foobar@FOOBAR.COM
> (auth:KERBEROS)
> 18/07/04 14:17:12 DEBUG UserGroupInformation: PrivilegedAction
> as:foobar@FOOBAR.COM (auth:KERBEROS) from:org.apache.hadoop.crypto.
> key.kms.KMSClientProvider.renewDelegationToken(KMSClientProvider.java:916)
> 18/07/04 14:17:12 DEBUG KerberosAuthenticator: JDK performed
> authentication on our behalf.
> 18/07/04 14:17:12 DEBUG UserGroupInformation: PrivilegedActionException
> as:foobar@FOOBAR.COM (auth:KERBEROS) cause:java.io.IOException: HTTP
> status [403], message [Forbidden]
> 18/07/04 14:17:12 WARN LoadBalancingKMSClientProvider: KMS provider at [
> http://kms2:9292/kms/v1/] threw an IOException!! java.io.IOException:
> HTTP status [403], message [Forbidden]
> at org.apache.hadoop.util.HttpExceptionUtils.validateResponse(
> HttpExceptionUtils.java:169)
> at org.apache.hadoop.security.token.delegation.web.
> DelegationTokenAuthenticator.doDelegationTokenOperation(
> DelegationTokenAuthenticator.java:301)
> at org.apache.hadoop.security.token.delegation.web.
> DelegationTokenAuthenticator.renewDelegationToken(
> DelegationTokenAuthenticator.java:217)
> at org.apache.hadoop.security.token.delegation.web.
> DelegationTokenAuthenticatedURL.renewDelegationToken(
> DelegationTokenAuthenticatedURL.java:415)
> at org.apache.hadoop.crypto.key.kms.KMSClientProvider$2.run(
> KMSClientProvider.java:920)
> at org.apache.hadoop.crypto.key.kms.KMSClientProvider$2.run(
> KMSClientProvider.java:917)
> at java.security.AccessController.doPrivileged(Native Method)
> at javax.security.auth.Subject.doAs(Subject.java:422)
> at org.apache.hadoop.security.UserGroupInformation.doAs(
> UserGroupInformation.java:1869)
> at org.apache.hadoop.crypto.key.kms.KMSClientProvider.
> renewDelegationToken(KMSClientProvider.java:916)
> at org.apache.hadoop.crypto.key.kms.LoadBalancingKMSClientProvider
> $2.call(LoadBalancingKMSClientProvider.java:143)
> at org.apache.hadoop.crypto.key.kms.LoadBalancingKMSClientProvider
> $2.call(LoadBalancingKMSClientProvider.java:140)
> at org.apache.hadoop.crypto.key.kms.LoadBalancingKMSClientProvider
> .doOp(LoadBalancingKMSClientProvider.java:95)
> at org.apache.hadoop.crypto.key.kms.LoadBalancingKMSClientProvider
> .renewDelegationToken(LoadBalancingKMSClientProvider.java:140)
> at org.apache.hadoop.crypto.key.kms.KMSClientProvider$
> KMSTokenRenewer.renew(KMSClientProvider.java:184)
> at org.apache.hadoop.security.token.Token.renew(Token.java:414)
> at App.main(App.java:32)
>
> 18/07/04 14:17:12 DEBUG KMSClientProvider: Renewing delegation token null
> with url:http://kms1:9292/kms/v1/, as:null
> 18/07/04 14:17:12 DEBUG UserGroupInformation: UGI: foobar@FOOBAR.COM
> (auth:KERBEROS)
> 18/07/04 14:17:12 DEBUG UserGroupInformation: +LoginUGI: foobar@FOOBAR.COM
> (auth:KERBEROS)
> 18/07/04 14:17:12 DEBUG UserGroupInformation: PrivilegedAction
> as:foobar@FOOBAR.COM (auth:KERBEROS) from:org.apache.hadoop.crypto.
> key.kms.KMSClientProvider.renewDelegationToken(KMSClientProvider.java:916)
> 18/07/04 14:17:12 DEBUG KerberosAuthenticator: JDK performed
> authentication on our behalf.
> New expiration: 1530793032703
> Kind: kms-dt, Service: 140.11.73.46:9292, Ident: (owner=foobar,
> renewer=foobar, realUser=, issueDate=1530706632603, maxDate=1531311432603,
> sequenceNumber=39, masterKeyId=2)
>
>
> We have written a super simple Java App to replicate this issue that
> basically does this:
>
> for (Token<? extends TokenIdentifier> token : creds.getAllTokens()) {
> System.out.println("Token Renew");
> System.out.println(token);
> long expiration = token.renew(conf);
> System.out.println("New expiration: " + expiration);
> System.out.println(token);
> }
>
>
> As you can see: All we're trying to do is to renew a Token. Every once in
> a while (~50%) we see this warning. The problem is when the initial
> delegation token was awarded by KMS Server 1 but the renew goes to KMS
> Server 2 we see the 403 Error from Server 2 before the LoadBalancingKMSClientProvider
> switches to KMS Server 1 where the renew works.
>
> That seems weird to me. Should KMS2 not be able to renew a token issued by
> KMS1?
>
> I have a feeling that we might have an issue in our KMS HA setup.
>
> Or is this normal behavior?
>
> Thank you!
>
> Cheers,
> Lars
>
>