Iotedge: (1.0.9 rc3) identity_cert and identity_pk values not being created in expected format

Created on 17 Dec 2019  路  7Comments  路  Source: Azure/iotedge

Expected Behavior

The config.yaml on the device is specifies:

Note:
The values of all of these fields can be specified either as a
"file" scheme URI such as "file:///C:/cert_key.pem" or a
file path such as "C:\\cert_key.pem"

so I would expect this powershell command

. {Invoke-WebRequest -useb https://aka.ms/iotedge-win} | Invoke-Expression; ` Initialize-IoTEdge -Dps -ScopeId XXXXXX -X509IdentityCertificate C:/Data/Users/DefaultAccount/Documents/cert.pem -X509IdentityPrivateKey C:/Data/Users/DefaultAccount/Documents/key.pem

to create a config file like

provisioning:
source: 'dps'
global_endpoint: 'https://global.azure-devices-provisioning.net'
scope_id: 'XXXXXXX'
attestation:
method: 'x509'
identity_cert: 'file:///C:/Data/Users/DefaultAccount/Documents/cert.pem'
identity_pk: 'file:///C:/Data/Users/DefaultAccount/Documents/key.pem'

                                          OR

provisioning:
source: 'dps'
global_endpoint: 'https://global.azure-devices-provisioning.net'
scope_id: 'XXXXXXX'
attestation:
method: 'x509'
identity_cert: 'C:\\Data\\Users\\DefaultAccount\\Documents\\cert.pem'
identity_pk: 'C:\\Data\\Users\\DefaultAccount\\Documents\\key.pem'

Current Behavior

provisioning:
source: 'dps'
global_endpoint: 'https://global.azure-devices-provisioning.net'
scope_id: 'XXXXXXX'
attestation:
method: 'x509'
identity_cert: 'C:/Data/Users/DefaultAccount/Documents/cert.pem'
identity_pk: 'C:/Data/Users/DefaultAccount/Documents/key.pem'

Creates issue
12/17/2019 11:49:13 AM info: iotedged::app -- Starting Azure IoT Edge Security Daemon
12/17/2019 11:49:13 AM info: iotedged::app -- Version - 1.0.9~rc3 (9f6b4967bc7148512a7f6c50f93aaa86c0a16da4)
12/17/2019 11:49:13 AM info: iotedged::app -- Using config file: C:\Data\ProgramData\iotedge\config.yaml
12/17/2019 11:49:13 AM error: edgelet_utils::logging -- caused by: File URI c:/Data/Users/DefaultAccount/Documents/cert.pem is unsupported
for 'provisioning.attestation.identity_cert'. Please check the config.yaml file.
12/17/2019 11:49:13 AM error: edgelet_utils::logging -- caused by: The daemon could not start up successfully: Could not configure Edge X.509
identity certificate
12/17/2019 11:49:13 AM error: iotedged::windows -- Error while running service. Quitting.

Steps to Reproduce

Provide a detailed set of steps to reproduce the bug.

  1. ". {Invoke-WebRequest -useb https://aka.ms/iotedge-win} | Invoke-Expression; ` Initialize-IoTEdge -Dps -ScopeId XXXXXX -X509IdentityCertificate C:/Data/Users/DefaultAccount/Documents/cert.pem -X509IdentityPrivateKey C:/Data/Users/DefaultAccount/Documents/key.pem"
  1. View generated config.yaml file

Able to fix by manually appending "file:///" to beginning of path, but this is not possible in the production environment.

Context (Environment)

1.0.9 rc3

Output of iotedge check

The term 'iotedge' is not recognized as the name of a cmdlet ...


Click here


<Paste here between the triple backticks>

Device Information

  • Host OS [e.g. Ubuntu 16.04, Ubuntu 18.04, Windows IoT Core]:
  • Architecture [e.g. amd64, arm32, arm64]:
  • Container OS [e.g. Linux containers, Windows containers]:

Runtime Versions

  • iotedged [run iotedge version]:
  • Edge Agent [image tag (e.g. 1.0.0)]:
  • Edge Hub [image tag (e.g. 1.0.0)]:
  • Docker/Moby [run docker version]:

Note: when using Windows containers on Windows, run docker -H npipe:////./pipe/iotedge_moby_engine version instead

Logs


iotedged logs


<Paste here between the triple backticks>


edge-agent logs


<Paste here between the triple backticks>


edge-hub logs


<Paste here between the triple backticks>

Additional Information

Please provide any additional information that may be helpful in understanding the issue.

security customer-reported iotedge question

All 7 comments

Hi!

Since you are using the 1.0.9-rc, please be sure to use the installer script from 1.0.9 (rather than the version found at https://aka.ms/iotedge-win which points to our current stable 1.0.8.x). You can find it here:

https://github.com/Azure/iotedge/blob/1.0.9-rc3/scripts/windows/setup/IotEdgeSecurityDaemon.ps1

This contains updated versions of functions like Initialize-IoTEdge

Hi,

Thanks for the quick response. unfortunately when I don't reference https://aka.ms/iotedge-win, using just:

Initialize-IoTEdge -Dps -ScopeId $scopeId -ContainerOs Windows -X509IdentityCertificate $x509IdentityCertificate -X509IdentityPrivateKey $x509IdentityPrivateKey

It throws error: The term 'Initialize-IoTEdge' is not recognized as the name of a cmdlet.

Is it an issue with my Deploy-IotEdge command?

. {Invoke-WebRequest -useb https://aka.ms/iotedge-win} | Invoke-Expression; `

Deploy-IoTEdge -OfflineInstallationPath C:/Data/Users/DefaultAccount/Documents

Confirmed that it is actually using the .cab file from the repo to Deploy.

You need to replace the aka.ms url with the one that I provided.

Also, please don't use the aka.ms url for Deploy-IoTEdge - you need to use the URL that I provided which points to the 1.0.9-rc script.

For example,

". {Invoke-WebRequest -useb https://github.com/Azure/iotedge/blob/1.0.9-rc3/scripts/windows/setup/IotEdgeSecurityDaemon.ps1} | Invoke-Expression; ` Initialize-IoTEdge -Dps -ScopeId XXXXXX -X509IdentityCertificate C:/Data/Users/DefaultAccount/Documents/cert.pem -X509IdentityPrivateKey C:/Data/Users/DefaultAccount/Documents/key.pem"

@AaronEdelman Did that resolve your issue?

@kkdawkins Not yet. When running the Deploy or Initialize with that url it throws error

Invoke-Expression : At line:149 char:19

  • Sign up
  • ~
    The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation marks ("&") to pass it
    as part of a string.

@kkdawkins All good now. Thanks a lot!

Was this page helpful?
0 / 5 - 0 ratings