Enabling Authentication in the MQTT Broker

The current implementation of the controller needs authentication to the MQTT Broker.
Perform the following steps to create a profile used in the authentication process with MQTT.
Note: RUCKUS recommends that you do not start the Mosquitto MQTT broker by user root. If you start Mosquitto MQTT broker by user root or with sudo, it will result in an incorrect start-up environment or other error.
  1. Startup MQTT broker with security enabled.
    1. Create a mosquitto configuration file, mosquitto.conf. Refer to the examples below.
      listener 8883
      psk_file /etc/mosquitto/pskfile 
      psk_hint hint
      tls_version tlsv1.2
      
    2. According to the pskfile configuration of mosquitto.conf, you must create another pskfile to store the authentication pre-shared key. The format is <username>:<password phrase>. The password phrase is converted into hex representation. Here is an example for the pskfile:
      testuser:7465737475736572
      The original password text before converting is testuser. The password has to match with the setting configured on the controller web interface.
    3. After you install the mosquitto MQTT broker, you can start it up by the following command:
      mosquitto -c /home/user/mosquitto.conf -p 1883
      Note: You can terminate the MQTT broker by pressing ctrl + C on the MQTT broker console.
  2. After starting an MQTT subscriber, you can start another MQTT subscriber to connect to the MQTT broker using unauthenticated port 1883 or authenticated port 8883.
    1. Here is an example to connect to the MQTT broker with unauthenticated version:
      mosquitto_sub -h <mosquitto_ip> -p 1883 -t 'sci-topic'
    2. Here is an example to connect to the MQTT broker using an authenticated security channel:
      mosquitto_sub -h <mosquitto_ip> -p 8883 -t 'sci-topic' --psk-identity testuser --psk 7465737475736572
    You can find the difference between the unauthenticated and authenticated version of the mosquitto_sub function, where the psk-identity and psk attribute is connected to MQTT broker using the port number 8883.
  3. Use the following information to create or configure the MQTT connection profile :
    1. MQTT server name.
    2. MQTT server host / IP address.
    3. MQTT server port number.
    4. System ID—The backend system collects data from multiple controllers. The system identifier is used to distinguish the data source.
    5. User credentials of login name and password.
    In the authenticated mode of SCI profile, you must provide the user name and password for TLSv1.2 with pre-shared key exchange standard as shown in the following figure.

    Setting SCI Profile in Authenticated Mode

    The SCI profile setting is used for allowing the controller to get the MQTT connection information. For example: IP address, port, or user credential. It does not mean that you must have a SCI setup to receive the GPB streaming data.

  4. Save the SCI profile.
  5. Configure the Northbound data streaming as explained in the following section.