A simple bash script to manage TryHackMe VPN connections from the command line.
- Easy VPN management: Start, stop, and check VPN status with simple commands
- Process validation: Prevents multiple VPN instances
- Config file validation: Ensures OpenVPN configuration exists
- Clean logging: Maintains logs for troubleshooting
- Status monitoring: Shows connection status and tunnel IP address
- Daemon mode: Runs VPN in background
- Linux system (tested on Kali Linux)
- OpenVPN installed (
sudo apt install openvpn) - TryHackMe OpenVPN configuration file
- Sudo privileges for OpenVPN operations
- Clone this repository:
git clone https://github.com/mbcyberworks/TryHackMe-vpn-manager.git
cd tryhackme-vpn-manager- Make the script executable:
chmod +x tryhackme- Move to system PATH (optional):
sudo cp tryhackme /usr/local/bin/- Update the config path in the script to match your TryHackMe OpenVPN file location:
CONFIG="/path/to/your/tryhackme-config.ovpn"# Start VPN connection
tryhackme start
# Stop VPN connection
tryhackme stop
# Check VPN status
tryhackme status$ tryhackme start
🚀 Starting TryHackMe VPN...
✅ VPN connected successfully!
$ tryhackme status
✅ VPN is currently running.
📡 TryHackMe IP: 10.x.x.x
$ tryhackme stop
🛑 Stopping TryHackMe VPN...
✅ VPN disconnected.Edit the script to update these variables according to your setup:
CONFIG: Path to your TryHackMe OpenVPN configuration filePIDFILE: Location for the process ID file (default:/tmp/tryhackme-vpn.pid)LOGFILE: Location for OpenVPN logs (default:/tmp/tryhackme-vpn.log)
- "Config file not found": Ensure the
CONFIGpath points to your TryHackMe.ovpnfile - "Failed to start VPN": Check the log file specified in
LOGFILEfor OpenVPN errors - Permission issues: Ensure you have sudo privileges for OpenVPN operations
Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
- Improve documentation
This project is licensed under the MIT License - see the LICENSE file for details.
MB Cyberworks - Ethical Hacker in Development
- Blog: mbcyberworks.nl
- Currently preparing for PNPT certification
This tool is intended for legitimate cybersecurity learning and practice on platforms like TryHackMe. Always ensure you have proper authorization before conducting any security testing activities.
Part of my cybersecurity learning journey. Check out more tools and write-ups on my blog.