LuciferYang commented on code in PR #58010: URL: https://github.com/apache/spark/pull/58010#discussion_r4439291265
########## docs/security.md: ########## @@ -183,6 +183,37 @@ Unlike the other SSL settings for the UI, the RPC SSL is *not* automatically ena `spark.ssl.enabled` is set. It must be explicitly enabled, to ensure a safe migration path for users upgrading Spark versions. +On Kubernetes, RPC SSL passwords set in the Spark configuration are propagated to executor pods +using environment variables, like the authentication secret described under +[Kubernetes](#kubernetes) above, so any user who can list pods in the namespace can read them. In +cluster mode they are also stored in plaintext in the driver's ConfigMap. To avoid both, store the +passwords in a Kubernetes Secret and bind the following variables on the driver and the executors +using `spark.kubernetes.driver.secretKeyRef.<name>` and +`spark.kubernetes.executor.secretKeyRef.<name>`, instead of setting them in the Spark configuration: + +* `_SPARK_SSL_RPC_KEY_STORE_PASSWORD` +* `_SPARK_SSL_RPC_KEY_PASSWORD` +* `_SPARK_SSL_RPC_PRIVATE_KEY_PASSWORD` +* `_SPARK_SSL_RPC_TRUST_STORE_PASSWORD` + +For example: +`spark.kubernetes.executor.secretKeyRef._SPARK_SSL_RPC_KEY_STORE_PASSWORD=<secret-name>:<key>`. + +On the driver, these variables also take precedence over the passwords the UI inherits from +`spark.ssl.*`. If the UI keystore or truststore uses a different password, set it explicitly in Review Comment: The sentence I suggested last round was too narrow. When `SSLOptions.parse` resolves a UI password that neither `spark.ssl.ui.*` nor a credential provider sets, it reads `_SPARK_SSL_RPC_*` before falling back to `spark.ssl.*`. So these variables also fill in UI passwords that aren't configured anywhere, in addition to overriding inherited ones. Take a driver with `_SPARK_SSL_RPC_KEY_PASSWORD` bound, only `spark.ssl.ui.keyStorePassword` set as shown here, and different key passwords on the two sides: the UI keystore opens, but Jetty uses the RPC key password to recover the private key and throws `UnrecoverableKeyException` (I reproduced this on 9b7c554), and `WebUI.bind` then calls `System.exit(1)`. Could you add a sentence after the first one saying that any UI password not set in `spark.ssl.ui` is filled from these variables? With `_SPARK_SSL_RPC_KEY_PASSWORD` bound on the driver, `spark.ssl.ui.keyPassword` has to be set as well, usually to the UI keystore password. When `needClientAuth` is on, `spark.ssl.ui.trustStorePassword` needs to be set explicitly too. -- 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]
