dongjoon-hyun commented on code in PR #57285:
URL: https://github.com/apache/spark/pull/57285#discussion_r3641833781
##########
core/src/main/scala/org/apache/spark/deploy/security/HadoopDelegationTokenManager.scala:
##########
@@ -199,16 +241,14 @@ private[spark] class HadoopDelegationTokenManager(
*/
private def updateTokensTask(): Array[Byte] = {
try {
- val freshUGI = doLogin()
- val creds = obtainTokensAndScheduleRenewal(freshUGI)
+ val creds = obtainTokensAndScheduleRenewal()
val tokens = SparkHadoopUtil.get.serialize(creds)
logInfo("Updating delegation tokens.")
schedulerRef.send(UpdateDelegationTokens(tokens))
tokens
} catch {
case _: InterruptedException =>
- // Ignore, may happen if shutting down.
Review Comment:
This seems to be removed mistakenly. Please recover this comment.
##########
core/src/main/scala/org/apache/spark/scheduler/SupportsDelegationToken.scala:
##########
@@ -21,19 +21,20 @@ import org.apache.hadoop.security.UserGroupInformation
import org.apache.spark.deploy.SparkHadoopUtil
import org.apache.spark.deploy.security.HadoopDelegationTokenManager
+import org.apache.spark.internal.Logging
/**
* A mix-in trait for SchedulerBackend that supports delegation tokens.
*/
-private[spark] trait SupportsDelegationToken {
+private[spark] trait SupportsDelegationToken extends Logging {
Review Comment:
Let's keep `SupportsDelegationToken` trait concisely. I don't think
`Logging` is required in this trait.
##########
core/src/main/scala/org/apache/spark/deploy/security/HadoopDelegationTokenManager.scala:
##########
@@ -76,28 +77,50 @@ private[spark] class HadoopDelegationTokenManager(
require((principal == null) == (keytab == null),
"Both principal and keytab must be defined, or neither.")
+ if (sparkConf.get(CREDENTIALS_DIRECT_PROVIDERS_ENABLED)) {
+ val hasEncryption = sparkConf.get(NETWORK_CRYPTO_ENABLED) ||
+ sparkConf.get(SASL_ENCRYPTION_ENABLED) ||
+ sparkConf.getBoolean("spark.ssl.rpc.enabled", false)
+ require(hasEncryption,
+ "RPC channel encryption (spark.network.crypto.enabled, " +
+ "spark.authenticate.enableSaslEncryption, or spark.ssl.rpc.enabled) must
be enabled when " +
+ "spark.security.credentials.directProviders.enabled is true. " +
+ "Credential tokens must not be transmitted over unencrypted channels.")
Review Comment:
This looks insufficient to me. Technically, we need to check
`NETWORK_AUTH_ENABLED` because `spark.network.crypto.enabled` and
`spark.authenticate.enableSaslEncryption` only take effect when
`spark.authenticate=true`.
```suggestion
val hasEncryption = sparkConf.getBoolean("spark.ssl.rpc.enabled", false)
||
(sparkConf.get(NETWORK_AUTH_ENABLED) &&
(sparkConf.get(NETWORK_CRYPTO_ENABLED) ||
sparkConf.get(SASL_ENCRYPTION_ENABLED)))
require(hasEncryption,
"RPC channel encryption must be enabled when " +
"spark.security.credentials.directProviders.enabled is true: either " +
"spark.ssl.rpc.enabled=true, or spark.authenticate=true together with
" +
"spark.network.crypto.enabled or
spark.authenticate.enableSaslEncryption. " +
"Credential tokens must not be transmitted over unencrypted channels.")
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]