Open brenojac opened 4 years ago
Any luck with this one? I'm experiencing similar issue when running inside Kubernetes.
Me too!
Also having this issue! My credentials are correct!! What the HECK!
Hey, I know why....you need to do this: instead of echo password | base64, do echo -n password | base64 and of course same for username.
Just try!
On Thu, Dec 31, 2020, 12:17 AM Braedencraig notifications@github.com wrote:
Also having this issue! My credentials are correct!! What the HECK!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mongo-express/mongo-express/issues/579#issuecomment-752677753, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEHZNZ7WBPJ6W333RYBMOCDSXNHCRANCNFSM4OINNLAQ .
I'm facing the same issue (using MongoDB Community Kubernetes Operator)
@deba10106 Where do you have to use the base64 encoding (when setting the password with MongoDB or just as a value for ME_CONFIG_MONGODB_ADMINPASSWORD)?
@fpause The solve for me was setting docker to a clean slate, and trying to authenticate again.
delete node_modules and package-lock, docker volume prune, docker rmi $(docker images -a -q), docker system prune
Hello my dear friends.
I've been trying to setup a docker container with MongoExpress + MongoDB all week long. I really tried fixing it using all information available on google, but I believe it exausted the possibilities of something obvious I'm missing. Here's my docker-compose (I'm omitting whatever is not related to mongodb and mdb express):
mongo: image: mongo container_name: mongodb restart: unless-stopped env_file: .env environment: - MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME} - MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD} - MONGO_INITDB_DATABASE=auth networks: - education-network volumes: - ./strapidb:/data/db ports: - "27017:27017" mongo-express: image: mongo-express ports: - 8081:8081 env_file: .env environment: - ME_CONFIG_MONGODB_ENABLE_ADMIN=true - ME_CONFIG_MONGODB_ADMINUSERNAME=${ME_CONFIG_MONGODB_ADMINUSERNAME} - ME_CONFIG_MONGODB_ADMINPASSWORD=${ME_CONFIG_MONGODB_ADMINPASSWORD} - ME_CONFIG_MONGODB_SERVER=${ME_CONFIG_MONGODB_SERVER} - ME_CONFIG_BASICAUTH_USERNAME=${ME_CONFIG_BASICAUTH_USERNAME} - ME_CONFIG_BASICAUTH_PASSWORD=${ME_CONFIG_BASICAUTH_PASSWORD} - ME_CONFIG_MONGODB_PORT=${ME_CONFIG_MONGODB_PORT} depends_on: - mongo links: - mongo networks: - education-network networks: education-network: driver: bridge
Here's my .env file (it's ok about passwords, I'll change them later, just for the sake of debugging this issue):
DATABASE_CLIENT=mongo DATABASE_NAME=strapi DATABASE_HOST=mongodb DATABASE_PORT=27017 DATABASE_USERNAME=strapi DATABASE_PASSWORD=password MONGO_INITDB_ROOT_USERNAME=admin MONGO_INITDB_ROOT_PASSWORD=pass ME_CONFIG_MONGODB_ADMINUSERNAME=admin ME_CONFIG_MONGODB_ADMINPASSWORD=pass ME_CONFIG_MONGODB_SERVER=mongodb ME_CONFIG_BASICAUTH_USERNAME=admin ME_CONFIG_BASICAUTH_PASSWORD=pass ME_CONFIG_MONGODB_PORT=27017
It runs just fine:
root@educationexperience:~/services/strapi# docker-compose up -d Creating network "strapi_education-network" with driver "bridge" Creating strapi ... done Creating mongodb ... done Creating strapi_mongo-express_1 ... done
It is hosted at https://mdb.projetoalex.cc. It's aparrently ok but no database is possible to create or edit, listing...
Here is the docker logs output:
mongo-express_1 | Welcome to mongo-express mongo-express_1 | ------------------------ mongo-express_1 | mongo-express_1 | mongo-express_1 | Mongo Express server listening at http://0.0.0.0:8081 mongo-express_1 | Server is open to allow connections from anyone (0.0.0.0) mongo-express_1 | basicAuth credentials are "admin:pass", it is recommended you change this in your config.js! mongodb | 2020-06-25T14:18:14.930+0000 I NETWORK [listener] connection accepted from 172.30.0.4:39680 #2 (1 connection now open) mongodb | 2020-06-25T14:18:14.941+0000 I NETWORK [conn2] received client metadata from 172.30.0.4:39680 conn2: { driver: { name: "nodejs", version: "2.2.24" }, os: { type: "Linux", name: "linux", architecture: "x64", version: "4.15.0-101-generic" }, platform: "Node.js v12.18.1, LE, mongodb-core: 2.1.8" } mongo-express_1 | Database connected mongodb | 2020-06-25T14:18:14.951+0000 I SHARDING [conn2] Marking collection admin.system.users as collection version: <unsharded> mongodb | 2020-06-25T14:18:14.952+0000 I ACCESS [conn2] SASL SCRAM-SHA-1 authentication failed for admin on admin from client 172.30.0.4:39680 ; UserNotFound: Could not find user "admin" for db "admin" mongo-express_1 | Error [MongoError]: Authentication failed. mongo-express_1 | at Function.MongoError.create (/node_modules/mongodb-core/lib/error.js:31:11) mongo-express_1 | at /node_modules/mongodb-core/lib/connection/pool.js:483:72 mongo-express_1 | at authenticateStragglers (/node_modules/mongodb-core/lib/connection/pool.js:429:16) mongo-express_1 | at Connection.messageHandler (/node_modules/mongodb-core/lib/connection/pool.js:463:5) mongo-express_1 | at Socket.<anonymous> (/node_modules/mongodb-core/lib/connection/connection.js:319:22) mongo-express_1 | at Socket.emit (events.js:315:20) mongo-express_1 | at addChunk (_stream_readable.js:295:12) mongo-express_1 | at readableAddChunk (_stream_readable.js:271:9) mongo-express_1 | at Socket.Readable.push (_stream_readable.js:212:10) mongo-express_1 | at TCP.onStreamRead (internal/stream_base_commons.js:186:23) { mongo-express_1 | ok: 0, mongo-express_1 | errmsg: 'Authentication failed.', mongo-express_1 | code: 18, mongo-express_1 | codeName: 'AuthenticationFailed' mongo-express_1 | } mongo-express_1 | Admin Database connected mongo-express_1 | unable to list databases mongo-express_1 | Error [MongoError]: command listDatabases requires authentication mongo-express_1 | at Function.MongoError.create (/node_modules/mongodb-core/lib/error.js:31:11) mongo-express_1 | at /node_modules/mongodb-core/lib/connection/pool.js:483:72 mongo-express_1 | at authenticateStragglers (/node_modules/mongodb-core/lib/connection/pool.js:429:16) mongo-express_1 | at Connection.messageHandler (/node_modules/mongodb-core/lib/connection/pool.js:463:5) mongo-express_1 | at Socket.<anonymous> (/node_modules/mongodb-core/lib/connection/connection.js:319:22) mongo-express_1 | at Socket.emit (events.js:315:20) mongo-express_1 | at addChunk (_stream_readable.js:295:12) mongo-express_1 | at readableAddChunk (_stream_readable.js:271:9) mongo-express_1 | at Socket.Readable.push (_stream_readable.js:212:10) mongo-express_1 | at TCP.onStreamRead (internal/stream_base_commons.js:186:23) { mongo-express_1 | ok: 0, mongo-express_1 | errmsg: 'command listDatabases requires authentication', mongo-express_1 | code: 13, mongo-express_1 | codeName: 'Unauthorized' mongo-express_1 | }
Sorry for this long post. But I really tried all options and I'm stuck with this issue. Hoping you guys can help me debug and solve it.
Thanks in advance.
- Breno
environment:
ME_CONFIG_MONGODB_SERVER: serip
ME_CONFIG_OPTIONS_EDITORTHEME: 3024-night
ME_CONFIG_BASICAUTH_USERNAME: username
ME_CONFIG_BASICAUTH_PASSWORD: password
ME_CONFIG_MONGODB_ADMINUSERNAME: mongouser
ME_CONFIG_MONGODB_ADMINPASSWORD: mongpasswd
@fpause The solve for me was setting docker to a clean slate, and trying to authenticate again.
delete node_modules and package-lock, docker volume prune, docker rmi $(docker images -a -q), docker system prune
I'm setting up just after cleaning docker when I found this issue. It's present and making mongo-express completely unusable.
@fpause, did you find a solution? I am also having the same issue with MongoDB Community Kubernetes Operator
Looks like it got fixed in v1.0.0-alpha.1
@StMarian I had to add support for SCRAM-SHA-1
in MongoDB Community Kubernetes Operator. By default there is a support only for the new one: SCRAM-SHA-256
.
...
spec:
security:
authentication:
modes: ["SCRAM", "SCRAM-SHA-1"]
...
After that, mongo-express
(0.54.0
) connected to my mongo (4.2
).
https://www.mongodb.com/docs/manual/core/security-scram/
Maybe, mongo-express
uses old library where only SCRAM-SHA-1
mechanism is supported?
I saw some bumps of packages in 1.0.0
, so maybe that's why it works on this tag.
anyone who has found a solution? I am facing a similar issue
Hey, I know why....you need to do this: instead of echo password | base64, do echo -n password | base64 and of course same for username.
Just try!
On Sat, 31 Dec 2022, 15:42 DANCHE, @.***> wrote:
anyone who has found a solution? I am facing a similar issue
— Reply to this email directly, view it on GitHub https://github.com/mongo-express/mongo-express/issues/579#issuecomment-1368179810, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEHZNZ2F5NE4K3C2FDM7ACTWP7PV7ANCNFSM4OINNLAQ . You are receiving this because you were mentioned.Message ID: @.***>
Well ... from my struggle with this .. I can share that not quoting "true" "false" values does lead to inconsistent behaviour I have a very similar docker compose and these 2 expressions behave differently.
ME_CONFIG_MONGODB_ENABLE_ADMIN=true
ME_CONFIG_MONGODB_ENABLE_ADMIN="true"
@StMarian I had to add support for
SCRAM-SHA-1
in MongoDB Community Kubernetes Operator. By default there is a support only for the new one:SCRAM-SHA-256
.... spec: security: authentication: modes: ["SCRAM", "SCRAM-SHA-1"] ...
After that,
mongo-express
(0.54.0
) connected to my mongo (4.2
).https://www.mongodb.com/docs/manual/core/security-scram/
Maybe,
mongo-express
uses old library where onlySCRAM-SHA-1
mechanism is supported?I saw some bumps of packages in
1.0.0
, so maybe that's why it works on this tag.
I can confirm that this is the solution when MongoDB Community Kubernetes operator is used. It took me half a day to find the comment and thus the solution. Thanks a lot! 😊
I am using version 1.0.2-rc
of mongo-express. So the problem with the unsupported authentenication mechanism does not seem to be solved by the mentioned upgrade of the dependencies.
I have the same issue.
For people who still have this problem, there is solution for docker-compose:
volumes:
project_local_mongo_data: {}
services:
mongo:
image: mongo:7
container_name: project_local_mongo
volumes:
- local_mongo_data:/data/db
ports:
- '27017:27017'
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: example
mongo-express:
image: mongo-express:1
container_name: project_local_mongo_express
depends_on:
- mongo
ports:
- '8081:8081'
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: example
ME_CONFIG_MONGODB_URL: mongodb://root:example@mongo:27017/
ME_CONFIG_BASICAUTH: false
Probably this is the line you are looking for ME_CONFIG_MONGODB_URL: mongodb://root:example@mongo:27017/
Good luck!
Hello my dear friends.
I've been trying to setup a docker container with MongoExpress + MongoDB all week long. I really tried fixing it using all information available on google, but I believe it exausted the possibilities of something obvious I'm missing. Here's my docker-compose (I'm omitting whatever is not related to mongodb and mdb express):
Here's my .env file (it's ok about passwords, I'll change them later, just for the sake of debugging this issue):
It runs just fine:
It is hosted at https://mdb.projetoalex.cc. It's aparrently ok but no database is possible to create or edit, listing...
Here is the docker logs output:
Sorry for this long post. But I really tried all options and I'm stuck with this issue. Hoping you guys can help me debug and solve it.
Thanks in advance.