Skip to content
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

[Question] MongoDB Connection String and TLS/SSL Configuration #395

Open
Kuchsn opened this issue Aug 22, 2024 · 5 comments
Open

[Question] MongoDB Connection String and TLS/SSL Configuration #395

Kuchsn opened this issue Aug 22, 2024 · 5 comments
Labels
question Further information is requested

Comments

@Kuchsn
Copy link

Kuchsn commented Aug 22, 2024

Is your feature request related to a problem? Please describe.

  1. Is there a way to use just a connection string for the MongoDB?
  2. Is there a way to add additional connection parameters to get a TLS/SSL secured Mongo connection?

Describe the solution you'd like
A single parameter for a connection string or an additional parameter for additional connection parameters.

Describe alternatives you've considered
A long term solution has to support a scalable extern MongoDB implementation. A Docker contain is justifiable for development.

@merlinseela
Copy link

merlinseela commented Aug 22, 2024

To question 1:
I am not entirly sure what exactly you are trying to accomplish but...

You can change the settings using properties files for the individual containers by setting the following parameters and then mounting the custom properties as a volume.

e.g. for AAS Environment

Properties:

basyx.backend = MongoDB
spring.data.mongodb.host=mongo
spring.data.mongodb.port=27017
spring.data.mongodb.database=aasenvironments
spring.data.mongodb.authentication-database=admin
spring.data.mongodb.username=mongoAdmin
spring.data.mongodb.password=mongoPassword

Docker mount:

    volumes:
      # Mount application.properties file
      - ./properties/aas_env_application.properties:/application/application.properties

As for question 2: No idea. I am just developing with BaSyx but not doing any Development of BaSyx itself.

@Kuchsn
Copy link
Author

Kuchsn commented Aug 22, 2024

I am not entirly sure what exactly you are trying to accomplish...

I want to add additional Parameter for Security like "tls":

additional_params=?authSource=admin&tls=true

You can change the settings using properties files...

Yes, that's what i assumend. But there are 89 properties files in the Repo, 11 in the aasenv folder and because authSource is already in the authentication-database parameter, it doesn't seem to be the right one to append tls=true.

I would like to do 2/(3) things:

  1. Use Mongo with TLS
  2. Make it possible to connect to an other extern database
  3. (Make it possible to configure the server using a connection string)

@mhrimaz
Copy link
Contributor

mhrimaz commented Aug 22, 2024

@Kuchsn You can use spring.data.mongodb.uri
https://docs.spring.io/spring-boot/reference/data/nosql.html#data.nosql.mongodb.connecting

@aaronzi aaronzi closed this as completed Aug 23, 2024
@Kuchsn
Copy link
Author

Kuchsn commented Aug 23, 2024

I will try to test this asap.
Thx for the info!

@max-schlenz
Copy link

we've tried the suggestions, unfortunately we haven't been successful.

After enabling TLS on the side of MongoDB, and verifying that i can only connect to it with TLS enabled, BaSyX still is unable to connect and shows "SSL Handshake Failed".
I'm using the same connection string as in MongoDB Compass, where i can connect successfully.

I've tried:

 spring.data.mongodb.host=
 spring.data.mongodb.port=
 spring.data.mongodb.database=
 spring.data.mongodb.authentication-database=
 spring.data.mongodb.username=
 spring.data.mongodb.password=
 spring.data.mongodb.ssl.enabled=
 spring.data.mongodb.uri=

in aas-discovery.properties and aas-env.properties, which are properly mounted in the containers.

@aaronzi aaronzi reopened this Aug 27, 2024
@aaronzi aaronzi added the question Further information is requested label Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Status: Backlog
Development

No branches or pull requests

5 participants