Commit 45599070 authored by Christian Kellner's avatar Christian Kellner

test: integration: auto import in secure mode

Tests the auto-import code paths but for secure mode. For now,
importing devices in secure mode should not happen because auto
import only happens in secure when the device has a valid key
is authorized and the boot attribute is set. Currently this
should never be true at the same time.
parent a70b0ac5
......@@ -1515,7 +1515,7 @@ class BoltTest(dbusmock.DBusTestCase):
self.assertEqual(remote_ssd1.status, BoltDevice.AUTHORIZED)
self.daemon_stop()
def test_device_auto_import(self):
def test_device_auto_import_sl1(self):
key = 'b68bce095a13ac39e9254a88b189a38f240487aa6f78f803390a0cdeceb774d8'
devs = [
......@@ -1554,6 +1554,48 @@ class BoltTest(dbusmock.DBusTestCase):
self.daemon_stop()
def test_device_auto_import_sl2(self):
# like test_device_auto_import but in SECURE mode
key = 'b68bce095a13ac39e9254a88b189a38f240487aa6f78f803390a0cdeceb774d8'
devs = [
{'authorized': 1, 'key': None, 'boot': 0, 'stored': False}, # no boot flag
{'authorized': 2, 'key': key, 'boot': 0, 'stored': False}, # no boot flag
{'authorized': 1, 'key': None, 'boot': 1, 'stored': False}, # boot, no key
{'authorized': 1, 'key': '', 'boot': 1, 'stored': False}, # boot, empty key
# boot, valid key, should not be possible to observe "in the wild"
{'authorized': 2, 'key': key, 'boot': 1, 'stored': True},
]
dc, host = self.add_domain_host(security='secure')
for i, d in enumerate(devs):
did = i + 1
path, uid = self.add_device(host,
did,
"Dock%d" % did,
"GNOME.org",
authorized=d['authorized'],
key=d['key'],
boot='%d' % d['boot'])
d['path'] = path
d['uid'] = uid
self.daemon_start()
self.polkitd_start()
client = self.client
devices = client.list_devices()
self.assertEqual(len(devices), len(devs) + 1)
for d in devs:
remote = self.find_device_by_uid(devices, d['uid'])
self.assertEqual(remote.status, BoltDevice.AUTHORIZED)
self.assertEqual(remote.stored, d['stored'])
self.daemon_stop()
def test_device_enroll(self):
self.daemon_start()
tree = self.default_mock_tree(acl=16)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment