This works as a proxy between AWS and a local MQTT broker to avoid the security requirements of AWS on your nodes.
Note: THIS IS NOT SECURED!!! Obviously.
Before deploying this in a real system, the local MQTT broker should implement some form of security.
In order to prevent infinite sending of a message, this proxy prepends proxy/
to all message topics both from the upstream (AWS) and downstream (local broker).
Integrating with Docker is on the todo list.
To get this to connect to your AWS account and broker you need to change two files.
client-aws.js
contains the paths to the keys that you need for AWS. This uses the aws-iot-device-sdk
to connect, which is a wrapper around MQTT.js, and can be found here: https://github.com/aws/aws-iot-device-sdk-js
This currently assumes you have key files in a sibling directory of this repo called keys/
.
mosquitto-client.js
contains the settings for connecting to the downstream broker. The filename mentions Mosquitto which has worked well, but this can be any broker supporting MQTT. The connection is made over MQTT.js.
Install Homebrew and then run
$ brew install mosquitto
$ screen -S mosquitto
# in the screen instance
$ mosquitto
The default settings work fine for development.
No idea.
npm install
node index.js
The proxy should send a few messages over the wire on startup.
Feel free to contribute to this, just file a PR please.
- Ideally this proxy should append a proxy ID to the topics as well so that each user can have their own proxy to enhance security and to prevent this being overloaded with more clients.
- Docker
MIT for now.