Skip to content

rdo-gishantsingh/VPNConnect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ReDefine VPN Connect

A colorful, feature-rich command-line tool for managing OpenVPN3 connections with automatic configuration cleanup and 2FA support.

πŸš€ Features

  • 🎨 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

πŸ“‹ Prerequisites

  • OpenVPN3 Client: Must be installed and configured
  • Linux System: Tested on Ubuntu/Debian systems
  • OpenVPN Config File: Located at ~/.config/client.ovpn

Install OpenVPN3 (Fedora)

# Add OpenVPN3 repository
sudo dnf update
sudo dnf copr enable dsommers/openvpn3

# Install OpenVPN3
sudo dnf update
sudo apt install openvpn3

For other distros you may follow this link: https://community.openvpn.net/Pages/OpenVPN3Linux

πŸ”§ Installation

  1. Clone the repository:
git clone https://github.com/rdo-gishantsingh/VPNConnect.git
cd VPNConnect
  1. Copy the script to your local bin:
cp redefine ~/.local/bin/
chmod +x ~/.local/bin/redefine
  1. Add to PATH (if not already):
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
  1. Place your OpenVPN config file:
# Copy your .ovpn file to the correct location
cp your-vpn-config.ovpn ~/.config/client.ovpn

πŸ“– Usage

Basic Commands

# Start VPN connection
redefine start

# Check connection status
redefine status

# Stop VPN connection
redefine stop

# Restart VPN connection
redefine restart

# Show help
redefine help

Example Session

$ 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

πŸ“ File Structure

~/.config/client.ovpn          # Your OpenVPN configuration file
~/.local/bin/redefine          # The VPN manager script
~/.local/share/openvpn3.log    # Detailed logs with timestamps

🎨 Output Examples

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)

πŸ” Security Features

  • 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

πŸ› οΈ Configuration

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 name

You can modify these variables at the top of the script if needed.

🚨 Troubleshooting

Common Issues

1. "OpenVPN3 is not installed"

# Install OpenVPN3 using the instructions above
sudo apt install openvpn3

2. "Config file not found"

# Ensure your .ovpn file is in the correct location
ls -la ~/.config/client.ovpn

3. "Compression is not available"

# The script automatically handles compression settings
# This should not occur with the current version

4. "Authentication failed"

# Ensure you're entering the correct:
# - Username
# - Password  
# - Current 2FA code from your authenticator app

Debug Mode

View detailed logs:

tail -f ~/.local/share/openvpn3.log

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘¨β€πŸ’» Author

Gishant Singh

πŸ™ Acknowledgments

  • 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!

About

🎨 Colorful OpenVPN3 manager with 2FA support, auto-cleanup, and comprehensive logging. Simple CLI tool for managing VPN connections on Linux with beautiful output and robust error handling.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages