jamesmcm / vopono

Run applications through VPN tunnels with temporary network namespaces
GNU General Public License v3.0
888 stars 46 forks source link

Launching a Program through a .desktop file with Vopono #241

Closed Lcchy closed 1 year ago

Lcchy commented 1 year ago

Hi there, First of all, thank you so much for this amazing tool! It is exactly what I have been looking for!

I am trying to set up Firefox to launch by default via Vopono. I therefore modified my firefox.desktop file and replaced:

Exec=firefox %u

with

Exec=/usr/bin/vopono exec --provider mullvad --server uk firefox %u

But when launching the app through the (Gnome) launcher, Firefox doesn't start. ps aux | grep firefox, vopono list or journalctl -f _COMM=firefox don't show anything. The only sign of any activity is:

$ journalctl -f _COMM=vopono
Nov 10 23:10:25 pc firefox.desktop[759032]:  2023-11-10T23:10:25.156Z INFO  vopono_core::util > Calling sudo for elevated privileges, current user will be used as default user

and nothing else.

In contrast, when running vopono exec --provider mullvad --server uk firefox via the CLI it all works perfectly.

If anyone has some advice or can help, I would be very grateful, thank you.


EDIT:

I did manage to get a few more error logs:

Nov 10 23:30:19 pc firefox.desktop[776273]:  2023-11-10T23:30:19.760Z INFO  vopono_core::util > Calling sudo for elevated privileges, current user will be used as default user
Nov 10 23:30:19 pc firefox.desktop[776311]: sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
Nov 10 23:30:22 pc firefox.desktop[776311]: sudo: a password is required
jamesmcm commented 1 year ago

Hey,

It seems the issue is that it expects the password over stdin, but can't get it when there is no terminal.

See: https://stackoverflow.com/questions/21659637/how-to-fix-sudo-no-tty-present-and-no-askpass-program-specified-error

So try either setting your user to NOPASSWD for sudo, so you can escalate privileges with no password, or set up an askpass program that sudo will use to request the password via a GUI.

Lcchy commented 1 year ago

Oh I see thanks! I did not realize vopono needed sudo rights to run as my terminal was already logged in when testing it. Adding the line Terminal=true to the .desktop made it possible to run, but the prompt for a sudo password each time I open Firefox makes the UX a bit difficult.

I will refer to #189 to see if an alternative way is possible. Thanks again!