Skip to content

Conversation

@jerryshao
Copy link
Contributor

What changes were proposed in this pull request?

Spark ThriftServer doesn't support spnego auth for thrift/http protocol, this mainly used for knox+thriftserver scenario. Since in HiveServer2 CLIService there already has existing codes to support it. So here copy it to Spark ThriftServer to make it support.

Related Hive JIRA HIVE-6697.

How was this patch tested?

Manual verification.

Change-Id: Icec0957ae47cb031883a3c9affcea8580cf9ab35
@SparkQA
Copy link

SparkQA commented Jul 13, 2017

Test build #79592 has finished for PR 18628 at commit 02a041a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@jerryshao
Copy link
Contributor Author

@cloud-fan would you please help to review, thanks a lot!

@jerryshao jerryshao changed the title [SPARK-21407][ThriftServer] Add spnego auth support for ThriftServer thrift/http protocol [SPARK-18061][ThriftServer] Add spnego auth support for ThriftServer thrift/http protocol Jul 14, 2017
Change-Id: I801f048afc6f683f7519b0cbf1c99e2268500c45
@SparkQA
Copy link

SparkQA commented Jul 14, 2017

Test build #79628 has finished for PR 18628 at commit 787e72c.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

} catch {
case e: IOException =>
throw new ServiceException("Unable to login to spnego with given principal/keytab " +
s"$principal/$keyTabFile", e)
Copy link
Contributor

Choose a reason for hiding this comment

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

shall we hide the principal/keytab?

@cloud-fan
Copy link
Contributor

cloud-fan commented Jul 17, 2017

looks good according to the existing similar code, but I'm not very familiar with this part of code, will leave it for a few days if someone else has some comments.

Also cc @jiangxb1987

// Try creating spnego UGI if it is configured.
val principal = hiveConf.getVar(ConfVars.HIVE_SERVER2_SPNEGO_PRINCIPAL)
val keyTabFile = hiveConf.getVar(ConfVars.HIVE_SERVER2_SPNEGO_KEYTAB)
if (principal.nonEmpty && keyTabFile.nonEmpty) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we log warning if principal or keyTablFile is empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm trying to avoid calling log APIs using reflection as mentioned in #15594

@jiangxb1987
Copy link
Contributor

This looks good to me, cc @cmirash @vanzin @steveloughran

Change-Id: I486c361a96687e3611754895d895b5326ee22f52
@SparkQA
Copy link

SparkQA commented Jul 17, 2017

Test build #79681 has finished for PR 18628 at commit 4765398.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

} catch {
case e: IOException =>
throw new ServiceException("Unable to login to spnego with given principal/keytab", e)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd recommend including as much diagnostics in the exception string, including principal & keytab, and the value of e.toString in the message

throw new ServiceException(s"Unable to login to spnego with principal `$principal and keytab `$keytab`: $e", e)

The scenario to plan for is "nothing works and all you have to go on is that string from the raised exception".


// Try creating spnego UGI if it is configured.
val principal = hiveConf.getVar(ConfVars.HIVE_SERVER2_SPNEGO_PRINCIPAL)
val keyTabFile = hiveConf.getVar(ConfVars.HIVE_SERVER2_SPNEGO_KEYTAB)
Copy link
Contributor

Choose a reason for hiding this comment

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

HiveConf.getVar() doesn't trim thhe results of leading/trailing via {{Configuration.getTrimmed()}}. Check for other uses of the confvar to see if there is any trimming of whitespace before and after their use: if so, you need to copy that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I searched the code, looks like there's no other place where using HiveConf.getVar trims the result.

Change-Id: Icce88ff9b266f470fd5407496756c933c0f1f959
@SparkQA
Copy link

SparkQA commented Aug 3, 2017

Test build #80193 has finished for PR 18628 at commit 12565cd.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@steveloughran
Copy link
Contributor

Thanks for making sure this is consistent with other uses of Configuration.get(); consistency is critical here

@jerryshao
Copy link
Contributor Author

@cloud-fan @jiangxb1987, what do you think about this PR, I think it mostly copies from HS2, and it is quite isolated unless we enabled spnego, so it should be safe to merge.

@jiangxb1987
Copy link
Contributor

retest this please

@jiangxb1987
Copy link
Contributor

LGTM pending jenkins

@SparkQA
Copy link

SparkQA commented Sep 5, 2017

Test build #81419 has finished for PR 18628 at commit 12565cd.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@jerryshao
Copy link
Contributor Author

Thanks @jiangxb1987 , let me merge it to master.

@asfgit asfgit closed this in 6a23254 Sep 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants