Skip to content

Allow configuring credential-cache for kerberized hive connector#13482

Merged
Praveen2112 merged 3 commits intotrinodb:masterfrom
Praveen2112:kerberos_credential_cache_hive
Aug 29, 2022
Merged

Allow configuring credential-cache for kerberized hive connector#13482
Praveen2112 merged 3 commits intotrinodb:masterfrom
Praveen2112:kerberos_credential_cache_hive

Conversation

@Praveen2112
Copy link
Copy Markdown
Member

@Praveen2112 Praveen2112 commented Aug 3, 2022

Description

This allows us deploy hive connector in a keytab less environment where the credentials are fetched from credential cache file.

Is this change a fix, improvement, new feature, refactoring, or other?

New feature for Hive and iceberg connector.

Is this a change to the core query engine, a connector, client library, or the SPI interfaces? (be specific)

This is specific to hive connector and iceberg connector.

How would you describe this change to a non-technical end user or system administrator?

This allows us deploy hive connector in a keytab less environment where the credentials are fetched from credential cache file.

Related issues, pull requests, and links

Documentation

( ) No documentation is needed.
( ) Sufficient documentation is included in this PR.
(x) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.

Release notes

( ) No release notes entries required.
(x) Release notes entries required with the following suggested text:

# Section
* Allow using credential-cache for kerberized hive connector

@cla-bot cla-bot bot added the cla-signed label Aug 3, 2022
@Praveen2112 Praveen2112 force-pushed the kerberos_credential_cache_hive branch from 2f86907 to 2cdea75 Compare August 4, 2022 05:58
Copy link
Copy Markdown
Contributor

@wendigo wendigo left a comment

Choose a reason for hiding this comment

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

LGTM % comments

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.

looks good

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 use keytab together with cache? Do we need validation for this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Using a keytab along with cache is also a valid configuration. So I don't think we need a verification for it. Maybe we can add an additional config to check if either of them are present.

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 a test for this then?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Additional PT environment for both keytab with cache ?

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.

Yes. WDYT?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

then we need to multiply the tests. Instead of copying tests I think adding more environment would give us better coverage.

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.

You can make tests parametric

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It is also kind of tricky - if we are testing for group configured_features then we need to make all the tests parametric but some of them would run in a non-kerberos environment. So we need to duplicate them for kerberos and non-kerberos environment - or introduce some dummy catalogs to non-keberos environment.

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.

OK. So let's add new environment then.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added

@Praveen2112 Praveen2112 force-pushed the kerberos_credential_cache_hive branch 3 times, most recently from bde6ddd to 1ec7ef9 Compare August 16, 2022 09:43
@Praveen2112
Copy link
Copy Markdown
Member Author

@wendigo / @kokosing / @s2lomon Have rebased it due to logical conflict. Addressed additional comments.

@Praveen2112 Praveen2112 force-pushed the kerberos_credential_cache_hive branch from 1ec7ef9 to 3fb0190 Compare August 16, 2022 11:26
Copy link
Copy Markdown
Member

@s2lomon s2lomon left a comment

Choose a reason for hiding this comment

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

lgtm

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.

Wow, I've not known that we can do that. So it's either null, or path to existing file correct?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah. And it applies check if the file exists.

@Praveen2112 Praveen2112 force-pushed the kerberos_credential_cache_hive branch from 12ff76c to a794072 Compare August 18, 2022 12:32
@Praveen2112 Praveen2112 force-pushed the kerberos_credential_cache_hive branch 2 times, most recently from 14c6238 to 252dbef Compare August 19, 2022 10:53
@Praveen2112
Copy link
Copy Markdown
Member Author

@wendigo / @kokosing Added tests and applied comments.

@kokosing
Copy link
Copy Markdown
Member

CI is red

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.

Use HOST_NAME in these values to make it clear what you tests

@Praveen2112 Praveen2112 force-pushed the kerberos_credential_cache_hive branch from 252dbef to 58df151 Compare August 24, 2022 09:38
@Praveen2112
Copy link
Copy Markdown
Member Author

@wendigo / @kokosing / @s2lomon We made one change in KerberosConfiguration - We enable storeKey - if keyTab is configured and credential-cache is not configured. (As TGT is fetched from Credential Cache, then the KeyTab will not be loaded, and we would get a LoginException stating 'No key to store'.). Is this the correct approach or should we restrict keyTab or credentialCache cannot be configured at the same time.

@kokosing
Copy link
Copy Markdown
Member

should we restrict keyTab or credentialCache cannot be configured at the same time.

I would start with this approach. It sounds that we could relax that in future when we learn about the use case. Configuring these two things is kind of misleading and I am not sure what user really wants.

@wendigo
Copy link
Copy Markdown
Contributor

wendigo commented Aug 24, 2022

I agree with @kokosing on this

@Praveen2112 Praveen2112 force-pushed the kerberos_credential_cache_hive branch from 58df151 to 4671f70 Compare August 24, 2022 12:53
Hostname substitution happens even if the realm part is missing. Realm is optional, if
there is no realm component in the principal, then it will be assumed that the principal
is in the default realm.
@Praveen2112 Praveen2112 force-pushed the kerberos_credential_cache_hive branch from 4671f70 to 16c9650 Compare August 25, 2022 05:30
@Praveen2112
Copy link
Copy Markdown
Member Author

@wendigo / @kokosing / @s2lomon AC

Copy link
Copy Markdown
Member

@s2lomon s2lomon left a comment

Choose a reason for hiding this comment

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

lgtm

@Praveen2112 Praveen2112 force-pushed the kerberos_credential_cache_hive branch from 16c9650 to adf88dc Compare August 25, 2022 14:48
@Praveen2112 Praveen2112 merged commit 5120f3f into trinodb:master Aug 29, 2022
@github-actions github-actions bot added this to the 394 milestone Aug 29, 2022
@colebow
Copy link
Copy Markdown
Member

colebow commented Aug 29, 2022

@Praveen2112 the template suggests there's another PR with docs for this change, but I can't find it. Could you link?

Also, what section should the release note go into?

@Praveen2112
Copy link
Copy Markdown
Member Author

I'm working on the PR for docs.

The release notes should be part of Hive connector.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

5 participants