Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions qubes/storage/zfs_encrypted.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ async def _ask_password(self, receiving_cmd):
if not self.app_reference:
# TODO this sucks, is there an easier way to get a reference to the
# global 'app' qubes.Qubes() instance?
self.log.warning("had no REFERENCE ETC to APP VARIABLE!!")
self.app_reference = qubes.Qubes()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely wrong. Every VM have vm.app attribute - use that instead.

pw_vm = self.app_reference.domains[self.ask_password_domain]
if not pw_vm:
Expand All @@ -78,12 +79,30 @@ async def _ask_password(self, receiving_cmd):
try:
# TODO how do we pass $1 to this stuff? we can pass **kwargs to
# asyncio.create_subprocess_exec, but we can't influence command
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Service calls can receive arguments after + char. See https://www.qubes-os.org/doc/qrexec/#service-policies-with-arguments

await pw_vm.run_service_for_stdio(
'qubes.AskPassword',
autostart=True, gui=True,
user='user',
input=self.name.encode()+b'\n', # context for the prompt
stdout=pw_pipe_out)
# await pw_vm.run_service_for_stdio(
# TODO THIS used to work, now it fucking broke.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you direct dom0, it needs R4.1 commit 50adc60. If you want to test on R4.0, you need to backport this commit.
Or maybe some other problem?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems likely. It used to work on 4.0, but after updating earlier this week it stopped working with the exception that run_service_for_stdio for the AdminVM class was not defined.

# 'qubes.AskPassword',
# autostart=True, gui=True,
# user='user',
# input=self.name.encode()+b'\n', # context for the prompt
# stdout=pw_pipe_out)
# TODO instead for now:
environ = os.environ.copy()
environ["QREXEC_REMOTE_DOMAIN"] = "dom0"
environ["DISPLAY"] = ":0"
proc = await asyncio.create_subprocess_exec(
*['sudo','-Eiu','user', '/etc/qubes-rpc/qubes.AskPassword'],
stdout=pw_pipe_out,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE,
close_fds=True,
env=environ,
)
proc.stdin.write(self.name.encode()+b'\n')
await proc.stdin.drain()
# TODO flush aka drain+write_eof() apparently, wtf python
proc.stdin.write_eof()
await proc.wait()
except subprocess.CalledProcessError as e:
# TODO os.close(pw_pipe_in pw_pipe_out)
os.close(pw_pipe_in)
Expand Down
Empty file modified setup.py
100644 → 100755
Empty file.