Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

OpenVPN Client Monitor will check the network connection periodically and can shutodnw/restart the OpenVPN client service if the connection is down, it can also check if the ip is leaking and restart it or shutdown the computer.

Notifications You must be signed in to change notification settings

00000vish/openvpn-client-monitor

Repository files navigation

OpenVPN Client Monitor

OpenVPN Client Monitor will check the network connection periodically and can shutodnw/restart the OpenVPN client service if the connection is down, it can also check if the ip is leaking and restart it or shutdown the computer.

⚠️ Warnings

  • For Linux running [email protected] only! (currently)

    • but can be easily changed your requirements.
  • Does not garantee this will prevent ip leaking!

Features

  • Defualt: Checks every 5 mins and restarts [email protected] if connection is down.
  • Very customizable via command line args.
  • Configurable checking interval.
  • Configurable restart/shutdown/more to come.

Installation

Using installer.sh (Debian)

Run installer.sh as sudo to install and setup auto start

sudo chmod +x ./installer.sh
sudo ./installer.sh

Manual Installation

Install requirements to run/build the OpenVPN Client Monitor with

python3 -m pip install -r requirements.txt

Building Binary

Make sure you installed requrement.txt first and then run

pyinstaller -F main.py

The single file binary will be in ./dist/main.

You can run it by (sudo required)

sudo ./dist/main

Setup Autostart

Copy the binary over ./user/bin/

sudo cp ./dist/main /usr/bin/openvpn-client-mon

Copy systemd file over to ./etc/systemd/system/

cp ./etc/systemd/system/openvpnclientmon.service /etc/systemd/system/openvpnclientmon.service

Enable and Start OpenVPN Client Monitor

sudo systemctl enable openvpnclientmon.service
sudo systemctl start openvpnclientmon.service

Running it as a script (not recommended)

Install requrements as sudo first

sudo python3 -m pip install -r requirements.txt

You can run it by (sudo required)

sudo python3 main.py

Command Line Args

To print command line args options

./main -h

To check the network connection every 100 seconds

./main -t 100

To check the network connection every 100 seconds and shutdown computer

./main -t 100 -a 2

To check the network connection every 100 seconds and restart

./main -t 100 -a 1

Development

Want to contribute? Great!, pull requests are welcomed! Thank you!

TODO

  • implement logging/log file
  • implement more actions
  • load settings from a config yaml file

License

MIT

About

OpenVPN Client Monitor will check the network connection periodically and can shutodnw/restart the OpenVPN client service if the connection is down, it can also check if the ip is leaking and restart it or shutdown the computer.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published