Skip to content

Conversation

@steveloughran
Copy link
Contributor

@steveloughran steveloughran commented Jun 9, 2016

What changes were proposed in this pull request?

During history server startup, the spark configuration is examined. If security.authentication is
set, log at debug and set the value to false, so that {{SecurityManager}} can be created.

How was this patch tested?

A new test in HistoryServerSuite sets the spark.authenticate property to true, tries to create a security manager via a new package-private method HistoryServer.createSecurityManager(SparkConf). This is the method used in HistoryServer.main. All other instantiations of a security manager in HistoryServerSuite have been switched to the new method, for consistency with the production code.

@SparkQA
Copy link

SparkQA commented Jun 9, 2016

Test build #60238 has finished for PR 13579 at commit 26d1ad2.

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

@vanzin
Copy link
Contributor

vanzin commented Jul 20, 2016

I might be missing something, but why doesn't the following work?

sparkConf.set(SecurityManager.SPARK_AUTH_CONF, "false")

That value is never read from the environment as far as I can tell.

@steveloughran
Copy link
Contributor Author

The main problem here is in a cluster where auth is turned on globally, the HS gets really confused: it's enabled but doesn't have any secrets. This patch sets things up so that even in a cluster-wide security enabled, the history server doesn't fall over

@steveloughran steveloughran force-pushed the history/SPARK-15844-security branch from 26d1ad2 to 6701922 Compare October 10, 2016 15:39
@vanzin
Copy link
Contributor

vanzin commented Oct 10, 2016

That doesn't answer my question, though. Why can't the history server explicitly set that value to false after all the settings having been read from wherever?

@SparkQA
Copy link

SparkQA commented Oct 10, 2016

Test build #66657 has finished for PR 13579 at commit 6701922.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@steveloughran
Copy link
Contributor Author

I see: you want the HS to set it? Yeah, that would work. I'll change this patch accordingly

@vanzin
Copy link
Contributor

vanzin commented Dec 7, 2016

@steveloughran are you going to update this patch?

@steveloughran
Copy link
Contributor Author

yeah, I've just got so many other distractions. Let me do it again while tests run in different windows

@steveloughran steveloughran force-pushed the history/SPARK-15844-security branch from 6701922 to 01a0220 Compare December 7, 2016 22:30
@SparkQA
Copy link

SparkQA commented Dec 7, 2016

Test build #69823 has finished for PR 13579 at commit 01a0220.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Dec 8, 2016

Test build #69824 has finished for PR 13579 at commit 3b3db69.

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

Copy link
Contributor

@vanzin vanzin left a comment

Choose a reason for hiding this comment

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

Couple of small things, otherwise looks good.

* always start.
* @param config configuration to be used in a SecurityManager constructor
*/
private def patchSecuritySettings(config: SparkConf): Unit = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you just inline this method? That avoids adding a method with a single call, and pretty much a copy of the whole scaladoc of the other method you're adding.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

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've inlined it, which highlights something else. if the debug message is viewed as unimportant, the if() clause can be pulled completely, and the security flag always set to false.

val conf = new SparkConf()
.set("spark.testing", "true")
.set(SecurityManager.SPARK_AUTH_CONF, "true")
HistoryServer.createSecurityManager(conf)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment explaining that the SecurityManager would throw an exception if spark.authenticate was true? (I think that'd be better than the comment you have before the test.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. You know, this test could be merged into "incomplete apps get refreshed", just by setting the security option and mentioning why it matters in a comment. I've patched that test to also use HistoryServer.createSecurityManager for consistency. it would save a fractional amount of test time

*/
test("SecurityManagerStartsWithSecureShuffle") {
val conf = new SparkConf()
.set("spark.testing", "true")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: indented too far

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed, along with IDE settings

@SparkQA
Copy link

SparkQA commented Dec 8, 2016

Test build #69864 has finished for PR 13579 at commit ad35cd9.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@steveloughran
Copy link
Contributor Author

stylecheck; unexpected, as I thought I'd run them in the mvn install of the module.

[error] /home/jenkins/workspace/SparkPullRequestBuilder/core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala:352:2:
Insert a space after the start of the comment

Comment is

  /**
   * Verify that the security manager needed for the history server can be instantiated
   * when `spark.authenticate` is `true`, rather than raise an `IllegalArgumentException`.
   **/

...the trailing **/ is the problem. Fixed

@vanzin
Copy link
Contributor

vanzin commented Dec 8, 2016

While tests are running, can you update the description? It mentions env vars, which is misleading since they don't have anything to do with this.

@steveloughran
Copy link
Contributor Author

done

* Verify that the security manager needed for the history server can be instantiated
* when `spark.authenticate` is `true`, rather than raise an `IllegalArgumentException`.
*/
test("SecurityManagerStartsWithSecureShuffle") {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can you write a test description like the others in the class, instead of this camel-cased string?

Also spark.authenticate is not (just) for secure shuffle, so the string itself is not really accurate. Just mention spark.authenticate.

@SparkQA
Copy link

SparkQA commented Dec 8, 2016

Test build #69868 has finished for PR 13579 at commit f375682.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@steveloughran
Copy link
Contributor Author

Test failure is pretty unlikely to be related. Looks more like a timing or timeout problem.

org.apache.spark.rdd.AsyncRDDActionsSuite.async failure handling

Failing for the past 1 build (Since Failed#69868 )
Took 10 sec.
Error Message

org.scalatest.exceptions.TestFailedDueToTimeoutException: The code passed to failAfter did not complete within 10 seconds.
Stacktrace

sbt.ForkMain$ForkError: org.scalatest.exceptions.TestFailedDueToTimeoutException: The code passed to failAfter did not complete within 10 seconds.

@SparkQA
Copy link

SparkQA commented Dec 12, 2016

Test build #70023 has finished for PR 13579 at commit 033f21e.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@vanzin
Copy link
Contributor

vanzin commented Dec 12, 2016

retest this please

@vanzin
Copy link
Contributor

vanzin commented Dec 12, 2016

LGTM, will merge once tests finish. (The interesting test is passing anyway.)

@SparkQA
Copy link

SparkQA commented Dec 12, 2016

Test build #70029 has finished for PR 13579 at commit 033f21e.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@vanzin
Copy link
Contributor

vanzin commented Dec 12, 2016

Merging to master.

@asfgit asfgit closed this in 586d198 Dec 12, 2016
@steveloughran
Copy link
Contributor Author

thanks!

@steveloughran steveloughran deleted the history/SPARK-15844-security branch December 12, 2016 21:08
robert3005 pushed a commit to palantir/spark that referenced this pull request Dec 15, 2016
…te = true

## What changes were proposed in this pull request?

During history server startup, the spark configuration is examined. If security.authentication is
set, log at debug and set the value to false, so that {{SecurityManager}} can be created.

## How was this patch tested?

A new test in `HistoryServerSuite` sets the `spark.authenticate` property to true, tries to create a security manager via a new package-private method `HistoryServer.createSecurityManager(SparkConf)`. This is the method used in `HistoryServer.main`. All other instantiations of a security manager in `HistoryServerSuite` have been switched to the new method, for consistency with the production code.

Author: Steve Loughran <stevel@apache.org>

Closes apache#13579 from steveloughran/history/SPARK-15844-security.
uzadude pushed a commit to uzadude/spark that referenced this pull request Jan 27, 2017
…te = true

## What changes were proposed in this pull request?

During history server startup, the spark configuration is examined. If security.authentication is
set, log at debug and set the value to false, so that {{SecurityManager}} can be created.

## How was this patch tested?

A new test in `HistoryServerSuite` sets the `spark.authenticate` property to true, tries to create a security manager via a new package-private method `HistoryServer.createSecurityManager(SparkConf)`. This is the method used in `HistoryServer.main`. All other instantiations of a security manager in `HistoryServerSuite` have been switched to the new method, for consistency with the production code.

Author: Steve Loughran <stevel@apache.org>

Closes apache#13579 from steveloughran/history/SPARK-15844-security.
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.

3 participants