Skip to content

Commit 913823b

Browse files
author
Vít Šesták
committed
Fixes nonpersistence of Qubes RPC policy file. Closes #27.
1 parent aecd1b2 commit 913823b

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Currently, it is public preview. It contains scripts that can:
66

7-
* Install the backup storage VM (see install-backup-storage-vm). Currently, it is needed to install it after every reboot of the BackupStorageVM, because policy file in /etc/qubes-rpc/ does not survive reboot.
7+
* Install the backup storage VM (see install-backup-storage-vm).
88
* Run the backup from dom0 (see backup).
99

1010
You might notice that DVM is also involved in the backup process, but no installation script is there. That's OK: All scripts needed in the DVM are uploaded automatically after DVM creation.

backupbackends/duplicity.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ def install_dom0(self, vm):
6767
subprocess.check_call("echo "+shlex.quote("$anyvm "+vm.get_name()+" allow")+" | sudo tee /etc/qubes-rpc/policy/v6ak.QubesInterVmBackupStorage", shell=True, stdout=subprocess.DEVNULL)
6868

6969
def install_backup_storage_vm(self, vm):
70-
# TODO: make it persistent across reboots
70+
vm.check_call("sudo mkdir -p /rw/config/qubes-bind-dirs.d")
71+
vm.check_call("echo \"touch /etc/qubes-rpc/v6ak.QubesInterVmBackupStorage; binds+=( '/etc/qubes-rpc/v6ak.QubesInterVmBackupStorage' )\" | sudo tee /rw/config/qubes-bind-dirs.d/10_vm-qubes-backup-poc.conf")
72+
vm.shutdown() # In order to apply binds
7173
vm.check_call("sudo mkdir -p /usr/local/share/v6-qubes-backup-poc/")
7274
vm.check_call("echo /usr/local/share/v6-qubes-backup-poc/v6-qubes-backup-poc.py | sudo tee /etc/qubes-rpc/v6ak.QubesInterVmBackupStorage")
7375
with open(self.base_path+"backup-storage-agent/v6-qubes-backup-poc.py") as inp:

qubesvmtools.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ def check_call(self, command, stdin = None, input = None, stdout = DEVNULL, stde
8181
ret = proc.wait()
8282
if ret != 0:
8383
raise subprocess.CalledProcessError(ret, command_native)
84+
def shutdown(self):
85+
subprocess.check_call(["qvm-shutdown", "--wait", self.name])
8486

8587
class DvmInstance(VmInstance):
8688
def __init__(self, name):

0 commit comments

Comments
 (0)