Giter Site home page Giter Site logo

Comments (7)

 avatar commented on August 20, 2024

Not a problem. Hey, @boolean-is-null. I just looked over the OpenVPN blocklet but haven't done so thoroughly yet (hence the lack of Wiki documentation for the blocklet). I plan to do so in the next couple days. The script looks like it checks for a pid file for each OpenVPN connection /run/openvpn/*.pid. This is how it checks if you have tunnels or not. I know you said you have them configured to be created. Can you double check if these file(s) exist?

from i3blocks-contrib.

boolean-is-null avatar boolean-is-null commented on August 20, 2024

Thank you for the feedback and the effort, really appreciated!
I've just checked and the file /run/openvpn/servername.pid exists and the tun0 device is up..

edit: any news on this issue? I've just checked again with an other vpn server/config and its still the same.

from i3blocks-contrib.

boolean-is-null avatar boolean-is-null commented on August 20, 2024

I'm not familiar with perl, nor the used script, but on my system the mentioned scripts (edit: i understand its shared memory):

my $openvpn_enabled='/dev/shm/openvpn_i3blocks_enabled';
my $openvpn_disabled='/dev/shm/openvpn_i3blocks_disabled';

do not really exist. openvpn_i3blocks_disabled is empty and openvpn_i3blocks_enabled doesn't exist at all.

PID files definitely exist as /run/openvpn/*.pid

from i3blocks-contrib.

 avatar commented on August 20, 2024

Sorry, I've been busy since the start of school.

The OpenVPN script. If it finds the PID file, it opens it and pulls out the PID. Then it checks the command line of the process /proc/$PID/cmdline for /--config\s*(.*\.conf)/ that is, it checks for the config.

From this config it looks for a dev declaration and pulls the interface from /dev\s+(\w+)/. Next it checks to see if /sys/class/net/$interface exists. If so, it will display that your VPN is up. If not, it assumes it is down.

To test, between lines 94 and 95, insert the following:

# check if interface exist
+print "$interface"
unless ($interface eq 'null') {

Then run the script. If you see an interface, see if /sys/class/net/$interface exists. If not, then this script will never work for you. If interface is null, check your config to ensure you have a line dev $interface.

If you do, cat /proc/$PID/cmdline (substitute $PID for a valid OpenVPN PID). See if there is something like --config /etc/openvpn/main.conf.

from i3blocks-contrib.

boolean-is-null avatar boolean-is-null commented on August 20, 2024

aaah! Thank you very much for this extensive explanation!

It works now, I had the problem that I ran the openvpn without --config, I just used openvpn configfile. During the testing I also used a config file ending in .ovpn which I overlooked.
The script also won't work with a relative path to the .conf file, which was another problem I had.

off topic: any clue why the PID files are not deleted for me, when the VPN disconnects?

from i3blocks-contrib.

 avatar commented on August 20, 2024

Haha, I wish I could help there. You would need to check with OpenVPN or your service manager about that. The PID file is their responsibility. It could be how OpenVPN is being closed. For example, if your service manager just SIGKILL's OpenVPN, I doubt it will ensure the PID files are deleted. Or OpenVPN could just be sloppy with PID files. Perhapse OpenVPN suspects that your /run is a tmpfs or that your service manager's initscript (or equivelent) will clean up. I don't use it enough to speak for sure.

As for the limited state of the openvpn script in i3blocks-contrib, I'll be keeping this issue open until I (or anyone else) finds time to better locate OpenVPN interfaces than that 3 step config hunt.

from i3blocks-contrib.

kb100 avatar kb100 commented on August 20, 2024

"It works now" assuming this means the issue has been resolved. Reopen if it is not resolved.

from i3blocks-contrib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.