Configure SSL connection for Mongo DB

Highlighted
Five Stars

Configure SSL connection for Mongo DB

Hi There,

 

We need to connect to MongoDB through Talend Using SSl Connection.

We have the Certificate, Certificate Authority and Private key files. But not sure how to use it in Talend.

Can anybody please help us with this.

 

Regards,

Apoorv Jain


Accepted Solutions
Five Stars

Re: Configure SSL connection for Mongo DB

Hi Sabrina,

 

Thanks for your reply, I was able to resolve this by following the below steps:

 

Step 1: Generate P12 keystore by using Mongodb Client Certificate and client private key:

openssl pkcs12 -export -name mongo_clientcert -in mongo-certificate -inkey client-private-key -out mongoclientkeystore.p12

Step 2: Convert P12 keystore to jks key store:

 

keytool -importkeystore -destkeystore mongoclient.keystore -srckeystore mongoclientkeystore.p12 -srcstoretype pkcs12 -alias mongo_clientcert

Step 3: Add the Certifying authority certificate and Mongo Client certificate to the truststore:

keytool -import -alias server-cert -file cacert -keystore mongoclient.truststore
keytool -import -alias client-cert -file mongo-certificate -keystore mongoclient.truststore

I then configured tSetKeyStore to use mongoclient.truststore as the TrustStore file and checked Need Client Authentication checkbox and used mongoclient.keystore generated in step 2 as the KeyStore.

 

The below link was very helpful in understanding the SSL certificate setup:
https://unix.stackexchange.com/questions/347116/how-to-create-keystore-and-truststore-using-self-sig...

Thanks and Regards,

Apoorv Jain


All Replies
Moderator

Re: Configure SSL connection for Mongo DB

Hello,

Is your mongodb-cert.crt the public self-signed certificate? If not, you could generate a JKS truststore using keytool :

keytool -importcert -file mongodb-cert.crt -keystore keystore.jks -alias "MONGODB"

 

In talend studio, you can use the tSetKeyStore component to load SSL configuration and point the ''TrustStore File" to your generated trust store.

tSetKeyStore-->onsubjobok-->tMongoDBConnection-->onsubjobok-->tMongoDBInput-->further processing.

Best regards

Sabrina

 

 

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Five Stars

Re: Configure SSL connection for Mongo DB

Hi Sabrina,

 

Thanks for your reply, I was able to resolve this by following the below steps:

 

Step 1: Generate P12 keystore by using Mongodb Client Certificate and client private key:

openssl pkcs12 -export -name mongo_clientcert -in mongo-certificate -inkey client-private-key -out mongoclientkeystore.p12

Step 2: Convert P12 keystore to jks key store:

 

keytool -importkeystore -destkeystore mongoclient.keystore -srckeystore mongoclientkeystore.p12 -srcstoretype pkcs12 -alias mongo_clientcert

Step 3: Add the Certifying authority certificate and Mongo Client certificate to the truststore:

keytool -import -alias server-cert -file cacert -keystore mongoclient.truststore
keytool -import -alias client-cert -file mongo-certificate -keystore mongoclient.truststore

I then configured tSetKeyStore to use mongoclient.truststore as the TrustStore file and checked Need Client Authentication checkbox and used mongoclient.keystore generated in step 2 as the KeyStore.

 

The below link was very helpful in understanding the SSL certificate setup:
https://unix.stackexchange.com/questions/347116/how-to-create-keystore-and-truststore-using-self-sig...

Thanks and Regards,

Apoorv Jain

Moderator

Re: Configure SSL connection for Mongo DB

Hello @apoorv_jain5000 

Great it is fixed and thanks for sharing this reference with us on community.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Put Massive Amounts of Data to Work

Learn how to make your data more available, reduce costs and cut your build time

Watch Now

How OTTO Utilizes Big Data to Deliver Personalized Experiences

Read about OTTO's experiences with Big Data and Personalized Experiences

Blog

Talend Integration with Databricks

Take a look at this video about Talend Integration with Databricks

Watch Now