The following Debian/Ubuntu packages are needed for this lab:
mosquitto
, mosquitto-clients
nmap
, wireshark
+ access to capture packets
rabbitmq-server
+ rights to start its plugins, amqp-tools
netcat-traditional
(or netcat-openbsd
)
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.
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:
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.
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-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.
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.
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.
Use nc
to create three clients (two subscribers and one publisher), like this:
Use ABORT
command to see that the transaction is cancelled.
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.
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?
Install a CoAP client (look in lectures or search on Debian repository).
nc
for sending the two messages above.