tpm2-tss icon indicating copy to clipboard operation
tpm2-tss copied to clipboard

Can we change ownership in tpm2-udev.rules?

Open ghost opened this issue 3 years ago • 2 comments

Can this entry:

KERNEL=="tpmrm[0-9]*", TAG+="systemd", MODE="0660", OWNER="tss", GROUP="tss"

Be changed to:

KERNEL=="tpmrm[0-9]*", TAG+="systemd", MODE="0660", GROUP="tss"

Because root needs write access as well otherwise processes like for example systemd-cryptenroll will require CAP_DAC_OVERRIDE just to be able to write to that node.

ghost avatar Jan 20 '22 20:01 ghost

The proper fix would be to add group tss to the supplemental group list of the service that needs access.

Root, by default has a saturated capability set, so unless something is twiddling with your capability set, root has cap dac override. The only time you would see it fail is if something dropped that from the capability set or an LSM is in place. But again, use DAC controls (supplemental groups) and you should avoid the issue.

williamcroberts avatar Jan 20 '22 21:01 williamcroberts

systemd-cryptenroll is not a service though, and yes SELinux exposed this issue: https://github.com/DefenSec/dssp5/commit/cb004093259ad68c9d8340f3695761ba419263d3

I dont see why tpm2-tss should claim full ownership of /dev/tpmrm

ghost avatar Jan 20 '22 21:01 ghost

@williamcroberts what shall we do with this one ? Candidate for 4.0 ?

AndreasFuchsTPM avatar Nov 02 '22 12:11 AndreasFuchsTPM

systemd-cryptenroll is not a service though, and yes SELinux exposed this issue: https://github.com/DefenSec/dssp5/commit/cb004093259ad68c9d8340f3695761ba419263d3

Ahh, yes, but the user could just have group tss as a workaround.

I dont see why tpm2-tss should claim full ownership of /dev/tpmrm

I guess it doesn't, since tpm stays user root, going through the resource manager interface shouldn't require user not root. Correction: tpm driver itself requires user "tss".

But I don't see why user root cannot use the rm interface.

williamcroberts avatar Nov 02 '22 19:11 williamcroberts