Wait for the Linux service launcher to execute its verified binary
This commit is contained in:
@@ -172,8 +172,12 @@ def device(args, activate):
|
|||||||
replace(UNIT, unit)
|
replace(UNIT, unit)
|
||||||
run('systemctl', 'daemon-reload')
|
run('systemctl', 'daemon-reload')
|
||||||
run('systemctl', 'start', UNIT.name, AGENT)
|
run('systemctl', 'start', UNIT.name, AGENT)
|
||||||
|
# The agent unit starts its Python launcher before exec'ing the signed binary.
|
||||||
|
deadline = time.monotonic() + 15
|
||||||
for service, expected in [(UNIT.name, destination/'helper'), (AGENT, new/'agent')]:
|
for service, expected in [(UNIT.name, destination/'helper'), (AGENT, new/'agent')]:
|
||||||
require(process_image(service) == expected, 'Unexpected running binary')
|
while process_image(service) != expected:
|
||||||
|
require(time.monotonic() < deadline, f'{service} did not start its verified binary')
|
||||||
|
time.sleep(0.2)
|
||||||
return dict(binding=binding, version=manifest['version'], previous=[old_hash, source[2]['policy_sha256']],
|
return dict(binding=binding, version=manifest['version'], previous=[old_hash, source[2]['policy_sha256']],
|
||||||
current=[new_hash, target[2]['policy_sha256']])
|
current=[new_hash, target[2]['policy_sha256']])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user