But most IoT stuff are hacked on, rarely using anything standard, and even when there is a framework involved, it seldom has security as a main feature.
Even when it does, it's still a lot of work. Take crossbar.io, which is my go to tool to communicate within a IoT context (or anything soft real time really). To secure it you need to:
- setup the TLS certificate. Default communication transport is over unencrypted websocket.
- configure the provided authentication service (and write a backend for your system).
- declare several realms to isolate the clients, and configure the permissions accordingly (default permissions are YOLO, to ease the "hello world", which I understand). Make sure you don't expose important RPC to the wrong clients or allow anybody to declare callbacks.
- manually code the procedure to use their hot reload system to swap code updates. It's made for local updates, not remote ones.
- be very careful when updating your clients. Crossbar routed RPC is transparent and it's tempting to replace a call from JS to Python to a call from JS to Postgres to remove a layer of indirection. But do you make proper permissions checks in your SQL ? Are you sure you don't expose too much ?
So basically, you can make it secure. But only if you know what you're doing and don't have a deadline tomorrow.