hassio-addons/addon-node-red

Dashboard access user - 401 Access Denied #366

droopanu posted onGitHub

Problem/Motivation

I'm trying to access the dashboard/gui using https (port 1880) and I get 401 Access Denied

I have configured the same username and password in http_static and http_node.

Expected behavior

Access the dashboard using the user in the config.

Actual behavior

HTTP basic auth not recognizing my user. 401 Access Denied

Steps to reproduce

(How can someone else make/see it happen)

Proposed changes

(If you have a proposed change, workaround or fix, describe the rationale behind it)


:wave: Thanks for opening your first issue here! If you're reporting a :bug: bug, please make sure you include steps to reproduce it. Also, logs, error messages and information about your hardware might be usefull.

posted by addons-assistant[bot] over 5 years ago

Have you seen and applied this note from the add-on documentation?

Note: In order to use the http_node you will need to expose Node-RED using a network port in addition to ingress. The HTTP nodes will also be presented under /endpoint/ as shown in the UI. If using the node-red-dashboard module this will also be hosted under this path and will use any credentials set here.

AND

If you cannot access HTTP nodes or Node-RED Dashboard, please check if you URL starts with /endpoint/, or else Home Assistant authentication will kick in.

posted by frenck over 5 years ago

I've done that. Otherwise there would be no response to the https request. The user/password shows that the port was was active.

After a bit of digging in the hass.io logs I noticed that the authentication was rejected by hass.io, not by the nodered addon. So I added that user/password also to hass.io and now it's working. Might be a good idea to add that to the FAQ.

Cheers, Liviu

posted by droopanu over 5 years ago

So I added that user/password also to hass.io and now it's working.

This shouldn't be necessary (and isn't a great user experience), it would be helpful if you could post the 401 response from the log, so we can identify the root cause.

posted by sinclairpaul over 5 years ago

The user I am using is "nodeadmin"

This is the 403:

Nov 12 12:41:47 dockervm 1e9f0975f0c8[915]: #033[32m19-11-11 23:41:47 INFO (MainThread) [hassio.auth] Auth request from a0d7b954_nodered for nodeadmin#033[0m Nov 12 12:41:47 dockervm hassio-supervisor[1352]: #033[32m19-11-11 23:41:47 INFO (MainThread) [hassio.auth] Auth request from a0d7b954_nodered for nodeadmin#033[0m Nov 12 12:41:47 dockervm 1e9f0975f0c8[915]: #033[33m19-11-11 23:41:47 WARNING (MainThread) [hassio.auth] Wrong login from nodeadmin#033[0m Nov 12 12:41:47 dockervm hassio-supervisor[1352]: #033[33m19-11-11 23:41:47 WARNING (MainThread) [hassio.auth] Wrong login from nodeadmin#033[0m

And this is a successful login after adding the user in hass.io:

Nov 13 10:02:31 dockervm hassio-supervisor[1352]: #033[32m19-11-12 21:02:31 INFO (MainThread) [hassio.auth] Auth request from a0d7b954_nodered for nodeadmin#033[0m Nov 13 10:02:31 dockervm 1e9f0975f0c8[915]: #033[32m19-11-12 21:02:31 INFO (MainThread) [hassio.auth] Auth request from a0d7b954_nodered for nodeadmin#033[0m Nov 13 10:02:31 dockervm 1e9f0975f0c8[915]: #033[32m19-11-12 21:02:31 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token#033[0m Nov 13 10:02:31 dockervm hassio-supervisor[1352]: #033[32m19-11-12 21:02:31 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token#033[0m Nov 13 10:02:31 dockervm 1e9f0975f0c8[915]: #033[32m19-11-12 21:02:31 INFO (MainThread) [hassio.auth] Success login from nodeadmin#033[0m Nov 13 10:02:31 dockervm hassio-supervisor[1352]: #033[32m19-11-12 21:02:31 INFO (MainThread) [hassio.auth] Success login from nodeadmin#033[0m

posted by droopanu over 5 years ago

Thanks, but can I see the 403 from the addon, i.e. the Nginx entry?

posted by sinclairpaul over 5 years ago

hmm .. you are right .... I just deleted the user from hass.io and I started getting auth denied again ... Added it back .. it started working again.

posted by droopanu over 5 years ago

Probably noone else tried to use the dashboard with a separate user, that's why the issue was not caught until now :D

posted by droopanu over 5 years ago

What I would like to see is the equivalent entry from the actual addon log for a 401:

[12/Nov/2019:17:16:42 -0500] 401 192.168.1.89(192.168.200.100) GET /test HTTP/1.1 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36)

posted by sinclairpaul over 5 years ago

To just clarify as I had a chance to test, if I access the dashboard on https://myhost:1880/endpoint/ui/ with the following set "http_node": { "username": "hassio", "password": "hassiohassiohassio" },

I can gain access, I would like to confirm the paths that are being accessed, as the dashboard should function ok. I do not need to add the user. If I was accessing anything outside of /endpoint/ I would have to.

posted by sinclairpaul over 5 years ago

I am trying to access only https://myhost:1880/ as https://myhost:1880/endpoint/ gives me the following error:

Cannot GET /endpoint/

posted by droopanu over 5 years ago

Thanks, https://myhost:1880/ uses Homeassistant Authentication, not the entries in the http_node settings. The NodeRed dashboard/HTTP nodes will utilise that authentication, which it does not appear you have configured. You can also use the Ingress default link to access the same in your scenario,

posted by sinclairpaul over 5 years ago

That makes sense .. thank you. :) Maybe add a example url in the readme to make it easier for users to figure it out :D

posted by droopanu over 5 years ago

I should add this is probably a terminology thing, as Node Red Dashboard is what is presented at /endpoint/ui/ not the actual GUI.

PR's are always welcome 😉

Glad we got it resolved.

posted by sinclairpaul over 5 years ago

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

posted by addons-assistant[bot] over 5 years ago

Fund this Issue

$0.00
Funded

Pull requests