moscajs / mosca

MQTT broker as a module
mosca.io
3.2k stars 513 forks source link

How to configure TLS correctly in Mosca #807

Open HvanTao opened 4 years ago

HvanTao commented 4 years ago

How to set option in Mosca SSL/TLS Work with nginx ?

HvanTao commented 4 years ago

var set = { secure: { port: 3101, keyPath: SECURE_KEY, certPath: SECURE_CERT }, }

Connecting to Server: Hostname: sh.****.com . Port: 3101 . Path: /mqtt . Client ID: hank_79510dddc4fe-491a-ae4a-06660ff0fbbe

error:Failed to connect AMQJSC0001E Connect timed out.

jimmiehansson commented 4 years ago

This could be resolved in NGINX using SSL termination with NGINX as a reverse proxy. You could then upstream the connection to a child over TLS encryption from an exposed port (80|443 -> 3101) See this documentation for more details: https://docs.nginx.com/nginx/admin-guide/security-controls/securing-http-traffic-upstream/