A colorful, feature-rich command-line tool for managing OpenVPN3 connections with automatic configuration cleanup and 2FA support.
- π¨ Colorful Output: Beautiful colored logs and status messages
- π§Ή Auto Cleanup: Automatically removes configurations on disconnect
- π Connection Status: Real-time VPN status and statistics
- π Comprehensive Logging: Detailed logs with timestamps
- β‘ Simple Commands: Easy-to-use CLI interface
- π‘οΈ Error Handling: Robust error checking and user feedback
- OpenVPN3 Client: Must be installed and configured
- Linux System: Tested on Ubuntu/Debian systems
- OpenVPN Config File: Located at
~/.config/client.ovpn
# Add OpenVPN3 repository
sudo dnf update
sudo dnf copr enable dsommers/openvpn3
# Install OpenVPN3
sudo dnf update
sudo apt install openvpn3For other distros you may follow this link: https://community.openvpn.net/Pages/OpenVPN3Linux
- Clone the repository:
git clone https://github.com/rdo-gishantsingh/VPNConnect.git
cd VPNConnect- Copy the script to your local bin:
cp redefine ~/.local/bin/
chmod +x ~/.local/bin/redefine- Add to PATH (if not already):
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc- Place your OpenVPN config file:
# Copy your .ovpn file to the correct location
cp your-vpn-config.ovpn ~/.config/client.ovpn# Start VPN connection
redefine start
# Check connection status
redefine status
# Stop VPN connection
redefine stop
# Restart VPN connection
redefine restart
# Show help
redefine help$ redefine start
[INFO] Starting VPN connection...
[INFO] Config file found at /home/user/.config/client.ovpn
[INFO] Importing OpenVPN configuration...
[SUCCESS] Configuration imported successfully
[INFO] Configuring compression settings...
[SUCCESS] Compression allowed for configuration
[INFO] Establishing VPN connection...
You will be prompted for your credentials and Google Authenticator code.
Please have your Google Authenticator app ready.
Username: your-username
Password: ************
Google Authenticator Code: 123456
[SUCCESS] VPN connection established successfully!
=== VPN STATUS ===
Configuration name: ReDefineVPN
Session path: /net/openvpn/v3/sessions/{session-id}
Status: Connection, Client connected
VPN is CONNECTED~/.config/client.ovpn # Your OpenVPN configuration file
~/.local/bin/redefine # The VPN manager script
~/.local/share/openvpn3.log # Detailed logs with timestamps
The script provides colorful, informative output:
- π΅ [INFO] - General information (Cyan)
- π’ [SUCCESS] - Successful operations (Green)
- π‘ [WARNING] - Warnings and notices (Yellow)
- π΄ [ERROR] - Error messages (Red)
- π£ [DEBUG] - Debug information (Purple)
- No Credential Storage: Uses OpenVPN3's native authentication
- Auto Cleanup: Removes configurations after disconnect
- Secure Logging: Logs activities without sensitive data
- Permission Checks: Validates file permissions and access
The script uses these default locations:
CONFIG_FILE="$HOME/.config/client.ovpn" # OpenVPN config
LOG_FILE="$HOME/.local/share/openvpn3.log" # Log file
CONFIG_NAME="ReDefineVPN" # Configuration nameYou can modify these variables at the top of the script if needed.
1. "OpenVPN3 is not installed"
# Install OpenVPN3 using the instructions above
sudo apt install openvpn32. "Config file not found"
# Ensure your .ovpn file is in the correct location
ls -la ~/.config/client.ovpn3. "Compression is not available"
# The script automatically handles compression settings
# This should not occur with the current version4. "Authentication failed"
# Ensure you're entering the correct:
# - Username
# - Password
# - Current 2FA code from your authenticator appView detailed logs:
tail -f ~/.local/share/openvpn3.log- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Gishant Singh
- GitHub: @rdo-gishantsingh
- OpenVPN3 team for the excellent client
- The open-source community for inspiration
- Contributors and testers
β If this script helped you, please give it a star!