vernemq stop default listener via config - mqtt-vernemq

I have setup verneMQ with TLS. At present Default MQTT (1883) & Secure MQTTS (8883) ports are active. To disable Default MQTT (1883) I tried to set
DOCKER_VERNEMQ_LISTENER__TCP__DEFAULT="0.0.0.0:8883" but VerneMQ failed to start with this setting.
If I don't set this ENV at all, still VerneMQ listens on default port.
Right now I am blocking port 1883 Service/ELB level. But what is the correct way to do this ?

Related

Which ports should be allowed in firewall to use TURN server?

I want to set up a turn server (coturn) on our company's servers. And I'm not sure which ports should be allowed by outside access. 8443 is a must, using WebRTC. 3478 is a must for credential use. But there's these gazillions of ports which TURN server uses, do they need to be allowed in firewall?Or which ports should be allowed to use CoTURN without problem?
I think it depends on the transport protocols you want to use and the level of security.
With Coturn coturn(git):
The default port for sending (or listening to) STUN/TURN requests is 3478.
TURN listener port for UDP and TCP listeners (Default: 3478). Note:
actually, TLS & DTLS sessions can connect to the "plain" TCP & UDP
port(s), too - if allowed by configuration. For example, the default
listening port can be set to 80 or 443, to go around some strict NATs.
Remember that ports < 1024 may require superuser privileges to start
the turnserver process.
In my project I used also tls listening port but probably it is not necessary:
The default port for sending (or listening to) STUN/TURN over TLS is 5349.
TURN listener port for TLS and DTLS listeners (Default: 5349). Note: actually, "plain" TCP & UDP sessions can connect to the TLS & DTLS port(s), too - if allowed by configuration. For example, the default tls listening port can be set to 443, to go around some strict NATs. Remember that ports < 1024 may require superuser privileges to start the turnserver process. For secure TCP connections, we currently support SSL version 3 and TLS versions 1.0, 1.1, 1.2. For secure UDP connections, we support DTLS version 1.
Also, for establishing at last p2p connection :
Each client will send the data through UDP to the other endpoint:
if it’s sending to a TURN server (to a relay candidate) it will send to a port between 49152-65535 (if it’s sending directly to the other party it will send to any port in the 0-65535 range)
--min-port Lower bound of the UDP port range for relay endpoints allocation. Default value is 49152, according to RFC 5766.
--max-port Upper bound of the UDP port range for relay endpoints allocation. Default value is 65535, according to RFC 5766.

Why does NodeJS client continuously keep on disconnecting to RabbitMQ broker?

I have installed RabbitMQ broker on Windows Server 2016. I have to connect to it using NodeJS client but it continuously disconnects and again connect to the broker. Can you please suggest what might have gone wrong ? I have gone through many articles but nothing solved my issue.
In order to achieve this,I have mentioned tcp keep-alive in rabbitmq.config file but it didn't solve my issue.
My configuration file looks like following :
rabbitmq.config (Location : C:\Users\\AppData\Roaming\RabbitMQ)
mqtt.listeners.tcp.default = 1883
## Default MQTT with TLS port is 8883
# mqtt.listeners.ssl.default = 8883
# anonymous connections, if allowed, will use the default
# credentials specified here
mqtt.allow_anonymous = true
mqtt.default_user = test
mqtt.default_pass = test
mqtt.vhost = dev
mqtt.exchange = amq.topic
# 24 hours by default
mqtt.subscription_ttl = 86400000
mqtt.prefetch = 10
net.ipv4.tcp_keepalive_time=60
net.ipv4.tcp_keepalive_intvl=20
net.ipv4.tcp_keepalive_probes=3
handshake_timeout = 60000
Ideally client should connect to the broker only once and keep on listening on a port from that broker. It should never disconnect in between.
After making some changes in config file I always stop rabbitmq and again starts by using following commands from sbin directory of RabbitMQ :
rabbitmq-service.bat stop
rabbitmq-service.bat install
rabbitmq-service.bat start
When I hit 2nd command, I get error that the configuration file should be in Erlang format with '.conf' extension. I did that as well but I faced same issue again.
Is there anything missing in configuration ? Please suggest.
I found that clients are sensitive, if you try to acknowlage the same message twice, for example, they will disconnect. Are you doing anything at all after you connect to the broker? Setting up queues that already exist with different params, declaring exchanges?

Connect to RabbitMQ via URL

I'm trying to connect to the rabbitmq which is hidden behind nginx proxy. It's declared as:
location ^~ /rabbitmq/ {
proxy_pass http://127.0.0.1:5672/;
}
The problem is that as I found AMPQ only specifies host but it doesn't know anything about urls.
Can I connect rabbit client to www.myserver.com/rabbitmq somehow? I'm using EasyNetQ to connect, but it looks like a protocol limitation, and implementation doesn't matter.
If it's not possible at all maybe there are some workarounds?
For AMQP, If using Nginx probably doing a TCP load balancing could help: https://docs.nginx.com/nginx/admin-guide/load-balancer/tcp-udp-load-balancer/, otherwise if you could use HAProxy you could try something like this:
frontend rabbitmq
mode tcp
bind *:5672
use_backend bunny
backend bunny
mode tcp
server bunny 127.0.0.1:5672 check
If you want to publish message over HTTP probably you would like to expose the rabbitmq API:
http://localhost:15672/api/index.html
Notice the port 15672, from the docs:
Note that the UI and HTTP API port — typically 15672 — does not support AMQP 0-9-1, AMQP 1.0, STOMP or MQTT connections. Separate ports should be used by those clients.

SSL springboot Verify the connector's configuration

I want to use ssl in my springboot app. I use this tutorial but when I try up start my app gives me this error:
***************************
APPLICATION FAILED TO START
***************************
Description:
The Tomcat connector configured to listen on port 8443 failed to start. The port may already be in use or the connector may be misconfigured.
Action:
Verify the connector's configuration, identify and stop any process that's listening on port 8443, or configure this application to listen on another port.
And my application.properties
#ssl
server.port=8443
server.ssl.key-alias=alias
server.ssl.key-password=password
server.ssl.key-store=classpath:keystore.jks
server.ssl.key-store-provider=SUN
server.ssl.key-store-type=JKS
Or do you know another way to do SSL trusted?
Generate the key with command line running in admin mode.

SSL/TLS with Eclipse Paho JavaScript Client

I've got a JavaScript-based WebApp that includes the Eclipse Paho client.
The WebApp is stored and executed on an NGINX webserver.
On the same Server where the webserver is installed, the MQTT broker mosquitto is running. I've defined port 8884 as listener port for secured connections.
Running mosquitto_sub (simple C client) with --cafile and -p 8884 works fine!
Now I want to secure the WebApp using SSL by passing mqttOptions = { useSSL: true } in my MQTT client implementation.
I can see that the app is trying to establish an connection to wss://ip instead of ws://ip. But the server responds with a connection refused which is totally clear because I did not configure anything on the webserver as I do not have a clue how to manage this. Will the wss connection be 'mapped' to a https or something? Do I need a websocket proxy in NGINX? Thanks in advance for any help.
You can not use the same port for raw MQTT and MQTT over websockets with mosquitto, you need to create 2 separate listeners.
The fact that you can connect with mosquitto_sub implies you have only set up a listener with the raw MQTT.
e.g.
listener 8883
listener 8884
protocol websockets
This will create a native MQTT listener on 8883 and a MQTT over websockets on port 8884
I did so. Here is the mosquitto conf entry:
listener 8884 127.0.0.1
protocol websockets
cafile /path/to/ca.crt
certfile /path/to/certfile.crt
keyfile /path/to/keyfile.key
require_certificate false
and so the app is trying to connect to myip:8884