@@ -73,11 +73,11 @@ Select Private key using a request URI
73
73
Should Contain ${stderr } item=cryptoki: socket (key: pkcs11:token=token123)
74
74
75
75
Execute Command cmd=tedge config unset device.key_uri
76
- Execute Command cmd=tedge config set c8y. device.key_uri pkcs11:token=token123
76
+ Execute Command cmd=tedge config set device.key_uri pkcs11:token=token123
77
77
${stderr } = Tedge Reconnect Should Fail With Failed to find a signing key
78
78
Should Contain ${stderr } item=cryptoki: socket (key: pkcs11:token=token123)
79
79
80
- Execute Command cmd=tedge config set c8y. device.key_uri "pkcs11:token=tedge;object=tedge"
80
+ Execute Command cmd=tedge config set device.key_uri "pkcs11:token=tedge;object=tedge"
81
81
${stderr } = Tedge Reconnect Should Succeed
82
82
Should Contain ${stderr } item=cryptoki: socket (key: pkcs11:token=tedge;object=tedge)
83
83
@@ -181,24 +181,20 @@ Connect to C8y using new keypair
181
181
ELSE
182
182
Fail Wrong key type provided.
183
183
END
184
- VAR ${ cert_path } = /etc/ tedge/ device-certs/ ${ object_name } .pem
184
+ ${ csr_path } = Execute Command cmd= tedge config get device.csr_path strip= ${ True }
185
185
186
186
Execute Command
187
187
... cmd=p11tool --set-pin=123456 --login --generate-privkey ${type } ${p11tool_args } --label ${object_name } "pkcs11:token=tedge"
188
- # we should probably generate certs signed by CA instead of uploading them
189
188
Execute Command
190
- ... cmd=GNUTLS_PIN=123456 certtool --generate-self-signed --template ${CERT_TEMPLATE } --outfile ${ cert_path } --load-privkey "pkcs11:token=tedge;object=${object_name } "
189
+ ... cmd=GNUTLS_PIN=123456 certtool --generate-request --template " ${CERT_TEMPLATE } " --outfile " ${ csr_path } " --load-privkey "pkcs11:token=tedge;object=${object_name } "
191
190
192
- Execute Command tedge config set c8y.device.cert_path ${cert_path }
193
- Execute Command cmd=tedge config set c8y.device.key_uri "pkcs11:token=tedge;object=${object_name } "
191
+ Execute Command cmd=tedge config set device.key_uri "pkcs11:token=tedge;object=${object_name } "
194
192
195
- # upload (THIS STAYS ON C8Y AND ISN'T DELETED)
196
- Upload Currently Used Certificates To Cumulocity
193
+ Register Device With Cumulocity CA ${csr_path }
197
194
198
195
Tedge Reconnect Should Succeed
199
196
200
- Execute Command tedge config unset c8y.device.cert_path
201
- Execute Command tedge config unset c8y.device.key_uri
197
+ Execute Command tedge config unset device.key_uri
202
198
203
199
Custom Setup
204
200
${DEVICE_SN } = Setup skip_bootstrap=${True }
@@ -208,18 +204,19 @@ Custom Setup
208
204
Execute Command sudo usermod -a -G softhsm tedge
209
205
Transfer To Device ${CURDIR } /data/init_softhsm.sh /usr/bin/
210
206
211
- # initialize the soft hsm and create a self-signed certificate
207
+ # initialize the soft hsm and create a certificate signing request
212
208
Execute Command tedge config set device.cryptoki.pin 123456
213
209
Execute Command tedge config set device.cryptoki.module_path /usr/lib/softhsm/libsofthsm2.so
214
- Execute Command sudo -u tedge /usr/bin/init_softhsm.sh --self-signed -- device-id "${DEVICE_SN } " --pin 123456
210
+ Execute Command sudo -u tedge /usr/bin/init_softhsm.sh --device-id "${DEVICE_SN } " --pin 123456
215
211
216
212
# configure tedge
217
213
${domain } = Cumulocity.Get Domain
218
214
Execute Command tedge config set c8y.url "${domain } "
219
215
Execute Command tedge config set mqtt.bridge.built_in true
220
216
Execute Command tedge config set device.cryptoki.mode socket
221
217
222
- Upload Currently Used Certificates To Cumulocity
218
+ ${csr_path } = Execute Command cmd=tedge config get device.csr_path strip=${True }
219
+ Register Device With Cumulocity CA ${csr_path }
223
220
224
221
Set tedge-p11-server Uri value=
225
222
@@ -238,7 +235,8 @@ Tedge Reconnect Should Fail With
238
235
Should Contain ${stderr } ${error }
239
236
RETURN ${stderr }
240
237
241
- Upload Currently Used Certificates To Cumulocity
238
+ Register Device With Cumulocity CA
239
+ [Arguments] ${csr_path }
240
+ ${credentials } = Cumulocity.Bulk Register Device With Cumulocity CA external_id=${DEVICE_SN }
242
241
Execute Command
243
- ... cmd=sudo env C8Y_USER="${C8Y_CONFIG.username } " C8Y_PASSWORD="${C8Y_CONFIG.password } " tedge cert upload c8y
244
- Register Certificate For Cleanup
242
+ ... cmd=tedge cert download c8y --csr-path "${csr_path } " --device-id "${DEVICE_SN } " --one-time-password '${credentials.one_time_password } ' --retry-every 5s --max-timeout 60s
0 commit comments