A bash wrapper CLI script to add/extend the ProtonVPN CLI commands with additional functionality like port-forwarding keep-alive support.
- Port Forwarding Keep-Alive: Automatically renews NAT-PMP port mappings to prevent disconnection timeouts
- Extended Commands:
protonvpn connect- Start with port-forwarding keep-alive in backgroundprotonvpn disconnect- Stop keep-alive before disconnectingprotonvpn get-port- Display the current mapped portprotonvpn keepalive-logs- Follow live keep-alive logsprotonvpn keepalive-stop- Stop the background keep-alive process
protonvpn: The official ProtonVPN command-line clientnatpmpc: For NAT-PMP port mapping support- Standard Unix tools:
curl,bash,grep
Copy and paste this command into your terminal:
curl -fsSL https://raw.githubusercontent.com/pjortiz/protonvpn-cli-wrapper/main/install.sh | bashThis will:
- Download the wrapper script from the GitHub repository
- Install it to
~/.protonvpn-wrapper/ - Add the necessary source line to your shell configuration files (
.bashrc,.bash_profile,.profile,.zshrc,.config/fish/config.fish)
After installation, reload your shell:
source ~/.bashrc # or your respective shell rc fileIf you prefer to install manually:
-
Clone or download the repository:
git clone https://github.com/pjortiz/protonvpn-cli-wrapper.git # or download protonvpn_wrapper.sh directly -
Create the installation directory and copy the wrapper:
mkdir -p ~/.protonvpn-wrapper cp protonvpn_wrapper.sh ~/.protonvpn-wrapper/ chmod +x ~/.protonvpn-wrapper/protonvpn_wrapper.sh
-
Add the source line to your shell configuration:
Choose one of the files below based on your shell:
- Bash:
~/.bashrcor~/.bash_profile - Zsh:
~/.zshrc - Fish:
~/.config/fish/config.fish
Add this line to the end of your chosen file:
[ -f ~/.protonvpn-wrapper/protonvpn_wrapper.sh ] && source ~/.protonvpn-wrapper/protonvpn_wrapper.sh
- Bash:
-
Reload your shell configuration:
source ~/.bashrc # or your respective shell rc file
# Connect with port-forwarding keep-alive
protonvpn connect
# Disconnect (stops keep-alive first)
protonvpn disconnect
# Get current mapped port
protonvpn get-port
# Follow keep-alive logs in real-time
protonvpn keepalive-logs
# Stop the keep-alive background process
protonvpn keepalive-stopTo remove the ProtonVPN CLI wrapper:
-
Remove the installation directory:
rm -rf ~/.protonvpn-wrapper -
Remove the source line from your shell configuration files:
Open and edit:
~/.bashrc~/.bash_profile~/.profile~/.zshrc~/.config/fish/config.fish
Remove or comment out the line:
[ -f ~/.protonvpn-wrapper/protonvpn_wrapper.sh ] && source ~/.protonvpn-wrapper/protonvpn_wrapper.sh
-
Reload your shell:
source ~/.bashrc # or your respective shell rc file
See LICENSE file for details.