eventure / hide.client.linux

Hide.me CLI VPN client for Linux
https://hide.me
GNU General Public License v2.0
90 stars 35 forks source link

Unable to Disconnect when closing the terminal #3

Closed EngHans closed 2 years ago

EngHans commented 3 years ago

Greetings,

First of all, thanks a lot for this client, it's awesome. I am having the situation that when I close the terminal (without killing the process), the client keeps running. Is there a way to finish the process after closing the terminal?

Steps to reproduce:

  1. Execute the client from a terminal.
  2. Test connection in hide.me/check, it should indicate you are connected to the VPN.
  3. Close the terminal while the process is running.
  4. Test connection in hide.me/check, it indicates you are connected to the VPN.

Expected behavior: The client ends when closing the terminal.

Current behavior: Client keeps running after the terminal is closed.

tcohar commented 3 years ago

I'm not sure if we should have the client disconnect when the terminal closes (on SIGHUP). Security-wise that might be a bad move as your terminal emulator might have been closed accidentally. Here's a one-liner that shuts down the client nicely, even when it lost it's terminal:

kill -SIGINT $(pidof hide.me)

EngHans commented 3 years ago

Amazing, thank you so much for your response.

I may have a faulty client because when I close the terminal in my system the process keeps running but I have no more access to the internet (which would be the only reason to keep the client running), how do I know? I am unable to connect to any website and every new terminal I open takes long to start (this is because I use the screenfetch package which displays the public IP which becomes undeterminable).

Besides every command or software I run through a terminal will end when I close the terminal, I don't really have an example of one that does not do it. So for the sake of standardization would be a good idea.

On the other hand, if I want to keep the process running in the background I could easily do the Ctrl+Z and bg workflow to do it, then recover the process with its pid if I need it.

Lastly, I might be running kill -SIGINT $(pidof hide.me) badly, as I am receiving the following kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec], I don't know if you can provide me with some help in this regard.

As a last comment, I am really grateful with this client, thank you so much for it, please consider my comments and decide whether you feel like it's a good idea to implement it or not, it's your VPN client and at the end you are who decides how it should work, I am just giving the "user-side feedback". Thanks again for your consideration.

tcohar commented 3 years ago

Besides every command or software I run through a terminal will end when I close the terminal, I don't really have an example of one that does not do it. So for the sake of standardization would be a good idea.

Well there's lftp, for example. It doesn't have to quit when the terminal gets closed. If you prefix any command with "nohup" it won't stop when the terminal gets closed

Lastly, I might be running kill -SIGINT $(pidof hide.me) badly, as I am receiving the following kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec], I don't know if you can provide me with some help in this regard.

Try this: kill -n SIGINT $(pidof hide.me)

If it doesn't work out, try running just pidof hide.me, it should produce the process id of the client.

With the latest update we bundled hide.me@.service systemd template unit file. Now you can run the client through systemd. This is the best way to use it. If you wish to try it, take a look at the updated documentation.

EngHans commented 3 years ago

Hi, thank you for your patience, I'm still unable to shut it down with this command, when I run kill -n SIGINT $(pidof hide.me) I get the following kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]

And trying pidof hide.me does not return anything (completely blank).

I also tried some command you put in other answer (systemctl stop hide.me) but I receive Failed to stop hide.me.service: Unit hide.me.service not loaded., I think this works only in the update you talked about earlier, but I'm not sure.

Can you please give me a hand?, now I have to restart my computer to disconnect again.

tcohar commented 3 years ago

Unless you renamed hide.me binary to something else, sudo pidof hide.me must return the client's process ID when the client is running SystemD service files are available with the latest release, yes. I suggest you update your client.