oasis-open / openc2-oif-device

OASIS TC Open Repository: Supports development OpenC2 Integration Framework (OIF) Device
https://github.com/oasis-open/openc2-oif-device
Apache License 2.0
5 stars 5 forks source link

transport_mqtt_1 times out #28

Closed mvle closed 1 year ago

mvle commented 2 years ago

Using the develop branch from https://github.com/ScreamBun/openc2-oif-device Running docker-compose -f device-compose.yaml up fails during bootstrap:

...
actuator-base_1    | Connected to amqp://queue:5672 on queue oc2ls_version_1.0_json_schema with [Bind:{Exchange actuator(direct)->oc2ls_version_1.0_json_schema},Bind:{Exchange actuator_all(fanout)->actuator_all}] and waiting to consume...
queue_1            | 2022-07-06 17:29:48.250622+00:00 [info] <0.729.0> accepting AMQP connection <0.729.0> (172.26.0.6:34060 -> 172.26.0.2:5672)
queue_1            | 2022-07-06 17:29:48.256921+00:00 [info] <0.729.0> connection <0.729.0> (172.26.0.6:34060 -> 172.26.0.2:5672): user 'guest' authenticated and granted access to vhost '/'
transport-mqtt_1   | KEY: oc2ls_version_1.0_json_schema -> aafdb86e-d9f1-4867-ad47-7a8be38f82b4
transport-mqtt_1   | KEY: slpf -> d08d5cd8-e5b3-471f-861e-c88583658507
transport-mqtt_1   | Traceback (most recent call last):
transport-mqtt_1   |   File "./MQTT/mqtt_transport.py", line 74, in <module>
transport-mqtt_1   |     client.connect(
transport-mqtt_1   |   File "/usr/lib/python3.8/site-packages/paho/mqtt/client.py", line 914, in connect
transport-mqtt_1   |     return self.reconnect()
transport-mqtt_1   |   File "/usr/lib/python3.8/site-packages/paho/mqtt/client.py", line 1044, in reconnect
transport-mqtt_1   |     sock = self._create_socket_connection()
transport-mqtt_1   |   File "/usr/lib/python3.8/site-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection
transport-mqtt_1   |     return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source)
transport-mqtt_1   |   File "/usr/lib/python3.8/socket.py", line 808, in create_connection
transport-mqtt_1   |     raise err
transport-mqtt_1   |   File "/usr/lib/python3.8/socket.py", line 796, in create_connection
transport-mqtt_1   |     sock.connect(sa)
transport-mqtt_1   | socket.timeout: timed out

Expected all the containers to come up w/o errors. Wondering if it's my environment or something else the matter. Any thoughts would be appreciated.

ScreamBun commented 2 years ago

A transport would error like this is caused when a connection to the intended host cannot be established. In the case of MQTT, it is likely due to not being able to connect to the broker.

The docs should have instructions to change the broker that is being used. Updating the MQTT_HOST key from the environment of the transport-mqtt service in the device-compose.yaml file should resolve the connection timeout. The value given should be the MQTT broker that you intend to use.