Open jpouellet opened 7 years ago
Also:
Not that it matters a ton in Qubes, but 644 is too wide. You should only need 400 in check_file() and 200 (maybe 600) in change_file().
In fact, I wonder if we should ever change the original perms to begin with. Just treating unreadable files as untrusted sounds like it has a safer failure mode. The unix permissions model is somewhat less relevant in Qubes, but users may still have completely valid reasons for wanting a file to remain unreadable and wouldn't want:
idk... @marmarek @rootkovska thoughts?
Also, the way qvm-open-trust-based is currently implemented (without locking), it's possible for two concurrent invocations of it to have the net-effect of making an unreadable file readable. One can imagine other such bugs not being caught.
We'll still need to change the permissions of files to change between trusted/untrusted, but I've made it so we now assume untrusted on inability to read.
I assume this still means that if a file is readable, yet we also find our attribute, then it's still considered untrusted.
@jpouellet I've made files have 0200
permission (w) upon being set trusted.
is_untrusted_xattr()
always tries to restoreorig_perms
, regardless of whether they were changed (to be able to read xattrs) or not. This is not the correct behavior when we did not change the perms in the first place.Note the chmod in the following:
This manifests itself as odd behavior such as: