Install a GNU Linux system

Use your own machine, either natively on GNU Linux, or through a virtual machine, Debian or Ubuntu.

The following Debian/Ubuntu packages are needed for this lab:

Please check whether they are installed on your machine. Write down the command(s) used for that.

MQTT protocol

Pub/sub messages

Check whether mosquitto server is running. If it is not running, find out the commands (program names) allowing you to start it, and start it.

Write down the port(s) mosquitto server listens on. What command do you use for that?

Find out the commands (program names) allowing to create publish and subscribe to topics packets.

Send a message of some topic using a publisher, afterwards start a subscriber of that topic, and finally send another message of the same topic. Does the subscriber show both messages or not?

Capture with wireshark the packet sent by the publisher and the packet received by the subscriber. Write down the MQTT type and their QoS found in the packet.

Topics

Create the following topic publishers: home/x/y, with x = {kitchen, hall, room} and y = {temperature, light, batterypercentage}.

Create a client which monitors all the sensors of the kitchen, echoing them each time they change in the following precise format:

Note that the sensors send just a topic, and the value of the topic, for example they send 25 and their topic. The client needs to discover the topic from the message.

Optional work: Write a publisher or a subscriber in a programming language of your choice which has bindings to MQTT on computer or smartphone. Check that it works with the broker and with the previous programs. You may need to install additional packages. More information at http://blog.guiguiabloc.fr/index.php/2014/11/13/mqtt-faites-communiquer-vos-objets-simplement.

Shared server

Read the whole page http://test.mosquitto.org. What is this about?

eduroam filters MQTT packets, hence you need to use your phone as router for this exercice. If using a phone is not possible for you, skip this exercice (or use a colleague's phone).

Listen on all topics starting with irco/. Send a text using irco/yourname. Check that you receive it, other colleagues receive it too, and that you receive other colleagues' texts.

What risk does this exercice introduce (if you listen on # for ex.), from security point of view?

RabbitMQ broker and clients

Write down all the binary programs provided by rabbitmq-server package.

Find out the programs allowing to start the RabbitMQ broker. Start it.

Write down the port(s) RabbitMQ server listens on.

Find out the commands (program names) allowing to create queue, send and receive a message.

RabbitMQ and AMQP

Use amqp-tools package for this exercise. Create a queue. Send a message and get it. Capture with wireshark the packet sent with the message, and the packet to get that message. Write down their format.

RabbitMQ and MQTT

Stop the mosquitto server and check that it is stopped.

Activate the MQTT plugin in the RabbitMQ broker. Write down the additional port(s) RabbitMQ server listens on.

Use mosquitto clients to subscribe and publish messages, using the RabbitMQ broker.

RabbitMQ and STOMP, transaction

Activate the STOMP plugin in the RabbitMQ broker. Write down the additional port(s) RabbitMQ server listens on.

Use nc to create three clients (two subscribers and one publisher), like this:

Finally, send two messages atomically, using a transaction.

Use ABORT command to see that the transaction is cancelled.

AMQP and STOMP interoperability

Create a STOMP subscriber to some queue/destination/topic. Create an AMQP sender to that queue. Check that the subscriber received the message.

Where is the message queue, i.e. where are the messages stored waiting to be read?

Create an AMQP subscriber to the same destination. Send to it a message. Check that both subscribers receive the message.

ActiveMQ broker - AMQP does not work

Stop or uninstall RabbitMQ. Check that it does not listen anymore. Install ActiveMQ broker and check that it is started. Write down all the binary programs provided by the package.

Enable MQTT and STOMP protocol support, see https://activemq.apache.org/components/classic/documentation/mqtt and https://activemq.apache.org/components/classic/documentation/stomp.

Check with nmap that it is listening on MQTT and STOMP ports.

Start a STOMP subscriber and an MQTT subscriber. Send a message with STOMP and check that both subscribers receive it. What do you conclude?

CoAP

Among the three brokers above, which one does support CoAP? Why?

Install a CoAP client (look in lectures or search on Debian repository).

  1. Send two packets, a confirmable one and a non-confirmable one, from one client to another. Look with wireshark at the messages exchanged.
  2. Use nc for sending the two messages above.

What protocol do you like most, and why?