summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Gerasimov <anton.gerasimov@here.com>2018-09-24 18:02:30 +0200
committerAnton Gerasimov <tossel@gmail.com>2018-10-01 10:44:50 +0200
commite689954dc9a07f1ceef65c797056f805daad90a9 (patch)
tree0dfbf98077d7701343bdda2f61532f5d4b27db43
parent80d25891eb998f19eabd5b589ef3d687dee7ee98 (diff)
downloadmeta-updater-e689954dc9a07f1ceef65c797056f805daad90a9.tar.gz
Fixes for oe-selftestfeat/OTA-719/nodeploy
-rw-r--r--lib/oeqa/selftest/cases/updater.py30
-rw-r--r--recipes-sota/aktualizr/aktualizr-auto-prov-creds.bb3
-rw-r--r--recipes-sota/aktualizr/aktualizr-auto-prov.bb1
-rw-r--r--recipes-sota/aktualizr/aktualizr-ca-implicit-prov-creds.bb1
-rwxr-xr-xrecipes-sota/aktualizr/aktualizr_git.bb6
5 files changed, 22 insertions, 19 deletions
diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py
index a3fe407..38bdcbf 100644
--- a/lib/oeqa/selftest/cases/updater.py
+++ b/lib/oeqa/selftest/cases/updater.py
@@ -110,25 +110,25 @@ class AktualizrToolsTests(OESelftestTestCase):
110 110
111 def test_cert_provider_local_output(self): 111 def test_cert_provider_local_output(self):
112 logger = logging.getLogger("selftest") 112 logger = logging.getLogger("selftest")
113 logger.info('Running bitbake to build aktualizr-implicit-prov') 113 logger.info('Running bitbake to build aktualizr-ca-implicit-prov')
114 bitbake('aktualizr-implicit-prov') 114 bitbake('aktualizr-ca-implicit-prov')
115 bb_vars = get_bb_vars(['SOTA_PACKED_CREDENTIALS', 'T'], 'aktualizr-native') 115 bb_vars = get_bb_vars(['SOTA_PACKED_CREDENTIALS', 'T'], 'aktualizr-native')
116 creds = bb_vars['SOTA_PACKED_CREDENTIALS'] 116 creds = bb_vars['SOTA_PACKED_CREDENTIALS']
117 temp_dir = bb_vars['T'] 117 temp_dir = bb_vars['T']
118 bb_vars_prov = get_bb_vars(['STAGING_DIR_HOST', 'libdir'], 'aktualizr-implicit-prov') 118 bb_vars_prov = get_bb_vars(['STAGING_DIR_HOST', 'libdir'], 'aktualizr-ca-implicit-prov')
119 config = bb_vars_prov['STAGING_DIR_HOST'] + bb_vars_prov['libdir'] + '/sota/sota_implicit_prov.toml' 119 config = bb_vars_prov['STAGING_DIR_HOST'] + bb_vars_prov['libdir'] + '/sota/sota_implicit_prov_ca.toml'
120 120
121 akt_native_run(self, 'aktualizr_cert_provider -c {creds} -r -l {temp} -g {config}' 121 akt_native_run(self, 'aktualizr_cert_provider -c {creds} -r -l {temp} -g {config}'
122 .format(creds=creds, temp=temp_dir, config=config)) 122 .format(creds=creds, temp=temp_dir, config=config))
123 123
124 # Might be nice if these names weren't hardcoded. 124 # Might be nice if these names weren't hardcoded.
125 cert_path = temp_dir + '/client.pem' 125 cert_path = temp_dir + '/var/sota/import/client.pem'
126 self.assertTrue(os.path.isfile(cert_path), "Client certificate not found at %s." % cert_path) 126 self.assertTrue(os.path.isfile(cert_path), "Client certificate not found at %s." % cert_path)
127 self.assertTrue(os.path.getsize(cert_path) > 0, "Client certificate at %s is empty." % cert_path) 127 self.assertTrue(os.path.getsize(cert_path) > 0, "Client certificate at %s is empty." % cert_path)
128 pkey_path = temp_dir + '/pkey.pem' 128 pkey_path = temp_dir + '/var/sota/import/pkey.pem'
129 self.assertTrue(os.path.isfile(pkey_path), "Private key not found at %s." % pkey_path) 129 self.assertTrue(os.path.isfile(pkey_path), "Private key not found at %s." % pkey_path)
130 self.assertTrue(os.path.getsize(pkey_path) > 0, "Private key at %s is empty." % pkey_path) 130 self.assertTrue(os.path.getsize(pkey_path) > 0, "Private key at %s is empty." % pkey_path)
131 ca_path = temp_dir + '/root.crt' 131 ca_path = temp_dir + '/var/sota/import/root.crt'
132 self.assertTrue(os.path.isfile(ca_path), "Client certificate not found at %s." % ca_path) 132 self.assertTrue(os.path.isfile(ca_path), "Client certificate not found at %s." % ca_path)
133 self.assertTrue(os.path.getsize(ca_path) > 0, "Client certificate at %s is empty." % ca_path) 133 self.assertTrue(os.path.getsize(ca_path) > 0, "Client certificate at %s is empty." % ca_path)
134 134
@@ -390,8 +390,9 @@ class ImplProvTests(OESelftestTestCase):
390 else: 390 else:
391 self.meta_qemu = None 391 self.meta_qemu = None
392 self.append_config('MACHINE = "qemux86-64"') 392 self.append_config('MACHINE = "qemux86-64"')
393 self.append_config('SOTA_CLIENT_PROV = " aktualizr-implicit-prov "') 393 self.append_config('SOTA_CLIENT_PROV = " aktualizr-ca-implicit-prov "')
394 runCmd('bitbake -c cleanall aktualizr aktualizr-implicit-prov') 394 self.append_config('SOTA_DEPLOY_CREDENTIALS = "0"')
395 runCmd('bitbake -c cleanall aktualizr aktualizr-ca-implicit-prov')
395 self.qemu, self.s = qemu_launch(machine='qemux86-64') 396 self.qemu, self.s = qemu_launch(machine='qemux86-64')
396 397
397 def tearDownLocal(self): 398 def tearDownLocal(self):
@@ -436,10 +437,11 @@ class ImplProvTests(OESelftestTestCase):
436 # Run cert_provider. 437 # Run cert_provider.
437 bb_vars = get_bb_vars(['SOTA_PACKED_CREDENTIALS'], 'aktualizr-native') 438 bb_vars = get_bb_vars(['SOTA_PACKED_CREDENTIALS'], 'aktualizr-native')
438 creds = bb_vars['SOTA_PACKED_CREDENTIALS'] 439 creds = bb_vars['SOTA_PACKED_CREDENTIALS']
439 bb_vars_prov = get_bb_vars(['STAGING_DIR_HOST', 'libdir'], 'aktualizr-implicit-prov') 440 bb_vars_prov = get_bb_vars(['STAGING_DIR_HOST', 'libdir'], 'aktualizr-ca-implicit-prov')
440 config = bb_vars_prov['STAGING_DIR_HOST'] + bb_vars_prov['libdir'] + '/sota/sota_implicit_prov.toml' 441 config = bb_vars_prov['STAGING_DIR_HOST'] + bb_vars_prov['libdir'] + '/sota/sota_implicit_prov_ca.toml'
441 442
442 akt_native_run(self, 'aktualizr_cert_provider -c {creds} -t root@localhost -p {port} -s -g {config}' 443 print('Provisining at root@localhost:%d' % self.qemu.ssh_port)
444 akt_native_run(self, 'aktualizr_cert_provider -c {creds} -t root@localhost -p {port} -s -u -r -g {config}'
443 .format(creds=creds, port=self.qemu.ssh_port, config=config)) 445 .format(creds=creds, port=self.qemu.ssh_port, config=config))
444 446
445 verifyProvisioned(self, machine) 447 verifyProvisioned(self, machine)
@@ -462,7 +464,9 @@ class HsmTests(OESelftestTestCase):
462 self.meta_qemu = None 464 self.meta_qemu = None
463 self.append_config('MACHINE = "qemux86-64"') 465 self.append_config('MACHINE = "qemux86-64"')
464 self.append_config('SOTA_CLIENT_PROV = "aktualizr-hsm-prov"') 466 self.append_config('SOTA_CLIENT_PROV = "aktualizr-hsm-prov"')
467 self.append_config('SOTA_DEPLOY_CREDENTIALS = "0"')
465 self.append_config('SOTA_CLIENT_FEATURES = "hsm"') 468 self.append_config('SOTA_CLIENT_FEATURES = "hsm"')
469 self.append_config('IMAGE_INSTALL_append = " softhsm-testtoken"')
466 runCmd('bitbake -c cleanall aktualizr aktualizr-hsm-prov') 470 runCmd('bitbake -c cleanall aktualizr aktualizr-hsm-prov')
467 self.qemu, self.s = qemu_launch(machine='qemux86-64') 471 self.qemu, self.s = qemu_launch(machine='qemux86-64')
468 472
@@ -521,7 +525,7 @@ class HsmTests(OESelftestTestCase):
521 bb_vars_prov = get_bb_vars(['STAGING_DIR_HOST', 'libdir'], 'aktualizr-hsm-prov') 525 bb_vars_prov = get_bb_vars(['STAGING_DIR_HOST', 'libdir'], 'aktualizr-hsm-prov')
522 config = bb_vars_prov['STAGING_DIR_HOST'] + bb_vars_prov['libdir'] + '/sota/sota_hsm_prov.toml' 526 config = bb_vars_prov['STAGING_DIR_HOST'] + bb_vars_prov['libdir'] + '/sota/sota_hsm_prov.toml'
523 527
524 akt_native_run(self, 'aktualizr_cert_provider -c {creds} -t root@localhost -p {port} -r -s -g {config}' 528 akt_native_run(self, 'aktualizr_cert_provider -c {creds} -t root@localhost -p {port} -r -s -u -g {config}'
525 .format(creds=creds, port=self.qemu.ssh_port, config=config)) 529 .format(creds=creds, port=self.qemu.ssh_port, config=config))
526 530
527 # Verify that HSM is able to initialize. 531 # Verify that HSM is able to initialize.
diff --git a/recipes-sota/aktualizr/aktualizr-auto-prov-creds.bb b/recipes-sota/aktualizr/aktualizr-auto-prov-creds.bb
index d964a0a..34460af 100644
--- a/recipes-sota/aktualizr/aktualizr-auto-prov-creds.bb
+++ b/recipes-sota/aktualizr/aktualizr-auto-prov-creds.bb
@@ -4,11 +4,12 @@ LICENSE = "MPL-2.0"
4LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad" 4LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad"
5 5
6DEPENDS = "aktualizr-native zip-native" 6DEPENDS = "aktualizr-native zip-native"
7ALLOW_EMPTY_${PN} = "1"
7 8
8require credentials.inc 9require credentials.inc
9 10
10do_install() { 11do_install() {
11 if [ -n ${SOTA_PACKED_CREDENTIALS} ]; then 12 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then
12 install -m 0700 -d ${D}${localstatedir}/sota 13 install -m 0700 -d ${D}${localstatedir}/sota
13 cp ${SOTA_PACKED_CREDENTIALS} ${D}${localstatedir}/sota/sota_provisioning_credentials.zip 14 cp ${SOTA_PACKED_CREDENTIALS} ${D}${localstatedir}/sota/sota_provisioning_credentials.zip
14 # Device should not be able to push data to treehub 15 # Device should not be able to push data to treehub
diff --git a/recipes-sota/aktualizr/aktualizr-auto-prov.bb b/recipes-sota/aktualizr/aktualizr-auto-prov.bb
index 65e89bd..01f21fa 100644
--- a/recipes-sota/aktualizr/aktualizr-auto-prov.bb
+++ b/recipes-sota/aktualizr/aktualizr-auto-prov.bb
@@ -7,7 +7,6 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7
7 7
8DEPENDS = "aktualizr-native zip-native" 8DEPENDS = "aktualizr-native zip-native"
9RDEPENDS_${PN}_append = "${@' aktualizr-auto-prov-creds' if d.getVar('SOTA_DEPLOY_CREDENTIALS', True) == '1' else ''}" 9RDEPENDS_${PN}_append = "${@' aktualizr-auto-prov-creds' if d.getVar('SOTA_DEPLOY_CREDENTIALS', True) == '1' else ''}"
10RDEPENDS_${PN} = " aktualizr"
11PV = "1.0" 10PV = "1.0"
12PR = "6" 11PR = "6"
13 12
diff --git a/recipes-sota/aktualizr/aktualizr-ca-implicit-prov-creds.bb b/recipes-sota/aktualizr/aktualizr-ca-implicit-prov-creds.bb
index 5debc19..a729e6b 100644
--- a/recipes-sota/aktualizr/aktualizr-ca-implicit-prov-creds.bb
+++ b/recipes-sota/aktualizr/aktualizr-ca-implicit-prov-creds.bb
@@ -4,6 +4,7 @@ LICENSE = "MPL-2.0"
4LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad" 4LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad"
5 5
6DEPENDS = "aktualizr aktualizr-native" 6DEPENDS = "aktualizr aktualizr-native"
7ALLOW_EMPTY_${PN} = "1"
7 8
8SRC_URI = " \ 9SRC_URI = " \
9 file://ca.cnf \ 10 file://ca.cnf \
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb
index 3c91386..ccaf475 100755
--- a/recipes-sota/aktualizr/aktualizr_git.bb
+++ b/recipes-sota/aktualizr/aktualizr_git.bb
@@ -16,8 +16,6 @@ RDEPENDS_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURE
16RDEPENDS_${PN}_append_class-target = " ${PN}-tools " 16RDEPENDS_${PN}_append_class-target = " ${PN}-tools "
17RDEPENDS_${PN}-secondary_append_class-target = " ${PN}-tools " 17RDEPENDS_${PN}-secondary_append_class-target = " ${PN}-tools "
18 18
19RDEPENDS_${PN}_class-target = " openssl-bin "
20
21PV = "1.0+git${SRCPV}" 19PV = "1.0+git${SRCPV}"
22PR = "7" 20PR = "7"
23 21
@@ -28,8 +26,8 @@ SRC_URI = " \
28 file://aktualizr-secondary.socket \ 26 file://aktualizr-secondary.socket \
29 file://aktualizr-serialcan.service \ 27 file://aktualizr-serialcan.service \
30 " 28 "
31SRCREV = "097c763ab4b4b057fa6bedfdac2049e53df93539" 29SRCREV = "803fa9f75ed96993775dc0aa5e65e71920125157"
32BRANCH ?= "feat/OTA-719/split-provision" 30BRANCH ?= "master"
33 31
34S = "${WORKDIR}/git" 32S = "${WORKDIR}/git"
35 33