Skip to content
Merged
Changes from all commits
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
27 changes: 15 additions & 12 deletions qubes/tests/integ/qrexec.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def test_053_qrexec_vm_service_eof_reverse(self):
self.create_remote_file(
self.testvm2,
"/etc/qubes-rpc/test.EOF",
"#!/bin/sh\n" "echo test; exec >&-; cat >/dev/null",
"#!/bin/sh\necho test; exec >&-; cat >/dev/null",
)

with self.qrexec_policy("test.EOF", self.testvm1, self.testvm2):
Expand Down Expand Up @@ -238,7 +238,9 @@ def test_055_qrexec_dom0_service_abort(self):
"""

self.loop.run_until_complete(self.testvm1.start())
self.create_local_file("/etc/qubes-rpc/test.Abort", "sleep 1")
self.create_local_file(
"/etc/qubes-rpc/test.Abort", "#!/bin/sh\nsleep 1"
)

with self.qrexec_policy("test.Abort", self.testvm1, "dom0"):
try:
Expand Down Expand Up @@ -282,7 +284,7 @@ def test_065_qrexec_exit_code_vm(self):

with self.qrexec_policy("test.Retcode", self.testvm1, self.testvm2):
self.create_remote_file(
self.testvm2, "/etc/qubes-rpc/test.Retcode", "exit 0"
self.testvm2, "/etc/qubes-rpc/test.Retcode", "#!/bin/sh\nexit 0"
)
(stdout, stderr) = self.loop.run_until_complete(
self.testvm1.run_for_stdio(
Expand All @@ -297,7 +299,7 @@ def test_065_qrexec_exit_code_vm(self):
self.assertEqual(stdout, b"0\n")

self.create_remote_file(
self.testvm2, "/etc/qubes-rpc/test.Retcode", "exit 3"
self.testvm2, "/etc/qubes-rpc/test.Retcode", "#!/bin/sh\nexit 3"
)
(stdout, stderr) = self.loop.run_until_complete(
self.testvm1.run_for_stdio(
Expand Down Expand Up @@ -330,7 +332,7 @@ def test_070_qrexec_vm_simultaneous_write(self):
self.create_remote_file(
self.testvm2,
"/etc/qubes-rpc/test.write",
"""\
"""#!/bin/sh\n\
# first write a lot of data
dd if=/dev/zero bs=993 count=10000 iflag=fullblock
# and only then read something
Expand Down Expand Up @@ -380,7 +382,7 @@ def test_071_qrexec_dom0_simultaneous_write(self):
self.create_remote_file(
self.testvm2,
"/etc/qubes-rpc/test.write",
"""\
"""#!/bin/sh\n\
# first write a lot of data
dd if=/dev/zero bs=993 count=10000 iflag=fullblock
# and only then read something
Expand Down Expand Up @@ -439,7 +441,7 @@ def test_072_qrexec_to_dom0_simultaneous_write(self):
self.create_remote_file(
self.testvm2,
"/etc/qubes-rpc/test.write",
"""\
"""#!/bin/sh\n\
# first write a lot of data
dd if=/dev/zero bs=993 count=10000 iflag=fullblock &
# and only then read something
Expand Down Expand Up @@ -496,7 +498,7 @@ def test_080_qrexec_service_argument_allow_default(self):
self.create_remote_file(
self.testvm2,
"/etc/qubes-rpc/test.Argument",
'/usr/bin/printf %s "$1"',
'#!/bin/sh\n/usr/bin/printf %s "$1"',
)
with self.qrexec_policy("test.Argument", self.testvm1, self.testvm2):
stdout, stderr = self.loop.run_until_complete(
Expand All @@ -518,7 +520,7 @@ def test_081_qrexec_service_argument_allow_specific(self):
self.create_remote_file(
self.testvm2,
"/etc/qubes-rpc/test.Argument",
'/usr/bin/printf %s "$1"',
'#!/bin/sh\n/usr/bin/printf %s "$1"',
)

with self.qrexec_policy("test.Argument", "$anyvm", "$anyvm", False):
Expand All @@ -543,7 +545,7 @@ def test_082_qrexec_service_argument_deny_specific(self):
self.create_remote_file(
self.testvm2,
"/etc/qubes-rpc/test.Argument",
'/usr/bin/printf %s "$1"',
'#!/bin/sh\n/usr/bin/printf %s "$1"',
)
with self.qrexec_policy("test.Argument", "$anyvm", "$anyvm"):
with self.qrexec_policy(
Expand Down Expand Up @@ -574,12 +576,12 @@ def test_083_qrexec_service_argument_specific_implementation(self):
self.create_remote_file(
self.testvm2,
"/etc/qubes-rpc/test.Argument",
'/usr/bin/printf %s "$1"',
'#!/bin/sh\n/usr/bin/printf %s "$1"',
)
self.create_remote_file(
self.testvm2,
"/etc/qubes-rpc/test.Argument+argument",
'/usr/bin/printf "specific: %s" "$1"',
'#!/bin/sh\n/usr/bin/printf "specific: %s" "$1"',
)

with self.qrexec_policy("test.Argument", self.testvm1, self.testvm2):
Expand All @@ -602,6 +604,7 @@ def test_084_qrexec_service_argument_extra_env(self):
self.create_remote_file(
self.testvm2,
"/etc/qubes-rpc/test.Argument",
"#!/bin/sh\n"
'/usr/bin/printf "%s %s" '
'"$QREXEC_SERVICE_FULL_NAME" "$QREXEC_SERVICE_ARGUMENT"',
)
Expand Down