Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bradsec/ovpnmanager
Python3 IPVanish OpenVPN Manager and VPN Server Randomizer
https://github.com/bradsec/ovpnmanager
debian ipvanish python3 raspberry-pi raspberrypi raspbian system-administration vpn vpn-manager
Last synced: about 1 month ago
JSON representation
Python3 IPVanish OpenVPN Manager and VPN Server Randomizer
- Host: GitHub
- URL: https://github.com/bradsec/ovpnmanager
- Owner: bradsec
- License: mit
- Created: 2019-11-03T07:51:30.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-16T07:02:01.000Z (over 3 years ago)
- Last Synced: 2024-11-10T13:12:07.584Z (3 months ago)
- Topics: debian, ipvanish, python3, raspberry-pi, raspberrypi, raspbian, system-administration, vpn, vpn-manager
- Language: Python
- Homepage:
- Size: 277 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OVPNMANAGER
### ovpnmanager.py for IPVanish
A terminal OpenVPN manager currently IPVanish.
This file is compatable with Debian based systems including Ubuntu and Raspberry Pi OS.
(Tested with Python 3.6+ on Raspberry Pi 3/4 running Raspberry Pi OS Buster).
Also compatable with pfSense (FreeBSD) firewall.### Features:
- Uses Python 3.6+ (built in modules only required).
- Start/stop OpenVPN service
- Fetch and sort IPVanish server list
- Rank servers based on ping latency
- Select random server from top ranked list
- Updates OpenVPN configuration file
- Includes other network functions which can be customised
- Can be run via a cron job at scheduled intervals### Usage:
- Run `sudo python3 ovpnmanager.py` to will default to setup number of servers with no country filter.
- `-s` specifies how many servers to test `sudo python3 ovpnmanager.py -s 10` will rank from 10 servers
- `-f` specifies a country filter ie. To rank only servers from US for example run `sudo python3 ovpnmanager -f us`
- pfSense depending on version `python3` command may be `python3.7`## Prerequisites Debian OS / Raspberry Pi:
(You need to have a working existing IPVanish OpenVPN configuration file)
1. `/etc/openvpn` default openvpn installation path
2. `/etc/openvpn/client.conf` is the default openvpn configuration file
3. A valid IPVanish username and password linked to the configuration file
4. `/etc/defaults/openvpn` contains line `AUTOSTART="client"Example of `/etc/openvpn/client.conf` file:
```
client
dev tun
proto udp
remote sjc-a14.ipvanish.com 443
resolv-retry infinite
nobind
persist-key
persist-tun
persist-remote-ip
ca ca.ipvanish.com.crt
verify-x509-name sjc-a14.ipvanish.com name
comp-lzo
verb 3
auth SHA256
cipher AES-256-CBC
keysize 256
tls-cipher TLS-DHE-RSA-WITH-AES-256-CBC-SHA:TLS-DHE-DSS-WITH-AES-256-CBC-SHA:TLS-RSA-WITH-AES-256-CBC-SHA
auth-user-pass auth.txt
script-security 2
```#### Example of Debian / Raspberry Pi OS root crontab - example show how to run every 4 hours with US only servers
Presumes ovpnmanager.py has been copied to `/etc/openvpn`
`0 */4 * * * /usr/bin/python3 /etc/openvpn/ovpnmanager.py -f us`## Prerequisites pfSense
#### Note: pfSense version recommended for advanced users
Note: There are still some issues with pfSense caching last server. Currently a work around has been added restart the client 3 times to flush out old server. Also depending on your configuration the get_ip_info() function may return your public service provider WAN address and not the VPN address.
1. Recommend backup of pfSense configuration prior to using.
2. Setup a working OpenVPN IPVanish client through the web admin interface.
3. pfSense Openvpn configuration files are located in `/var/etc/openvpn`.
4. Client files will start with client followed by a number, identify the number and edit the main() function in ovpnmanager.py#### Example of pfSense root crontab - example show how to run every 4 hours with US only servers
Presumes ovpnmanager.py has been copied to `/var/etc/openvpn`
`0 */4 * * * /usr/local/bin/python3.7 /var/etc/openvpn/ovpnmanager.py -f us`