Skip to content

Commit c42952d

Browse files
akitanakamccheah
authored andcommitted
[SPARK-21642][CORE] Use FQDN for DRIVER_HOST_ADDRESS instead of ip address
## What changes were proposed in this pull request? The patch lets spark web ui use FQDN as its hostname instead of ip address. In current implementation, ip address of a driver host is set to DRIVER_HOST_ADDRESS. This becomes a problem when we enable SSL using "spark.ssl.enabled", "spark.ssl.trustStore" and "spark.ssl.keyStore" properties. When we configure these properties, spark web ui is launched with SSL enabled and the HTTPS server is configured with the custom SSL certificate you configured in these properties. In this case, client gets javax.net.ssl.SSLPeerUnverifiedException exception when the client accesses the spark web ui because the client fails to verify the SSL certificate (Common Name of the SSL cert does not match with DRIVER_HOST_ADDRESS). To avoid the exception, we should use FQDN of the driver host for DRIVER_HOST_ADDRESS. Error message that client gets when the client accesses spark web ui: javax.net.ssl.SSLPeerUnverifiedException: Certificate for <10.102.138.239> doesn't match any of the subject alternative names: [] ## How was this patch tested? manual tests Author: Hideaki Tanaka <[email protected]> Closes apache#18846 from thideeeee/SPARK-21642.
1 parent 0dff8be commit c42952d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

core/src/main/scala/org/apache/spark/internal/config/package.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ package object config {
253253
private[spark] val DRIVER_HOST_ADDRESS = ConfigBuilder("spark.driver.host")
254254
.doc("Address of driver endpoints.")
255255
.stringConf
256-
.createWithDefault(Utils.localHostName())
256+
.createWithDefault(Utils.localCanonicalHostName())
257257

258258
private[spark] val DRIVER_BIND_ADDRESS = ConfigBuilder("spark.driver.bindAddress")
259259
.doc("Address where to bind network listen sockets on the driver.")

core/src/main/scala/org/apache/spark/util/Utils.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,13 @@ private[spark] object Utils extends Logging {
940940
customHostname = Some(hostname)
941941
}
942942

943+
/**
944+
* Get the local machine's FQDN.
945+
*/
946+
def localCanonicalHostName(): String = {
947+
customHostname.getOrElse(localIpAddress.getCanonicalHostName)
948+
}
949+
943950
/**
944951
* Get the local machine's hostname.
945952
*/

0 commit comments

Comments
 (0)