Skip to content
This repository has been archived by the owner on Jan 9, 2020. It is now read-only.

Allow client certificate PEM for resource staging server #257

Merged
merged 1 commit into from
May 19, 2017

Conversation

mccheah
Copy link

@mccheah mccheah commented May 1, 2017

Allows the TLS certificate for reaching the resource staging server to be specified as a PEM file from the submitter's disk. Note that this is still uploaded as a trustStore file into the init-container - the client creates a temporary trustStore file from the certificate PEM. This is to simplify the secret generation so that we don't have to worry about differentiating between mounting the PEM vs. mounting a trustStore.

Depends on #246 which in turn depends on #251 .

@ash211
Copy link

ash211 commented May 10, 2017

rerun unit tests please

@ash211
Copy link

ash211 commented May 10, 2017

@mccheah seems like a legit test failure

@mccheah mccheah force-pushed the submission-v2-kubernetes-credentials branch from dc19d14 to c2bbe6f Compare May 17, 2017 19:17
@mccheah mccheah force-pushed the allow-client-cert-pem branch 2 times, most recently from 4a4dd42 to 067dcb8 Compare May 17, 2017 19:25
val maybeKeyStorePasswordFile = sparkConf.get(RESOURCE_STAGING_SERVER_KEYSTORE_PASSWORD_FILE)
val maybeKeyPasswordFile = sparkConf.get(RESOURCE_STAGING_SERVER_KEYSTORE_KEY_PASSWORD_FILE)
val maybeClientCertPem = sparkConf.get(RESOURCE_STAGING_SERVER_CERT_PEM)
Copy link

Choose a reason for hiding this comment

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

typo: RESOURCE_STAGING_SERVER_CLIENT_CERT_PEM

}
}
val resolvedTrustStorePassword = baseSslOptions.trustStorePassword
.orElse(maybeClientCertPem.map( _ => "defaultTrustStorePassword"))
Copy link

Choose a reason for hiding this comment

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

will this default password ever actually work? I wonder if it's better to require a password upfront rather than failing later when the default inevitably doesn't match

Copy link
Author

Choose a reason for hiding this comment

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

It will match because the SSL options provider is generating the trustStore with the given password from the certificate file.

Copy link

Choose a reason for hiding this comment

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

Ah got it -- didn't realize this same codepath was being used both during creating the temp truststore and reading it on the other side

Copy link
Author

Choose a reason for hiding this comment

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

I'm open to ideas of making the flow clearer here

Copy link

Choose a reason for hiding this comment

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

I think it's fine as is -- if I'd read more closely the context around I think I would've seen that

@@ -87,6 +87,32 @@ class ResourceStagingServerSslOptionsProviderSuite extends SparkFunSuite with Be
}
}

test("Setting pem files without setting passwords should use random passwords.") {
Copy link

Choose a reason for hiding this comment

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

I think we want at least one integration test that verifies the whole flow works with full-on SSL/certs everywhere, including this PR to use client certificates from init container -> resource staging server. Is there an existing test we can extend to have more SSL, or does that need to be a new test to get that coverage?

Copy link
Author

Choose a reason for hiding this comment

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

The existing tests all use keyStores and trustStores and we would need to write a new test to cover using PEM files instead.

@mccheah
Copy link
Author

mccheah commented May 18, 2017

Requires rebasing onto branch-2.1-kubernetes.

@mccheah mccheah force-pushed the allow-client-cert-pem branch from ddc98c1 to 505ce93 Compare May 18, 2017 22:09
@mccheah mccheah changed the base branch from submission-v2-kubernetes-credentials to branch-2.1-kubernetes May 18, 2017 22:10
@mccheah
Copy link
Author

mccheah commented May 18, 2017

Finished rebasing.

@ash211 ash211 merged commit 88306b2 into branch-2.1-kubernetes May 19, 2017
@ash211 ash211 deleted the allow-client-cert-pem branch May 19, 2017 20:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants