-
Notifications
You must be signed in to change notification settings - Fork 12
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
Push image not working with SSL cert/key active on HA #81
Comments
I am not sure if HTTPs is supported. A quick google and I think i found the -5 code: https://github.com/espressif/arduino-esp32/blob/master/libraries/HTTPClient/src/HTTPClient.h#L44 |
I pushed an update to Some testing is still required... so feel free to try the latest dev build of the firmware. |
Thanks, @fvanroie I've tested latest build and got it to work... partially. HA configuration: homeassistant:
allowlist_external_dirs:
- /config
- /share
- /tmp
internal_url: https://XXX.XXX.X.XX:8123
external_url: https://mypersonalduck.duckdns.org
http:
ssl_certificate: /ssl/fullchain.pem
ssl_key: /ssl/privkey.pem Notice that I've changed HA's internal_url configuration as well to https. So path in mqtt message is absolutely correct (Checked with MQTT Explorer). But plate reports a 404 response though. Also get a 404 response in browser on my local PC as well (unfortunately expected). Guess HA doesn't really don't want to share that 'internal' non-exposed path via https. Path is not configurable by user and cannot be whitelisted AFAIK. I've not enough knowledge about the topic to come up with a clever solution. Could be that running HA supervised gives extra challenges with the allowed/whitelisted paths ? But via https i can easily gain browser access eg. to an image stored in a HA whitelisted path/folder. Finalized my tests pushing an already converted image from a whitelisted folder (config/www or local) to plate via HA services: service: mqtt.publish
data:
topic: hasp/plates/command/p2b40.src
payload_template: >
https://192.XXX.XXX.XXX:8123/local/3c2a249c29fdcde2de1c74d3ad38ac73.dib With above, image appears on plate 😀 So issue is about the access rights at HA's end to certain non whitelisted paths/folders. Perhaps the solution is to revise CC a bit and use 'public' HA folders for the final image ? |
Hi, i have tried install last (and not last) firmware, addon and home assistant, many combinations. but i catch this error alltime. from 192.168.1.1 (router?) 2023-01-20 20:27:10.809 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140344930660704] Error handling message: Unknown error (unknown_error) from 192.168.1.1 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWe |
Haven't really tested lately whether or not openHASP accepts images via https. |
In browser all pic is available. i am used ha/local/pic.jpg link, also tried any image from internet (from example for example), 2023-01-24 14:56:21,579.579 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script this feature very important for use, especially on big screens, and i hope, |
This error log is caught by XA for windows initially without ssl. Errors with access rights from temp directory are visible here. 2023-01-30 12:11:37,728.728 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script |
Well this is not going to work properly on windows because we use UNIX temporary files to generate the images. @htvekov when using SSL there are 2 possible configuration (SSL handled by HA or SSL handled by a Reverse Proxy). That means that you must tell HA your configuration setup using |
I did some quick SSL tests last night, when I was playing with image config anyway 😉 Didn't save any logs, but I can redo test later if needed. If adding https address or my DuckDNS path in HA's Using a browser I can access the file entering the exact same path (copy/paste from openHASP log) openHASP fw still accepts inbound https messages. I've retested with a dib file i had stored locally and i can without issues push that direct src mqtt message |
If HA is configured to handle SSL (https://www.home-assistant.io/integrations/http/#ssl_certificate) then you must have Please activate CC debug mode and provide logs |
I went through various scenarios and actually got SSL working with one specific configuration 🎉🙂 For SSL to work here using 'standard' DuckDNS following settings must be done: Image path for
I guess that using above will direct all traffic between HA and external components through DuckDNS (not really the best solution) Debug log clips from CC in HA + openHASP logs attached. HA has some SSL protocol issues if two images are send within a few seconds (in my case images are identical) |
1st snippet: CC can't access media_player content (CC validated the SSL certificate and did not match IP/hostname) 2nd snippet: CC did get the image and made available... then something wrong with your automation... 3rd snippet: Likely trying to serve http over https... 4th snippet: Again... SSL mismatch. Conclusions: you are running SSL in HA and therefore you get all sorts of SSL mismatches... |
Well, I guess you're absolutely right that SSL in HA is not an ideal solution. Anyway, both CC and openHASP fw supports SSL. I've just confirmed that with my tests. |
In the 3rd snippet you are not making use of internal_url... It's working, but all your internal traffic is going around the internet... (not a good idea) |
Ok. Then I understood what you meant 🙂 I guess a reverse proxy configuration (nginx or similar) would work as expected. |
Please tell me if I use the local http server and use the src command via mqtt (it is used by the push image service from ha?) How to send an image to the board correctly? are there size or format restrictions? |
Does this lend any clues?
|
Does this still dosen't work? |
#144 will be a solution to this. |
#144 is included in 0.7.5 now. |
openHASP 0.6.3 - HA supervised core-2021.10.5
HA Configuration
HA direct service call used to test
Describe the bug
Using duckdns to gain access to HA from external network, causes issues with paths/permissions using
openhasp.push_image
Using SSL on HA will also disable the possibility to gain local access to HA via http://local_ip_address:port. Only access via https://local_ip_address:port is possible with the expected insecure browser warning.
Installing reverse proxy will solve the local access issue with url's, but not necessarily issue with permission/access rights to HA's folders.
Seems like converted image is never recieved. Test picture is tested to be accessible via browser using same url
Most likely permission issues with the api/openhasp/serve path. Can't add that specific path to HA's
allowlist_external_dirs
, as it's not exposed to HA.Also noted that URL pushed to openhasp device is the
internal_url
from HA configuration. Could also be an issue, as device only will be able to access HA via https URL's (alternatively external duckdns url)Note: If SSL is deactivated in HA, everything works perfectly without issues at all.
Debug log
2021-12-04 21:20:30 DEBUG (SyncWorker_3) [custom_components.openhasp.image] image_to_rgb565 out_image: /tmp/tmpdghbzkiu
2021-12-04 21:20:30 DEBUG (MainThread) [custom_components.openhasp] Push hasp/wt32_01/command/p5b40.src with http://my.local.ip.address:port/api/openhasp/serve/4ab482c80ba29d55629f5a44f9e1e0f7
The text was updated successfully, but these errors were encountered: