Skip to content

Commit f55efeb

Browse files
Chris Choschmalliso
authored andcommitted
DOCS-13471: configure SSL for the connector (#9)
* DOCS-13471: added configure SSL for the connector section
1 parent 65e4eae commit f55efeb

File tree

3 files changed

+103
-0
lines changed

3 files changed

+103
-0
lines changed

conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
'manual': ('http://docs.mongodb.com/manual%s', ''),
6565
'community-support': ('https://www.mongodb.com/community-support-resources%s', ''),
6666
'kafka-21-javadoc': ('https://kafka.apache.org/21/javadoc/org/apache/kafka%s', ''),
67+
'atlas': ('https://docs.atlas.mongodb.com%s', ''),
68+
'wikipedia': ('https://en.wikipedia.org/wiki/%s', ''),
6769
'java-docs-latest': ('http://mongodb.github.io/mongo-java-driver/3.12/%s', ''),
6870
}
6971

source/index.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ This guide is divided into the following topics:
3434
:maxdepth: 1
3535

3636
Install MongoDB Kafka Connector </kafka-installation>
37+
Configure SSL/TLS </kafka-configure-ssl>
3738
Sink Connector Guide </kafka-sink>
3839
Source Connector Guide </kafka-source>
3940
Kafka Docker Example </kafka-docker-example>

source/kafka-configure-ssl.txt

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
.. _kafka-configure-ssl:
2+
3+
=================================================
4+
Configure SSL/TLS for the MongoDB Kafka Connector
5+
=================================================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 2
13+
:class: singlecol
14+
15+
Overview
16+
--------
17+
18+
This guide shows you how to configure your MongoDB Kafka Source or Sink
19+
Connector worker to use SSL/TLS certificates to connect to a MongoDB
20+
cluster. An SSL/TLS-secured connection encrypts your network communications
21+
between your Kafka Connector and your MongoDB cluster. To enable the
22+
secure connection, create certificates, store them on the worker host machine,
23+
and supply credentials to access the certificates to the connector.
24+
25+
.. note::
26+
27+
If your MongoDB cluster is hosted by :atlas:`MongoDB Atlas </>` or does
28+
not require SSL/TLS certificates for connection explicitly, you can already
29+
connect securely and do not need to follow the steps in this guide.
30+
31+
Set up your Trust Store and Key Store
32+
-------------------------------------
33+
34+
Each server you run your Kafka Connector worker instance on needs a
35+
**key store** and **trust store** to secure your SSL/TLS credentials.
36+
37+
The key store is a password-protected database that contains a private key and
38+
a Certificate Authority (CA) signed certificate that is used to verify the
39+
client's identity to external hosts.
40+
41+
The trust store is a password-protected database that contains certificates
42+
identifying parties that the client trusts such as CA root or intermediate
43+
certificates and your MongoDB cluster's end entity certificate.
44+
45+
Key Store
46+
~~~~~~~~~
47+
48+
If your SSL/TLS configuration requires a client certificate to connect,
49+
generate a secure private key and provide the client certificate bundled
50+
with the intermediate authority certificate. You can use ``openssl`` to
51+
generate a :wikipedia:`pkcs12 </PKCS_12>` file to store this information
52+
in your key store using the following command:
53+
54+
.. code-block:: none
55+
56+
openssl pkcs12 -export -inkey <private key> -in <bundled certificate> -out <output pkcs12 file>
57+
58+
Trust Store
59+
~~~~~~~~~~~
60+
61+
Use the `keytool <https://docs.oracle.com/en/java/javase/12/tools/keytool.html>`_
62+
application packaged in your J2SE installation to import certificates of
63+
parties that you trust into the trust store with the following command:
64+
65+
.. code-block:: none
66+
67+
keytool -import -trustcacerts -import -file <root or intermediate CA certificate>
68+
69+
If your SSL/TLS configuration requires the end entity certificate for your
70+
MongoDB cluster, you can import it into the trust store with the following
71+
command:
72+
73+
.. code-block:: none
74+
75+
keytool -import -file <server bundled certificate> -keystore <keystore name>
76+
77+
For more information on how to set up a client key store and trust store for
78+
testing purposes, see
79+
:manual:`OpenSSL Client Certificates for Testing </appendix/security/appendixC-openssl-client/#appendix-c-openssl-client-certificates-for-testing>`.
80+
81+
Configure Your JVM Options
82+
--------------------------
83+
84+
The MongoDB Kafka Connector worker processes read JVM options from the
85+
environment variable ``KAFKA_OPTS``.
86+
87+
Export the following JVM options in the ``KAFKA_OPTS`` variable, substituting
88+
the values for the placeholders before launching your worker instance.
89+
90+
.. code-block:: none
91+
92+
export KAFKA_OPTS="\
93+
-Djavax.net.ssl.trustStore=<path to truststore> \
94+
-Djavax.net.ssl.trustStorePassword=<truststore password> \
95+
-Djavax.net.ssl.keyStore=<path to keystore> \
96+
-Djavax.net.ssl.keyStorePassword=<keystore password>"
97+
98+
After you configure the ``KAFKA_OPTS`` variable, the Connector should attempt
99+
to connect using the SSL/TLS protocol and certificates in your key store
100+
and trust store when run.

0 commit comments

Comments
 (0)