{"id":19417777,"url":"https://github.com/bradsec/pfsense-vpn-rotator","last_synced_at":"2026-06-10T22:31:37.737Z","repository":{"id":214736731,"uuid":"737234922","full_name":"bradsec/pfsense-vpn-rotator","owner":"bradsec","description":"A shell script specifically designed for pfSense systems. Its primary function is to automate the process of rotating and randomizing server addresses and ports for existing OpenVPN client configurations.","archived":false,"fork":false,"pushed_at":"2025-01-09T13:31:13.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-25T03:41:42.801Z","etag":null,"topics":["freebsd","openvpn","openvpn-client","openvpn-server","pfsense","pfsense-firewall","shell-script"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bradsec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-30T09:36:00.000Z","updated_at":"2025-01-09T13:31:17.000Z","dependencies_parsed_at":"2023-12-30T11:23:03.337Z","dependency_job_id":"d15b1c40-f25e-49d1-bb59-6c55187fc577","html_url":"https://github.com/bradsec/pfsense-vpn-rotator","commit_stats":null,"previous_names":["bradsec/pfsense-vpn-rotator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bradsec/pfsense-vpn-rotator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradsec%2Fpfsense-vpn-rotator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradsec%2Fpfsense-vpn-rotator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradsec%2Fpfsense-vpn-rotator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradsec%2Fpfsense-vpn-rotator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bradsec","download_url":"https://codeload.github.com/bradsec/pfsense-vpn-rotator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradsec%2Fpfsense-vpn-rotator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34174148,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["freebsd","openvpn","openvpn-client","openvpn-server","pfsense","pfsense-firewall","shell-script"],"created_at":"2024-11-10T13:11:20.885Z","updated_at":"2026-06-10T22:31:37.712Z","avatar_url":"https://github.com/bradsec.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pfSense OpenVPN Client Rotator / Randomizer\n  \n### Last tested on pfSense CE 2.7.2-RELEASE (PHP 8.2.11)\n\n## Overview\n\n`pfsense-vpn-rotator.sh` is a shell script specifically designed for pfSense systems. Its primary function is to automate the process of rotating and randomizing server addresses and ports for **existing** OpenVPN client configurations. This script ensures dynamic and secure VPN connections by periodically altering the VPN endpoints.\n\n## Features\n\n- Safely rotates VPN server configurations using the `pfSsh.php` command.\n- Compatible with PHP 8.x versions of pfSense.\n- Eliminates the risks associated with direct editing of `config.xml`.\n- Automatically selects a random VPN server from predefined lists.\n- Dynamically updates OpenVPN client configurations on pfSense.\n- Restarts the VPN service to apply changes seamlessly.\n- Supports multiple server lists based on VPN IDs.\n\n## Prerequisites\n\n- You must have fully configured and working OpenVPN client configurations.\n- Access to the pfSense shell and `/usr/local/sbin/pfSsh.php`.\n- Basic understanding of shell scripting and pfSense configuration.\n\n## Why `pfSsh.php`?\n\nThe script leverages `pfSsh.php` for configuration changes rather than directly modifying `config.xml`. This approach reduces the risk of file corruption and syntax errors, ensuring the stability and integrity of your pfSense system's configuration. It's a best practice recommended for making programmable changes to pfSense configurations.\n\n## Installation\n\n1. Download and edit the script as required.\n2. Copy the script to your pfSense server (e.g., /usr/local/sbin).\n3. Make the script executable: `chmod +x pfsense-vpn-rotator.sh`.\n4. Ensure that your server lists (`server_list1`, `server_list2`, etc.) are correctly defined within the script. Each list should correspond to a specific VPN ID. (Example has ProtonVPN AU and US server lists).  \n\nNote: The name variable above the server_list (`server_name1`, `server_name2`, etc.) will be added to the OpenVPN client description to make it easier to identify the VPN connections in the pfSense WebUI.\n\n## Quick Download and Install Method\n\n```terminal\n# Run from pfSense terminal (CLI)\ncurl -o /usr/local/sbin/pfsense-vpn-rotator.sh https://raw.githubusercontent.com/bradsec/pfsense-vpn-rotator/main/pfsense-vpn-rotator.sh\n\n# Make the script executable\nchmod +x /usr/local/sbin/pfsense-vpn-rotator.sh\n\n# Run script as required (example below for OpenVPN client (vpnid) 1)\n/usr/local/sbin/pfsense-vpn-rotator.sh 1\n```\n  \n## Usage\n\n```terminal\n/usr/local/sbin/pfsense-vpn-rotator.sh \u003cvpnid\u003e\n\n# Replace `\u003cvpnid\u003e` with the appropriate VPN ID.\n```\n\nRun the script directly from the pfSense shell or use the cron package in pfSense for scheduling the script execution. To install cron from WebUI goto `System \u003e Package Manager`. If `Cron` is not in `Installed Packages` go to `Available Packages` and search `Cron` and install. Once installed `Cron` will appear under the `Services` pfSense menu.  \n  \nBelow is an example of Cron job running the script every 6 hours for OpenVPN client (vpnid) 1\n```terminal\n0 \t*/6 \t* \t* \t* \troot \t/usr/local/sbin/pfsense-vpn-rotator.sh 1\n```\nNote: Offset cron schedule times for each vpnid (ie. Don't have vpnid 1 and 2 trying to set and restart the Openvpn client at same time).\n\n## Troubleshooting \n\nIf you are unsure of your vpnid you can run the following commands from the shell on pfSense to view the Openvpn client configuration information:\n```terminal\npfSsh.php\nprint_r(config_get_path('openvpn/openvpn-client', array()));\nexec;\nexit\n```\n\n## License\n\nThis script is released under the [MIT License](LICENSE).\n\n## Disclaimer\n\nThis script is provided \"as is\", without warranty of any kind. Use it at your own risk. Always ensure you have backups of your configurations before running any automation scripts.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbradsec%2Fpfsense-vpn-rotator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbradsec%2Fpfsense-vpn-rotator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbradsec%2Fpfsense-vpn-rotator/lists"}