Skip to content

Support kerberos authentication for Kudu connector#3549

Closed
liyubin117 wants to merge 1 commit intotrinodb:masterfrom
liyubin117:kudu-kerberos
Closed

Support kerberos authentication for Kudu connector#3549
liyubin117 wants to merge 1 commit intotrinodb:masterfrom
liyubin117:kudu-kerberos

Conversation

@liyubin117
Copy link
Copy Markdown
Member

@liyubin117 liyubin117 commented Apr 26, 2020

Add the following configuration to etc/catalog/kudu.properties to enable kerberos authentication:

   ## Whether to enable kerberos authentication, default is false
   kudu.kerberos-auth.enabled=true

   # whether to output kerberos debug information, default is false
   kudu.kerberos-auth.debug.enabled=true

   # The Kerberos principal that Presto will use when connecting to Kudu
   kudu.kerberos-auth.principal=xxx

   # Kudu client keytab location
   kudu.kerberos-auth.keytab=xxx.keytab
Kudu Changes

support kerberos authentication

Fixes #1237

@cla-bot
Copy link
Copy Markdown

cla-bot bot commented Apr 26, 2020

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to cla@prestosql.io. For more information, see https://github.com/prestosql/cla.

Copy link
Copy Markdown
Member

@Praveen2112 Praveen2112 left a comment

Choose a reason for hiding this comment

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

Thanks for working on this. Please file a CLA

private boolean disableStatistics;
private boolean schemaEmulationEnabled;
private String schemaEmulationPrefix = "presto::";
private boolean kerberosAuthEnabled;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we have this in a separate config file ?

private final boolean kerberosAuthEnabled;

public KuduClientSession(KuduClient client, SchemaEmulation schemaEmulation)
public KuduClientSession(KuduClient client, SchemaEmulation schemaEmulation, boolean kerberosAuthEnabled)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we have it as a wrap of top of KuduClientSession ?

builder.defaultSocketReadTimeoutMs(config.getDefaultSocketReadTimeout().toMillis());
if (config.isDisableStatistics()) {
builder.disableStatistics();
KuduClient client;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we have separate module for the kerberos based KuduClient ?

if (debugEnabled) {
System.setProperty("sun.security.krb5.debug", "true");
}
UserGroupInformation.setConfiguration(conf);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need to add hadoop dependencies ? How about reusing KerberosAuthentication in presto plugiin toolkit ?

Copy link
Copy Markdown
Member

@kokosing kokosing left a comment

Choose a reason for hiding this comment

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

Thank you for working on this, this will be a great contribution to Presto.

I left some general comments about implementation and configuration properties (to make in line with other components in Presto that are using KRB).

The biggest challenge is see here is testing. Do you have any idea how to tackle this? I would suggest to you setup product tests that could use https://github.com/prestosql/docker-images/tree/master/prestodev/kerberos. What do you think? I can help you go through this, but please prepare that is not something that can be written over night.

## Disable Kudu client's collection of statistics.
#kudu.client.disable-statistics = false

#######################
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this should be a regular subsection.

Same applies to ### Advanced Kudu Java client configuration.

@mosabua Any suggestsions?


<dependency>
<groupId>io.prestosql.hadoop</groupId>
<artifactId>hadoop-apache</artifactId>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need entire hadoop dependency for this?

</dependency>

<dependency>
<groupId>io.prestosql.hadoop</groupId>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please move it to other compile dependencies.

return this;
}

public boolean isKerberosAuthEnabled()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add kudu.authentication.type property that accepts KERBEROS or NONE

return kerberosPrincipal;
}

@Config("kudu.kerberos-auth.principal")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

kudu.client.principal ?

return kerberosKeytab;
}

@Config("kudu.kerberos-auth.keytab")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

kudu.client.keytab

return kerberosAuthDebugEnabled;
}

@Config("kudu.kerberos-auth.debug.enabled")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please remove this property. One can add it using jvm.config

import java.io.IOException;
import java.security.PrivilegedExceptionAction;

public class KuduUtil
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please use io.prestosql.plugin.base.authentication.KerberosAuthentication and io.prestosql.plugin.base.authentication.CachingKerberosAuthentication

return kerberosPrincipal;
}

@Config("kudu.kerberos-auth.principal")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Kerberos related properties should not be allowed to be configures if kudu.authentication.type=NONE. Please see usages how it typically achieved by look at usages of io.airlift.configuration.ConditionalModule#installModuleIf.

@liyubin117
Copy link
Copy Markdown
Member Author

liyubin117 commented Apr 29, 2020

@kokosing @Praveen2112 Thanks for your review and suggestions!
I will complete the pull request as soon as possible, in spite of a very urgent and unexpected internal deadline may breaks my later schedule, I will do my best

@sumit-gupta-sgt
Copy link
Copy Markdown

Any expected ETA for this functionality ?

@grantatspothero
Copy link
Copy Markdown
Contributor

@sumit-gupta-sgt This feature was just released in Trino 372:
https://trino.io/docs/current/release/release-372.html#kudu-connector

@hashhar
Copy link
Copy Markdown
Member

hashhar commented Mar 3, 2022

Closing this since it is now obsolete and was merged in #10953

@hashhar hashhar closed this Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Support Kerberos authentication for Kudu Connector

6 participants