0
0
IOT Protocolsdevops~10 mins

MQTT over TLS (MQTTS) in IOT Protocols - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the MQTT broker URL with TLS.

IOT Protocols
mqtt_client.connect("[1]")
Drag options to blanks, or click blank then click option'
Amqtt://broker.example.com
Bmqtts://broker.example.com
Chttp://broker.example.com
Dtcp://broker.example.com
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'mqtt://' which is not secure
Using 'http://' which is for web protocols
Using 'tcp://' which is not specific to MQTT
2fill in blank
medium

Complete the code to set the TLS certificate file path for the MQTT client.

IOT Protocols
mqtt_client.tls_set(ca_certs="[1]")
Drag options to blanks, or click blank then click option'
A/etc/ssl/certs/ca.pem
B/tmp/mqtt.sock
C/home/user/mqtt_config.txt
D/var/log/mqtt.log
Attempts:
3 left
💡 Hint
Common Mistakes
Using a log file path instead of a certificate
Using a config text file path
Using a socket file path
3fill in blank
hard

Fix the error in the code to enable TLS for the MQTT client.

IOT Protocols
mqtt_client.[1](tls_version=ssl.PROTOCOL_TLSv1_2)
Drag options to blanks, or click blank then click option'
Aset_tls
Benable_tls
Ctls_set
Dstart_tls
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent methods like 'enable_tls' or 'start_tls'
Using 'set_tls' which is incorrect
4fill in blank
hard

Fill both blanks to configure the MQTT client with username and password for secure connection.

IOT Protocols
mqtt_client.username_pw_set(username="[1]", password="[2]")
Drag options to blanks, or click blank then click option'
Auser123
Bpass123
Cadmin
Dguest
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing username and password values
Using default or guest credentials
5fill in blank
hard

Fill all three blanks to create a dictionary for TLS settings including certificate, key, and TLS version.

IOT Protocols
tls_settings = {"ca_certs": "[1]", "certfile": "[2]", "tls_version": [3], "keyfile": "[4]"}
Drag options to blanks, or click blank then click option'
A/etc/ssl/certs/ca.pem
B/etc/ssl/certs/client.crt
Cssl.PROTOCOL_TLSv1_2
D/etc/ssl/private/client.key
Attempts:
3 left
💡 Hint
Common Mistakes
Using key file path as certfile
Using incorrect TLS version constant
Mixing file paths