hass-configurator
hass-configurator copied to clipboard
Not list files after set "ENFORCE_BASEPATH": true
Hello, what I do wrong? I setup configurator via pip3 install
/etc/hass/settings.conf
{ "LISTENIP": "0.0.0.0", "PORT": 3218, "GIT": false, "BASEPATH": "/home/hass/.homeassistant/", "ENFORCE_BASEPATH": true, "SSL_CERTIFICATE": null, "SSL_KEY": null, "IGNORE_SSL": false, "HASS_API": "http://127.0.0.1:8123/api/", "HASS_WS_API": null, "HASS_API_PASSWORD": "Long time live access token" "USERNAME": null, "PASSWORD": null, "ALLOWED_NETWORKS": [], "ALLOWED_DOMAINS": [], "BANNED_IPS": [], "BANLIMIT": 0, "IGNORE_PATTERN": [], "DIRSFIRST": true, "HIDEHIDDEN": true, "SESAME": null, "SESAME_TOTP_SECRET": null, "VERIFY_HOSTNAME": null, "ENV_PREFIX": "HC_", "NOTIFY_SERVICE": "persistent_notification.create" }
/etc/systemd/system/[email protected] [Unit] Description=HASS-Configurator After=network-online.target
[Service] Type=simple User=%i WorkingDirectory=/home/hass/.homeassistant/ ExecStart=/usr/local/bin/hass-configurator /etc/hass/settings.conf Restart=on-failure RestartSec=5s
[Install] WantedBy=multi-user.target
======================================================
/var/log/syslog Nov 10 19:41:13 axius hass-configurator[1123]: INFO:2019-11-10 19:41:13,977:hass_configurator.configurator:192.168.1.123 - "GET / HTTP/1.1" 200 - Nov 10 19:41:14 axius hass-configurator[1123]: INFO:2019-11-10 19:41:14,854:hass_configurator.configurator:192.168.1.123 - "GET /api/listdir?path=. HTTP/1.1" 200 - Nov 10 19:41:14 axius hass-configurator[1123]: WARNING:2019-11-10 19:41:14,855:hass_configurator.configurator:Access denied.
======================================================
======================================================
If I change "ENFORCE_BASEPATH": to false all start working good, but possible to change directory and list file system, what I want to avoid.
Please try to start the configurator without the enforced basepath, then open a file within the basepath. That way the configurator will re-open the same file and path at the next startup. Then stop the configurator, enable enforce basepath, then start again. It should then start with the file you had open last and display the content of the directory.
I assume you get the error because prior to shutting down the configurator you had a file open that was outside of the basepath. The configurator remembers this and tries to access the same file when you restart the configurator, even though with the enforced basepath access to that file is now denied.
Does this solution work?
Nope. i migrated to docker and there configurator work perfect. But I special try to reproduce situation in dev environment and receive same result Now configurator endorsed to "BASEPATH": "/home/projects/", "ENFORCE_BASEPATH": true,
And any way
Log: INFO:2019-11-25 22:33:06,405:hass_configurator.configurator:Starting server INFO:2019-11-25 22:33:06,406:hass_configurator.configurator:Listening on: http://0.0.0.0:3218 INFO:2019-11-25 22:33:09,547:hass_configurator.configurator:192.168.1.123 - "GET / HTTP/1.1" 200 - WARNING:2019-11-25 22:33:09,574:hass_configurator.configurator:Exception getting bootstrap WARNING:2019-11-25 22:33:09,575:hass_configurator.configurator:<urlopen error [Errno 111] Connection refused> INFO:2019-11-25 22:33:12,053:hass_configurator.configurator:192.168.1.123 - "GET /api/file?filename=/home/projects/smarthome/docker-compose.yml HTTP/1.1" 200 - INFO:2019-11-25 22:33:12,959:hass_configurator.configurator:192.168.1.123 - "GET /api/listdir?path=. HTTP/1.1" 200 - WARNING:2019-11-25 22:33:12,961:hass_configurator.configurator:Access denied.
Because its not affecting me now, you can close this issue without resolution, just for your information.
I have the same problem right now. I can't navigate... :disappointed:
There´re any ways to fully restart or reset the plugging? I uninstall and install but the problem persist.
I don't know why this is happening. As a workaround you should be able to open a specific folder manually. To do this, open the JavaScript console of your browser and execute the function listdir('/your/path')
.
It would also be interesting if this problem persists when you use another browser, and if learing the browser cache can solve the problem as well.
listdir command doesn't work.
I try to open configurator with another browser and the problem persist
I also saw this, maybe it helps
There are two options:
- There seems to be a problem with the ingress-functionality of hassio. It somehow messes with the external dependencies the configurator relies on. If this is really the case, please open an issue at the hassio-addons repository.
- You have something like PiHole or some other content blocking mechanism active that prevents the configurator to load these external resources.
There're another problem. Now I can load base path with listdir('/')
but when I try to open config folder I get no response.
I don't use hassio and the ingress-functionality, so I don't know what the problem could be. Please head over to the forum at https://community.home-assistant.io to see if someone there knows why this is happening.
The problem it's not with ingress. When I access from local network with local IP it still happening.
Could you make another screenshot like above when accessing locally? And instead of the preview-tab please open the response-tab.
I start configurator.py with settings.conf file. If I set ENFORCE_BASEPATH to false then work fine and I can view all file system. But if i set ENFORCE_BASEPATH to true then I view situation on screenshot: I can not view basepath directory, but configurator.py open file from previous session from basepath directory.
Error on console "Permission denied."show only if I set ENFORCE_BASEPATH to true.
{
"LISTENIP": "0.0.0.0",
"PORT": 3218,
"GIT": false,
"BASEPATH": "/etc/homeassistant/",
"ENFORCE_BASEPATH": true,
"SSL_CERTIFICATE": null,
"SSL_KEY": null,
"IGNORE_SSL": false,
"HASS_API": null,
"HASS_WS_API": null,
"HASS_API_PASSWORD": null,
"USERNAME": null,
"PASSWORD": null,
"ALLOWED_NETWORKS": [],
"ALLOWED_DOMAINS": [],
"BANNED_IPS": [],
"BANLIMIT": 0,
"IGNORE_PATTERN": [],
"DIRSFIRST": true,
"SESAME": null,
"SESAME_TOTP_SECRET": null,
"VERIFY_HOSTNAME": null,
"ENV_PREFIX": "HC_",
"NOTIFY_SERVICE": "persistent_notification.create"
}
.
@ravikwow
Have you tried this? Also please remove the trailing
/
in yourBASEPATH
configuration.
Thanks, I remove /
, it work.