thin-edge / thin-edge.io

The open edge framework for lightweight IoT devices
https://thin-edge.io
Apache License 2.0
221 stars 54 forks source link

Follow up tasks for built-in bridge #2794

Open jarhodes314 opened 7 months ago

jarhodes314 commented 7 months ago

In #2716, support was added to the mapper for a built-in Cumulocity bridge, to replace the mosquitto-based bridge.

Here is a list of follow up tasks that need completing before the feature is fully complete and ready to be enabled for users:

jarhodes314 commented 6 months ago

I've been looking at making the logic work for tedge cert create and have hit a bit of an issue. In the case of the built-in bridge, we want the device certificate to be owned by tedge, but in the mosquitto bridge, the device certificate should instead be owned by mosquitto. At the moment, the configuration for the bridge is c8y.bridge.built_in, implying that this setting is per-cloud, but since only one of mosquitto or the mapper should be able to read the cert/key at a time, it isn't actually possible to have this setting work differently for different clouds.

@didier-wenzek @reubenmiller do you think it's reasonable to change the setting to bridge.built_in (or some other name), or do you have other suggestions as to how to resolve this?

didier-wenzek commented 6 months ago

I've been looking at making the logic work for tedge cert create and have hit a bit of an issue. In the case of the built-in bridge, we want the device certificate to be owned by tedge, but in the mosquitto bridge, the device certificate should instead be owned by mosquitto. At the moment, the configuration for the bridge is c8y.bridge.built_in, implying that this setting is per-cloud, but since only one of mosquitto or the mapper should be able to read the cert/key at a time, it isn't actually possible to have this setting work differently for different clouds.

@didier-wenzek @reubenmiller do you think it's reasonable to change the setting to bridge.built_in (or some other name), or do you have other suggestions as to how to resolve this?

I see different alternatives - none really convincing

  1. Having a device certificate per cloud. But how to ensure all these have the same CN? Furthermore, this doesn't really help here when the point is to connect the same cloud (c8y) using two different mechanisms (mosquitto bridge or built-in).
  2. Let tedge cert create checks the c8y.bridge.built_in setting (or better as you propose a generic bridge.built_in setting) to assign the appropriate owner to the private key, One might improve the user experience if tedge cert create can also be used to re-assign the proper owner if the setting for bridge.built_in is changed.