[qubes-users] delaying total shutdown of disposable qube

Hi

When we open an attachment from emails, like .odf files and such, and start writing in them, meaning to send the edited file back to the sender. Then there is a slight chance of a person saving the file, closing the editor and then loosing the file because the qube has shut down.

We would like to add a new disposable template in which the disposable vm's will be shut down with a delay of a few minutes, just enough for the person to start replying to the email and finding that they need the file and then open up the file manager from that disposable qube that was almost shut down and thus saving the file.

How would we do this? Is there some option in Qubes-OS that supports this?

If no option exists then I would like to know what happens when you close an app like librewriter that is opened in a dispvm. How does the dispvm know that it is supposed to shut down when the app is closed? Perhaps we can find a way through there to implement some kind of delay.

Ólafur Jens Sigurðsson:

We would like to add a new disposable template in which the disposable vm's
will be shut down with a delay of a few minutes, just enough for the person
to start replying to the email and finding that they need the file and then
open up the file manager from that disposable qube that was almost shut down
and thus saving the file.

How would we do this? Is there some option in Qubes-OS that supports this?

I'm not aware of a built-in option, but you could cobble two things
together:

1. To make the destination qubes.OpenInVM service wait indefinitely
after the launched program is done, create an executable file at
/usr/local/etc/qubes-rpc/qubes.OpenInVM in e.g. fedora-delayed-dvm
containing:

#!/bin/sh
/etc/qubes-rpc/"\{0\#\#\*/\}" "@"
exec sleep inf

Maybe also link it at /usr/local/etc/qubes-rpc/qubes.OpenURL to
get the same behavior for URLs.

2. To automatically shut down DisposableVMs based on
fedora-delayed-dvm when they have been running with no windows for 15
minutes, install the qubes-app-shutdown-idle package in the TemplateVM
(e.g. fedora-33), and:

$ qvm-service --enable fedora-delayed-dvm shutdown-idle

Rusty

Rusty Bird:

Ólafur Jens Sigurðsson:
> We would like to add a new disposable template in which the disposable vm's
> will be shut down with a delay of a few minutes, just enough for the person
> to start replying to the email and finding that they need the file and then
> open up the file manager from that disposable qube that was almost shut down
> and thus saving the file.
>
> How would we do this? Is there some option in Qubes-OS that supports this?

I'm not aware of a built-in option, but you could cobble two things
together:

Umm, but also: If you open the file in a DisposableVM for editing,
don't you already get the modified file back if you just press save
and close the DisposableVM window?

1. To make the destination qubes.OpenInVM service wait indefinitely
after the launched program is done, create an executable file at
/usr/local/etc/qubes-rpc/qubes.OpenInVM in e.g. fedora-delayed-dvm
containing:

#!/bin/sh
/etc/qubes-rpc/"\{0\#\#\*/\}" "@"
exec sleep inf

Maybe also link it at /usr/local/etc/qubes-rpc/qubes.OpenURL to
get the same behavior for URLs.

2. To automatically shut down DisposableVMs based on
fedora-delayed-dvm when they have been running with no windows for 15
minutes, install the qubes-app-shutdown-idle package in the TemplateVM
(e.g. fedora-33), and:

$ qvm-service --enable fedora-delayed-dvm shutdown-idle

Rusty

When we open an attachment from emails, like .odf files and such, and
start writing in them, meaning to send the edited file back to the
sender. Then there is a slight chance of a person saving the file,
closing the editor and then loosing the file because the qube has
shut down.

How do you do this?

a) Qubes Attachments (thunderbird-qubes)
b) qvm-open-in-dvm configured under Files & Attachments in Thunderbird
c) saving the file to a folder and invoking qvm-open-in-dvm or
equivalent context menu option

Your question makes sense with a) & b)

Umm, but also: If you open the file in a DisposableVM for editing, don't you already get the modified file back if you just press save and close the DisposableVM window?

This would be scenario c) ... in which case there is no issue as the
sending qube now has an updated (edited) version of the file as Rusty
Bird points out.

We would like to add a new disposable template in which the disposable vm's will be shut down with a delay of a few minutes,

You could achieve this by combining a named disposable qube [1] with the shutdown script [2] earlier linked by Rusty Bird.

[1] see DisposableVM Customization | Qubes OS as an example. These qubes are disposable (no persistence) but will remain running until you shut them down.

[2] GitHub - QubesOS/qubes-app-shutdown-idle ... available as a package from the standard Qubes OS repo.

/Sven