Skip to content

add device cert common name validation logic when connecting to Cumulocity #3855

@reubenmiller

Description

@reubenmiller

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

If someone creates a device certificate outside of thin-edge.io with a Common Name that is not Cumulocity compliant, then the device will fail to connect to Cumulocity, but the error message is not obvious to the user that the Common Name is valid.

Describe the solution you'd like

Add a warning message which is printed during the tedge connect c8y command that warns the user when an invalid Common Name is detected (the same validation which is already done when using tedge cert create --device-id "myinvalid:name")

The validation is already present in the tedge cert create c8y command, however if users are creating their own device certificates (via some custom PKI integration), then they don't go through the same validation process, and hence it makes it harder for the users to spot the invalid common name.

$ tedge cert create c8y --device-id "myinvalid:name"
Error: failed to create a test certificate for the device myinvalid:name.

Caused by:
    0: DeviceID Error
    1: The string '"myinvalid:name"' contains characters which cannot be used in a name [use only A-Z, a-z, 0-9, ' = ( ) , - . ? % * _ ! @]

Describe alternatives you've considered

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions