Re: [qubes-users] qvm-open-in-vm behavior with URLs

2019-09-18 Thread 'Oli Sturm' via qubes-users
> On Wednesday, September 18, 2019 2:14 PM, unman un...@thirdeyesecurity.org 
> wrote:
> 

> > 2.  Cant help you with brave.
> > There's obviously something wrong with your browser/firefox
> > configuration in "untrusted"."x-www-browser: command not found" is
> > obviously wrong. 


I looked into this. It's complicated. At the core of it however is Brave - you 
were right about that. Turns out Brave has a segfault bug that comes up when a 
window is already open: https://github.com/brave/brave-browser/issues/4142

In a nutshell, the RPC process ends up in xdg-open, which has a million 
fallbacks - and the segfault results in a non-zero exit code, so xdg-open keeps 
looking. 


Here are steps to work around the issue, until they fix that bug:

1. x-www-browser isn't really needed, but I thought it couldn't hurt to have 
it. So I created one in /usr/local/bin/x-www-browser:

#!/bin/sh
/usr/bin/brave-browser-stable $@ || true

As you can see, this ignores the error result from the segfault bug.

2. I created a copy of the Brave .desktop file:

sudo cp /usr/share/applications/brave-browser.desktop 
/usr/local/share/applications

3. I edited that clone and replaced calls to 
/usr/local/bin/brave-browser-stable with calls to /usr/local/bin/x-www-browser

Now everything works. Since all my changes are in /usr/local, they can be 
applied in VMs or TemplateVMs.

Cheers
Oli

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/EM7hMLraPgcFcGFpV0Wu4Nl-e8mo7zsUAE-VetqJ8oHEerFFggXr6xBLqb_Dc6xb1BtvI8BAuEGTnX7gZ4__cVcFBGW6JGwpNQ3m-JJQ0rw%3D%40oliversturm.com.


signature.asc
Description: OpenPGP digital signature


Re: [qubes-users] qvm-open-in-vm behavior with URLs

2019-09-18 Thread 'Oli Sturm' via qubes-users
On Wednesday, September 18, 2019 2:14 PM, unman  
wrote:

> 1.  It's a security feature, asking for confirmation.
> If you dont want it -
> Set in /etc/qubes-rpc/policy/qubes.OpenURL:
> whatever $anyvm allow,target=untrusted
> 

> This will set untrusted as default handler for URLs with no prompt at
> all.

Right, thanks. I would personally prefer it if the argument passed to 
qvm-open-in-vm was used to pre-select. Not a big thing though.

> 2.  Cant help you with brave.
> There's obviously something wrong with your browser/firefox
> configuration in "untrusted"."x-www-browser: command not found" is
> obviously wrong. Try fixing that and setting to brave.
> It works as intended in Debian-10 with chromium, with no spurious
> firefox entries. Give it a try.

Fair enough. I wasn't assuming that the issue was specific to Brave, but who 
knows. 


Thanks
Oli

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/rVcOkF2Xz_gV9--c3ruBjqHiCyZg-440k-GyaHpWJsQfGD9NUhzAh_bn_fBqkWeBdAnV1Ss9S6EpWC7RlIJLNiUTf32N-MuUTl3mYVRSXWw%3D%40oliversturm.com.


signature.asc
Description: OpenPGP digital signature


Re: [qubes-users] qvm-open-in-vm behavior with URLs

2019-09-18 Thread unman
On Wed, Sep 18, 2019 at 11:46:20AM +, 'Oli Sturm' via qubes-users wrote:
> Hi,
> 
> I'm trying to set up URL handling along the lines 
> of??https://micahflee.com/2016/06/qubes-tip-opening-links-in-your-preferred-appvm/??for
>  my email vm. However, the qvm-open-in-vm command behaves strangely in two 
> different ways.
> 
> 1. Much less important than (2) but still irritating: I execute 
> "qvm-open-in-vm untrusted http://example.com;, where "untrusted" is of course 
> the name of my VM. The confirmation dialog pops up and requires me to select 
> or type "untrusted" a second time before I can open the URL. I found that if 
> I pass a string that is not the name of a VM, the command doesn't even 
> execute - so is this an additional security feature? Or rather a bug? 
> Shouldn't "untrusted" by preselected in the confirmation dialog?
> 
> 2. In the "untrusted" VM, the default browser is Brave:
> 
> [user@untrusted]~% xdg-settings get default-web-browser
> brave-browser.desktop
> 
> When I execute the command qvm-open-in-vm untrusted http://example.com??in my 
> email VM and confirm the operation, three things happen:
> 
> a. The running Brave browser in "untrusted" shows a new tab for 
> http://example.com??- excellent, that's the idea.
> b. A new window opens for Firefox running in "untrusted", also showing 
> http://example.com??- this is rather unexpected and inexplicable to me.
> c. The console shows various warnings, errors and crashes:
> 
> [user@sensitive]~% qvm-open-in-vm untrusted http://example.com
> 
> [3800:3800:0918/122055.414677:ERROR:sandbox_linux.cc(369)] 
> InitializeSandbox() called with multiple threads in process gpu-process.
> 
> /usr/bin/xdg-open: line 756:?? 3769 Segmentation fault?? (core 
> dumped) "$command_exec" "$@"
> 
> /usr/bin/xdg-open: line 881: x-www-browser: command not found
> 
> [Parent 3923, Gecko_IOThread] WARNING: pipe error (45): Connection reset by 
> peer: file 
> /builddir/build/BUILD/firefox-68.0.2/ipc/chromium/src/chrome/common/ipc_channel_posix.cc,
>  line 358
> 
> Any ideas what's going wrong here? My setup is R4.0 with all updates 
> installed today. Both VMs used in my tests are based on Fedora 29.
> 
> Thanks
> Oli
> 

1. It's a security feature, asking for confirmation.
If you dont want it -
Set in /etc/qubes-rpc/policy/qubes.OpenURL:
whatever $anyvm allow,target=untrusted

This will set untrusted as default handler for URLs with no prompt at
all.


2. Cant help you with brave.
There's obviously something wrong with your browser/firefox
configuration in "untrusted"."x-www-browser: command not found" is
obviously wrong. Try fixing that and setting to brave.
It works as intended in Debian-10 with chromium, with no spurious
firefox entries. Give it a try.

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/20190918131418.GA32293%40thirdeyesecurity.org.


[qubes-users] qvm-open-in-vm behavior with URLs

2019-09-18 Thread 'Oli Sturm' via qubes-users
Hi,

I'm trying to set up URL handling along the lines of 
https://micahflee.com/2016/06/qubes-tip-opening-links-in-your-preferred-appvm/ 
for my email vm. However, the qvm-open-in-vm command behaves strangely in two 
different ways.

1. Much less important than (2) but still irritating: I execute "qvm-open-in-vm 
untrusted http://example.com;, where "untrusted" is of course the name of my 
VM. The confirmation dialog pops up and requires me to select or type 
"untrusted" a second time before I can open the URL. I found that if I pass a 
string that is not the name of a VM, the command doesn't even execute - so is 
this an additional security feature? Or rather a bug? Shouldn't "untrusted" by 
preselected in the confirmation dialog?

2. In the "untrusted" VM, the default browser is Brave:

[user@untrusted]~% xdg-settings get default-web-browser
brave-browser.desktop

When I execute the command qvm-open-in-vm untrusted http://example.com in my 
email VM and confirm the operation, three things happen:

a. The running Brave browser in "untrusted" shows a new tab for 
http://example.com - excellent, that's the idea.
b. A new window opens for Firefox running in "untrusted", also showing 
http://example.com - this is rather unexpected and inexplicable to me.
c. The console shows various warnings, errors and crashes:

[user@sensitive]~% qvm-open-in-vm untrusted http://example.com

[3800:3800:0918/122055.414677:ERROR:sandbox_linux.cc(369)] InitializeSandbox() 
called with multiple threads in process gpu-process.

/usr/bin/xdg-open: line 756:  3769 Segmentation fault  (core dumped) 
"$command_exec" "$@"

/usr/bin/xdg-open: line 881: x-www-browser: command not found

[Parent 3923, Gecko_IOThread] WARNING: pipe error (45): Connection reset by 
peer: file 
/builddir/build/BUILD/firefox-68.0.2/ipc/chromium/src/chrome/common/ipc_channel_posix.cc,
 line 358

Any ideas what's going wrong here? My setup is R4.0 with all updates installed 
today. Both VMs used in my tests are based on Fedora 29.

Thanks
Oli

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/qa6f1zqGI8OL-oGXtBLUDKpY2dTr0cTOaLZLtv8sH_ffvsvgy_A6BxwaZFOG1HB3mqzhnwjANPkah8V801Jca-Z4hzd8eMWOBn3oJhw6ZTk%3D%40oliversturm.com.


signature.asc
Description: OpenPGP digital signature