Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow setting the device.id when using c8y basic auth #3240

Open
reubenmiller opened this issue Nov 12, 2024 · 0 comments
Open

allow setting the device.id when using c8y basic auth #3240

reubenmiller opened this issue Nov 12, 2024 · 0 comments
Assignees
Labels
improvement User value

Comments

@reubenmiller
Copy link
Contributor

Is your feature improvement request related to a problem? Please describe.

With the introduction of Basic Auth in #3036 (to support existing/legacy Cumulocity solutions), the solution still requires a dummy certificate to be set so that the correct device.id field can be read. The device.id tedge configuration property is a special property which is read from the existing public device certificate, however when using Basic Auth, a certificate is not required, so it is unexpected to demand that the user create a dummy certificate.

Describe the solution you'd like

When either of the following conditions is true:

  • c8y.auth_mode is set to basic
  • c8y.auth_mode is set to auto and the c8y.credentials_path file exists

Then, the device.id tedge configuration property should be read from.

[device]
id = "<device_id>"

This would require the user to set the value via the tedge config set command.

tedge config set device.id mydeviceid

However, if the above conditions are not met, then the user should be presented with the current error message (when trying to set the device.id when using device certificates):

tedge config set device.id mydeviceid
error: invalid value 'device.id' for '<KEY>': The device id is read from the device certificate and cannot be set directly.
To set 'device.id' to some <id>, you can use `tedge cert create --device-id <id>`.

For more information, try '--help'.

Describe alternatives you've considered

When using Cumulocity Basic Auth mode, the device.id could be derived from the c8y.username property in the c8y.credentials_path file, for example a value of t1234/device_myexample would be interpreted as myexample.

This solution is not ideal as it relies on very specific Cumulocity parsing of the username, and also assumes that the username and the device.id are the same (where technically they do not need to match!)

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement User value
Projects
None yet
Development

No branches or pull requests

2 participants