Sends notifications to pushover when a client connects or disconnects from an openvpn server. The application is written in rust, purely as a learning exercise to get used to writing rust code.
It is strongly encouraged to only run this against openvpn servers which have only a few clients. Only one request to the pushover API will ever be made at one time, however if a lot of clients connect or disconnect at the same time it could result in a lot of messages being sent one after another. My use case was a raspberry pi openvpn server on my home network with a handful of regular clients. Always be friendly to the pushover API.
You will need:-
- A running openvpn server with access to its management port
- A pushover account
- A user key and application token from pushover
To compile from source you will require Rust stable and cargo
The easiest way to install the application is to pull the latest binary from the release page
Cargo can be used to install the application from source
git clone [email protected]:tmorgansl/openvpn-notifier.git
cd openvpn_notifier
cargo build --release
This will create the target binary in target/release
.
The installation has been tested on stable linux toolchain, v1.31.1.
The binary file requires your application token and user key passed as command line arguments
./openvpn-notifier --token=<TOKEN> --user_key=<USER_KEY>
Once the application is running, it will poll the openvpn management address (default localhost:5555
) every 5 seconds for changes in the number of clients.
Additional options can be found by using the help flag
./openvpn-notifier -h
Q. When some clients disconnect I get the notification hours later, what's going on?
A. When the openvpn server is in UDP mode, not all clients will send the disconnect notification by default. Instead, the client's session will be cleaned up after a long timeout period. To resolve this issue, add the following line to the client's .ovpn file
explicit-exit-notify 2
For more details, consult the openvpn manual.
This project is licensed under the MIT License - see the LICENSE file for details