-
Notifications
You must be signed in to change notification settings - Fork 72
tedge connect c8y shows warnings about certificates when connect via basic auth credentials #3476
Description
Describe the bug
When connecting to Cumulocity using Basic Auth (e.g. tedge config set c8y.auth_method basic), the tedge connect c8y prints out unnecessary warnings about failing to change the ownership of the public and private certificate, which is unexpected as a device certificate is not needed when connecting via Basic Auth credentials.
Below shows the tedge connect c8y lines with the two WARN lines which should not be present when using basic auth.
root@tedge:~# tedge connect c8y
Connecting to Cumulocity with config:
device id: rmi_test1001
cloud profile: <none>
cloud host: thin-edge-io.eu-latest.cumulocity.com:8883
auth method: basic
credentials path: /etc/tedge/credentials.toml
bridge: mosquitto
service manager: systemd
mosquitto version: 2.0.11
Creating device in Cumulocity cloud... ✓
2025-03-15T09:04:20.14318654Z WARN tedge::cli::connect::command: Failed to change ownership of /etc/tedge/device-certs/tedge-certificate.pem to mosquitto:mosquitto: The path is not accessible. "/etc/tedge/device-certs/tedge-certificate.pem"
2025-03-15T09:04:20.143328557Z WARN tedge::cli::connect::command: Failed to change ownership of /etc/tedge/device-certs/tedge-private-key.pem to mosquitto:mosquitto: The path is not accessible. "/etc/tedge/device-certs/tedge-private-key.pem"
Restarting mosquitto... ✓
Waiting for mosquitto to be listening for connections... ✓
Verifying device is connected to cloud... ✓
Enabling tedge-mapper-c8y... ✓
Enabling tedge-agent... ✓To Reproduce
-
Configure thin-edge.io to use basic auth when connecting to Cumulocity
sudo tedge config set c8y.auth_method basic cat <<EOT > "$(tedge config get c8y.credentials_path)" [c8y] username = "t12345/device_rmi_test1001" password = "<some_password>" EOT sudo tedge config set device.id rmi_test1001
-
Connect to c8y
sudo tedge connect c8y
Expected behavior
The following log messages should not be present in the output as it is expected that the certificate files do not exist when using basic auth.
2025-03-15T09:04:20.14318654Z WARN tedge::cli::connect::command: Failed to change ownership of /etc/tedge/device-certs/tedge-certificate.pem to mosquitto:mosquitto: The path is not accessible. "/etc/tedge/device-certs/tedge-certificate.pem"
2025-03-15T09:04:20.143328557Z WARN tedge::cli::connect::command: Failed to change ownership of /etc/tedge/device-certs/tedge-private-key.pem to mosquitto:mosquitto: The path is not accessible. "/etc/tedge/device-certs/tedge-private-key.pem"
Screenshots
Environment (please complete the following information):
| Property | Value |
|---|---|
| OS [incl. version] | Debian GNU/Linux 12 (bookworm) |
| Hardware [incl. revision] | unknown |
| System-Architecture | Linux tedge 6.8.0-39-generic #39-Ubuntu SMP PREEMPT_DYNAMIC Sat Jul 6 02:50:39 UTC 2024 aarch64 GNU/Linux |
| thin-edge.io version | tedge 1.4.3~266+gf4ee98b |
Additional context