-
Notifications
You must be signed in to change notification settings - Fork 60
DOCSP-14874 TLS/SSL Page #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jordan-smith721
merged 7 commits into
mongodb:master
from
jordan-smith721:DOCSP-14874-ssl
Feb 21, 2024
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ceecb9a
first draft tls page
jordan-smith721 8df5d78
typos and updates
jordan-smith721 4d85ee1
header casing
jordan-smith721 d823033
add to toc
jordan-smith721 e13badf
clarify wording
jordan-smith721 a24e7cb
add link to connection string page
jordan-smith721 5a5ecf3
add .driver options to command line
jordan-smith721 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ source/includes/table/ | |
source/includes/toc | ||
fabfile | ||
giza.log | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
.. _spark-configure-tls: | ||
|
||
================= | ||
Configure TLS/SSL | ||
================= | ||
|
||
.. contents:: On this page | ||
:local: | ||
:backlinks: none | ||
:depth: 2 | ||
:class: singlecol | ||
|
||
.. facet:: | ||
:name: genre | ||
:values: reference | ||
|
||
.. meta:: | ||
:keywords: code example, authenticate | ||
|
||
Overview | ||
-------- | ||
|
||
In this guide, you can learn how to configure :wikipedia:`TLS/SSL | ||
<Transport_Layer_Security>` to secure communications between the | ||
{+connector-long+} and your MongoDB deployment. | ||
|
||
To use TLS/SSL, your application and each of your Spark | ||
workers must have access to cryptographic certificates that prove their | ||
identity. Store the certificates in your JVM trust store and your JVM | ||
key store. You can configure access to these certificates through your Spark | ||
configuration file, or when launching a Spark job from the command line. | ||
|
||
Create a JVM Trust Store | ||
------------------------ | ||
|
||
The JVM trust store saves certificates that securely identify other applications | ||
with which your application interacts. Using these certificates, your | ||
application can prove that the connection to another application is genuine and | ||
secure. | ||
|
||
Create a trust store with the `keytool <https://docs.oracle.com/javase/8/docs/technotes/tools/unix/keytool.html>`__ command line tool provided as part of the | ||
JDK: | ||
|
||
.. code-block:: sh | ||
|
||
keytool -importcert -trustcacerts -file <path to certificate authority file> | ||
-keystore <path to trust store> -storepass <password> | ||
|
||
Create a JVM Key Store | ||
---------------------- | ||
|
||
The JVM key store saves certificates that securely identify your application to | ||
other applications. Using these certificates, other | ||
applications can prove that the connection to your application is genuine and | ||
secure. | ||
|
||
Create a key store by using the `keytool | ||
<https://docs.oracle.com/javase/8/docs/technotes/tools/unix/keytool.html>`__, or | ||
`openssl <https://www.openssl.org/docs/>`__ command line tools. | ||
|
||
Enable TLS/SSL | ||
-------------- | ||
|
||
You can enable TLS/SSL for the connection to your MongoDB instance through the | ||
``tls`` parameter in your connection URI. | ||
|
||
The following example shows a connection URI with the ``tls`` option assigned | ||
to ``true`` to enable TLS/SSL: | ||
|
||
.. code-block:: none | ||
|
||
"mongodb+srv://<username>:<password>@<cluster-url>?tls=true" | ||
|
||
For more information about creating a connection string, see the | ||
:manual:`Connection String guide <reference/connection-string/>` on the server | ||
manual. | ||
|
||
Configure Access to Certificate Stores | ||
-------------------------------------- | ||
|
||
To configure your Spark application to access the certificates stored in your | ||
JVM trust store and JVM key store, the following system properties must be set: | ||
|
||
- javax.net.ssl.trustStore | ||
- javax.net.ssl.trustStorePassword | ||
- javax.net.ssl.keyStore | ||
- javax.net.ssl.keyStorePassword | ||
|
||
Set the Properties in Your Spark Configuration File | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
You can set the system properties in your Spark configuration file as follows: | ||
|
||
.. code-block:: none | ||
|
||
spark.executor.extraJavaOptions=-Djavax.net.ssl.trustStore=<Path to your trust store> -Djavax.net.ssl.trustStorePassword=<Your trust store password> -Djavax.net.ssl.keyStore=<Path to your key store> -Djavax.net.ssl.keyStorePassword=<Your key store password>" | ||
|
||
spark.driver.extraJavaOptions=-Djavax.net.ssl.trustStore=<Path to your trust store> -Djavax.net.ssl.trustStorePassword=<Your trust store password> -Djavax.net.ssl.keyStore=<Path to your key store> -Djavax.net.ssl.keyStorePassword=<Your key store password>" | ||
|
||
Set the Properties From the Command Line | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
You can set the system properties from the command line by adding them with the | ||
``--conf`` flag when you submit a Spark job: | ||
|
||
.. code-block:: sh | ||
|
||
./bin/spark-submit --name "<Your app name>" \ | ||
--master "<Master URL>" \ | ||
--conf "spark.executor.extraJavaOptions=-Djavax.net.ssl.trustStore=<Path to your trust store> -Djavax.net.ssl.trustStorePassword=<Your trust store password> -Djavax.net.ssl.keyStore=<Path to your key store> -Djavax.net.ssl.keyStorePassword=<Your key store password>" \ | ||
rozza marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sparkApplication.jar \ | ||
--conf "spark.driver.extraJavaOptions=-Djavax.net.ssl.trustStore=<Path to your trust store> -Djavax.net.ssl.trustStorePassword=<Your trust store password> -Djavax.net.ssl.keyStore=<Path to your key store> -Djavax.net.ssl.keyStorePassword=<Your key store password>" \ | ||
sparkApplication.jar |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could link to a description or instructions for connection URI here.
I'm not sure if there's anything more specific than this?
https://www.mongodb.com/docs/upcoming/reference/connection-string/#find-your-connection-string