Hi all,
I created an addon that exposes a REST endpoint that will send WhatsApp messages based on GitHub - pedroslopez/whatsapp-web.js: A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app.
This works perfect.
Now I wanted to make it secure as the REST endpoint is now exposed inside my network. The goal is that they should only be called by the HA framework (automation actions, NodeRed calls, etc).
This security can (should) be done on 2 levels:
- Add some authentication.
- Don’t expose the REST endpoint port (but keep it inside the home assistant OS/docker host)
The first can be done by adding some shared secret of sort. Either something custom either via the /auth supervisor API and a dedicated user (service account).
The second can be done (if not mistaken) by adding 127.0.0.1 in the docker run command parameter for port mapping. I do have however no control (I think) over that.
Q: How can I limit exposure of the endpoint port of my add-on to only Home Assistant (and other add-ons inside HA)?
Thanks,
Stefaan