Skip to content

Parse Dashboard not connecting Parse Server (err: master key is required) #2382

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

Open
4 tasks done
sudhishkr opened this issue Feb 6, 2023 · 18 comments
Open
4 tasks done
Labels
bounty:$5 Bounty applies for fixing this issue (Parse Bounty Program) type:docs Only change in the docs or README

Comments

@sudhishkr
Copy link

sudhishkr commented Feb 6, 2023

New Issue Checklist

Issue Description

Parse Dashboard not connecting Parse Server (err: master key is required)

Steps to reproduce

docker run --name parse-mongo-db -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=password -p 27017:27017 -d mongo

docker run --name parse-server -e PARSE_SERVER_APPLICATION_ID=myapp -e PARSE_SERVER_MASTER_KEY=master_key -e PARSE_SERVER_DATABASE_URI=mongodb://admin:password@mongo/parse_server?authSource=admin --link parse-mongo-db:mongo -p 1337:1337 -d parseplatform/parse-server

cat > /tmp/config.json << EOF
{
  "apps": [
    {
      "serverURL": "http://localhost:1337/parse",
      "appId": "myapp",
      "masterKey": "master_key",
      "appName": "myapp",
      "masterKeyIps": ["127.0.0.1"]
    }
  ],
  "users": [
    {
      "user":"admin",
      "pass":"password",
      "apps": [{"appId": "myapp", "readOnly": false}]
    }
  ]
}
EOF

docker run --name parse-dashboard -e PARSE_DASHBOARD_ALLOW_INSECURE_HTTP=true --link parse-server:parse-server -p 4040:4040 -v /tmp/config.json:/src/Parse-Dashboard/parse-dashboard-config.json -d parseplatform/parse-dashboard

Actual Outcome

Screen Shot 2023-02-05 at 7 45 02 PM

Expected Outcome

Successful Login

Environment

$ docker images
parseplatform/parse-server      latest       7c5539478f9a   6 days ago     262MB
parseplatform/parse-dashboard   latest       ba8bd5083493   3 months ago   361MB
mongo                           latest       a440572ac3c1   3 days ago     639MB

Dashboard

  • Parse Dashboard version: ba8bd5083493
  • Browser (Safari, Chrome, Firefox, Edge, etc.): All
  • Browser version: NA

Server

  • Parse Server version: 7c5539478f9a
  • Operating system: MacOS
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Local

Database

  • System (MongoDB or Postgres): Mongo
  • Database version: a440572ac3c1
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): Local

Logs

Failed to load resource: the server responded with a status of 403 (Forbidden)

on browser ^

@parse-github-assistant
Copy link

parse-github-assistant bot commented Feb 6, 2023

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@sudhishkr
Copy link
Author

Similar issue #602

@andrewfelker I know the previous issue is quite old, but do you have any insights here?

@sudhishkr
Copy link
Author

Similar issue #2349

@zhangwb1996 do you see any issue with the way I have set up "masterKeyIps": ["127.0.0.1"]

@dblythy
Copy link
Member

dblythy commented Feb 6, 2023

It would be relating to masterKeyIps, If you have a look at the Parse Server logs, it should tell you the IP that was rejected. Adding that to the masterKeyIps will resolve the issue

@sudhishkr
Copy link
Author

It would be relating to masterKeyIps, If you have a look at the Parse Server logs, it should tell you the IP that was rejected. Adding that to the masterKeyIps will resolve the issue

Thanks @dblythy .. I am going to try it on my parse-server. Also looks like this fix is out in the beta release as per this parse-community/parse-server#8316 (comment)

@sudhishkr
Copy link
Author

Yay! I got this working .. thanks @dblythy! Going to close this issue.

@mtrezza mtrezza added the type:question Support or code-level question label Feb 6, 2023
@mtrezza
Copy link
Member

mtrezza commented Feb 6, 2023

Would you want to add the step to the Parse Dashboard installation instructions in the README?

It should say that for Parse Server 6 the masterKeyIps needs to be configured.

I've reopened this as a docs issue.

@mtrezza mtrezza added type:docs Only change in the docs or README and removed type:question Support or code-level question labels Feb 6, 2023
@mtrezza mtrezza reopened this Feb 6, 2023
@ghasempoorm
Copy link

ghasempoorm commented Feb 13, 2023

Yay! I got this working .. thanks @dblythy! Going to close this issue.

hello,
I have same problem. but it's not worked after adding the rejected IP. why?

@matthiasbaldi
Copy link

Is there any documentation to this property masterKeyIps?
Because how should we define a IP whitelist when i.e. the dashboard is running in a Kubernetes cluster? Yes, I could define IPs but this is not how you should provision your cluster. Or do I have missed something on this feature?
Is it possible at least to set an IP range by CIDR?

@mtrezza
Copy link
Member

mtrezza commented Mar 3, 2023

Yes, you can use CIDR syntax to enable for example all IPs.

The Parse Server docs for that option have been improved but it's not merged into stable release yet hence they are not published.


/* (Optional) Restricts the use of master key permissions to a list of IP addresses.<br><br>This option accepts a list of single IP addresses, for example:<br>`['10.0.0.1', '10.0.0.2']`<br><br>You can also use CIDR notation to specify an IP address range, for example:<br>`['10.0.1.0/24']`<br><br>Special cases:<br>- Setting an empty array `[]` means that `masterKey` cannot be used even in Parse Server Cloud Code.<br>- Setting `['0.0.0.0/0']` means disabling the filter and the master key can be used from any IP address.<br><br>To connect Parse Dashboard from a different server requires to add the IP address of the server that hosts Parse Dashboard because Parse Dashboard uses the master key.<br><br>Defaults to `['127.0.0.1', '::1']` which means that only `localhost`, the server itself, is allowed to use the master key.
  :DEFAULT: ["127.0.0.1","::1"] */
masterKeyIps: ?(string[]);

@sudhishkr
Copy link
Author

@mtrezza let me take a stab at fixing the docs. I read somewhere that this issue was fixed in the upcoming new release (not sure if thats still true).

@muratdoglu
Copy link

@sudhishkr hi, I have 'unauthorized: master key is required' problem but can't solve this. Can you explain to me? But basic please :D

@mtrezza mtrezza added the bounty:$5 Bounty applies for fixing this issue (Parse Bounty Program) label Jun 7, 2023
@edson-gaspar
Copy link

I think this info will be important for someone having trouble when trying to run parse-server + parse-dashboard on docker-compose: When listing ips on PARSE_SERVER_MASTER_KEY_IPS, the syntax is not an array like on javascript, this catch errors on server start, you need to list ips splitted by comma on environment variable. Ex: PARSE_SERVER_MASTER_KEY_IPS: 172.0.0.0/1,::1

@mtrezza
Copy link
Member

mtrezza commented Oct 18, 2023

@edson-gaspar Would you want to open a PR to add this to the docs?

@edson-gaspar
Copy link

@mtrezza I don't feel quite sure how I should document it.

@sudhishkr
Copy link
Author

@mtrezza - if you can assign this to me, I can try to take a stab on Thursday.

@mtrezza
Copy link
Member

mtrezza commented Oct 24, 2023

@sudhishkr We don't "assign" issues, please feel free to open a PR and link this issue so that others can see you're working on it.

@fatherofinvention
Copy link

Fix for "Server not reachable: unauthorized: master key is required" Error

I ran up against this today and struggled a bit. Hope this helps someone. If you encounter the error "Server not reachable: unauthorized: master key is required" while setting up Parse Server, you might need to specify the IP addresses allowed to use the master key. To resolve this issue, add the PARSE_SERVER_MASTER_KEY_IPS environment variable to your configuration, using the CIDR notation 0.0.0.0/0 to allow all IPs. In my docker-compose.yml I added:

parse:
    image: parseplatform/parse-server
    environment:
      - # OTHER ENV VARS
      - PARSE_SERVER_MASTER_KEY_IPS=0.0.0.0/0

Be cautious with this setting as it opens up master key access to all IP addresses, which could pose a security risk. If you want to tighten it up, add your own local IP address that you are accessing the dashboard from (e.g. your laptop's IP).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bounty:$5 Bounty applies for fixing this issue (Parse Bounty Program) type:docs Only change in the docs or README
Projects
None yet
Development

No branches or pull requests

8 participants