-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow specifying qvm-block device by UUID #2272
Comments
I'm seeking for a way to a more robust association between removable device and VM. # prepare own uuid, based on serial and partition numbers
QUUID="`uuidgen -s -n @oid -N "${ID_SERIAL} ${PARTN}"`"
# crop uuid to match regular expression (qubes/ext/block.py)
NAME="${QUUID:(-12)}"
# make a link to the device
ln -sf ${DEVNAME} /dev/${NAME} qvm-block output:
Is it worth a PR? |
Can this be solved by using |
I introduced my very own cropped version of UUID due to xenstore' path limitations. |
There are two conflicting requirements here:
To see it yourself, you can easily do that with loop block devices: simply attach the same file as both I think a solution here could be to add extra device property - a "stable identifier", that can be used to attach the device, especially with |
The stable id implementation I'd see like this:
|
What if we'll use an existing device description in the role of stable id? User operates on qvm-device like the following: qvm-block a testvm sys-usb:device_description --persistent. Qvm-device uses description to find ident and stores it in qubes.xml along with an option alias. On processing qubes.xml device ident will be determined by previously saved alias. I've made working concept based on this idea, but still have a few doubts:
@marmarek, When you have a moment, please take a look and let me know what you think. |
Is there a potential security problem here? UUIDs of block devices may very well be attacker-controlled in some cases. |
Moving discussion from QubesOS/qubes-core-admin#447
A sample of one:
It looks to depend on just device characteristics, not data on it (well, partition table is part of the data, but the id for whole device is not depending on it). This isn't ideal because there may be cases where it isn't unique (I've seen some devices where vendor was lazy and serial number was all-zero...), but in most cases it should be good enough. And definitely better than the current approach. I still thing a solution is a separate "stable id" device property - that is used to lookup the device, but the actual connection is done with temporary unique identifier (the current one is probably fine, but something based on hardware topology could work too). If collision is detected, it can be handled by either refusing the operation, or asking the user to resolve it. An ID that is spoofable by the device (or its firmware) is not ideal, but I think it's acceptable trade-off. Similarly you need to trust that sys-usb will actually attach the device you ask it for. |
Perhaps the best answer is to have both. Right now, any device connected to sys-usb must be assumed to be able to compromise it, but that will not be the case once sys-usb becomes a unikernel. |
With regard to having both - I think you're on the right track there - go beyond both, though - this is how I'm thinking about it, after stealing ideas from this thread and other existing solutions in other products. Maybe this has already been hashed out or doesn't really fit the bill, but I'll defer to those who have been more engaged in this to decide on that So, to the point of "having both" - the way VMWare Workstation does this seems to be by supporting practically anything that the underlying OS supports under the /dev filesystem - upon initial persistent assignment, the user chooses a suitable representation from some node under /dev which can be some of the ones mentioned already, and probably some more esoteric ones (and some that actually aren't reliable, if you really want to use them):
The drawback (which could also be seen as a benefit - flexibility) is that it puts the burden on the user to know which identifier is most specific and appropriate for their situation. If they're non-technical, they need to know to choose I don't know how palatable (read: time-consuming) that is from an implementation standpoint but it seems like the best experience for both technical and non-technical users. I had to check how it actually worked in VMWare Workstation because I had forgotten- due to it never causing me any problems over ~3-4 years, despite heavy use of plugged-and-played USB block devices I don't know enough about how the device is actually plumbed and what the backend bit would look like (I assume udev and qrpc) but it seems that if you started with a function that could convert any /dev node (by-uuid, by-id, mapper name, etc) into the unique identifier stored in the qubesdb then that bit of the problem would be solved Maybe I'm missing something and there's some hidden complexity or problems with this approach, but it seems (relatively) simple BTW, I really appreciate the work everyone is doing on this and am really looking forward to having it working. I'm currently implementing it with hacky hard-coded udev rules in sys-usb (serial + GPT UUID) that use qrpc to ask dom0 to confirm and then attach. It's mostly stolen from one of the solutions mentioned in one of the linked issues above, with additional logic for certain cases and some sanitization. It requires hand-editing the sys-usb template each time I have a new drive that I need to be persistently and reliably mapped Thanks again! |
I would add that such a solution would be very useful for LUKS devices. I decrypt 2 additional LUKS devices in /etc/crypttab and the order in which they are decrypted seems to be completely random (that is, the order in which the password prompts are presented). This means that one device is sometimes dm-4, sometimes dm-3. This makes it very difficult to attach such dm devices to AppVMs persistently, I have to fail the password prompts on purpose if the order is wrong. |
On 2016-08-25 18:06, johnyjukya@[...].org wrote:
The text was updated successfully, but these errors were encountered: