-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VPN doesn't start when using systemd / gui without sudo (Arch Linux / AirVPN) #66
Comments
Hi, the systemd-service doesn't actually establish connections by itself, it only listens to commands from qomui-gui or qomui-cli and manages basic configurations such as the firewall. Since you apparently haven't activated the firewall, though, the log is all but empty. |
Thanks for the quick response! Okay, what's the benefit of running it as a service? Also, why doesn't the GUI log that it's connecting to the service as it should? |
For security reasons, I want to avoid running the gui process with root privileges that are needed for using OpenVPN for example. Those commands are exposed and handled by qomui-service. Systemd is used for convenience so you can easily control and enable it as a system service. It's not actually needed, though. Of course, I could have also achieved that by simply starting qomui-service as a second process once you launch the gui but then you'd always have to enter your password to start qomui.
Yes, I forgot to add a log message for that. But actually, qomui-gui won't start without the service being active. The service also handles logging, so qomui failing to launch because it can't communicate with the service won't actually be logged. If you have any further questions or remarks, I'd be happy to hear those! |
Great that makes a lot of sense! You should add something about that to the readme :)
Ah okay, I was expecting to see the message here: Line 107 in 2fbc416
|
Moved the log message, so it will now appear in the log given that the service is actually running. Thanks for your suggestions! |
I actually still have to run the gui as admin even when the service is enabled/running or I get a permission error when trying to open the socket. |
You are not supposed to start qomui-gui as root/admin. What kind of permission error are you getting exactly? Does it refer to dbus? |
The service is running and I start the gui as user
The log for connection in the GUI has a code 99 socket error, if I do not 'cancel' the attempt to connect, the repeated connection attempts cause qomui-gui to hang and I have to kill the process.
Running the gui with admin rights resolves the issues. |
After further testing, if I don't run the gui as with sudo, I cannot download/update provider information either. It just hangs and needs to be killed, no errors displayed. |
Can you try the following:
Post the output of both when you are trying to download/update provider configs here.
It seems you have disabled ipv6 on your system but are using an ipv6 OpenVPN config (this line: "OpenVPN: write UDPv6: Cannot assign requested address (code=99)"). This cannot work. I don't recommend disabling ipv6 as it can causes issues. The firewall takes care of possible ipv6 leaks. If that's not the case, please post the content of /usr/share/qomui/temp.ovpn after an unsuccessful connection attempt. |
When I attempt to download the provider config, the program hangs without output. (the progress bar freezes) I do not have ipv6 disabled (except by qomui). I can't get the non-admin qomui to display providers anymore since I deleted the AirVPN config while trying to debug so I can't get the contents after the unsuccessful connection. I tried reinstalling and all the issues persist. Can you give instructions to delete all config data? |
After deleting all the config info and reinstalling I was able to download the provider information without a problem. When I try to save the config information (the 'save' button on that page) I get the following
I tried this many times. The gui always freezes after this. The provider information does seem to save though, because it is present when I open the gui a second time. However, I still cannot connect to the server without admin privileges. Edit: |
Okay, at this point I can get a non-admin gui to connect to the server, the gui hangs for about 2 minutes during the connection (which does not happen when I have admin rights) but eventually comes back and works! Additionally, even after installing a polkit agent gui, the qomui gui hangs after authentication. |
Delete these two directories: "/usr/share/qomui" & "~/.qomui"
Have you rebooted or reinitialized dbus? This may help. Otherwise, there might be an issue with Qomui's policy file. Can you post its content: "/usr/share/dbus-1/system.d/org.qomui.service.conf" Or as you suggest there is something wrong with polkit. I'll try to investigate this issue but I never encountered this behavior on any machine I tested Qomui on or got polkit authentication requests. |
Yeah, I've done that and rebooted multiple times.
Thanks for your help, I'm pretty confused by it myself. Happy to try any debugging or changes you can recommend, I'm quite proficient in python and have been looking at the code and don't see why it would hang after a successful authentication. I am confused that you wouldn't get polkit authentication requests when you call pkexec to save config changes? |
Me, too. But I suspect the reason is that Qomui is trying to call the service via D-Bus on launch and it's somehow denied by polkit. The policy looks fine, though. Which distribution/DE are you using currently? Could you try installing a graphical polkit agent as described in the Arch Wiki for example.
This line is strange. It suggests that no polkit agent is running at all. Have you tried running an arbitrary command with pkexec from console such as "pkexec ls"? Edit: Alternatively you could try to write a custom policy in "/etc/polkit-1/rules.d/49-qomui_nopasswd.rule". I put an example on pastebin. |
I'm using Arch with i3, everything up to date. I installed the gnome polkit agent as described in that wiki a while ago. I am not getting polkit requests when launching the gui, just when saving the config. The log demonstrates successful connection to the dbus service.
To summarize my current issues
I was looking into that as well, I don't think it will change anything but I'll try it later today. |
Sorry, I somehow missed that edit where you described that you already tried installing a polkit agent.
To me that sounds like a D-Bus issue; possibly, authentication via polkit takes a long time even if successful eventually. The operations you mention all require communication via D-Bus. If the gui hangs that could indicate that the D-Bus call is blocking the event loop. That it works smoothly with sudo confirms this as you are automatically authenticated in that case. I'm not quite sure how to troubleshoot this exactly, but I'll try setting up an Arch/i3 installation to replicate this problem.
Does the graphical polkit agent ever come up or are you using this workaround? |
I'll investigate this as well.
The agent gui appears and works as intended, but after it closes the qomui gui hangs. |
While the GUI is frozen during connection, the VPN connection is functional e.g. I can visit ipleak and see my AirVPN server. It is only the GUI that is blocking. Additionally, it appears if I wait long enough sometimes the configuration will save. The polkit rules file does not change anything, I even still get a prompt for a password when saving the config. I presume this because the rules file you wrote is for the service and the gui is the one making the config save call? If I dismiss the request qomui-gui also hangs. |
Update: Just did a minimal installation of Arch/i3. Here's what I found:
Now, I'm quite clueless to be honest. |
I would have been surprised if it was i3 that was causing the problems. Also quite clueless. I'll pursue it on my own a bit more and see what I can find. |
Perhaps I'm just misunderstanding how the service is supposed to work, but enabling the systemd unit and rebooting does not result in a VPN connection. I've had no problems with the GUI and I expected the service would just load the config and run at boot.
Log
Service status
When I launch the GUI, the log contains no mention of connecting to Dbus service (I've changed the log level to DEBUG and am getting other debug messages)
The text was updated successfully, but these errors were encountered: