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

mongo express simple access does not work anymore #105

Open
Verizane opened this issue Oct 24, 2023 · 10 comments
Open

mongo express simple access does not work anymore #105

Verizane opened this issue Oct 24, 2023 · 10 comments

Comments

@Verizane
Copy link

Verizane commented Oct 24, 2023

Hi,

a few months before I used the following compose to start a simple mongo-express and mongodb setup for local usage:

version: '3.1'

services:

  mongo:
    image: mongo
    restart: always
    ports:
      - 27017:27017
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: example

  mongo-express:
    image: mongo-express
    restart: always
    ports:
      - 8081:8081
    environment:
      ME_CONFIG_MONGODB_ADMINUSERNAME: root
      ME_CONFIG_MONGODB_ADMINPASSWORD: example
      ME_CONFIG_MONGODB_URL: mongodb://root:example@mongo:27017/

up until now it was working as expected, I could use the mongo express to access the database information without authentication.

Now a colleague and I tried it again with clean images and it does not work anymore.

Has the default authentication changed?

@fsklenar
Copy link

Hi,

same for me - I am not able to connect to DB.

@duncan-tincello
Copy link

Hello, same here.

@monsterkrampe
Copy link

monsterkrampe commented Oct 27, 2023

I had a similar (maybe the same) issue. For me, this is related to #87.
Version 1.0.0 of mongo-express makes it impossible to disable basic authentication. mongo-express/mongo-express#969 mongo-express/mongo-express#975
(I had mongo-express running behind traefik with basic auth and almost lost it since basic auth dialogues kept popping up all the time despite the correct credentials for the traefik middleware. I'm now not using the traefik middleware anymore and just set the appropriate credentials for the mongo-express basic auth via environment variables.)

This specific issue should be resolved in Version 1.0.1 or higher.

@duncan-tincello
Copy link

I just noticed this in the Docker logs:
basicAuth credentials are "admin:pass", it is recommended you change this in your config.js!
The credentials admin/pass work for me.

@monsterkrampe
Copy link

monsterkrampe commented Oct 27, 2023

True, admin:pass works by default.
You can also set different credentials with the environment variables ME_CONFIG_BASICAUTH_USERNAME and ME_CONFIG_BASICAUTH_PASSWORD but you cannot disable it entirely even if you set this to empty strings apparently.

@MiladZarour
Copy link

I am not sure if I have the same error,
I am learning docker, and I want to create a new docker for mongo-express using this command :
docker run -d -p 8081:8081 -e ME_CONFIG_MONGODB_ADMINUSERNAME=admin -e ME_CONFIG_MONGODB_ADMINPASSWORD=password --net mongo-network --name mongo-express -e ME_CONFIG_MONGODB_SERVER=mongodb mongo-express

After that , tried to localhost:8081 , and it is asking me for username and password
so I write the username : admin , and the password : password

and for some reason it is not accepting it !

is that somehow similar here ?

@MiladZarour
Copy link

MiladZarour commented Dec 7, 2023

aaah , I just read the comment above me , it says admin:pass
I tried that , and it works !
not sure why !
maybe I should set those environment varilabes : ME_CONFIG_BASICAUTH_USERNAME ME_CONFIG_BASICAUTH_PASSWORD ?

@PoseidonOstravy
Copy link

PoseidonOstravy commented Jan 4, 2024

I am encountering an "Unauthorized" issue similar to what's been discussed in this thread using basicaly same yaml. Despite setting up the environment variables for admin credentials correctly in my docker-compose.yml, Mongo-Express displayed an "Unauthorized" message when attempting to access in web browser for me and several colleagues.

I noticed in the discussion that as of version 1.0.0 of mongo-express, it's no longer possible to disable basic authentication, which might be leading to the unauthorized issues..

Interestingly, the issue seems to have resolved itself as we are now able to access Mongo-Express without the unauthorized message (and that make us scared). Could there have been any changes or updates in the background that resolved this issue? Has anyone else experienced a similar sudden resolution?

EDIT: Found root cause - corporate overlords disabled basic auth in Edge with a policy. Solution - use other browser then Edge when expecting basic auth

@BlackthornYugen
Copy link
Member

Has the default authentication changed?

The default is now to require a password, but you can disable it with ME_CONFIG_BASICAUTH=false. Currently the default credentials are admin:pass but in a future enhancement a random password I'd like to log a random password if a password isn't set. For users that don't want any password they can disable BASICAUTH or set a fixed password.

@Sarath61
Copy link

aaah , I just read the comment above me , it says admin:pass I tried that , and it works ! not sure why ! maybe I should set those environment varilabes : ME_CONFIG_BASICAUTH_USERNAME ME_CONFIG_BASICAUTH_PASSWORD ?

I was unable to login after ME_CONFIG_BASICAUTH_USERNAME ME_CONFIG_BASICAUTH_PASSWORD using these env variables also what changes you made in previous command you mention above to work ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants