Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1980#discussion_r18005554
  
    --- Diff: core/src/main/scala/org/apache/spark/ui/JettyUtils.scala ---
    @@ -207,6 +210,48 @@ private[spark] object JettyUtils extends Logging {
       private def attachPrefix(basePath: String, relativePath: String): String 
= {
         if (basePath == "") relativePath else (basePath + 
relativePath).stripSuffix("/")
       }
    +
    +  private def getConnector(port: Int, conf: SparkConf): Connector = {
    +    val https = getHttpPolicy(conf)
    +    if (https) {
    +      buildSslSelectChannelConnector(port, conf)
    +    } else {
    +      conf.set("spark.http.policy", "http")
    +      val connector = new SelectChannelConnector
    +      connector.setPort(port)
    +      connector
    +    }
    +  }
    +
    +  private def buildSslSelectChannelConnector(port: Int, conf: SparkConf): 
Connector =
    +  {
    +    val connector = new SslSelectChannelConnector
    +    connector.setPort(port)
    +
    +    val context = connector.getSslContextFactory
    +    val needAuth = conf.getBoolean("spark.client.https.need-auth", false)
    +
    +    context.setNeedClientAuth(needAuth)
    +    
context.setKeyManagerPassword(conf.get("spark.ssl.server.keystore.keypassword", 
"123456"))
    --- End diff --
    
    Something I'd recommend here instead is to just bypass options to Jetty. 
e.g., some untested code based on similar Java code I have around:
    
        val ctxFactory = new SslContextFactory();
        conf.getAll.
          .filter { case (k, v) => k.startsWith("spark.ui.ssl.") }
          .foreach { case (k, v) => // set property in ctxFactory }
        connector = new SslSelectChannelConnector(ctxFactory);
    
    The trick is setting the property; in my code I use 
`BeanUtils.setProperty()` for that. My main concern here is that Jetty's SSL 
connector has a bunch of configurable options, and having a bypass mechanism 
would avoid having to plumb all of them manually.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to