linux-app
linux-app copied to clipboard
Add at least basic settings
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:
- 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.
- 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).
- 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.
Hey @toxpal
So to answer to some of your questions:
- 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 ? - TBD
- 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.
Thank you for your response, I trust in Proton again... :)
Hey @toxpal
So to answer to some of your questions:
- 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?
- 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:
Update: in Linux Mint, after adding it there ^, simply click the "modify" icon and change it to this:
... 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.
Hey @toxpal So to answer to some of your questions:
- 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 https://github.com/ProtonVPN/linux-cli/issues/44#issuecomment-911701915 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
.
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 https://github.com/ProtonVPN/linux-cli/issues/44, but I don't know.
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).
I did the pull request https://github.com/ProtonVPN/linux-cli/pull/55 that implements this service. You are all welcome to test it and give feedback.
@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
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
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.
Hey @toxpal So to answer to some of your questions:
- 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 withsystemctl --user daemon-reload
and enable it withsystemctl --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.
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
- 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?
Update: in Linux Mint, after adding it there ^, simply click the "modify" icon and change it to this:
... 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.
Hey @toxpal So to answer to some of your questions:
- 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 withsystemctl --user daemon-reload
and enable it withsystemctl --user enable protonvpn-autostart
.I could not get it working reliably with Kill Switch enabled at first, but the solution from https://github.com/ProtonVPN/linux-cli/issues/44#issuecomment-911701915 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..
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.