Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Add at least basic settings #4

Open
toxpal opened this issue Jun 1, 2021 · 22 comments
Open

Add at least basic settings #4

toxpal opened this issue Jun 1, 2021 · 22 comments

Comments

@toxpal
Copy link

toxpal commented Jun 1, 2021

Just installed the app on Manjaro KDE and... well, it's completely useless because no single setting exists in the app. While Android app is great, Linux app lacks these settings:

  1. Start on boot. Now, even if I set kill switch as permanent, it has no effect because it only works when app is launched. Forgot to launch app manually every single time after (re)booting OS? Too bad, you are not protected.
  2. Create default profile. My workplace only allows connections from whitelisted IPs, so it's extremely important my IP is the same every single time after VPN connection is established (in other words, I don't want to connect to a random server every time).
  3. Allow minimizing app into the tray. Now, it either runs as a "normal" app in a separate window, either it doesn't work at all because closing app.. well, literally closes it.

While I like your service (migrated from Nord VPN) and your policy/transparency, I was actually shocked to see that you released Linux app which only provides a false sense of security and actually does almost nothing. But your Android app is OK, so I surely know you can do it.

@calexandru2018
Copy link
Collaborator

Hey @toxpal

So to answer to some of your questions:

  1. It is planned, but until then you could use something that linux already offers out-of-the box, a .service configuration within --user space. Also not sure by what you mean about the killswitch, could you please provide more details ?
  2. TBD
  3. That actually works atm but only on DE that actually support it natively. If you look at the SPEC file you can see that the dependency is there, but given that linux does not have a "native" tray implementation in place (due to DE fragmentation) it often is hard to enforce having a systray, it is although achievable.

@toxpal
Copy link
Author

toxpal commented Jun 7, 2021

Thank you for your response, I trust in Proton again... :)

@asorel1942
Copy link

Hey @toxpal

So to answer to some of your questions:

  1. It is planned, but until then you could use something that linux already offers out-of-the box, a .service configuration within --user space. Also not sure by what you mean about the killswitch, could you please provide more details ?

How exactly would one go about doing this? I currently have Protonvpn configured to start on boot using Manjaro's Autostart feature, however the VPN will not automatically turn on, and must be activated manually. Is there a way to auto-activate the connection in addition to simply auto-opening the application? If not, is this feature in the works?

@gavinr
Copy link

gavinr commented Aug 26, 2021

  1. Start on boot. Now, even if I set kill switch as permanent, it has no effect because it only works when app is launched. Forgot to launch app manually every single time after (re)booting OS? Too bad, you are not protected.

How exactly would one go about doing this? I

In Linux Mint I can go to "Startup Applications" and add it there:
image

@gavinr
Copy link

gavinr commented Sep 1, 2021

Update: in Linux Mint, after adding it there ^, simply click the "modify" icon and change it to this:
Selection_009

... this seems to work for me! It does not run the GUI, but you are connected to the VPN (check by going to https://ip.me) and if you open the GUI it does say connected.

@natanjunges
Copy link

natanjunges commented Oct 27, 2021

Hey @toxpal
So to answer to some of your questions:

  1. It is planned, but until then you could use something that linux already offers out-of-the box, a .service configuration within --user space. Also not sure by what you mean about the killswitch, could you please provide more details ?

How exactly would one go about doing this? I currently have Protonvpn configured to start on boot using Manjaro's Autostart feature, however the VPN will not automatically turn on, and must be activated manually. Is there a way to auto-activate the connection in addition to simply auto-opening the application? If not, is this feature in the works?

I created a systemd service in user space, as @calexandru2018 mentioned. It works quite well, it waits for network-online.target (it needs NetworkManager to be fully initialized), connects automatically, opens the GUI and disconnects automatically on logout. It also restarts itself in case it fails to start.

[Unit]
Description=ProtonVPN autostart

[Service]
Type=oneshot
RemainAfterExit=yes
# Waits until it is online. It is required because system targets cannot be used in user services.
ExecStartPre=sh -c "until systemctl is-active network-online.target; do sleep 1; done"
ExecStart=protonvpn-cli c -f
ExecStartPost=-sh -c "protonvpn &"
TimeoutStartSec=30
ExecStop=protonvpn-cli d
Restart=on-failure

[Install]
WantedBy=default.target

To use it, just save it in ~/.config/systemd/user/protonvpn-autostart.service, reload the systemd daemon with systemctl --user daemon-reload and enable it with systemctl --user enable protonvpn-autostart.

I could not get it working reliably with Kill Switch enabled at first, but the solution from ProtonVPN/linux-cli#44 (comment) seems to have worked. Just insert these two lines after RemainAfterExit=yes:

ExecStartPre=-protonvpn-cli ks --off
ExecStartPre=-protonvpn-cli ks --on

Then reload the systemd daemon with systemctl --user daemon-reload.

@pehlm
Copy link

pehlm commented Oct 29, 2021

I like your solution but I can't get it to work on my Kubuntu 20.04 system. No graphical-session.target is active, what should I do if it isn't active?

I think it's more reliable to use autostart as on ProtonVPN/linux-cli#44, but I don't know.

@natanjunges
Copy link

natanjunges commented Oct 31, 2021

I updated the service to address this issue. It is now using the more generic default.target, as some distributions don't implement the graphical-session.target yet (and the graphical session is only required to open the GUI, which is optional).

@natanjunges
Copy link

I did the pull request ProtonVPN/linux-cli#55 that implements this service. You are all welcome to test it and give feedback.

@francoisromain
Copy link

@natanjunges Thank you for this very useful script.

I still have a small a problem :

On Ubuntu 21.10, protonMail bridge starts with Startup Applications. With protonvpn starting with your script, protonmail Bridge indicates an error : no network, with a red dot on its icon. I have to restart it manually to remove this error.

Is there a way to start protonMail bridge from systemd after protonvpn?

thank you

@natanjunges
Copy link

Hi @francoisromain,
I don't use ProtonMail Bridge, but I think it can indeed be started as a systemd user service. It would need the following line in the Unit section to make sure it will wait for the ProtonVPN service:

After=protonvpn-autostart.service

@quadratz
Copy link

quadratz commented Mar 9, 2022

I created a systemd service in user space, as @calexandru2018 mentioned. It works quite well, it waits for network-online.target (it needs NetworkManager to be fully initialized), connects automatically, opens the GUI and disconnects automatically on logout. It also restarts itself in case it fails to start.

[Unit]
Description=ProtonVPN autostart

[Service]
Type=oneshot
RemainAfterExit=yes
# Waits until it is online. It is required because system targets cannot be used in user services.
ExecStartPre=sh -c "until systemctl is-active network-online.target; do sleep 1; done"
ExecStart=protonvpn-cli c -f
ExecStartPost=-sh -c "protonvpn &"
TimeoutStartSec=30
ExecStop=protonvpn-cli d
Restart=on-failure

[Install]
WantedBy=default.target

I have Fedora 35 with KDE spin installed. With that script, every time I log into the desktop, KDE Wallet always asks for a password. This probably occurs because of this KDE bug. My temporary solution is replacing ExecStartPre=sh -c "until systemctl is-active network-online.target; do sleep 1; done" with ExecStartPre=sh -c "until ping -c 1 9.9.9.9; do sleep 1; done" which will waits until it is connected to the internet. The complete script will look like this:

[Unit]
Description=ProtonVPN autostart

[Service]
Type=oneshot
RemainAfterExit=yes
# Waits until internet is connected.
ExecStartPre=sh -c "until ping -c 1 9.9.9.9; do sleep 1; done"
ExecStart=protonvpn-cli c -f
TimeoutStartSec=30
ExecStop=protonvpn-cli d
Restart=on-failure

[Install]
WantedBy=default.target

I'm not expert at coding. Just wanted to share this little hack, in case someone else encounters the same problem. Please, feel free to correct and improve the code.

@ShabirK21
Copy link

Hey @toxpal
So to answer to some of your questions:

  1. It is planned, but until then you could use something that linux already offers out-of-the box, a .service configuration within --user space. Also not sure by what you mean about the killswitch, could you please provide more details ?

How exactly would one go about doing this? I currently have Protonvpn configured to start on boot using Manjaro's Autostart feature, however the VPN will not automatically turn on, and must be activated manually. Is there a way to auto-activate the connection in addition to simply auto-opening the application? If not, is this feature in the works?

I created a systemd service in user space, as @calexandru2018 mentioned. It works quite well, it waits for network-online.target (it needs NetworkManager to be fully initialized), connects automatically, opens the GUI and disconnects automatically on logout. It also restarts itself in case it fails to start.

[Unit]
Description=ProtonVPN autostart

[Service]
Type=oneshot
RemainAfterExit=yes
# Waits until it is online. It is required because system targets cannot be used in user services.
ExecStartPre=sh -c "until systemctl is-active network-online.target; do sleep 1; done"
ExecStart=protonvpn-cli c -f
ExecStartPost=-sh -c "protonvpn &"
TimeoutStartSec=30
ExecStop=protonvpn-cli d
Restart=on-failure

[Install]
WantedBy=default.target

To use it, just save it in ~/.config/systemd/user/protonvpn-autostart.service, reload the systemd daemon with systemctl --user daemon-reload and enable it with systemctl --user enable protonvpn-autostart.

I could not get it working reliably with Kill Switch enabled at first, but the solution from ProtonVPN/linux-cli#44 (comment) seems to have worked. Just insert these two lines after RemainAfterExit=yes:

ExecStartPre=-protonvpn-cli ks --off
ExecStartPre=-protonvpn-cli ks --on

Then reload the systemd daemon with systemctl --user daemon-reload.

Hi, thanks for the awesome script, it works, but for the killswitch, adding those lines don't seem to enable it, when i check the status with protonvpn-cli.

@Nottt
Copy link

Nottt commented Aug 5, 2022

So on Zorin OS 16.1 I tried this:

[Unit]
Description=ProtonVPN autostart

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStartPre=-protonvpn-cli ks --off
ExecStartPre=-protonvpn-cli ks --on
# Waits until it is online. It is required because system targets cannot be used in user services.
ExecStartPre=sh -c "until ping -c1 google.com; do sleep 1; done"
ExecStart=protonvpn-cli c -f
ExecStartPost=-sh -c "protonvpn &"
TimeoutStartSec=30
ExecStop=protonvpn-cli d
Restart=on-failure

[Install]
WantedBy=default.target

But the service fails to start with protonvpn_nm_lib.exceptions.KeyringError: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

@toxpal
Copy link
Author

toxpal commented Aug 28, 2022

  • It is planned, but until then you could use something that linux already offers out-of-the box, a .service configuration within --user space.
  • TBD

So more than 14 months have passed, I installed the app again, and.. nothing?

@matheuswillder
Copy link

Update: in Linux Mint, after adding it there ^, simply click the "modify" icon and change it to this: Selection_009

... this seems to work for me! It does not run the GUI, but you are connected to the VPN (check by going to https://ip.me) and if you open the GUI it does say connected.

Nice! And if the DE used does not allow you modify the startup command after activating it you can go to the ~/.config/autostart/protonvpn.desktop file and modify in a text editor. The systemd service above also looks good but since the pull request has not been merged I think this is the simplest solution since it's just a file in the /home folder.

@ghost
Copy link

ghost commented Sep 15, 2022

Hey @toxpal
So to answer to some of your questions:

  1. It is planned, but until then you could use something that linux already offers out-of-the box, a .service configuration within --user space. Also not sure by what you mean about the killswitch, could you please provide more details ?

How exactly would one go about doing this? I currently have Protonvpn configured to start on boot using Manjaro's Autostart feature, however the VPN will not automatically turn on, and must be activated manually. Is there a way to auto-activate the connection in addition to simply auto-opening the application? If not, is this feature in the works?

I created a systemd service in user space, as @calexandru2018 mentioned. It works quite well, it waits for network-online.target (it needs NetworkManager to be fully initialized), connects automatically, opens the GUI and disconnects automatically on logout. It also restarts itself in case it fails to start.

[Unit]
Description=ProtonVPN autostart

[Service]
Type=oneshot
RemainAfterExit=yes
# Waits until it is online. It is required because system targets cannot be used in user services.
ExecStartPre=sh -c "until systemctl is-active network-online.target; do sleep 1; done"
ExecStart=protonvpn-cli c -f
ExecStartPost=-sh -c "protonvpn &"
TimeoutStartSec=30
ExecStop=protonvpn-cli d
Restart=on-failure

[Install]
WantedBy=default.target

To use it, just save it in ~/.config/systemd/user/protonvpn-autostart.service, reload the systemd daemon with systemctl --user daemon-reload and enable it with systemctl --user enable protonvpn-autostart.

I could not get it working reliably with Kill Switch enabled at first, but the solution from ProtonVPN/linux-cli#44 (comment) seems to have worked. Just insert these two lines after RemainAfterExit=yes:

ExecStartPre=-protonvpn-cli ks --off
ExecStartPre=-protonvpn-cli ks --on

Then reload the systemd daemon with systemctl --user daemon-reload.

Hey, I tried this but it didn't work on Debian 11 (GNOME). Is it still working or am I missing something?

I followed the instructions and played with settings a little bit to see of it changes anything, but it doesn't connect at all..

@Juankz
Copy link

Juankz commented Oct 4, 2022

In my case this service unit failed because it starts before the user login, hence the vpn password is locked. My solution was to change the last line from WantedBy=default.target to WantedBy=xdg-desktop-autostart.target. Then disable and enable the service.

@Snaggly
Copy link

Snaggly commented Jun 22, 2023

Hello,
any news regarding to this?

@calexandru2018
Copy link
Collaborator

Hey all, since our focus now lies in the new linux client we won't be issuing any updates to the current client. But rest assured that we're working on implementing a settings window for this new client. Currently we're finishing the implementation of some features that should be released soon (new client only, do note). You can find more info here: #76

@toxpal
Copy link
Author

toxpal commented Jun 22, 2023

That would be great... except that development of new client takes years (what kind of programmers are assigned to this job) without any result. Meanwhile, old client has no updates for years.

@IkelAtomig
Copy link

@calexandru2018 Will the CLI be merged with the new one ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests