Azure / iotedge

The IoT Edge OSS project
MIT License
1.46k stars 461 forks source link

Change port 443 for nested edge scenario #5612

Closed mramin2000 closed 2 years ago

mramin2000 commented 3 years ago

Hello,

I'm working with the nested edge scenario and I'd like to use port 443 on both the child and the parent device for different service, but it seems like the devices are communicating on port 443 among themselves. Is it possible to change this port? I've already changed the portbindings for edgeHub and the API Proxy module on another port, but this didn't help.

dmolokanov commented 3 years ago

@huguesBouvier Do you know if customer can change 443 port for their service in nested edge?

huguesBouvier commented 3 years ago

@dmolokanov Yes, the process is described here: https://docs.microsoft.com/en-us/azure/iot-edge/how-to-configure-api-proxy-module?view=iotedge-2020-11#minimize-open-ports. The changes need to be made on the parent.

mramin2000 commented 3 years ago

Now it works. Thanks.

mramin2000 commented 3 years ago

Now I'm working with docker registry module on the parent too. I've changed the API Proxy Default port to 8000 (in its port bindings as well). On the child edge device I've changed mcr.microsoft.com to $upstream:8000 and also in its config (instead of $upstream I've used parent hostname and port 8000). The connection works, but a new module deployment gives the error: "Unable to process module SimulatedTemperatureSensor add or update as the module identity could not be obtained" in the edgeAgent logs. When I remove modules in IoT Hub, they disappear correctly on the child device, but deploying them again doesn't work. I still like to use port 443 for my own services. Are there any other settings I have to do for this scenario?

huguesBouvier commented 3 years ago

No, there might be something else. Could you give me the logs of: API proxy on parent edgeHub on parent edgeHub on children edgeAgent on children edged on children Thanks!

huguesBouvier commented 3 years ago

Just realized: Did you put back the API proxy from 443 to 8000? Then you need to put edgeHub back on 443. That is why you are seeing this issue. You can't use 443 without the API proxy, it is used by edgeHub.

However, API proxy is configurable, if your applications are using HTTP, it should be possible to configure the API proxy to route your messages. Please see: Readme: https://github.com/Azure/iotedge/tree/master/edge-modules/api-proxy-module API proxy config file: https://github.com/Azure/iotedge/blob/master/edge-modules/api-proxy-module/templates/nginx_default_config.conf

mramin2000 commented 3 years ago

With the following settings I can successfully use port 8000 of the API Proxy module and deploy modules to the child device, but I can't use 443 for my own services: On the parent: -edgeHub Portbinding for 443 with hostport 443 (and also 5671 and 8883) -API Proxy Default Nginx Port 8000 and port binding for 8000 to hostport 8000 on container create options On the child: -$upstream:8000 on each module -hostname:8000 in [agent] section in config.toml -edgeHub Portbinding for 443 with hostport 443 (and alos 5671 and 8883)

I tried to change the portbinding for the edgeHub for both devices to 443 with hostport 8443. This has worked before on the devices without nested edge to make my own service on port 443 run. But when I do this in the nested scenario the parent works and can deploy modules while port 443 is used for my service while I get the following logs on the child:

System logs child Oct 18 11:52:24 nt08002786d03e aziot-edged[9594]: 2021-10-18T09:52:24Z [INFO] - Checking edge runtime status Oct 18 11:52:24 nt08002786d03e aziot-edged[9594]: 2021-10-18T09:52:24Z [INFO] - Edge runtime is running. Oct 18 11:52:27 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:27Z [WARN] - Failed to communicate with IoT Hub (attempt 1 of 1): error trying to connect: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:: self signed certificate Oct 18 11:52:27 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:27Z [INFO] - !!! Hub client error Oct 18 11:52:27 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:27Z [INFO] - !!! caused by: error trying to connect: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:: self signed certificate Oct 18 11:52:27 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:27Z [INFO] - !!! caused by: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:: self signed certificate Oct 18 11:52:27 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:27Z [INFO] - !!! caused by: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914: Oct 18 11:52:27 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:27Z [INFO] - !!! caused by: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914: Oct 18 11:52:27 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:27Z [INFO] - --> 404 {"content-type": "application/json"} Oct 18 11:52:27 nt08002786d03e aziot-edged[9594]: 2021-10-18T09:52:27Z [ERR!] - Internal server error: Could not list identities Oct 18 11:52:27 nt08002786d03e aziot-edged[9594]: caused by: HTTP response error: [404 Not Found] {"message":"Hub client error\ncaused by: error trying to connect: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:: self signed certificate\ncaused by: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:: self signed certificate\ncaused by: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:\ncaused by: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:"} Oct 18 11:52:27 nt08002786d03e aziot-edged[9594]: 2021-10-18T09:52:27Z [INFO] - [mgmt] - - - [2021-10-18 09:52:27.070195737 UTC] "GET /identities/?api-version=2020-07-07 HTTP/1.1" 500 Internal Server Error 788 "-" "-" auth_id(-) Oct 18 11:52:31 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:31Z [INFO] - <-- GET /identities/modules?api-version=2020-09-01&type=aziot {"host": ":0"} Oct 18 11:52:31 nt08002786d03e aziot-keyd[9608]: 2021-10-18T09:52:31Z [INFO] - <-- GET /key/device-id?api-version=2020-09-01 {"host": "keyd.sock"} Oct 18 11:52:31 nt08002786d03e aziot-keyd[9608]: 2021-10-18T09:52:31Z [INFO] - --> 200 {"content-type": "application/json"} Oct 18 11:52:31 nt08002786d03e aziot-keyd[9608]: 2021-10-18T09:52:31Z [INFO] - <-- POST /sign?api-version=2020-09-01 {"content-type": "application/json", "host": "keyd.sock", "content-length": "374"} Oct 18 11:52:31 nt08002786d03e aziot-keyd[9608]: 2021-10-18T09:52:31Z [INFO] - --> 200 {"content-type": "application/json"} Oct 18 11:52:36 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:36Z [WARN] - Failed to communicate with IoT Hub (attempt 1 of 1): error trying to connect: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:: self signed certificate Oct 18 11:52:36 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:36Z [INFO] - !!! Hub client error Oct 18 11:52:36 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:36Z [INFO] - !!! caused by: error trying to connect: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:: self signed certificate Oct 18 11:52:36 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:36Z [INFO] - !!! caused by: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:: self signed certificate Oct 18 11:52:36 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:36Z [INFO] - !!! caused by: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914: Oct 18 11:52:36 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:36Z [INFO] - !!! caused by: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914: Oct 18 11:52:36 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:36Z [INFO] - --> 404 {"content-type": "application/json"} Oct 18 11:52:36 nt08002786d03e aziot-edged[9594]: 2021-10-18T09:52:36Z [ERR!] - Internal server error: Could not list identities Oct 18 11:52:36 nt08002786d03e aziot-edged[9594]: caused by: HTTP response error: [404 Not Found] {"message":"Hub client error\ncaused by: error trying to connect: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:: self signed certificate\ncaused by: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:: self signed certificate\ncaused by: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:\ncaused by: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:"} Oct 18 11:52:36 nt08002786d03e aziot-edged[9594]: 2021-10-18T09:52:36Z [INFO] - [mgmt] - - - [2021-10-18 09:52:36.722875953 UTC] "GET /identities/?api-version=2020-07-07 HTTP/1.1" 500 Internal Server Error 788 "-" "-" auth_id(-) Oct 18 11:52:48 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:48Z [INFO] - <-- GET /identities/modules?api-version=2020-09-01&type=aziot {"host": ":0"} Oct 18 11:52:48 nt08002786d03e aziot-keyd[9608]: 2021-10-18T09:52:48Z [INFO] - <-- GET /key/device-id?api-version=2020-09-01 {"host": "keyd.sock"} Oct 18 11:52:48 nt08002786d03e aziot-keyd[9608]: 2021-10-18T09:52:48Z [INFO] - --> 200 {"content-type": "application/json"} Oct 18 11:52:48 nt08002786d03e aziot-keyd[9608]: 2021-10-18T09:52:48Z [INFO] - <-- POST /sign?api-version=2020-09-01 {"content-type": "application/json", "host": "keyd.sock", "content-length": "374"} Oct 18 11:52:48 nt08002786d03e aziot-keyd[9608]: 2021-10-18T09:52:48Z [INFO] - --> 200 {"content-type": "application/json"} Oct 18 11:52:53 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:53Z [WARN] - Failed to communicate with IoT Hub (attempt 1 of 1): error trying to connect: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:: self signed certificate Oct 18 11:52:53 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:53Z [INFO] - !!! Hub client error Oct 18 11:52:53 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:53Z [INFO] - !!! caused by: error trying to connect: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:: self signed certificate Oct 18 11:52:53 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:53Z [INFO] - !!! caused by: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:: self signed certificate Oct 18 11:52:53 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:53Z [INFO] - !!! caused by: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914: Oct 18 11:52:53 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:53Z [INFO] - !!! caused by: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914: Oct 18 11:52:53 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:53Z [INFO] - --> 404 {"content-type": "application/json"} Oct 18 11:52:53 nt08002786d03e aziot-edged[9594]: 2021-10-18T09:52:53Z [ERR!] - Internal server error: Could not list identities Oct 18 11:52:53 nt08002786d03e aziot-edged[9594]: caused by: HTTP response error: [404 Not Found] {"message":"Hub client error\ncaused by: error trying to connect: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:: self signed certificate\ncaused by: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:: self signed certificate\ncaused by: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:\ncaused by: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../openssl-1.1.1l/ssl/statem/statem_clnt.c:1914:"} Oct 18 11:52:53 nt08002786d03e aziot-edged[9594]: 2021-10-18T09:52:53Z [INFO] - [mgmt] - - - [2021-10-18 09:52:53.946842592 UTC] "GET /identities/?api-version=2020-07-07 HTTP/1.1" 500 Internal Server Error 788 "-" "-" auth_id(-) Oct 18 11:52:58 nt08002786d03e aziot-edged[9594]: 2021-10-18T09:52:58Z [INFO] - [mgmt] - - - [2021-10-18 09:52:58.968149750 UTC] "GET /modules?api-version=2020-07-07 HTTP/1.1" 200 OK 1185 "-" "-" auth_id(-) Oct 18 11:52:59 nt08002786d03e aziot-identityd[9603]: 2021-10-18T09:52:59Z [INFO] - <-- GET /identities/modules?api-version=2020-09-01&type=aziot {"host": ":0"} Oct 18 11:52:59 nt08002786d03e aziot-keyd[9608]: 2021-10-18T09:52:59Z [INFO] - <-- GET /key/device-id?api-version=2020-09-01 {"host": "keyd.sock"} Oct 18 11:52:59 nt08002786d03e aziot-keyd[9608]: 2021-10-18T09:52:59Z [INFO] - --> 200 {"content-type": "application/json"} Oct 18 11:52:59 nt08002786d03e aziot-keyd[9608]: 2021-10-18T09:52:59Z [INFO] - <-- POST /sign?api-version=2020-09-01 {"content-type": "application/json", "host": "keyd.sock", "content-length": "374"} Oct 18 11:52:59 nt08002786d03e aziot-keyd[9608]: 2021-10-18T09:52:59Z [INFO] - --> 200 {"content-type": "application/json"} Oct 18 11:52:59 nt08002786d03e aziot-edged[9594]: 2021-10-18T09:52:59Z [INFO] - [mgmt] - - - [2021-10-18 09:52:59.239865523 UTC] "GET /modules?api-version=2020-07-07 HTTP/1.1" 200 OK 1185 "-" "iotedge/0.1.0" auth_id(-)
edgeHub logs child <6> 2021-10-18 09:42:48.080 +00:00 [INF] - Attempting to connect to IoT Hub for client childNEU2/$edgeHub via AMQP... <6> 2021-10-18 09:42:48.211 +00:00 [INF] - Exiting disconnected state <6> 2021-10-18 09:42:48.216 +00:00 [INF] - Received device connected callback <6> 2021-10-18 09:42:48.218 +00:00 [INF] - Device connected to cloud, processing subscriptions for connected clients. <6> 2021-10-18 09:42:48.218 +00:00 [INF] - Processing subscriptions for client childNEU2/SimulatedTemperatureSensor on device connected to cloud. <6> 2021-10-18 09:42:48.218 +00:00 [INF] - Done syncing reported properties for childNEU2/SimulatedTemperatureSensor <6> 2021-10-18 09:42:48.228 +00:00 [INF] - Attempting to connect to IoT Hub for client childNEU2/SimulatedTemperatureSensor via AMQP... <6> 2021-10-18 09:42:48.250 +00:00 [INF] - Processing subscriptions for client childNEU2/$edgeHub on device connected to cloud. <6> 2021-10-18 09:42:48.257 +00:00 [INF] - Entering connected state <6> 2021-10-18 09:42:48.257 +00:00 [INF] - Cloud connection for childNEU2/$edgeHub is True <6> 2021-10-18 09:42:48.261 +00:00 [INF] - Connection status for childNEU2/$edgeHub changed to ConnectionEstablished <6> 2021-10-18 09:42:48.263 +00:00 [INF] - Client childNEU2/$edgeHub connected to cloud, processing existing subscriptions. <6> 2021-10-18 09:42:48.264 +00:00 [INF] - Skipping childNEU2/$edgeHub for subscription processing, as it is currently being processed. <6> 2021-10-18 09:42:48.264 +00:00 [INF] - Created cloud proxy for client childNEU2/$edgeHub via AMQP, with client operation timeout 20 seconds. <6> 2021-10-18 09:42:48.264 +00:00 [INF] - Device scope identities refresh is ready because a refresh was signalled. <6> 2021-10-18 09:42:48.266 +00:00 [INF] - Initialized cloud proxy ... for childNEU2/$edgeHub <6> 2021-10-18 09:42:48.266 +00:00 [INF] - Created cloud connection for client childNEU2/$edgeHub <6> 2021-10-18 09:42:48.271 +00:00 [INF] - Starting refresh of device scope identities cache <6> 2021-10-18 09:42:48.328 +00:00 [INF] - Cloud connection for childNEU2/SimulatedTemperatureSensor is True <6> 2021-10-18 09:42:48.328 +00:00 [INF] - Connection status for childNEU2/SimulatedTemperatureSensor changed to ConnectionEstablished <6> 2021-10-18 09:42:48.328 +00:00 [INF] - Client childNEU2/SimulatedTemperatureSensor connected to cloud, processing existing subscriptions. <6> 2021-10-18 09:42:48.329 +00:00 [INF] - Skipping childNEU2/SimulatedTemperatureSensor for subscription processing, as it is currently being processed. <6> 2021-10-18 09:42:48.329 +00:00 [INF] - Created cloud proxy for client childNEU2/SimulatedTemperatureSensor via AMQP, with client operation timeout 20 seconds. <6> 2021-10-18 09:42:48.329 +00:00 [INF] - Initialized cloud proxy ... for childNEU2/SimulatedTemperatureSensor <6> 2021-10-18 09:42:48.329 +00:00 [INF] - Created cloud connection for client childNEU2/SimulatedTemperatureSensor <6> 2021-10-18 09:42:48.349 +00:00 [INF] - Done syncing reported properties for childNEU2/$edgeHub <4> 2021-10-18 09:42:54.215 +00:00 [WRN] - Encountered an error while refreshing the device scope identities cache. Will retry the operation in some time... <6> 2021-10-18 09:42:54.215 +00:00 [INF] - Done refreshing device scope identities cache. Waiting for 60 minutes. <6> 2021-10-18 09:44:01.704 +00:00 [INF] - Entering periodic task to reauthenticate connected clients <6> 2021-10-18 09:46:29.682 +00:00 [INF] - Obtained edge hub config patch update from module twin <6> 2021-10-18 09:46:29.993 +00:00 [INF] - Updating edge hub configuration <6> 2021-10-18 09:46:30.755 +00:00 [INF] - Updated reported properties for childNEU2/$edgeHub <6> 2021-10-18 09:47:10.146 +00:00 [INF] - Closing link Events for childNEU2/SimulatedTemperatureSensor <6> 2021-10-18 09:47:10.169 +00:00 [INF] - Closing link MethodSending for childNEU2/SimulatedTemperatureSensor <6> 2021-10-18 09:47:10.170 +00:00 [INF] - Closing link MethodReceiving for childNEU2/SimulatedTemperatureSensor <6> 2021-10-18 09:47:10.171 +00:00 [INF] - Closing link TwinSending for childNEU2/SimulatedTemperatureSensor <6> 2021-10-18 09:47:10.171 +00:00 [INF] - Closing link TwinReceiving for childNEU2/SimulatedTemperatureSensor <6> 2021-10-18 09:47:10.171 +00:00 [INF] - Closing link ModuleMessages for childNEU2/SimulatedTemperatureSensor <6> 2021-10-18 09:47:10.174 +00:00 [INF] - Setting proxy inactive for childNEU2/SimulatedTemperatureSensor. <6> 2021-10-18 09:47:10.175 +00:00 [INF] - Removing device connection for device childNEU2/SimulatedTemperatureSensor with removeCloudConnection flag 'True'. <6> 2021-10-18 09:47:10.181 +00:00 [INF] - Closing receiver in cloud proxy ... for childNEU2/SimulatedTemperatureSensor <6> 2021-10-18 09:47:10.181 +00:00 [INF] - Closed cloud proxy ... for childNEU2/SimulatedTemperatureSensor <6> 2021-10-18 09:47:10.181 +00:00 [INF] - Device connection removed for device childNEU2/SimulatedTemperatureSensor <6> 2021-10-18 09:47:10.189 +00:00 [INF] - Remove device connection for device childNEU2/SimulatedTemperatureSensor <6> 2021-10-18 09:47:11.504 +00:00 [INF] - Updated reported properties for childNEU2/$edgeHub <6> 2021-10-18 09:49:01.699 +00:00 [INF] - Entering periodic task to reauthenticate connected clients <6> 2021-10-18 09:49:27.361 +00:00 [INF] - Obtained edge hub config patch update from module twin <6> 2021-10-18 09:49:27.733 +00:00 [INF] - Updating edge hub configuration <6> 2021-10-18 09:49:28.230 +00:00 [INF] - Updated reported properties for childNEU2/$edgeHub <6> 2021-10-18 09:54:01.698 +00:00 [INF] - Entering periodic task to reauthenticate connected clients
edgeAgent logs child <6> 2021-10-18 09:19:16.410 +00:00 [INF] - Experimental features configuration: {"Enabled":false,"DisableCloudSubscriptions":false} <6> 2021-10-18 09:19:16.548 +00:00 [INF] - Installing certificates [CN=testchild.ca:11/06/2021 13:43:13],[CN=Azure IoT CA TestOnly Intermediate CA:11/06/2021 13:42:25],[CN=Azure IoT CA TestOnly Root CA:11/06/2021 13:42:24],[CN=Azure IoT CA TestOnly Root CA:11/06/2021 13:42:24] to Root <6> 2021-10-18 09:19:16.657 +00:00 [INF] - Starting metrics listener on Host: *, Port: 9600, Suffix: metrics <6> 2021-10-18 09:19:16.699 +00:00 [INF] - Updating performance metrics every 05m:00s <6> 2021-10-18 09:19:16.706 +00:00 [INF] - Started operation Get system resources <6> 2021-10-18 09:19:16.708 +00:00 [INF] - Collecting metadata metrics <6> 2021-10-18 09:19:16.801 +00:00 [INF] - Set metadata metrics: 1.2.4.47309863 (...), {"Enabled":false,"DisableCloudSubscriptions":false}, {"OperatingSystemType":"linux","Architecture":"x86_64","Version":"1.2.4","Provisioning":{"Type":"ProvisioningType","DynamicReprovisioning":false,"AlwaysReprovisionOnStartup":false},"ServerVersion":"20.10.8","KernelVersion":"5.4.91-rt50-yocto-preempt-rt","OperatingSystem":"...","NumCpus":4,"Virtualized":"yes"}, True <6> 2021-10-18 09:19:17.335 +00:00 [INF] - Created persistent store at /tmp/edgeAgent <6> 2021-10-18 09:19:17.377 +00:00 [INF] - Started operation Checkpoint Availability <6> 2021-10-18 09:19:17.382 +00:00 [INF] - Started operation refresh twin config <6> 2021-10-18 09:19:17.428 +00:00 [INF] - Edge agent attempting to connect to IoT Hub via Amqp_Tcp_Only... <6> 2021-10-18 09:19:17.473 +00:00 [INF] - Registering request handler UploadModuleLogs <6> 2021-10-18 09:19:17.475 +00:00 [INF] - Registering request handler GetModuleLogs <6> 2021-10-18 09:19:17.476 +00:00 [INF] - Registering request handler UploadSupportBundle <6> 2021-10-18 09:19:17.478 +00:00 [INF] - Registering request handler RestartModule <4> 2021-10-18 09:19:22.611 +00:00 [WRN] - Empty edge agent config was received. Attempting to read config from backup (/tmp/edgeAgent/backup.json) instead <6> 2021-10-18 09:19:22.614 +00:00 [INF] - Edge agent config backup file does not exist - /tmp/edgeAgent/backup.json <6> 2021-10-18 09:19:23.534 +00:00 [INF] - Edge agent connected to IoT Hub via Amqp_Tcp_Only. <6> 2021-10-18 09:19:23.630 +00:00 [INF] - Initialized new module client with subscriptions enabled <6> 2021-10-18 09:19:23.953 +00:00 [INF] - Obtained Edge agent twin from IoTHub with desired properties version 67 and reported properties version 183. <6> 2021-10-18 09:20:05.043 +00:00 [INF] - Plan execution started for deployment 67 <6> 2021-10-18 09:20:05.061 +00:00 [INF] - Executing command: "Command Group: (\n [Create module SimulatedTemperatureSensor]\n [Start module SimulatedTemperatureSensor]\n)" <6> 2021-10-18 09:20:05.066 +00:00 [INF] - Executing command: "Create module SimulatedTemperatureSensor" <6> 2021-10-18 09:20:21.002 +00:00 [INF] - Executing command: "Start module SimulatedTemperatureSensor" <6> 2021-10-18 09:20:22.758 +00:00 [INF] - Executing command: "Command Group: (\n [Create module edgeHub]\n [Start module edgeHub]\n)" <6> 2021-10-18 09:20:22.760 +00:00 [INF] - Executing command: "Create module edgeHub" <6> 2021-10-18 09:20:38.611 +00:00 [INF] - Executing command: "Start module edgeHub" <6> 2021-10-18 09:20:40.929 +00:00 [INF] - Executing command: "Command Group: (\n [Create module AzureEventGridonIoTEdge]\n [Start module AzureEventGridonIoTEdge]\n)" <6> 2021-10-18 09:20:40.929 +00:00 [INF] - Executing command: "Create module AzureEventGridonIoTEdge" <6> 2021-10-18 09:21:51.706 +00:00 [INF] - Executing command: "Start module AzureEventGridonIoTEdge" <6> 2021-10-18 09:21:54.442 +00:00 [INF] - Plan execution ended for deployment 67 <6> 2021-10-18 09:21:55.165 +00:00 [INF] - Updated reported properties <6> 2021-10-18 09:22:00.545 +00:00 [INF] - Updated reported properties <6> 2021-10-18 09:24:03.087 +00:00 [INF] - Plan execution started for deployment 68 <6> 2021-10-18 09:24:03.089 +00:00 [INF] - Executing command: "Stop module AzureEventGridonIoTEdge" <6> 2021-10-18 09:24:04.119 +00:00 [INF] - Executing command: "Remove module AzureEventGridonIoTEdge" <6> 2021-10-18 09:24:04.229 +00:00 [INF] - Executing command: "Saving AzureEventGridonIoTEdge to store" <6> 2021-10-18 09:24:04.234 +00:00 [INF] - Plan execution ended for deployment 68 <6> 2021-10-18 09:24:04.834 +00:00 [INF] - Updated reported properties <6> 2021-10-18 09:24:10.635 +00:00 [INF] - Updated reported properties <6> 2021-10-18 09:24:51.828 +00:00 [INF] - Plan execution started for deployment 69 <6> 2021-10-18 09:24:51.834 +00:00 [INF] - Executing command: "Saving edgeHub to store" <6> 2021-10-18 09:24:51.836 +00:00 [INF] - Executing command: "Command Group: (\n [Command Group: (\n [Prepare update module edgeHub]\n [Stop module edgeHub]\n [Update module edgeHub]\n)]\n [Start module edgeHub]\n)" <6> 2021-10-18 09:24:51.836 +00:00 [INF] - Executing command: "Command Group: (\n [Prepare update module edgeHub]\n [Stop module edgeHub]\n [Update module edgeHub]\n)" <6> 2021-10-18 09:24:53.525 +00:00 [INF] - Received direct method call - ping <6> 2021-10-18 09:24:53.528 +00:00 [INF] - Received request ping with payload <6> 2021-10-18 09:24:53.533 +00:00 [INF] - Successfully handled request ping <6> 2021-10-18 09:24:53.677 +00:00 [INF] - Received direct method call - GetModuleLogs <6> 2021-10-18 09:24:53.678 +00:00 [INF] - Received request GetModuleLogs with payload <6> 2021-10-18 09:24:53.701 +00:00 [INF] - Processing request to get logs for {"schemaVersion":"1.0","items":{"id":"\\bedgeAgent\\b","filter":{"tail":1500,"since":"15m","until":null,"loglevel":null,"regex":""}},"encoding":1,"contentType":1} <6> 2021-10-18 09:24:53.749 +00:00 [INF] - Initiating streaming logs for edgeAgent <6> 2021-10-18 09:24:53.923 +00:00 [INF] - Received 1958 bytes of logs for edgeAgent <6> 2021-10-18 09:24:53.931 +00:00 [INF] - Successfully handled request GetModuleLogs <6> 2021-10-18 09:25:34.654 +00:00 [INF] - Executing command: "Start module edgeHub" <6> 2021-10-18 09:25:58.888 +00:00 [INF] - Plan execution ended for deployment 69 <6> 2021-10-18 09:25:59.280 +00:00 [INF] - Updated reported properties <6> 2021-10-18 09:26:04.559 +00:00 [INF] - Updated reported properties <6> 2021-10-18 09:27:30.989 +00:00 [INF] - Plan execution started for deployment 70 <6> 2021-10-18 09:27:30.990 +00:00 [INF] - Executing command: "Command Group: (\n [Create module AzureEventGridonIoTEdge]\n [Start module AzureEventGridonIoTEdge]\n)" <6> 2021-10-18 09:27:30.991 +00:00 [INF] - Executing command: "Create module AzureEventGridonIoTEdge" <6> 2021-10-18 09:27:46.886 +00:00 [INF] - Executing command: "Start module AzureEventGridonIoTEdge" <6> 2021-10-18 09:27:48.706 +00:00 [INF] - Plan execution ended for deployment 70 <6> 2021-10-18 09:27:49.062 +00:00 [INF] - Updated reported properties <6> 2021-10-18 09:27:54.433 +00:00 [INF] - Updated reported properties <6> 2021-10-18 09:38:13.963 +00:00 [INF] - Plan execution started for deployment 71 <6> 2021-10-18 09:38:13.963 +00:00 [INF] - Executing command: "Saving edgeHub to store" <6> 2021-10-18 09:38:13.966 +00:00 [INF] - Executing command: "Command Group: (\n [Command Group: (\n [Prepare update module edgeHub]\n [Stop module edgeHub]\n [Update module edgeHub]\n)]\n [Start module edgeHub]\n)" <6> 2021-10-18 09:38:13.966 +00:00 [INF] - Executing command: "Command Group: (\n [Prepare update module edgeHub]\n [Stop module edgeHub]\n [Update module edgeHub]\n)" <6> 2021-10-18 09:38:56.723 +00:00 [INF] - Executing command: "Start module edgeHub" <6> 2021-10-18 09:38:59.098 +00:00 [INF] - Plan execution ended for deployment 71 <6> 2021-10-18 09:38:59.446 +00:00 [INF] - Updated reported properties <6> 2021-10-18 09:39:04.829 +00:00 [INF] - Updated reported properties <6> 2021-10-18 09:41:12.964 +00:00 [INF] - Obtained Edge agent twin from IoTHub with desired properties version 71 and reported properties version 193. <6> 2021-10-18 09:46:08.062 +00:00 [INF] - Received direct method call - ping <6> 2021-10-18 09:46:08.062 +00:00 [INF] - Received request ping with payload <6> 2021-10-18 09:46:08.062 +00:00 [INF] - Successfully handled request ping <6> 2021-10-18 09:46:08.228 +00:00 [INF] - Received direct method call - GetModuleLogs <6> 2021-10-18 09:46:08.228 +00:00 [INF] - Received request GetModuleLogs with payload <6> 2021-10-18 09:46:08.230 +00:00 [INF] - Processing request to get logs for {"schemaVersion":"1.0","items":{"id":"\\bedgeAgent\\b","filter":{"tail":1500,"since":"15m","until":null,"loglevel":null,"regex":""}},"encoding":1,"contentType":1} <6> 2021-10-18 09:46:08.262 +00:00 [INF] - Initiating streaming logs for edgeAgent <6> 2021-10-18 09:46:08.289 +00:00 [INF] - Received 574 bytes of logs for edgeAgent <6> 2021-10-18 09:46:08.290 +00:00 [INF] - Successfully handled request GetModuleLogs <6> 2021-10-18 09:46:10.656 +00:00 [INF] - Received direct method call - GetModuleLogs <6> 2021-10-18 09:46:10.657 +00:00 [INF] - Received request GetModuleLogs with payload <6> 2021-10-18 09:46:10.658 +00:00 [INF] - Processing request to get logs for {"schemaVersion":"1.0","items":{"id":"\\bedgeHub\\b","filter":{"tail":1500,"since":"15m","until":null,"loglevel":null,"regex":""}},"encoding":1,"contentType":1} <6> 2021-10-18 09:46:10.687 +00:00 [INF] - Initiating streaming logs for edgeHub <6> 2021-10-18 09:46:10.759 +00:00 [INF] - Received 4647 bytes of logs for edgeHub <6> 2021-10-18 09:46:10.761 +00:00 [INF] - Successfully handled request GetModuleLogs <6> 2021-10-18 09:47:09.965 +00:00 [INF] - Plan execution started for deployment 72 <6> 2021-10-18 09:47:09.966 +00:00 [INF] - Executing command: "Stop module SimulatedTemperatureSensor" <6> 2021-10-18 09:47:10.957 +00:00 [INF] - Executing command: "Stop module AzureEventGridonIoTEdge" <6> 2021-10-18 09:47:12.042 +00:00 [INF] - Executing command: "Remove module SimulatedTemperatureSensor" <6> 2021-10-18 09:47:12.145 +00:00 [INF] - Executing command: "Remove module AzureEventGridonIoTEdge" <6> 2021-10-18 09:47:12.253 +00:00 [INF] - Executing command: "Saving SimulatedTemperatureSensor to store" <6> 2021-10-18 09:47:12.254 +00:00 [INF] - Executing command: "Saving AzureEventGridonIoTEdge to store" <6> 2021-10-18 09:47:12.255 +00:00 [INF] - Plan execution ended for deployment 72 <6> 2021-10-18 09:47:12.626 +00:00 [INF] - Updated reported properties <6> 2021-10-18 09:47:18.021 +00:00 [INF] - Updated reported properties <6> 2021-10-18 09:50:06.223 +00:00 [INF] - Unable to process module SimulatedTemperatureSensor add or update as the module identity could not be obtained <6> 2021-10-18 09:50:06.578 +00:00 [INF] - Updated reported properties <6> 2021-10-18 09:50:47.693 +00:00 [INF] - Unable to process module SimulatedTemperatureSensor add or update as the module identity could not be obtained <6> 2021-10-18 09:51:30.292 +00:00 [INF] - Unable to process module SimulatedTemperatureSensor add or update as the module identity could not be obtained <6> 2021-10-18 09:52:11.823 +00:00 [INF] - Unable to process module SimulatedTemperatureSensor add or update as the module identity could not be obtained <6> 2021-10-18 09:52:53.953 +00:00 [INF] - Unable to process module SimulatedTemperatureSensor add or update as the module identity could not be obtained <6> 2021-10-18 09:53:37.188 +00:00 [INF] - Unable to process module SimulatedTemperatureSensor add or update as the module identity could not be obtained <6> 2021-10-18 09:54:16.871 +00:00 [INF] - Unable to process module SimulatedTemperatureSensor add or update as the module identity could not be obtained <6> 2021-10-18 09:54:59.493 +00:00 [INF] - Unable to process module SimulatedTemperatureSensor add or update as the module identity could not be obtained <6> 2021-10-18 09:55:38.897 +00:00 [INF] - Unable to process module SimulatedTemperatureSensor add or update as the module identity could not be obtained <6> 2021-10-18 09:56:20.170 +00:00 [INF] - Unable to process module SimulatedTemperatureSensor add or update as the module identity could not be obtained <6> 2021-10-18 09:57:02.084 +00:00 [INF] - Unable to process module SimulatedTemperatureSensor add or update as the module identity could not be obtained <6> 2021-10-18 09:57:45.130 +00:00 [INF] - Unable to process module SimulatedTemperatureSensor add or update as the module identity could not be obtained <6> 2021-10-18 09:58:25.733 +00:00 [INF] - Unable to process module SimulatedTemperatureSensor add or update as the module identity could not be obtained <6> 2021-10-18 09:59:08.393 +00:00 [INF] - Unable to process module SimulatedTemperatureSensor add or update as the module identity could not be obtained <6> 2021-10-18 09:59:48.959 +00:00 [INF] - Unable to process module SimulatedTemperatureSensor add or update as the module identity could not be obtained <6> 2021-10-18 10:00:29.517 +00:00 [INF] - Unable to process module SimulatedTemperatureSensor add or update as the module identity could not be obtained <6> 2021-10-18 10:01:09.736 +00:00 [INF] - Unable to process module SimulatedTemperatureSensor add or update as the module identity could not be obtained

Here the logs of the parent device:

API Proxy logs parent [2021-10-18T09:13:50Z INFO api_proxy_module::monitors::config_monitor] Initializing config monitoring loop [2021-10-18T09:13:50Z INFO api_proxy_module::monitors::config_monitor] Starting config monitoring loop [2021-10-18T09:13:50Z INFO api_proxy_module::monitors::certs_monitor] Initializing certs monitoring loop [2021-10-18T09:13:51Z INFO api_proxy_module::monitors::certs_monitor] Starting certs monitoring loop [2021-10-18T09:13:53Z INFO api_proxy_module] Starting/Restarting API-Proxy [2021-10-18T09:13:56Z WARN mqtt3::client::connect] could not connect to server: Connection refused (os error 111) [2021-10-18T09:14:01Z WARN mqtt3::client::connect] could not connect to server: Connection refused (os error 111) [2021-10-18T09:14:11Z WARN mqtt3::client::connect] could not connect to server: unexpected EOF [2021-10-18T09:16:31Z WARN mqtt3::client] client will reconnect because of error: connection closed by server [2021-10-18T09:16:36Z WARN mqtt3::client::connect] could not connect to server: unexpected EOF [2021-10-18T09:16:42Z WARN mqtt3::client::connect] could not connect to server: Connection refused (os error 111) [2021-10-18T09:16:49Z WARN mqtt3::client::connect] could not connect to server: Connection refused (os error 111) [2021-10-18T09:16:59Z WARN mqtt3::client::connect] could not connect to server: Connection refused (os error 111) [2021-10-18T09:17:12Z WARN mqtt3::client::connect] could not connect to server: unexpected EOF 10.254.0.1 - - [18/Oct/2021:09:17:45 +0000] "GET /v2/ HTTP/1.1" 200 2 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:17:50 +0000] "HEAD /v2/azureiotedge-agent/manifests/1.2 HTTP/1.1" 200 0 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:18:52 +0000] "GET /v2/ HTTP/1.1" 200 2 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:18:57 +0000] "HEAD /v2/azureiotedge-agent/manifests/1.2 HTTP/1.1" 200 0 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:19:09 +0000] "GET /v2/ HTTP/1.1" 200 2 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:19:14 +0000] "HEAD /v2/azureiotedge-agent/manifests/1.2 HTTP/1.1" 200 0 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:20:15 +0000] "GET /v2/ HTTP/1.1" 200 2 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:20:20 +0000] "HEAD /v2/azureiotedge-simulated-temperature-sensor/manifests/1.0 HTTP/1.1" 200 0 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:20:32 +0000] "GET /v2/ HTTP/1.1" 200 2 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:20:38 +0000] "HEAD /v2/azureiotedge-hub/manifests/1.2 HTTP/1.1" 200 0 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:20:51 +0000] "GET /v2/ HTTP/1.1" 200 2 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:20:56 +0000] "HEAD /v2/azure-event-grid/iotedge/manifests/latest HTTP/1.1" 200 0 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:21:01 +0000] "GET /v2/azure-event-grid/iotedge/manifests/sha256:... HTTP/1.1" 200 1096 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:21:07 +0000] "GET /v2/azure-event-grid/iotedge/manifests/sha256:... HTTP/1.1" 200 2625 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:21:13 +0000] "GET /v2/azure-event-grid/iotedge/blobs/sha256:... HTTP/1.1" 200 11701 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:21:23 +0000] "GET /v2/azure-event-grid/iotedge/blobs/sha256:... HTTP/1.1" 200 31653622 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:21:25 +0000] "GET /v2/azure-event-grid/iotedge/blobs/sha256:... HTTP/1.1" 200 2787134 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:21:26 +0000] "GET /v2/azure-event-grid/iotedge/blobs/sha256:... HTTP/1.1" 200 1656768 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:21:29 +0000] "GET /v2/azure-event-grid/iotedge/blobs/sha256:... HTTP/1.1" 200 1452293 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:21:31 +0000] "GET /v2/azure-event-grid/iotedge/blobs/sha256:... HTTP/1.1" 200 2278529 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:21:34 +0000] "GET /v2/azure-event-grid/iotedge/blobs/sha256:... HTTP/1.1" 200 8082828 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:21:36 +0000] "GET /v2/azure-event-grid/iotedge/blobs/sha256:... HTTP/1.1" 200 144 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:21:36 +0000] "GET /v2/azure-event-grid/iotedge/blobs/sha256:... HTTP/1.1" 200 98 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:21:36 +0000] "GET /v2/azure-event-grid/iotedge/blobs/sha256:... HTTP/1.1" 200 1284 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:21:41 +0000] "GET /v2/azure-event-grid/iotedge/blobs/sha256:... HTTP/1.1" 200 149 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:21:47 +0000] "GET /v2/azure-event-grid/iotedge/blobs/sha256:... HTTP/1.1" 200 13088704 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:25:02 +0000] "GET /v2/ HTTP/1.1" 200 2 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:25:07 +0000] "HEAD /v2/azureiotedge-hub/manifests/1.2 HTTP/1.1" 200 0 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:25:29 +0000] "GET /v2/ HTTP/1.1" 200 2 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:25:34 +0000] "HEAD /v2/azureiotedge-hub/manifests/1.2 HTTP/1.1" 200 0 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:27:41 +0000] "GET /v2/ HTTP/1.1" 200 2 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:27:46 +0000] "HEAD /v2/azure-event-grid/iotedge/manifests/latest HTTP/1.1" 200 0 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:38:24 +0000] "GET /v2/ HTTP/1.1" 200 2 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:38:29 +0000] "HEAD /v2/azureiotedge-hub/manifests/1.2 HTTP/1.1" 200 0 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:38:51 +0000] "GET /v2/ HTTP/1.1" 200 2 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" 10.254.0.1 - - [18/Oct/2021:09:38:56 +0000] "HEAD /v2/azureiotedge-hub/manifests/1.2 HTTP/1.1" 200 0 "-" "docker/20.10.8 go/go1.16.7 git-commit/... kernel/5.4.91-rt50-yocto-preempt-rt os/linux arch/amd64 UpstreamClient(edgelet/0.1.0)" [2021-10-18T09:40:15Z WARN mqtt3::client] client will reconnect because of error: connection closed by server [2021-10-18T09:40:21Z WARN mqtt3::client::connect] could not connect to server: unexpected EOF [2021-10-18T09:40:27Z WARN mqtt3::client::connect] could not connect to server: Connection refused (os error 111) [2021-10-18T09:40:34Z WARN mqtt3::client::connect] could not connect to server: Connection refused (os error 111) [2021-10-18T09:40:43Z WARN mqtt3::client::connect] could not connect to server: Connection refused (os error 111) [2021-10-18T09:40:57Z WARN mqtt3::client::connect] could not connect to server: unexpected EOF
edgeHub logs parent <6> 2021-10-18 09:47:10.180 +00:00 [INF] - Closed cloud proxy ... for childNEU2/SimulatedTemperatureSensor <6> 2021-10-18 09:47:10.180 +00:00 [INF] - Device connection removed for device childNEU2/SimulatedTemperatureSensor <6> 2021-10-18 09:47:10.183 +00:00 [INF] - Remove device connection for device childNEU2/SimulatedTemperatureSensor <6> 2021-10-18 09:47:10.960 +00:00 [INF] - Updated reported properties for parentNEU2/$edgeHub <6> 2021-10-18 09:47:16.522 +00:00 [INF] - Updated reported properties for childNEU2/$edgeHub <6> 2021-10-18 09:47:17.121 +00:00 [INF] - Updated reported properties for childNEU2/$edgeAgent <6> 2021-10-18 09:47:22.745 +00:00 [INF] - Updated reported properties for childNEU2/$edgeAgent <6> 2021-10-18 09:49:28.623 +00:00 [INF] - Updated reported properties for childNEU2/$edgeHub <6> 2021-10-18 09:50:06.868 +00:00 [INF] - Updated reported properties for childNEU2/$edgeAgent <6> 2021-10-18 09:50:48.418 +00:00 [INF] - Entering periodic task to reauthenticate connected clients <6> 2021-10-18 09:54:28.664 +00:00 [INF] - Done syncing reported properties for childNEU2/$edgeHub <6> 2021-10-18 09:55:48.418 +00:00 [INF] - Entering periodic task to reauthenticate connected clients <6> 2021-10-18 09:59:28.952 +00:00 [INF] - Done syncing reported properties for childNEU2/$edgeHub <6> 2021-10-18 10:00:48.418 +00:00 [INF] - Entering periodic task to reauthenticate connected clients <6> 2021-10-18 10:04:29.333 +00:00 [INF] - Done syncing reported properties for childNEU2/$edgeHub <6> 2021-10-18 10:05:48.416 +00:00 [INF] - Entering periodic task to reauthenticate connected clients <6> 2021-10-18 10:09:29.835 +00:00 [INF] - Done syncing reported properties for childNEU2/$edgeHub <6> 2021-10-18 10:10:25.633 +00:00 [INF] - New token received on the Cbs link <6> 2021-10-18 10:10:25.634 +00:00 [INF] - Token updated for childNEU2/$edgeAgent <6> 2021-10-18 10:10:47.263 +00:00 [INF] - Started task to cleanup processed and stale messages for endpoint iothub <6> 2021-10-18 10:10:47.429 +00:00 [INF] - Cleaned up 323 messages from queue for endpoint iothub and 323 messages from message store. <6> 2021-10-18 10:10:48.426 +00:00 [INF] - Entering periodic task to reauthenticate connected clients

Do you have any other suggestions to solve this problem without editing the API Proxy config? Thanks a lot!

huguesBouvier commented 3 years ago

Check those options: https://github.com/Azure/iotedge/blob/master/doc/EnvironmentVariables.md Change the environment variable: HttpSettings__Port of the child, it should do what you want.

mramin2000 commented 3 years ago

I tried this with Port 8000 and 8443 as well, but both settings didn't work. Moreover the child reported the new config in IoT Hub, but the edgeHub module didn't restart itself, only manually. The errors in the logs are the same as before, the child still tries to use 443 for connecting.

huguesBouvier commented 3 years ago

Hum, I never used that option. It may use only the server part then. if it doesn't work, I see only this:

mramin2000 commented 3 years ago

When I set the edgeHub port bindings on the parent on 443 to 443, everything works, while the settings on the child seem to be unnecessary. There I've set the env variable "HttpSettings_Port" on 8000 or 8443 and the edgeHub port bindings on 443/8000, 443/8443, 8000/8000 and 8000/8443 but without any effect. But when I change "HttpSettings_Port" on the parent to 8000 with the same port bindings for 443/443, the child can not pull new deployments. I think port 443 for the child is hard coded somewhere, maybe this is a bug. But thanks a lot for your help!

huguesBouvier commented 3 years ago

Looking at the code it seems it changes only the server port, not where you connect to. I think its doing what's intended, though it won't help you. There doesn't seem to be any simple config option. You should try option 1 above. If you use http it should not be so difficult.

mramin2000 commented 3 years ago

I've tried a lot with iptables rules in the last days, but none of these settings have worked for me. Here are some variants:

Variant A:

Variant B:

Variant C:

Here are the settings of iptables for Variant C:

iptables -L -n on parent Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED,DNAT ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 INPUT_direct all -- 0.0.0.0/0 0.0.0.0/0 INPUT_ZONES all -- 0.0.0.0/0 0.0.0.0/0 DROP all -- 0.0.0.0/0 0.0.0.0/0 ctstate INVALID REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8443 Chain FORWARD (policy DROP) target prot opt source destination DOCKER-USER all -- 0.0.0.0/0 0.0.0.0/0 DOCKER-ISOLATION-STAGE-1 all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED DOCKER all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED DOCKER all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED DOCKER all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED,DNAT ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 FORWARD_direct all -- 0.0.0.0/0 0.0.0.0/0 FORWARD_IN_ZONES all -- 0.0.0.0/0 0.0.0.0/0 FORWARD_OUT_ZONES all -- 0.0.0.0/0 0.0.0.0/0 DROP all -- 0.0.0.0/0 0.0.0.0/0 ctstate INVALID REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 OUTPUT_direct all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8443 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 Chain DOCKER (3 references) target prot opt source destination ACCEPT tcp -- 0.0.0.0/0 10.254.0.3 tcp dpt:5000 ACCEPT tcp -- 0.0.0.0/0 10.254.0.4 tcp dpt:443 ACCEPT tcp -- 0.0.0.0/0 10.254.0.5 tcp dpt:8883 ACCEPT tcp -- 0.0.0.0/0 10.254.0.5 tcp dpt:5671 Chain DOCKER-ISOLATION-STAGE-1 (1 references) target prot opt source destination DOCKER-ISOLATION-STAGE-2 all -- 0.0.0.0/0 0.0.0.0/0 DOCKER-ISOLATION-STAGE-2 all -- 0.0.0.0/0 0.0.0.0/0 RETURN all -- 0.0.0.0/0 0.0.0.0/0 Chain DOCKER-ISOLATION-STAGE-2 (2 references) target prot opt source destination DROP all -- 0.0.0.0/0 0.0.0.0/0 DROP all -- 0.0.0.0/0 0.0.0.0/0 RETURN all -- 0.0.0.0/0 0.0.0.0/0 Chain DOCKER-USER (1 references) target prot opt source destination RETURN all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED /* allow internal docker communication */ REJECT all -- 0.0.0.0/0 0.0.0.0/0 mark match 0x10000 /* Reject all packets that were marked in mangle/PREROUTING as not being open ports */ reject-with icmp-host-prohibited DROP all -- 0.0.0.0/0 0.0.0.0/0 mark match 0x20000 /* Drop all packets that were marked in mangle/PREROUTING as not being open ports */ RETURN all -- 0.0.0.0/0 0.0.0.0/0 Chain FORWARD_IN_ZONES (1 references) target prot opt source destination FWDI_docker all -- 0.0.0.0/0 0.0.0.0/0 [goto] FWDI_docker all -- 0.0.0.0/0 0.0.0.0/0 [goto] FWDI_docker all -- 0.0.0.0/0 0.0.0.0/0 [goto] FWDI_default all -- 0.0.0.0/0 0.0.0.0/0 [goto] FWDI_default all -- 0.0.0.0/0 0.0.0.0/0 [goto] Chain FORWARD_OUT_ZONES (1 references) target prot opt source destination FWDO_docker all -- 0.0.0.0/0 0.0.0.0/0 [goto] FWDO_docker all -- 0.0.0.0/0 0.0.0.0/0 [goto] FWDO_docker all -- 0.0.0.0/0 0.0.0.0/0 [goto] FWDO_default all -- 0.0.0.0/0 0.0.0.0/0 [goto] FWDO_default all -- 0.0.0.0/0 0.0.0.0/0 [goto] Chain FORWARD_direct (1 references) target prot opt source destination Chain FWDI_default (2 references) target prot opt source destination FWDI_default_pre all -- 0.0.0.0/0 0.0.0.0/0 FWDI_default_log all -- 0.0.0.0/0 0.0.0.0/0 FWDI_default_deny all -- 0.0.0.0/0 0.0.0.0/0 FWDI_default_allow all -- 0.0.0.0/0 0.0.0.0/0 FWDI_default_post all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 Chain FWDI_default_allow (1 references) target prot opt source destination Chain FWDI_default_deny (1 references) target prot opt source destination Chain FWDI_default_log (1 references) target prot opt source destination Chain FWDI_default_post (1 references) target prot opt source destination Chain FWDI_default_pre (1 references) target prot opt source destination Chain FWDI_docker (3 references) target prot opt source destination FWDI_docker_pre all -- 0.0.0.0/0 0.0.0.0/0 FWDI_docker_log all -- 0.0.0.0/0 0.0.0.0/0 FWDI_docker_deny all -- 0.0.0.0/0 0.0.0.0/0 FWDI_docker_allow all -- 0.0.0.0/0 0.0.0.0/0 FWDI_docker_post all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 Chain FWDI_docker_allow (1 references) target prot opt source destination Chain FWDI_docker_deny (1 references) target prot opt source destination Chain FWDI_docker_log (1 references) target prot opt source destination Chain FWDI_docker_post (1 references) target prot opt source destination Chain FWDI_docker_pre (1 references) target prot opt source destination Chain FWDO_default (2 references) target prot opt source destination FWDO_default_pre all -- 0.0.0.0/0 0.0.0.0/0 FWDO_default_log all -- 0.0.0.0/0 0.0.0.0/0 FWDO_default_deny all -- 0.0.0.0/0 0.0.0.0/0 FWDO_default_allow all -- 0.0.0.0/0 0.0.0.0/0 FWDO_default_post all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 Chain FWDO_default_allow (1 references) target prot opt source destination Chain FWDO_default_deny (1 references) target prot opt source destination Chain FWDO_default_log (1 references) target prot opt source destination Chain FWDO_default_post (1 references) target prot opt source destination Chain FWDO_default_pre (1 references) target prot opt source destination Chain FWDO_docker (3 references) target prot opt source destination FWDO_docker_pre all -- 0.0.0.0/0 0.0.0.0/0 FWDO_docker_log all -- 0.0.0.0/0 0.0.0.0/0 FWDO_docker_deny all -- 0.0.0.0/0 0.0.0.0/0 FWDO_docker_allow all -- 0.0.0.0/0 0.0.0.0/0 FWDO_docker_post all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 Chain FWDO_docker_allow (1 references) target prot opt source destination Chain FWDO_docker_deny (1 references) target prot opt source destination Chain FWDO_docker_log (1 references) target prot opt source destination Chain FWDO_docker_post (1 references) target prot opt source destination Chain FWDO_docker_pre (1 references) target prot opt source destination Chain INPUT_ZONES (1 references) target prot opt source destination IN_docker all -- 0.0.0.0/0 0.0.0.0/0 [goto] IN_docker all -- 0.0.0.0/0 0.0.0.0/0 [goto] IN_docker all -- 0.0.0.0/0 0.0.0.0/0 [goto] IN_default all -- 0.0.0.0/0 0.0.0.0/0 [goto] IN_default all -- 0.0.0.0/0 0.0.0.0/0 [goto] Chain INPUT_direct (1 references) target prot opt source destination Chain IN_default (2 references) target prot opt source destination IN_default_pre all -- 0.0.0.0/0 0.0.0.0/0 IN_default_log all -- 0.0.0.0/0 0.0.0.0/0 IN_default_deny all -- 0.0.0.0/0 0.0.0.0/0 IN_default_allow all -- 0.0.0.0/0 0.0.0.0/0 IN_default_post all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 Chain IN_default_allow (1 references) target prot opt source destination Chain IN_default_deny (1 references) target prot opt source destination Chain IN_default_log (1 references) target prot opt source destination Chain IN_default_post (1 references) target prot opt source destination Chain IN_default_pre (1 references) target prot opt source destination Chain IN_docker (3 references) target prot opt source destination IN_docker_pre all -- 0.0.0.0/0 0.0.0.0/0 IN_docker_log all -- 0.0.0.0/0 0.0.0.0/0 IN_docker_deny all -- 0.0.0.0/0 0.0.0.0/0 IN_docker_allow all -- 0.0.0.0/0 0.0.0.0/0 IN_docker_post all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 Chain IN_docker_allow (1 references) target prot opt source destination Chain IN_docker_deny (1 references) target prot opt source destination Chain IN_docker_log (1 references) target prot opt source destination Chain IN_docker_post (1 references) target prot opt source destination Chain IN_docker_pre (1 references) target prot opt source destination Chain OUTPUT_direct (1 references) target prot opt source destination
iptables -L -t nat on parent Chain PREROUTING (policy ACCEPT) target prot opt source destination PREROUTING_direct all -- anywhere anywhere PREROUTING_ZONES all -- anywhere anywhere DOCKER all -- anywhere anywhere ADDRTYPE match dst-type LOCAL DNAT tcp -- anywhere anywhere tcp dpt:8443 to:10.254.0.5:443 Chain INPUT (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination OUTPUT_direct all -- anywhere anywhere DOCKER all -- anywhere !127.0.0.0/8 ADDRTYPE match dst-type LOCAL Chain POSTROUTING (policy ACCEPT) target prot opt source destination MASQUERADE all -- 10.252.254.0/24 anywhere MASQUERADE all -- 10.254.0.0/24 anywhere MASQUERADE all -- 172.16.0.0/16 anywhere POSTROUTING_direct all -- anywhere anywhere POSTROUTING_ZONES all -- anywhere anywhere MASQUERADE tcp -- 10.254.0.3 10.254.0.3 tcp dpt:5000 MASQUERADE tcp -- 10.254.0.4 10.254.0.4 tcp dpt:https MASQUERADE tcp -- 10.254.0.5 10.254.0.5 tcp dpt:8883 MASQUERADE tcp -- 10.254.0.5 10.254.0.5 tcp dpt:amqps Chain DOCKER (2 references) target prot opt source destination RETURN all -- anywhere anywhere RETURN all -- anywhere anywhere DNAT tcp -- anywhere anywhere tcp dpt:5000 to:10.254.0.3:5000 DNAT tcp -- anywhere anywhere tcp dpt:8443 to:10.254.0.4:443 DNAT tcp -- anywhere anywhere tcp dpt:8883 to:10.254.0.5:8883 DNAT tcp -- anywhere anywhere tcp dpt:amqps to:10.254.0.5:5671 Chain OUTPUT_direct (1 references) target prot opt source destination Chain POSTROUTING_ZONES (1 references) target prot opt source destination POST_docker all -- anywhere anywhere [goto] POST_docker all -- anywhere anywhere [goto] POST_docker all -- anywhere anywhere [goto] POST_default all -- anywhere anywhere [goto] POST_default all -- anywhere anywhere [goto] Chain POSTROUTING_direct (1 references) target prot opt source destination Chain POST_default (2 references) target prot opt source destination POST_default_pre all -- anywhere anywhere POST_default_log all -- anywhere anywhere POST_default_deny all -- anywhere anywhere POST_default_allow all -- anywhere anywhere POST_default_post all -- anywhere anywhere Chain POST_default_allow (1 references) target prot opt source destination Chain POST_default_deny (1 references) target prot opt source destination Chain POST_default_log (1 references) target prot opt source destination Chain POST_default_post (1 references) target prot opt source destination Chain POST_default_pre (1 references) target prot opt source destination Chain POST_docker (3 references) target prot opt source destination POST_docker_pre all -- anywhere anywhere POST_docker_log all -- anywhere anywhere POST_docker_deny all -- anywhere anywhere POST_docker_allow all -- anywhere anywhere POST_docker_post all -- anywhere anywhere Chain POST_docker_allow (1 references) target prot opt source destination Chain POST_docker_deny (1 references) target prot opt source destination Chain POST_docker_log (1 references) target prot opt source destination Chain POST_docker_post (1 references) target prot opt source destination Chain POST_docker_pre (1 references) target prot opt source destination Chain PREROUTING_ZONES (1 references) target prot opt source destination PRE_docker all -- anywhere anywhere [goto] PRE_docker all -- anywhere anywhere [goto] PRE_docker all -- anywhere anywhere [goto] PRE_default all -- anywhere anywhere [goto] PRE_default all -- anywhere anywhere [goto] Chain PREROUTING_direct (1 references) target prot opt source destination Chain PRE_default (2 references) target prot opt source destination PRE_default_pre all -- anywhere anywhere PRE_default_log all -- anywhere anywhere PRE_default_deny all -- anywhere anywhere PRE_default_allow all -- anywhere anywhere PRE_default_post all -- anywhere anywhere Chain PRE_default_allow (1 references) target prot opt source destination Chain PRE_default_deny (1 references) target prot opt source destination Chain PRE_default_log (1 references) target prot opt source destination Chain PRE_default_post (1 references) target prot opt source destination Chain PRE_default_pre (1 references) target prot opt source destination Chain PRE_docker (3 references) target prot opt source destination PRE_docker_pre all -- anywhere anywhere PRE_docker_log all -- anywhere anywhere PRE_docker_deny all -- anywhere anywhere PRE_docker_allow all -- anywhere anywhere PRE_docker_post all -- anywhere anywhere Chain PRE_docker_allow (1 references) target prot opt source destination Chain PRE_docker_deny (1 references) target prot opt source destination Chain PRE_docker_log (1 references) target prot opt source destination Chain PRE_docker_post (1 references) target prot opt source destination Chain PRE_docker_pre (1 references) target prot opt source destination
iptables -L -n on child Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED,DNAT ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 INPUT_direct all -- 0.0.0.0/0 0.0.0.0/0 INPUT_ZONES all -- 0.0.0.0/0 0.0.0.0/0 DROP all -- 0.0.0.0/0 0.0.0.0/0 ctstate INVALID REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8443 Chain FORWARD (policy DROP) target prot opt source destination DOCKER-USER all -- 0.0.0.0/0 0.0.0.0/0 DOCKER-ISOLATION-STAGE-1 all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED DOCKER all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED DOCKER all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED DOCKER all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED,DNAT ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 FORWARD_direct all -- 0.0.0.0/0 0.0.0.0/0 FORWARD_IN_ZONES all -- 0.0.0.0/0 0.0.0.0/0 FORWARD_OUT_ZONES all -- 0.0.0.0/0 0.0.0.0/0 DROP all -- 0.0.0.0/0 0.0.0.0/0 ctstate INVALID REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 OUTPUT_direct all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8443 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 Chain DOCKER (3 references) target prot opt source destination ACCEPT tcp -- 0.0.0.0/0 10.254.0.3 tcp dpt:8883 ACCEPT tcp -- 0.0.0.0/0 10.254.0.3 tcp dpt:443 ACCEPT tcp -- 0.0.0.0/0 10.254.0.3 tcp dpt:5671 Chain DOCKER-ISOLATION-STAGE-1 (1 references) target prot opt source destination DOCKER-ISOLATION-STAGE-2 all -- 0.0.0.0/0 0.0.0.0/0 DOCKER-ISOLATION-STAGE-2 all -- 0.0.0.0/0 0.0.0.0/0 RETURN all -- 0.0.0.0/0 0.0.0.0/0 Chain DOCKER-ISOLATION-STAGE-2 (2 references) target prot opt source destination DROP all -- 0.0.0.0/0 0.0.0.0/0 DROP all -- 0.0.0.0/0 0.0.0.0/0 RETURN all -- 0.0.0.0/0 0.0.0.0/0 Chain DOCKER-USER (1 references) target prot opt source destination RETURN all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED /* allow internal docker communication */ REJECT all -- 0.0.0.0/0 0.0.0.0/0 mark match 0x10000 /* Reject all packets that were marked in mangle/PREROUTING as not being open ports */ reject-with icmp-host-prohibited DROP all -- 0.0.0.0/0 0.0.0.0/0 mark match 0x20000 /* Drop all packets that were marked in mangle/PREROUTING as not being open ports */ RETURN all -- 0.0.0.0/0 0.0.0.0/0 Chain FORWARD_IN_ZONES (1 references) target prot opt source destination FWDI_docker all -- 0.0.0.0/0 0.0.0.0/0 [goto] FWDI_docker all -- 0.0.0.0/0 0.0.0.0/0 [goto] FWDI_docker all -- 0.0.0.0/0 0.0.0.0/0 [goto] FWDI_default all -- 0.0.0.0/0 0.0.0.0/0 [goto] FWDI_default all -- 0.0.0.0/0 0.0.0.0/0 [goto] Chain FORWARD_OUT_ZONES (1 references) target prot opt source destination FWDO_docker all -- 0.0.0.0/0 0.0.0.0/0 [goto] FWDO_docker all -- 0.0.0.0/0 0.0.0.0/0 [goto] FWDO_docker all -- 0.0.0.0/0 0.0.0.0/0 [goto] FWDO_default all -- 0.0.0.0/0 0.0.0.0/0 [goto] FWDO_default all -- 0.0.0.0/0 0.0.0.0/0 [goto] Chain FORWARD_direct (1 references) target prot opt source destination Chain FWDI_default (2 references) target prot opt source destination FWDI_default_pre all -- 0.0.0.0/0 0.0.0.0/0 FWDI_default_log all -- 0.0.0.0/0 0.0.0.0/0 FWDI_default_deny all -- 0.0.0.0/0 0.0.0.0/0 FWDI_default_allow all -- 0.0.0.0/0 0.0.0.0/0 FWDI_default_post all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 Chain FWDI_default_allow (1 references) target prot opt source destination Chain FWDI_default_deny (1 references) target prot opt source destination Chain FWDI_default_log (1 references) target prot opt source destination Chain FWDI_default_post (1 references) target prot opt source destination Chain FWDI_default_pre (1 references) target prot opt source destination Chain FWDI_docker (3 references) target prot opt source destination FWDI_docker_pre all -- 0.0.0.0/0 0.0.0.0/0 FWDI_docker_log all -- 0.0.0.0/0 0.0.0.0/0 FWDI_docker_deny all -- 0.0.0.0/0 0.0.0.0/0 FWDI_docker_allow all -- 0.0.0.0/0 0.0.0.0/0 FWDI_docker_post all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 Chain FWDI_docker_allow (1 references) target prot opt source destination Chain FWDI_docker_deny (1 references) target prot opt source destination Chain FWDI_docker_log (1 references) target prot opt source destination Chain FWDI_docker_post (1 references) target prot opt source destination Chain FWDI_docker_pre (1 references) target prot opt source destination Chain FWDO_default (2 references) target prot opt source destination FWDO_default_pre all -- 0.0.0.0/0 0.0.0.0/0 FWDO_default_log all -- 0.0.0.0/0 0.0.0.0/0 FWDO_default_deny all -- 0.0.0.0/0 0.0.0.0/0 FWDO_default_allow all -- 0.0.0.0/0 0.0.0.0/0 FWDO_default_post all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 Chain FWDO_default_allow (1 references) target prot opt source destination Chain FWDO_default_deny (1 references) target prot opt source destination Chain FWDO_default_log (1 references) target prot opt source destination Chain FWDO_default_post (1 references) target prot opt source destination Chain FWDO_default_pre (1 references) target prot opt source destination Chain FWDO_docker (3 references) target prot opt source destination FWDO_docker_pre all -- 0.0.0.0/0 0.0.0.0/0 FWDO_docker_log all -- 0.0.0.0/0 0.0.0.0/0 FWDO_docker_deny all -- 0.0.0.0/0 0.0.0.0/0 FWDO_docker_allow all -- 0.0.0.0/0 0.0.0.0/0 FWDO_docker_post all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 Chain FWDO_docker_allow (1 references) target prot opt source destination Chain FWDO_docker_deny (1 references) target prot opt source destination Chain FWDO_docker_log (1 references) target prot opt source destination Chain FWDO_docker_post (1 references) target prot opt source destination Chain FWDO_docker_pre (1 references) target prot opt source destination Chain INPUT_ZONES (1 references) target prot opt source destination IN_docker all -- 0.0.0.0/0 0.0.0.0/0 [goto] IN_docker all -- 0.0.0.0/0 0.0.0.0/0 [goto] IN_docker all -- 0.0.0.0/0 0.0.0.0/0 [goto] IN_default all -- 0.0.0.0/0 0.0.0.0/0 [goto] IN_default all -- 0.0.0.0/0 0.0.0.0/0 [goto] Chain INPUT_direct (1 references) target prot opt source destination Chain IN_default (2 references) target prot opt source destination IN_default_pre all -- 0.0.0.0/0 0.0.0.0/0 IN_default_log all -- 0.0.0.0/0 0.0.0.0/0 IN_default_deny all -- 0.0.0.0/0 0.0.0.0/0 IN_default_allow all -- 0.0.0.0/0 0.0.0.0/0 IN_default_post all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 Chain IN_default_allow (1 references) target prot opt source destination Chain IN_default_deny (1 references) target prot opt source destination Chain IN_default_log (1 references) target prot opt source destination Chain IN_default_post (1 references) target prot opt source destination Chain IN_default_pre (1 references) target prot opt source destination Chain IN_docker (3 references) target prot opt source destination IN_docker_pre all -- 0.0.0.0/0 0.0.0.0/0 IN_docker_log all -- 0.0.0.0/0 0.0.0.0/0 IN_docker_deny all -- 0.0.0.0/0 0.0.0.0/0 IN_docker_allow all -- 0.0.0.0/0 0.0.0.0/0 IN_docker_post all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 Chain IN_docker_allow (1 references) target prot opt source destination Chain IN_docker_deny (1 references) target prot opt source destination Chain IN_docker_log (1 references) target prot opt source destination Chain IN_docker_post (1 references) target prot opt source destination Chain IN_docker_pre (1 references) target prot opt source destination Chain OUTPUT_direct (1 references) target prot opt source destination
iptables -L -t nat on child Chain PREROUTING (policy ACCEPT) target prot opt source destination PREROUTING_direct all -- anywhere anywhere PREROUTING_ZONES all -- anywhere anywhere DOCKER all -- anywhere anywhere ADDRTYPE match dst-type LOCAL Chain INPUT (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination OUTPUT_direct all -- anywhere anywhere DOCKER all -- anywhere !127.0.0.0/8 ADDRTYPE match dst-type LOCAL DNAT tcp -- anywhere anywhere tcp dpt:https to:parentIP:8443 Chain POSTROUTING (policy ACCEPT) target prot opt source destination MASQUERADE all -- 10.252.254.0/24 anywhere MASQUERADE all -- 10.254.0.0/24 anywhere MASQUERADE all -- 172.16.0.0/16 anywhere POSTROUTING_direct all -- anywhere anywhere POSTROUTING_ZONES all -- anywhere anywhere MASQUERADE tcp -- 10.254.0.3 10.254.0.3 tcp dpt:8883 MASQUERADE tcp -- 10.254.0.3 10.254.0.3 tcp dpt:https MASQUERADE tcp -- 10.254.0.3 10.254.0.3 tcp dpt:amqps Chain DOCKER (2 references) target prot opt source destination RETURN all -- anywhere anywhere RETURN all -- anywhere anywhere DNAT tcp -- anywhere anywhere tcp dpt:8883 to:10.254.0.3:8883 DNAT tcp -- anywhere anywhere tcp dpt:8443 to:10.254.0.3:443 DNAT tcp -- anywhere anywhere tcp dpt:amqps to:10.254.0.3:5671 Chain OUTPUT_direct (1 references) target prot opt source destination Chain POSTROUTING_ZONES (1 references) target prot opt source destination POST_docker all -- anywhere anywhere [goto] POST_docker all -- anywhere anywhere [goto] POST_docker all -- anywhere anywhere [goto] POST_default all -- anywhere anywhere [goto] POST_default all -- anywhere anywhere [goto] Chain POSTROUTING_direct (1 references) target prot opt source destination Chain POST_default (2 references) target prot opt source destination POST_default_pre all -- anywhere anywhere POST_default_log all -- anywhere anywhere POST_default_deny all -- anywhere anywhere POST_default_allow all -- anywhere anywhere POST_default_post all -- anywhere anywhere Chain POST_default_allow (1 references) target prot opt source destination Chain POST_default_deny (1 references) target prot opt source destination Chain POST_default_log (1 references) target prot opt source destination Chain POST_default_post (1 references) target prot opt source destination Chain POST_default_pre (1 references) target prot opt source destination Chain POST_docker (3 references) target prot opt source destination POST_docker_pre all -- anywhere anywhere POST_docker_log all -- anywhere anywhere POST_docker_deny all -- anywhere anywhere POST_docker_allow all -- anywhere anywhere POST_docker_post all -- anywhere anywhere Chain POST_docker_allow (1 references) target prot opt source destination Chain POST_docker_deny (1 references) target prot opt source destination Chain POST_docker_log (1 references) target prot opt source destination Chain POST_docker_post (1 references) target prot opt source destination Chain POST_docker_pre (1 references) target prot opt source destination Chain PREROUTING_ZONES (1 references) target prot opt source destination PRE_docker all -- anywhere anywhere [goto] PRE_docker all -- anywhere anywhere [goto] PRE_docker all -- anywhere anywhere [goto] PRE_default all -- anywhere anywhere [goto] PRE_default all -- anywhere anywhere [goto] Chain PREROUTING_direct (1 references) target prot opt source destination Chain PRE_default (2 references) target prot opt source destination PRE_default_pre all -- anywhere anywhere PRE_default_log all -- anywhere anywhere PRE_default_deny all -- anywhere anywhere PRE_default_allow all -- anywhere anywhere PRE_default_post all -- anywhere anywhere Chain PRE_default_allow (1 references) target prot opt source destination Chain PRE_default_deny (1 references) target prot opt source destination Chain PRE_default_log (1 references) target prot opt source destination Chain PRE_default_post (1 references) target prot opt source destination Chain PRE_default_pre (1 references) target prot opt source destination Chain PRE_docker (3 references) target prot opt source destination PRE_docker_pre all -- anywhere anywhere PRE_docker_log all -- anywhere anywhere PRE_docker_deny all -- anywhere anywhere PRE_docker_allow all -- anywhere anywhere PRE_docker_post all -- anywhere anywhere Chain PRE_docker_allow (1 references) target prot opt source destination Chain PRE_docker_deny (1 references) target prot opt source destination Chain PRE_docker_log (1 references) target prot opt source destination Chain PRE_docker_post (1 references) target prot opt source destination Chain PRE_docker_pre (1 references) target prot opt source destination
huguesBouvier commented 3 years ago

Looking hard at it, it is difficult to pinpoint what the issue could be. I can't really help for that level of details. If IPtable doesn't work for you, what protocol is your application using? If it uses http, then loading your own config in api should be easier.

huguesBouvier commented 2 years ago

Can I close this issue? I can provide help for configuring IP proxy but it will not be possible for IP tables. Thanks!

mramin2000 commented 2 years ago

Our application uses https, so we need incoming traffic on port 443 for our service. Looking at the nginx config from here I found that the edgeHub endpoint is mapped to https as default. Could it help to change this part (line 17,18) to another port like 8443? If not, do you have any suggestions for what I have to change in the API Proxy config? We need to reroute edgeHub traffic to another port like 8443. And thanks a lot for your help so far!

huguesBouvier commented 2 years ago

You can change the configuration very easily to 8443 by adding the env var: NGINX_DEFAULT_PORT=8443 but it wont help you because you will also need to change the downstream edgeHub.

However, the API proxy can handle 2 connection on the same port and route them to different target.

For example look at the piece of code in the config:


        **if ($uri ~ ^/v2*.)**
        {
            **rewrite ^(.*)$ /registry$1 last;**
        }

        **location ~^/registry/(.*) {**
            proxy_http_version 1.1;
            resolver 127.0.0.11;
            set $endpoint http://${DOCKER_REQUEST_ROUTE_ADDRESS}/$1$is_args$args;
            proxy_pass $endpoint;
        }

        **if ($http_x_ms_version)**
        {
            **rewrite ^(.*)$ /storage$1 last;**
        }

        **location ~^/storage/(.*){**
            resolver 127.0.0.11;
            proxy_http_version 1.1;
            set $endpoint http://${BLOB_UPLOAD_ROUTE_ADDRESS}/$1$is_args$args;
            proxy_pass $endpoint;
        }

if the request contains the header "http_x_ms_version" it is routed to the blob storage module if the request uri start with "/v2" then it is routed to the "registry module" (for docker)

You can make your own rule: if the request come from your custom module below, route it to your custom module upstream.

For debugging I suggest that you mount the file /app/nginx_default_config.conf on your drive so you can make changes fast. do nginx -s stop in api proxy container to reload nginx with the new config.

mramin2000 commented 2 years ago

I tried it again with iptables and made it finally working. It was much easier than I thought in the other tries. On the parent I have deleted the 443/443 port binding for edgeHub and set API Proxy on Nginx Port 443 with port binding for 443 to hostport 8443. On the child I set edgeHub Portbinding on 443 to Hostport 8443 and put in $upstream:443 for the modules. Additionally I made one rule on the parent: iptables -t nat -A PREROUTING -p tcp -s --dport 443 -j REDIRECT --to-ports 8443

Thanks for your help!

huguesBouvier commented 2 years ago

You're welcome!