stages/dnf: Remove random seed after dnf run

Some dnf packages introduce random seed file. If we leave in the tree
it would mean all systems running from the created image would use
the same random seed. This can be potentially dangerous, therefore we
just remove the generated random seed from our images.
This commit is contained in:
Ondřej Budai 2019-09-26 14:47:35 +02:00 committed by Tom Gundersen
parent cc73fa5d10
commit fd8eb9492f

View file

@ -1,5 +1,5 @@
#!/usr/bin/python3
import contextlib
import hashlib
import json
import os
@ -129,6 +129,10 @@ def main(tree, options):
machine_id_file.unlink()
machine_id_file.touch()
# remove random seed from the tree if exists
with contextlib.suppress(FileNotFoundError):
os.unlink(f"{tree}/var/lib/systemd/random-seed")
return 0