| Posted | Nick | Remark | |
|---|---|---|---|
| #openstack-nova - 2019-11-11 | |||
| 20:29:41 | sean-k-mooney | it depnds on how qemu store it | |
| 20:29:45 | efried | which is just as bad. | |
| 20:29:54 | dansmith | efried: that's more work than you need to do to get the secret really | |
| 20:30:02 | sean-k-mooney | well the tpm data shoudl stilly be encyrpted | |
| 20:30:04 | dansmith | efried: if you're root, you can read all of host memory, you can trigger a crash dump on the qemu, or ptrace it, etc | |
| 20:30:20 | sean-k-mooney | but read and writes to it shoudl be decypted by qemu | |
| 20:30:39 | efried | yeah, point is if you don't have root wherever the instance is currently running, but you do have root somewhere else in the cloud. | |
| 20:30:56 | dansmith | efried: ah yes, sorry.. | |
| 20:31:04 | efried | Is there already a way to mark an instance not migratable? | |
| 20:31:27 | dansmith | you don't even need root anywhere in the cluster to do that attack, fwiw | |
| 20:31:34 | dansmith | all you need is the ability to connect to rabbit and it's over | |
| 20:32:01 | dansmith | given that you can convince a compute you don't even have shell access to to send you the guest's memory contents to a non-secure port | |
| 20:33:23 | sean-k-mooney | so without going on too much of a tangent if you use SGX or other sercure memory enclave technologies you can protect form that | |
| 20:33:36 | sean-k-mooney | but i think that is out of scope fo vTPM | |
| 20:33:50 | sean-k-mooney | with SGX root cant read all memeory | |
| 20:34:06 | sean-k-mooney | and the kernel lockdown feature in 5.4 will also prevent that in some cases | |
| 20:35:27 | dansmith | sean-k-mooney: my attack doesn't require root to be able to read the memory | |
| 20:35:34 | dansmith | I said you don't even need shell on the box with the instance | |
| 20:35:54 | dansmith | my attack might not work with encrypted memory for other reasons, but not because of root | |
| 20:36:17 | sean-k-mooney | sure that was not the point i was makeing | |
| 20:36:19 | sean-k-mooney | https://thenewstack.io/linux-kernel-finally-gets-its-lockdown/ | |
| 20:36:33 | sean-k-mooney | ^ that is a cool feature in 5.4 that shoudl help | |
| 20:36:59 | sean-k-mooney | but anyway i like the idea of removing the key once we boot the instnace | |
| 20:37:16 | efried | So is there a way to indicate I don't want my instance live-migratable? | |
| 20:37:42 | sean-k-mooney | i used to say use sriov/pinning or hugepage but we fixed that :) | |
| 20:37:50 | dansmith | efried: meaning as a user asking the operator to not handle your memory contents over a migration? | |
| 20:37:52 | sean-k-mooney | ill check the libvirt xml | |
| 20:37:54 | sean-k-mooney | maybe | |
| 20:38:18 | dansmith | efried: the user isn't supposed to know that a live migration can or has happened really anyway, so what you're asking for is like an SLA which would happen outside of nova I think | |
| 20:38:30 | efried | dansmith: I guess I meant more like something on the instance so that n-api would simply refuse to migrate | |
| 20:38:50 | dansmith | efried: I know, and I'm saying that's not an appropriate thing for nova to be doing IMHO | |
| 20:38:51 | efried | other than incidentals, like PCI devices (right?), I mean something specific. | |
| 20:39:01 | sean-k-mooney | efried: i mean we coudl just check for vtpm and reject | |
| 20:39:06 | dansmith | no, | |
| 20:39:17 | dansmith | sean-k-mooney: he's saying some user wanting to not be live migrated for risk, | |
| 20:39:25 | dansmith | not nova refusing to migrate vtpm-having instances | |
| 20:39:30 | sean-k-mooney | ah | |
| 20:39:34 | efried | either user (so in the flavor) or admin (conf opt) | |
| 20:39:39 | dansmith | if we can migrate them (which we can I think) then we should | |
| 20:39:46 | dansmith | efried: user doesn't control the flavor | |
| 20:39:48 | sean-k-mooney | thats a similar discustion to the spec fo exposing post copy | |
| 20:39:51 | dansmith | the *details* of the flavor | |
| 20:40:22 | dansmith | but yeah, I'd say the cloud should say "Flavors that end in -secu will never be live migrated for security reasons" and then just handle that policy themselves | |
| 20:40:30 | sean-k-mooney | in that spec they wanted a way to mark a vm as not using post copy to avoid the risk of remote execution over a netwrok link | |
| 20:42:38 | umbSublime | That's something I was asked today. Is there a way to make a vm/flavor _NOT_ live-migratable. Some of our users would for some reason want to opt-out of being live-migratable and understand what that means if we need to do maintenance on the host | |
| 20:45:13 | sean-k-mooney | fyi just looking at the libvirt level i dont see anything in https://libvirt.org/formatdomain.html that would alow us to mark a vm as not live migratable but we could do int at the nova level | |
| 20:45:39 | efried | hm, there's a side effect of the hack that's necessary to transfer the vtpm data meaning that you could disable migration by simply not setting those conf opts. | |
| 20:45:51 | dansmith | sean-k-mooney: I assumed he was looking for a nova tunable not libvirt | |
| 20:46:11 | sean-k-mooney | ya i just said i would look at both levels | |
| 20:46:21 | dansmith | ack | |
| 20:47:16 | sean-k-mooney | efried: which conf options? | |
| 20:47:37 | efried | https://review.opendev.org/#/c/639934/14/nova/conf/libvirt.py | |
| 20:47:42 | sean-k-mooney | the nova migration uri? | |
| 20:48:24 | sean-k-mooney | that would block you form using swtpm too however right | |
| 20:49:00 | sean-k-mooney | why is swtpm_group a choices field | |
| 20:49:14 | sean-k-mooney | that kindof ties distos hands | |
| 20:49:22 | sean-k-mooney | same for user i guess | |
| 20:50:51 | sean-k-mooney | efried: with may kolla-ansible hat on it also forces me to run the swtpm as a specific user or group which is not ideal | |
| 20:52:31 | efried | sean-k-mooney: IIUC the libvirt process takes care of starting the swtpm. | |
| 20:52:47 | efried | I mean, I didn't have to do anything special to start it. | |
| 20:53:15 | sean-k-mooney | ok but im not sure we should be resticting the options in nova | |
| 20:53:33 | sean-k-mooney | e.g. i think that should just be a string field | |
| 20:54:12 | sean-k-mooney | if you do "ps aux | grep swtpm" what user/group is it running as | |
| 20:55:46 | efried | some processes have a `tss` user, some have `root`. | |
| 20:56:28 | efried | sorry, the root ones are just qemu. They have swtpm CLI opts in 'em. | |
| 22:21:40 | efried | Not sure why I shouldn't determine the uid/gid based on the swtpm process running on the dest host. | |
| 22:22:35 | efried | I guess discovering which process that is could be a bit tricky. | |
| 22:26:13 | efried | oh, ahem, the swtpm processes correspond to instances; they don't exist until the tpm does, chicken/egg. | |
| 22:27:15 | sean-k-mooney | efried: is this in relattion to the config options or something else? | |
| 22:27:22 | sean-k-mooney | *relation | |
| 22:28:05 | efried | yeah, I was trying to figure out a way not to need the config options. | |
| 22:28:12 | efried | because they suck. | |
| 22:28:23 | sean-k-mooney | well why do we need them? | |
| 22:28:40 | sean-k-mooney | nova is not startign the swtpm binary | |
| 22:28:46 | sean-k-mooney | right? | |
| 22:28:51 | sean-k-mooney | that is handeled by libvirt | |
| 22:28:52 | efried | the tpm data file needs to be owned by the uid/gid of the swtpm server process | |
| 22:29:08 | sean-k-mooney | will libvirt create that for us? | |
| 22:29:21 | efried | It creates the process | |
| 22:29:39 | efried | it doesn't help us for it to create the file, cause it ain't the right one. | |
| 22:31:28 | sean-k-mooney | im not really a fan of nova having to manage those file permissions | |
| 22:31:40 | sean-k-mooney | espcially if the file is not own by the nova user | |
| 22:31:58 | efried | I agree. Summed up above as "suck". | |
| 22:32:36 | sean-k-mooney | could we make the files be owned by nova? | |
| 22:32:54 | sean-k-mooney | i have not really looked at how this works at a lowerer level | |
| 22:34:03 | sean-k-mooney | also we really should not have a generic recursive_chown function in nova. | |
| 22:34:14 | sean-k-mooney | *need to have | |
| 22:35:57 | sean-k-mooney | i dont nessisarly know of a better way but from a privsep point of view it sucks to have generic functions like that that take a path user and group | |
| 22:39:41 | sean-k-mooney | efried: is this just needed for the save_and_migrate_vtpm_dir and restore_vtpm_dir functions | |
| 22:39:57 | efried | yes | |
| 22:41:06 | sean-k-mooney | your kind of assuming that nova will have read acess to those folders in places | |
| 22:41:18 | sean-k-mooney | although you might be using privladged functions | |
| 22:42:10 | efried | I haven't really looked at that patch yet (I didn't write it) but I would assume I would need to use privileged operations on both sides. | |
| 22:42:42 | sean-k-mooney | i gues when you do fileutils.ensure_tree(swtpm_dir) to create the folder its in the libvirt instance dir and nova should have write acess to that | |
| 22:43:01 | sean-k-mooney | no all operations would need to be privaladged | |
| 22:45:22 | sean-k-mooney | so that patch is mainly for resize since cold migrate wont work and normal users cant call it | |
| 22:46:01 | efried | On the source, moving the data from its normal location to within the instance dir needs to be privileged to get at the data in its original location | |
| 22:46:01 | efried | Conversely on the dest, creating the real location needs to be privileged; and we should really make sure it's already owned by the right user before moving the contents back out. | |
| 22:46:12 | efried | so I don't see which operations there wouldn't need to be privileged. | |
| 22:47:05 | sean-k-mooney | the ensure_tree function call here https://review.opendev.org/#/c/639934/15/nova/virt/libvirt/utils.py@654 | |