I’m experimenting with the concept of a reverse ~/QubesIncoming folder, something like ~/QubesOutgoing, where you put some files and that triggers automatically a qvm-move(-to-vm) operation. It’s quite useful for screenshots, saving something from an app and sending it to somewhere else. It is still buggy, and even if I tried to do some research before but maybe with the wrong terms, so now I’m wondering if I might be reinventing the wheel…
Some time ago @apparatus gave me the idea about qvm-copy-from which may be related (or not) to what you are working on. I haven’t had the time to experiment with it yet but in case you are interested:
I also remember seeing a guide about rsync between qubes which may also work.
Is it legit to think that this could be a potential security risk, where in the compromised qube, this folder would be searched for in order to put there malicious “screenshot”. I am not claiming, just risk assesing…
It’s actually quite easy. In dom0, create a file named /etc/qubes/policy.d/20-automove.policy containing the following line:
qubes.Filecopy * QUBES-FROM QUBES-TO allow
Now, if you run qvm-move-to-vm QUBES-TO file inside QUBES-FROM, it will proceed immediately without asking for confirmation.
(Note: Replace QUBES-FROM and QUBES-TO with the actual names of the qubes involved. Also, ensure this rule is placed in a file with a lower number (e.g., 20) than the default policy
(usually 90) so it takes precedence.)
Thanks for the ideas, some of them don’t fit well with my use case because, what I want to avoid is the situation where inside a software, I only have the option to “Save”, and then:
select a directory
open a terminal or a file manager
go to this directory
move the file
After this, it is a regular qvm-move... workflow, with custom policies or not. Right now, one of the current bugs is my GTK window in dom0, the one to choose the target of the qvm-move-to-vm command. It works, kind of, but I don’t know how to make it work when launched by the systemd service. With your ideas, I’m now thinking about using a named disposable target qube just for that, acting as a proxy, where dom0 then moves the file to the ~/QubesOutgoing directory of the disposable.
I would speculate, that dialog appears because of the policy which is set to ask. Surely a good tool when wanting to have something dynamic.
In your case I would argue, it would be sufficient to just have a script (executed by systemd) that picks the file and based on the directory name sends it to its target. Where the same for dom0 applies as a sender but with qvm-move-to-vm instead of just qvm-move.
Therefore I don’t see a reason for needing a disposable vm for anything.
Also, just wanting to make sure, please don’t invent a way for a vm so send something to dom0
It did me too - even though @balder86 is 100% correct about the Qubes-side risk.
I think it is because the whole idea tempts the mind towards further automation of file handling in the target qube, which could effectively automate the user-side risk.
I like the manual step where I ask myself “Why has has been qvm-copy/moving files here?” before I touch them and it would be easy -but wrong for my threat model(s)- to remove that also.
You are right - my mistake. Inter-vm transfers really do invoke the dialog due to the ask policy. I’m sorry …
I had a closer look at the situation and found a way how the script could behave somewhat similar between dom0 and qubes in regards of having a common QubesOutgoing folder + the dialog to choose a target.
It seems there is no way to force the native dialog in dom0. But one can create a dialog with the qubes to choose from - semi the same.
well if you have ~/QubesOutgoing/browser, then it would suggest browser as destination, which means you dont have to write “browser” before confirming it, which is not in line with Qubes security policy for copying files (user has to explicitly state the destination VM).
About the very first part of the command, I also removed anything not having the AppVM or DispVM classes + not running or paused to keep it short. I will try that zenity command, thanks!
@kuhbs, my current issue is mostly about dom0 (qvm-move-to-vm, not qvm-move), where you have to specify the qube.
Kinda like mv file.txt ~/QubesOutgoing/browser and then it does the rest via systemd magic? That makes sense to me, but I don’t really see the usecase.
Screenshots you can do with xfce4-screenshooter in the VMs individually, you don’t need to take screenshots in dom0 unless you want to actually capture the whole screen and not just one VMs screen (which should be rare).