Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1550233 > unrolled thread
| Started by | Jason Gunthorpe <jgunthorpe@obsidianresearch.com> |
|---|---|
| First post | 2017-01-03 22:50 +0100 |
| Last post | 2017-01-04 15:00 +0100 |
| Articles | 13 — 4 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [tpmdd-devel] [PATCH RFC 0/4] RFC: in-kernel resource manager Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-01-03 22:50 +0100
Re: [tpmdd-devel] [PATCH RFC 0/4] RFC: in-kernel resource manager James Bottomley <James.Bottomley@HansenPartnership.com> - 2017-01-03 23:50 +0100
Re: [tpmdd-devel] [PATCH RFC 0/4] RFC: in-kernel resource manager Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-01-04 01:20 +0100
Re: [tpmdd-devel] [PATCH RFC 0/4] RFC: in-kernel resource manager James Bottomley <James.Bottomley@HansenPartnership.com> - 2017-01-04 01:40 +0100
Re: [tpmdd-devel] [PATCH RFC 0/4] RFC: in-kernel resource manager Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-01-04 02:00 +0100
Re: [tpmdd-devel] [PATCH RFC 0/4] RFC: in-kernel resource manager Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-01-04 14:00 +0100
Re: [tpmdd-devel] [PATCH RFC 0/4] RFC: in-kernel resource manager James Bottomley <James.Bottomley@HansenPartnership.com> - 2017-01-04 16:00 +0100
Re: [tpmdd-devel] [PATCH RFC 0/4] RFC: in-kernel resource manager James Bottomley <James.Bottomley@HansenPartnership.com> - 2017-01-04 20:10 +0100
Re: [tpmdd-devel] [PATCH RFC 0/4] RFC: in-kernel resource manager Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-01-04 20:30 +0100
Re: [tpmdd-devel] [PATCH RFC 0/4] RFC: in-kernel resource manager Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-01-04 20:30 +0100
Re: [tpmdd-devel] [PATCH RFC 0/4] RFC: in-kernel resource manager Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-01-04 00:30 +0100
Re: [tpmdd-devel] [PATCH RFC 0/4] RFC: in-kernel resource manager Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-01-04 13:50 +0100
Re: [tpmdd-devel] [PATCH RFC 0/4] RFC: in-kernel resource manager Ken Goldman <kgoldman@us.ibm.com> - 2017-01-04 15:00 +0100
| From | Jason Gunthorpe <jgunthorpe@obsidianresearch.com> |
|---|---|
| Date | 2017-01-03 22:50 +0100 |
| Subject | Re: [tpmdd-devel] [PATCH RFC 0/4] RFC: in-kernel resource manager |
| Message-ID | <sVF7Y-3Mr-23@gated-at.bofh.it> |
On Tue, Jan 03, 2017 at 08:36:10AM -0800, James Bottomley wrote: > > I'm not sure about this. Why you couldn't have a very thin daemon > > that prepares the file descriptor and sends it through UDS socket to > > a client. > > So I'm a bit soured on daemons from the trousers experience: tcsd > crashed regularly and when it did it took all the TPM connections down > irrecoverably. I'm not saying we can't write a stateless daemon to fix > most of the trousers issues, but I think it's valuable first to ask the > question, "can we manage without a daemon at all?" I actually think > the answer is "yes", so I'm interested in seeing how far that line of > research gets us. There is clearly no need for a daemon to be involved when working on simple tasks like key load and key sign/enc/dec actions, adding such a thing only increases the complexity. If we discover a reason to have a daemon down the road then it should work in some way where the user space can call out to the daemon over a different path than the kernel. (eg dbus or something) > Do you have a link to the presentation? The Plumbers etherpad doesn't > contain it. I've been trying to work out whether a properly set up TPM > actually does need any protections at all. As far as I can tell, once > you've set all the hierarchy authorities and the lockout one, you're > pretty well protected. I think we should also consider TPM 1.2 support in all of this, it is still a very popular peice of hardware and it is equally able to support a RM. So, in general, I'd prefer to see the unprivileged char dev hard prevented by the kernel from doing certain things: - Wipe the TPM - Manipulate the SRK, nvram, tpm flags, change passwords etc - Read back the EK - Write to PCRs - etc. Even if TPM 2 has a stronger password based model, I still think the kernel should hard prevent those sorts of actions even if the user knows the TPM password. Realistically people in less senstive environments will want to use the well known TPM passwords and still have reasonable safety in their unprivileged accounts. Jason
[toc] | [next] | [standalone]
| From | James Bottomley <James.Bottomley@HansenPartnership.com> |
|---|---|
| Date | 2017-01-03 23:50 +0100 |
| Message-ID | <sVG41-4nb-1@gated-at.bofh.it> |
| In reply to | #1550233 |
On Tue, 2017-01-03 at 14:47 -0700, Jason Gunthorpe wrote: > On Tue, Jan 03, 2017 at 08:36:10AM -0800, James Bottomley wrote: > > > > I'm not sure about this. Why you couldn't have a very thin daemon > > > that prepares the file descriptor and sends it through UDS socket > > > to a client. > > > > So I'm a bit soured on daemons from the trousers experience: tcsd > > crashed regularly and when it did it took all the TPM connections > > down irrecoverably. I'm not saying we can't write a stateless > > daemon to fix most of the trousers issues, but I think it's > > valuable first to ask the question, "can we manage without a daemon > > at all?" I actually think the answer is "yes", so I'm interested > > in seeing how far that line of research gets us. > > There is clearly no need for a daemon to be involved when working on > simple tasks like key load and key sign/enc/dec actions, adding such > a thing only increases the complexity. > > If we discover a reason to have a daemon down the road then it should > work in some way where the user space can call out to the daemon over > a different path than the kernel. (eg dbus or something) Agreed ... I think the only reason I can currently see for needing a daemon is if we need it to sort out access security (which I'm hoping we don't). > > Do you have a link to the presentation? The Plumbers etherpad > > doesn't contain it. I've been trying to work out whether a > > properly set up TPM actually does need any protections at all. As > > far as I can tell, once you've set all the hierarchy authorities > > and the lockout one, you're pretty well protected. > > I think we should also consider TPM 1.2 support in all of this, it is > still a very popular peice of hardware and it is equally able to > support a RM. I've been running with the openssl and gnome-keyring patches in 1.2 for months now. The thing about 1.2 is that the volatile store is much larger, so there's a lot less of a need for a RM. It's only a requirement in 2.0 because most shipping TPMs only seem to have room for about 3 objects. > So, in general, I'd prefer to see the unprivileged char dev hard > prevented by the kernel from doing certain things: > > - Wipe the TPM > - Manipulate the SRK, nvram, tpm flags, change passwords etc > - Read back the EK These are all things that the TPM itself is capable of enforcing a policy for. I think we should aim for correct setup of the TPM in the first place so it enforces the policy in a standard manner rather than having an artificial policy enforcement in the kernel. > - Write to PCRs The design of a TPM is mostly that it's up to user space to deal with this. Userspace can, of course, kill the TPM ability to quote and seal to PCRs by inappropriately extending them. However, there are a lot of responsible applications that want to use PCRs in userspace; for instance cloud boot and attestation. We don't really want to restrict their ability arbitrarily. > - etc. > > Even if TPM 2 has a stronger password based model, I still think the > kernel should hard prevent those sorts of actions even if the user > knows the TPM password. That would make us different from TPM1.2: there, if you know the owner authorisation, trousers will pretty much let you do anything. > Realistically people in less senstive environments will want to use > the well known TPM passwords and still have reasonable safety in > their unprivileged accounts. Can we not do most of this with localities? In theory locality 0 is supposed to be only the bios and the boot manager and the OS gets to access 1-3. We could reserve one for the internal kernel and still have a couple for userspace (I'll have to go back and check numbers; I seem to remember there were odd restrictions on which PCR you can reset and extend in which locality). If we have two devices (one for each locality) we could define a UNIX ACL on the devices to achieve what you want. James
[toc] | [prev] | [next] | [standalone]
| From | Jason Gunthorpe <jgunthorpe@obsidianresearch.com> |
|---|---|
| Date | 2017-01-04 01:20 +0100 |
| Message-ID | <sVHt7-5qe-11@gated-at.bofh.it> |
| In reply to | #1550263 |
On Tue, Jan 03, 2017 at 02:39:58PM -0800, James Bottomley wrote: > > I think we should also consider TPM 1.2 support in all of this, it is > > still a very popular peice of hardware and it is equally able to > > support a RM. > > I've been running with the openssl and gnome-keyring patches in 1.2 for > months now. The thing about 1.2 is that the volatile store is much > larger, so there's a lot less of a need for a RM. It's only a > requirement in 2.0 because most shipping TPMs only seem to have room > for about 3 objects. It would be great if the 1.2 RM could support just enough to allow RSA key operations from userspace, without key virtualization. That would allow the plugins that already exist to move to the RM interface and we can get rid of the hard dependency on trousers. I honestly don't think this should be much work beyond what Jarkko has already done... > > So, in general, I'd prefer to see the unprivileged char dev hard > > prevented by the kernel from doing certain things: > > > > - Wipe the TPM > > - Manipulate the SRK, nvram, tpm flags, change passwords etc > > - Read back the EK > > These are all things that the TPM itself is capable of enforcing a > policy for. I think we should aim for correct setup of the TPM in the > first place so it enforces the policy in a standard manner rather than > having an artificial policy enforcement in the kernel. Well, by policy you mean 'know the owner password' which at least I am *very* nervous about exposing beyond the super user - certainly in my embedded systems. On a desktop I think these actions should be protected by the usual 'sudo' scheme dbus has *in addition* to the owner password. It is rare that anyone would want to do these actions this seems like the right choice from a security perspective. > > - Write to PCRs > > The design of a TPM is mostly that it's up to user space to deal with > this. Userspace can, of course, kill the TPM ability to quote and seal > to PCRs by inappropriately extending them. However, there are a lot of > responsible applications that want to use PCRs in userspace; for > instance cloud boot and attestation. We don't really want to restrict > their ability arbitrarily. The entire RM model is that of a sandbox, so if extending the PCR is viewable by other RM clients it must be prevented. We don't want a user to be able to DOS other users by extending a PCR and breaking system attestation or unsealing. Like you say below localities may be part of the answer here, and I also recall that various PCRs become read-only at certain localities. However, until we figure out a security model for writing PCRs I think the RM has to ban them. > > Even if TPM 2 has a stronger password based model, I still think the > > kernel should hard prevent those sorts of actions even if the user > > knows the TPM password. > > That would make us different from TPM1.2: there, if you know the owner > authorisation, trousers will pretty much let you do anything. Well, I also think trousers is wrong to do that. :) But this is not trousers, this is an in-kernel 0666 char dev that will be active on basically every Linux system with a TPM. I think we have a duty to be very conservative here. This is why I want to see a command white list in Jarkko's patches to start. Every command exposed needs a very careful security analysis first, and we should start with only the commands we know are safe :\ > > Realistically people in less senstive environments will want to use > > the well known TPM passwords and still have reasonable safety in > > their unprivileged accounts. > > Can we not do most of this with localities? In theory locality 0 is > supposed to be only the bios and the boot manager and the OS gets to > access 1-3. We could reserve one for the internal kernel and still > have a couple for userspace (I'll have to go back and check numbers; I > seem to remember there were odd restrictions on which PCR you can reset > and extend in which locality). If we have two devices (one for each > locality) we could define a UNIX ACL on the devices to achieve what you > want. Good point, yes, localities should be thought about when designing this new RM char dev uAPI... Our support for localities in the kernel today uses some really gross sysfs file and is basically insane, IMHO. Maybe there should be a /dev/tpmrm for each locality? If so then only the safe one with unwritable localities can be 0666 by default.. Jason
[toc] | [prev] | [next] | [standalone]
| From | James Bottomley <James.Bottomley@HansenPartnership.com> |
|---|---|
| Date | 2017-01-04 01:40 +0100 |
| Message-ID | <sVHMu-5wN-21@gated-at.bofh.it> |
| In reply to | #1550316 |
On Tue, 2017-01-03 at 17:17 -0700, Jason Gunthorpe wrote: > On Tue, Jan 03, 2017 at 02:39:58PM -0800, James Bottomley wrote: > > > > I think we should also consider TPM 1.2 support in all of this, > > > it is still a very popular peice of hardware and it is equally > > > able to support a RM. > > > > I've been running with the openssl and gnome-keyring patches in 1.2 > > for months now. The thing about 1.2 is that the volatile store is > > much larger, so there's a lot less of a need for a RM. It's only a > > requirement in 2.0 because most shipping TPMs only seem to have > > room for about 3 objects. > > It would be great if the 1.2 RM could support just enough to allow > RSA key operations from userspace, without key virtualization. That > would allow the plugins that already exist to move to the RM > interface and we can get rid of the hard dependency on trousers. [getting long, let's divide into separate issues] They actually already do: Trousers, for all its annoying complexity, doesn't actually implement a resource manager, so we should be able to do all the RSA operations we want today with the current 1.2 interface and no RM. The difficulty is no API ... unless you want to speak at the TPM command level and do all the HMAC calculations yourself. James
[toc] | [prev] | [next] | [standalone]
| From | Jason Gunthorpe <jgunthorpe@obsidianresearch.com> |
|---|---|
| Date | 2017-01-04 02:00 +0100 |
| Message-ID | <sVI5P-5DZ-19@gated-at.bofh.it> |
| In reply to | #1550327 |
On Tue, Jan 03, 2017 at 04:29:59PM -0800, James Bottomley wrote: > On Tue, 2017-01-03 at 17:17 -0700, Jason Gunthorpe wrote: > > On Tue, Jan 03, 2017 at 02:39:58PM -0800, James Bottomley wrote: > > > > > > I think we should also consider TPM 1.2 support in all of this, > > > > it is still a very popular peice of hardware and it is equally > > > > able to support a RM. > > > > > > I've been running with the openssl and gnome-keyring patches in 1.2 > > > for months now. The thing about 1.2 is that the volatile store is > > > much larger, so there's a lot less of a need for a RM. It's only a > > > requirement in 2.0 because most shipping TPMs only seem to have > > > room for about 3 objects. > > > > It would be great if the 1.2 RM could support just enough to allow > > RSA key operations from userspace, without key virtualization. That > > would allow the plugins that already exist to move to the RM > > interface and we can get rid of the hard dependency on trousers. > [getting long, let's divide into separate issues] > > They actually already do: Trousers, for all its annoying complexity, > doesn't actually implement a resource manager, so we should be able to > do all the RSA operations we want today with the current 1.2 interface > and no RM. The current interface cannot be used by unprivileged users. I want to see the kernel provide an unprivileged safe interface for both TPM 1.2 and TPM 2.0 > The difficulty is no API ... unless you want to speak at > the TPM command level and do all the HMAC calculations yourself. I think the openssl RSA method could certainly do the TPM command level with not really a big problem. That would avoid all these crazy dependencies and debate :| I have a very good idea what that would look like for tpm 1.2 and I would estimate < 500 lines.... Jason
[toc] | [prev] | [next] | [standalone]
| From | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> |
|---|---|
| Date | 2017-01-04 14:00 +0100 |
| Message-ID | <sVTkB-4MT-5@gated-at.bofh.it> |
| In reply to | #1550316 |
On Tue, Jan 03, 2017 at 05:17:32PM -0700, Jason Gunthorpe wrote: > On Tue, Jan 03, 2017 at 02:39:58PM -0800, James Bottomley wrote: > > > > I think we should also consider TPM 1.2 support in all of this, it is > > > still a very popular peice of hardware and it is equally able to > > > support a RM. > > > > I've been running with the openssl and gnome-keyring patches in 1.2 for > > months now. The thing about 1.2 is that the volatile store is much > > larger, so there's a lot less of a need for a RM. It's only a > > requirement in 2.0 because most shipping TPMs only seem to have room > > for about 3 objects. > > It would be great if the 1.2 RM could support just enough to allow RSA > key operations from userspace, without key virtualization. That would > allow the plugins that already exist to move to the RM interface and > we can get rid of the hard dependency on trousers. > > I honestly don't think this should be much work beyond what Jarkko has > already done... > > > > So, in general, I'd prefer to see the unprivileged char dev hard > > > prevented by the kernel from doing certain things: > > > > > > - Wipe the TPM > > > - Manipulate the SRK, nvram, tpm flags, change passwords etc > > > - Read back the EK > > > > These are all things that the TPM itself is capable of enforcing a > > policy for. I think we should aim for correct setup of the TPM in the > > first place so it enforces the policy in a standard manner rather than > > having an artificial policy enforcement in the kernel. > > Well, by policy you mean 'know the owner password' which at least I am > *very* nervous about exposing beyond the super user - certainly in my > embedded systems. > > On a desktop I think these actions should be protected by the usual > 'sudo' scheme dbus has *in addition* to the owner password. > > It is rare that anyone would want to do these actions this seems like > the right choice from a security perspective. > > > > - Write to PCRs > > > > The design of a TPM is mostly that it's up to user space to deal with > > this. Userspace can, of course, kill the TPM ability to quote and seal > > to PCRs by inappropriately extending them. However, there are a lot of > > responsible applications that want to use PCRs in userspace; for > > instance cloud boot and attestation. We don't really want to restrict > > their ability arbitrarily. > > The entire RM model is that of a sandbox, so if extending the PCR is > viewable by other RM clients it must be prevented. We don't want a > user to be able to DOS other users by extending a PCR and breaking > system attestation or unsealing. > > Like you say below localities may be part of the answer here, and I > also recall that various PCRs become read-only at certain localities. > > However, until we figure out a security model for writing PCRs I think > the RM has to ban them. > > > > Even if TPM 2 has a stronger password based model, I still think the > > > kernel should hard prevent those sorts of actions even if the user > > > knows the TPM password. > > > > That would make us different from TPM1.2: there, if you know the owner > > authorisation, trousers will pretty much let you do anything. > > Well, I also think trousers is wrong to do that. :) > > But this is not trousers, this is an in-kernel 0666 char dev that will > be active on basically every Linux system with a TPM. I think we have > a duty to be very conservative here. > > This is why I want to see a command white list in Jarkko's patches to > start. Every command exposed needs a very careful security analysis > first, and we should start with only the commands we know are safe :\ > > > > Realistically people in less senstive environments will want to use > > > the well known TPM passwords and still have reasonable safety in > > > their unprivileged accounts. > > > > Can we not do most of this with localities? In theory locality 0 is > > supposed to be only the bios and the boot manager and the OS gets to > > access 1-3. We could reserve one for the internal kernel and still > > have a couple for userspace (I'll have to go back and check numbers; I > > seem to remember there were odd restrictions on which PCR you can reset > > and extend in which locality). If we have two devices (one for each > > locality) we could define a UNIX ACL on the devices to achieve what you > > want. > > Good point, yes, localities should be thought about when designing > this new RM char dev uAPI... > > Our support for localities in the kernel today uses some really gross > sysfs file and is basically insane, IMHO. > > Maybe there should be a /dev/tpmrm for each locality? If so then only > the safe one with unwritable localities can be 0666 by default.. Do you see that it would be possible to have ioctl for setting the locality, or is it out of the question? I'm planning to have an ioctl for the whitelist anyway. > Jason /Jarkko
[toc] | [prev] | [next] | [standalone]
| From | James Bottomley <James.Bottomley@HansenPartnership.com> |
|---|---|
| Date | 2017-01-04 16:00 +0100 |
| Message-ID | <sVVcK-62m-15@gated-at.bofh.it> |
| In reply to | #1550745 |
On Wed, 2017-01-04 at 14:50 +0200, Jarkko Sakkinen wrote: > On Tue, Jan 03, 2017 at 05:17:32PM -0700, Jason Gunthorpe wrote: > > On Tue, Jan 03, 2017 at 02:39:58PM -0800, James Bottomley wrote: [...] > > > > Even if TPM 2 has a stronger password based model, I still > > > > think the kernel should hard prevent those sorts of actions > > > > even if the user knows the TPM password. > > > > > > That would make us different from TPM1.2: there, if you know the > > > owner authorisation, trousers will pretty much let you do > > > anything. > > > > Well, I also think trousers is wrong to do that. :) > > > > But this is not trousers, this is an in-kernel 0666 char dev that > > will be active on basically every Linux system with a TPM. I think > > we have a duty to be very conservative here. Just to note on this that trousers *is* effectively an 0666 kernel device: all tcsd does is run with root privileges on the real /dev/tpm0 and mediate the calls. It doesn't seem to police them at all. I realise you want better than this, and I definitely think this is a worthy goal, but the point I want to make is that an 0666 device and trousers are basically equivalent. > > This is why I want to see a command white list in Jarkko's patches > > to start. Every command exposed needs a very careful security > > analysis first, and we should start with only the commands we know > > are safe :\ > > > > > > Realistically people in less senstive environments will want to > > > > use the well known TPM passwords and still have reasonable > > > > safety in their unprivileged accounts. > > > > > > Can we not do most of this with localities? In theory locality 0 > > > is supposed to be only the bios and the boot manager and the OS > > > gets to access 1-3. We could reserve one for the internal kernel > > > and still have a couple for userspace (I'll have to go back and > > > check numbers; I seem to remember there were odd restrictions on > > > which PCR you can reset and extend in which locality). If we > > > have two devices (one for each locality) we could define a UNIX > > > ACL on the devices to achieve what you want. > > > > Good point, yes, localities should be thought about when designing > > this new RM char dev uAPI... > > > > Our support for localities in the kernel today uses some really > > gross sysfs file and is basically insane, IMHO. > > > > Maybe there should be a /dev/tpmrm for each locality? If so then > > only the safe one with unwritable localities can be 0666 by > > default.. > > Do you see that it would be possible to have ioctl for setting the > locality, or is it out of the question? I'm planning to have an ioctl > for the whitelist anyway. For localities, assuming they can have real meaning in terms of the protection model, I think one device per locality is better than an ioctl because device policy is settable in underspace via the UNIX ACL and hence locality policy is too. If we have an ioctl, we then have to introduce a "who's allowed to do this?" policy in the kernel. I also think the command filter actually needs more thought. Right at the moment, if we go with the current proposals, the kernel will create two devices: /dev/tpm<n> and /dev/tpms<n>. By default they'll both be root owned and 0600, so the current patch adequately protects the TPM. I think we go with this now and do the filter later. On the filter design: Now if we look at use cases, for my laptop, where I'm the only user, I want unrestricted access to the TPM. I can achieve that by making /dev/tpms0 0666 (or changing its ownership to me). Jason's use case is devices running non-root apps that need restricted TPM access. For them, a single filter on /dev/tpms0 might work, although there might be unrestricted apps needing a broader range of tpm access (perhaps not all running as root?) For the cloud use case, we're going to have a variety of applications each with a variety of restrictions (for instance, the orchestration system is definitely going to need PCR extensions if it's doing attestations, but the guests might not want this) etc. I think all this points to multiple potential users each with their own filter, so I think the actual architecture for the filter is an ioctl which adds a new filtered device connected to the RM which may be executed many times. That way the creator of the device can decide the filter policy and the use policy via the standard device UNIX ACL and you can have lots of them to make this fine grained. It could also be done with something /dev/ptmx like, so perhaps a filesystem may be the answer as well? If you want, I can commit to building this once we have all the requirements and we can get Jarkko's patch set reviewed now without it. James
[toc] | [prev] | [next] | [standalone]
| From | James Bottomley <James.Bottomley@HansenPartnership.com> |
|---|---|
| Date | 2017-01-04 20:10 +0100 |
| Message-ID | <sVZ6G-lZ-21@gated-at.bofh.it> |
| In reply to | #1550890 |
On Wed, 2017-01-04 at 11:31 -0700, Jason Gunthorpe wrote: > On Wed, Jan 04, 2017 at 06:53:03AM -0800, James Bottomley wrote: > > > > > But this is not trousers, this is an in-kernel 0666 char dev > > > > that will be active on basically every Linux system with a TPM. > > > > I think we have a duty to be very conservative here. > > > > Just to note on this that trousers *is* effectively an 0666 kernel > > device: all tcsd does is run with root privileges on the real > > /dev/tpm0 and mediate the calls. It doesn't seem to police them at > > all. > > That may be, but IHMO trousers is simply not relevant. Real systems > do not seem to use trousers. I don't use it. Google doesn't use it. > You report it is crashy. > > To me it just doesn't represent a reasonable way to use the TPM > hardware. It basically represents the only current way until there's a new API, so all our current key handling tools use it. Given how I slammed it in Plumbers, I'd be the last one to defend its actual API as usable ... we just don't have another (yet). > > For localities, assuming they can have real meaning in terms of the > > protection model, I think one device per locality is better than an > > ioctl because device policy is settable in underspace via the UNIX > > ACL and hence locality policy is too. > > Yes. > > > I also think the command filter actually needs more thought. Right > > at the moment, if we go with the current proposals, the kernel will > > create two devices: /dev/tpm<n> and /dev/tpms<n>. By default > > they'll both be root owned and 0600, so the current patch > > adequately protects the TPM. > > Yes, but, considering the goals here I'd rather see the default > kernel permissions for tpms be 0666 .... > > You are doing all this work to get the user space side in shape, I'd > like to see matching kernel support. To me that means out-of-the-box > a user can just use your plugins, the plugins will access /dev/tmps > and everything will work fine for RSA key storage. Actually, not necessarily; you're not considering the setup issue: right at the moment users get delivered TPMs mostly in the cleared state (thankfully they no longer have to clear via bios). So the first thing a new user has to do is set all the authorizations and create an SRK equivalent primary object at 0x81000001. I think in the interests of best practice we want to make that as easy as possible; saying they have to do this as root and use a different device is problematic. You can say they don't have to use a different device because the filter can be lifted for root, but then how do I lock down root apps for this untrusted root setup secure boot has going on? I suppose we could use TPMA_PERMANENT for this. The first three bits indicate whether the authorizations are set, so if they're all clear, we can assume an unowned TPM and lift the filter? A sort of trust on first use model. James
[toc] | [prev] | [next] | [standalone]
| From | Jason Gunthorpe <jgunthorpe@obsidianresearch.com> |
|---|---|
| Date | 2017-01-04 20:30 +0100 |
| Message-ID | <sVZq1-vQ-13@gated-at.bofh.it> |
| In reply to | #1551119 |
On Wed, Jan 04, 2017 at 10:57:51AM -0800, James Bottomley wrote: > > You are doing all this work to get the user space side in shape, I'd > > like to see matching kernel support. To me that means out-of-the-box > > a user can just use your plugins, the plugins will access /dev/tmps > > and everything will work fine for RSA key storage. > > Actually, not necessarily; you're not considering the setup issue: > right at the moment users get delivered TPMs mostly in the cleared I have no problem with users being instructed to do 'sudo tpm2-provision' or having that happen via GUI using the usual privilege escalation techniques. > state (thankfully they no longer have to clear via bios). So the first > thing a new user has to do is set all the authorizations and create an > SRK equivalent primary object at 0x81000001. I think in the interests > of best practice we want to make that as easy as possible; saying they > have to do this as root and use a different device is problematic. The device names should never be exposed to the user. The user should specify a chip number (default to 0) and the tools should select the correct available device to do what the user is asking. First try /dev/tpms and elevate filter, then try /dev/tpmX, then fail. > You can say they don't have to use a different device because the > filter can be lifted for root, but then how do I lock down root apps > for this untrusted root setup secure boot has going on? Presumably the same way you lock down /dev/tpm0 today? selinux I guess? > I suppose we could use TPMA_PERMANENT for this. The first three bits > indicate whether the authorizations are set, so if they're all clear, > we can assume an unowned TPM and lift the filter? A sort of trust on > first use model. I feel tpm provisioning is something that should only be done by the system owner, and that means root in unix parlance. I don't want random end-users provisioning the TPM in my server, for instance. Jason
[toc] | [prev] | [next] | [standalone]
| From | Jason Gunthorpe <jgunthorpe@obsidianresearch.com> |
|---|---|
| Date | 2017-01-04 20:30 +0100 |
| Message-ID | <sVZ6G-lZ-23@gated-at.bofh.it> |
| In reply to | #1550890 |
On Wed, Jan 04, 2017 at 06:53:03AM -0800, James Bottomley wrote: > > > But this is not trousers, this is an in-kernel 0666 char dev that > > > will be active on basically every Linux system with a TPM. I think > > > we have a duty to be very conservative here. > > Just to note on this that trousers *is* effectively an 0666 kernel > device: all tcsd does is run with root privileges on the real /dev/tpm0 > and mediate the calls. It doesn't seem to police them at all. That may be, but IHMO trousers is simply not relevant. Real systems do not seem to use trousers. I don't use it. Google doesn't use it. You report it is crashy. To me it just doesn't represent a reasonable way to use the TPM hardware. > For localities, assuming they can have real meaning in terms of the > protection model, I think one device per locality is better than an > ioctl because device policy is settable in underspace via the UNIX ACL > and hence locality policy is too. Yes. > I also think the command filter actually needs more thought. Right at > the moment, if we go with the current proposals, the kernel will create > two devices: /dev/tpm<n> and /dev/tpms<n>. By default they'll both be > root owned and 0600, so the current patch adequately protects the TPM. Yes, but, considering the goals here I'd rather see the default kernel permissions for tpms be 0666 .... You are doing all this work to get the user space side in shape, I'd like to see matching kernel support. To me that means out-of-the-box a user can just use your plugins, the plugins will access /dev/tmps and everything will work fine for RSA key storage. No messing with udev, no opt-in to TPM usage, no daemon to install, no chmod on a dev node. It Just Works. > Now if we look at use cases, for my laptop, where I'm the only user, I > want unrestricted access to the TPM. I can achieve that by making > /dev/tpms0 0666 (or changing its ownership to me). This usecase is already handled by making /dev/tmp0 accessible to the user. Keeping the 'enable RM' ioctl makes that a little wonky but entirely workable.. > Jason's use case is devices running non-root apps that need restricted > TPM access. For them, a single filter on /dev/tpms0 might work, > although there might be unrestricted apps needing a broader range of > tpm access (perhaps not all running as root?) Yes, I have a range of usage restrictions. As an example: My systems support key migration, so I want to make it very hard for an attacker to use the migration machinery to steal an RSA key. The user controls the migration password, I hope it is strong, but even so the system is currently desgined so that only a ssh user can even issue migration commands to the tpm. Someone hacking a network daemon simply cannot. This is the sort of defence in depth I think is imporant in a security system like this. > For the cloud use case, we're going to have a variety of applications > each with a variety of restrictions (for instance, the orchestration > system is definitely going to need PCR extensions if it's doing > attestations, but the guests might not want this) etc. To me a design for how the PCRs actually need to work is what is missing here. I only minimially understand this use case... And it seems like a big leap that orchestration software *needs* unprivileged TPM access. > I think all this points to multiple potential users each with their own > filter, so I think the actual architecture for the filter is an ioctl > which adds a new filtered device connected to the RM which may be > executed many times. Maybe, but that also seems like over kill.. It entirely depends on what the PCR use model actually is. Here is an alternative starting idea: - Introduce /dev/tpms a single cdev node that can talk to all chips and all localities. - By default it is 0666 - By default it has a very strong filter allowing only key load, some key ops and any thing else we can identify as unambiguously safe. - It has a root-only ioctl that can change the filter (op, chip) - It has a root-only ioctl that can change the locality - Keep the enable-RM ioctl on /dev/tmpX, except that enable-RM would switch the /dev/tpm0 FD to only use the above uAPI and set an all-permissive filter. The followup would be a TPM namespace design that meets the needs of people working on containers and related. We already know we need this today for IMA in containers and vtpm isolation. TPM namespaces would basically control the filtering options on /dev/tmps and set the default TPM. So one could run orchestration software unprivileged inside a TPM namespace with greater access. This should be enough stuff for people to explore different security models in user space. The root-only ioctls and /dev/tpm0 are enough to let user space create FDs with whatever properties are needed and pass them to unprivileged, eg via fd passing or via open-as-root/drop privs techniques. The default configuration is enough to enable the RSA key model that we actually do understand well and almost have code for :) I think this is very important.. We don't introduce any new security risks we don't understand. Jason
[toc] | [prev] | [next] | [standalone]
| From | Jason Gunthorpe <jgunthorpe@obsidianresearch.com> |
|---|---|
| Date | 2017-01-04 00:30 +0100 |
| Message-ID | <sVGGJ-4S6-7@gated-at.bofh.it> |
| In reply to | #1550233 |
On Tue, Jan 03, 2017 at 05:21:28PM -0500, Ken Goldman wrote: > On 1/3/2017 4:47 PM, Jason Gunthorpe wrote: > > > > I think we should also consider TPM 1.2 support in all of this, it is > > still a very popular piece of hardware and it is equally able to > > support a RM. > > I suspect that TPM 2.0 and TPM 1.2 are so different that there may be > little or no code in common. Sure, but the uapi should make sense for both versions, ie, I don't want to see a tpm 2.0 specific char dev. Jason
[toc] | [prev] | [next] | [standalone]
| From | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> |
|---|---|
| Date | 2017-01-04 13:50 +0100 |
| Message-ID | <sVTaW-4JG-3@gated-at.bofh.it> |
| In reply to | #1550233 |
On Tue, Jan 03, 2017 at 02:47:02PM -0700, Jason Gunthorpe wrote: > On Tue, Jan 03, 2017 at 08:36:10AM -0800, James Bottomley wrote: > > > > I'm not sure about this. Why you couldn't have a very thin daemon > > > that prepares the file descriptor and sends it through UDS socket to > > > a client. > > > > So I'm a bit soured on daemons from the trousers experience: tcsd > > crashed regularly and when it did it took all the TPM connections down > > irrecoverably. I'm not saying we can't write a stateless daemon to fix > > most of the trousers issues, but I think it's valuable first to ask the > > question, "can we manage without a daemon at all?" I actually think > > the answer is "yes", so I'm interested in seeing how far that line of > > research gets us. > > There is clearly no need for a daemon to be involved when working on > simple tasks like key load and key sign/enc/dec actions, adding such a > thing only increases the complexity. > > If we discover a reason to have a daemon down the road then it should > work in some way where the user space can call out to the daemon over > a different path than the kernel. (eg dbus or something) > > > Do you have a link to the presentation? The Plumbers etherpad doesn't > > contain it. I've been trying to work out whether a properly set up TPM > > actually does need any protections at all. As far as I can tell, once > > you've set all the hierarchy authorities and the lockout one, you're > > pretty well protected. > > I think we should also consider TPM 1.2 support in all of this, it is > still a very popular peice of hardware and it is equally able to > support a RM. I'm not against considering TPM 1.2 support but getting both in the same patch set would be too much. > > So, in general, I'd prefer to see the unprivileged char dev hard > prevented by the kernel from doing certain things: > > - Wipe the TPM > - Manipulate the SRK, nvram, tpm flags, change passwords etc > - Read back the EK > - Write to PCRs > - etc. I rather have an ioctl where you can supply a list of CCs that you want to allow a client to do. /Jarkko > Even if TPM 2 has a stronger password based model, I still think the > kernel should hard prevent those sorts of actions even if the user > knows the TPM password. > > Realistically people in less senstive environments will want to use > the well known TPM passwords and still have reasonable safety in their > unprivileged accounts. > > Jason
[toc] | [prev] | [next] | [standalone]
| From | Ken Goldman <kgoldman@us.ibm.com> |
|---|---|
| Date | 2017-01-04 15:00 +0100 |
| Message-ID | <sVGGJ-4S6-9@gated-at.bofh.it> |
| In reply to | #1550233 |
On 1/3/2017 4:47 PM, Jason Gunthorpe wrote: > > I think we should also consider TPM 1.2 support in all of this, it is > still a very popular piece of hardware and it is equally able to > support a RM. I suspect that TPM 2.0 and TPM 1.2 are so different that there may be little or no code in common. My immediate need is for a 2.0 resource manager, since it's a gap in the technology, while 1.2 does have tcsd.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web