azukaar / Cosmos-Server

☁️ The Most Secure and Easy Selfhosted Home Server. Take control of your data and privacy without sacrificing security and stability (Authentication, anti-DDOS, anti-bot)
https://cosmos-cloud.io
Other
3.58k stars 126 forks source link

[BUG]: SCRAM-SHA-1 Authentication failed when using own DB credentials #27

Closed psybernoid closed 1 year ago

psybernoid commented 1 year ago

What happened?

When launching install wizard and selecting supply my own credentials, the web GUI seemingly accepts it. image

However, progress is not made, docker logs show: [ERROR] Status: Database error : connection() error occurred during connection handshake: auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-1": (AuthenticationFailed) Authentication failed.

What should have happened?

Presumably, when supplying database credentials, the wizard should skip this step and connect?

How to reproduce the bug?

Sample docker-compose file. Should be able to reproduce from this.

version: '3.3' services: cosmos-server: image: 'azukaar/cosmos-server:latest' container_name: cosmos-server restart: unless-stopped depends_on:

networks: cosmos: name: cosmos-db external: false

Relevant log output

[ERROR] Status: Database error : connection() error occurred during connection handshake: auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-1": (AuthenticationFailed) Authentication failed.

Other details

No response

System details

Alpine Linux 3.17

azukaar commented 1 year ago

This is just mongo complaining about "Authentication Failed" aka. your password is wrong that can have two reasons:

psybernoid commented 1 year ago

Re-creating from scratch and changed the password to something simple - Abcd1234.

Still the same error.

azukaar commented 1 year ago

Try removing name: cosmos-db in your network?

psybernoid commented 1 year ago

Right. Got it, the issue was with the environment variables in the mongo container. I was using the docker-compose posted here: https://github.com/azukaar/Cosmos-Server/issues/11#issuecomment-1547482207 as an initial guide.

Below is a working config template:

version: '3.3' services: cosmos-server: image: 'azukaar/cosmos-server:latest' container_name: cosmos-server restart: unless-stopped depends_on:

networks: cosmos: external: false

azukaar commented 1 year ago

Glad you worked it out!