File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4040 {
4141 "file" : " \\ tests\\ unit\\ iothub\\ aio\\ test_async_clients.py" ,
4242 "_justification" : " Test containing fake signed data"
43+ },
44+ {
45+ "file" : " \\ tests\\ unit\\ iothub\\ pipeline\\ test_pipeline_stages_iothub.py" ,
46+ "_justification" : " Test containing fake keys"
47+ },
48+ {
49+ "file" : " \\ tests\\ unit\\ provisioning\\ shared_client_tests.py" ,
50+ "_justification" : " Test containing fake keys"
51+ },
52+ {
53+ "file" : " \\ tests\\ unit\\ provisioning\\ pipeline\\ test_pipeline_stages_provisioning.py" ,
54+ "_justification" : " Test containing fake keys"
55+ },
56+ {
57+ "file" : " \\ tests\\ unit\\ common\\ pipeline\\ test_pipeline_stages_base.py" ,
58+ "_justification" : " Test containing fake signed data"
4359 }
4460 ]
4561
Original file line number Diff line number Diff line change @@ -46,6 +46,18 @@ dead_duration : the amount of time the MQTT broker will be taken down for.
4646
4747Before running the the ` mean_time_recover_with_docker.py ` script make sure your docker engine is running.
4848
49+ #### Connection string
50+
51+ Both ` mean_time_recover_with_docker.py ` and ` simple_send_message.py ` read the device connection
52+ string from the ` IOTHUB_DEVICE_CONNECTION_STRING ` environment variable; neither script contains a
53+ connection string or key of its own. The local ` aedes ` broker does not verify the key, so any
54+ base64 value works, for example:
55+
56+ ` export IOTHUB_DEVICE_CONNECTION_STRING="HostName=localhost;DeviceId=devicemtr;SharedAccessKey=<base64 key>" `
57+
58+ Use a throwaway value here. Never place a real IoT Hub device key in a shell history or a file
59+ that can be committed.
60+
4961#### Certificate creation
5062
5163There is another script which will create some self signed certificates for use in the ` aedes ` server.
Original file line number Diff line number Diff line change 55# --------------------------------------------------------------------------
66import docker
77import asyncio
8+ import os
89import uuid
910from azure .iot .device .aio import IoTHubDeviceClient
1011from azure .iot .device import Message
@@ -124,6 +125,14 @@ def timer_done():
124125
125126async def main ():
126127
128+ conn_str = os .getenv ("IOTHUB_DEVICE_CONNECTION_STRING" )
129+ if not conn_str :
130+ raise RuntimeError (
131+ "Set the IOTHUB_DEVICE_CONNECTION_STRING environment variable to the connection "
132+ "string of the device used against the local test broker, e.g. "
133+ "HostName=localhost;DeviceId=devicemtr;SharedAccessKey=<base64 key>"
134+ )
135+
127136 ca_cert = "self_cert_localhost.pem"
128137 certfile = open (ca_cert )
129138 root_ca_cert = certfile .read ()
@@ -140,7 +149,6 @@ async def main():
140149
141150 # Do not delete sleep from here. Server needs some time to start.
142151 await asyncio .sleep (5 )
143- conn_str = "HostName=localhost;DeviceId=devicemtr;SharedAccessKey=Zm9vYmFy"
144152 device_client = IoTHubDeviceClient .create_from_connection_string (
145153 conn_str , keep_alive = KEEP_ALIVE , server_verification_cert = root_ca_cert
146154 )
Original file line number Diff line number Diff line change 44# license information.
55# --------------------------------------------------------------------------
66import asyncio
7+ import os
78import uuid
89from azure .iot .device .aio import IoTHubDeviceClient
910from azure .iot .device import Message
@@ -41,7 +42,13 @@ async def main():
4142 # Scenario based values
4243 keep_alive = 15
4344
44- conn_str = "HostName=localhost;DeviceId=devicemtr;SharedAccessKey=Zm9vYmFy"
45+ conn_str = os .getenv ("IOTHUB_DEVICE_CONNECTION_STRING" )
46+ if not conn_str :
47+ raise RuntimeError (
48+ "Set the IOTHUB_DEVICE_CONNECTION_STRING environment variable to the connection "
49+ "string of the device used against the local test broker, e.g. "
50+ "HostName=localhost;DeviceId=devicemtr;SharedAccessKey=<base64 key>"
51+ )
4552 device_client = IoTHubDeviceClient .create_from_connection_string (
4653 conn_str , keep_alive = keep_alive
4754 )
You can’t perform that action at this time.
0 commit comments