PAN Keepalive is a Python script designed to keep a Palo Alto Networks GlobalProtect VPN connection alive by periodically reconnecting every 30 minutes. This can be useful in environments where the VPN connection might drop due to inactivity.
This script uses the PanGPA.exe command to reconnect the VPN at regular intervals. By doing so, it ensures that the VPN connection remains active even when there is no user activity.
- Python 3.x
- Windows operating system
- Palo Alto Networks GlobalProtect VPN client
-
Clone the repository:
git clone https://github.com/marksowell/pan-keepalive.git cd pan-keepalive -
Ensure you have Python 3.x installed on your system. You can download it from python.org.
-
Open the
pan_keepalive.pyscript and verify the path toPanGPA.exe. The default path is:globalprotect_cli = r"C:\Program Files\Palo Alto Networks\GlobalProtect\PanGPA.exe"
-
Connect to your VPN using the Palo Alto Networks GlobalProtect client.
-
Run the script:
python pan_keepalive.py
The script will run indefinitely, reconnecting the VPN every 30 minutes.
You can configure the script to start automatically when your system boots. Here’s how to do it using a startup shortcut:
-
Create a Shortcut:
-
Right-click on your desktop or in a folder and select
New > Shortcut. -
In the location field, enter the path to your Python executable followed by the path to your script, e.g.:
"C:\Path\To\Python\python.exe" "C:\Path\To\pan-keepalive\pan_keepalive.py"
-
Click
Nextand give your shortcut a name (e.g.,PAN Keepalive).
-
-
Move the Shortcut to the Startup Folder:
- Press
Win + R, typeshell:startup, and press Enter. - Move the shortcut you created into the Startup folder.
- Press
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.