โ Ever wanted to use a different IP for your apps on your VPS?
โ Bought a Germany VPS but need a USA IP to connect to your favorite free LLM API?
โจ This project is for you!
๐ก It allows you to use any country's IP through ProtonVPN's OpenVPN configs and use it as a proxy so that your app requests go through it without exposing your real VPS IP.
- Multi-Container Support: Monitor multiple VPN proxies independently
- Automatic VPN Leak Detection: External monitor detects and fixes IP leaks per container
- Self-Repairing: Automatically recovers from connection failures
- Zero Manual Intervention: Fully autonomous operation
- Smart Config Rotation: Tries different VPN servers until one works
- Individual Health Monitoring: Only restarts affected containers, healthy ones keep running
- Docker installed on your machine
- Visit: ProtonVPN OpenVPN Downloads
- Log in to your ProtonVPN account.
- Choose a protocol (UDP/TCP) and download the
.ovpnconfiguration files. - Place all
.ovpnfiles into theovpn_configsdirectory.
jp-free-1.protonvpn.udp.ovpn file included is a sample placeholder and will not work for actual connections. Replace it with a real .ovpn file from your ProtonVPN account.
- Inside the
ovpn_configsdirectory, open the existingproton_openvpn_userpass.txtfile and add your ProtonVPN login credentials from ProtonVPN's account page:
Username
Password
- SSH into your VPS and navigate to the project folder.
- Generate docker-compose.yml and start services:
chmod +x generate-compose.sh && ./generate-compose.sh 1 && docker compose up -d --buildChange
1to deploy multiple proxies (e.g.,3creates ports 6101, 6102, 6103).
โ ๏ธ ProtonVPN Free plan allows only 1 connection.
- Monitor the logs:
# VPN container logs
docker compose logs -f vpn_proxy_1
# Leak monitor logs
docker logs -f vpn_proxy_leak_monitorA separate monitor container checks ALL VPN proxy containers for IP leaks:
- Every 5 minutes: Tests each proxy container individually
- Smart Restart: Only restarts the affected container if leak detected
- Healthy Containers: Keep running unaffected during restarts
When you deploy 3 proxies with ./generate-compose.sh 3, the monitor checks each one independently:
[monitor] Checking 3 container(s)...
[monitor] Checking vpn_proxy_1 (port 6101)...
[monitor] OK vpn_proxy_1 is working correctly (Country: US)
[monitor] Checking vpn_proxy_2 (port 6102)...
[monitor] LEAK DETECTED in vpn_proxy_2! Country is FI
[monitor] Restarting: vpn_proxy_2
[monitor] Checking vpn_proxy_3 (port 6103)...
[monitor] OK vpn_proxy_3 is working correctly (Country: JP).
โโโ Dockerfile # Container image definition
โโโ docker-compose.yml # Auto-generated by generate-compose.sh
โโโ start.sh # Main container entrypoint (VPN + Tinyproxy)
โโโ monitor.sh # External leak detector (separate container)
โโโ healthcheck.sh # Docker health check (process monitoring)
โโโ generate-compose.sh # Deployment tool (auto-detects host country)
โโโ diagnose.sh # Troubleshooting utility
โโโ fix-ovpn-warnings.sh # Optional: Patches OpenVPN config warnings
โโโ tinyproxy.conf.template # Tinyproxy configuration template
โโโ ovpn_configs/ # Your ProtonVPN .ovpn files
โโโ *.ovpn # OpenVPN configuration files
โโโ proton_openvpn_userpass.txt # Your ProtonVPN credentials
The proxy is accessible from the host at http://127.0.0.1:6101.
For container-to-container communication, connect to the vpn_proxy_network:
docker network connect vpn_proxy_network your_container
# Then use: http://vpn_proxy_1:6101 as proxyOr in Docker Compose:
services:
your_app:
image: your-app:latest
networks:
- vpn_proxy_network
environment:
- HTTP_PROXY=http://vpn_proxy_1:6101
- HTTPS_PROXY=http://vpn_proxy_1:6101
networks:
vpn_proxy_network:
external: true# Simple test
curl -s --proxy http://127.0.0.1:6101 https://ipinfo.io/json | jq -r '"IP: \(.ip) | Country: \(.country)"'
# Python test
python3 -c "import requests; info = requests.get('https://ipinfo.io/json', proxies={'http':'http://127.0.0.1:6101','https':'http://127.0.0.1:6101'}).json(); print(f\"IP: {info['ip']} | Country: {info['country']}\")"chmod +x diagnose.sh && ./diagnose.shNormal during initial connection. The system will:
- Try all VPN configs in random order
- Wait 5 minutes if all configs fail
- Try again indefinitely until successful
docker logs -f vpn_proxy_leak_monitorIf you see "Rate limit exceeded" errors in the monitor logs, the system now uses multiple free IP detection services. To get more reliable monitoring:
- Increase check interval (edit
CHECK_INTERVALin docker-compose.yml to 1800 for 30-minute checks) - Optional: Get IPinfo.io API token for 50k requests/month:
- Sign up at https://ipinfo.io/signup
- Add your token to docker-compose.yml:
IPINFO_TOKEN=your_token_here
# Restart specific proxy
docker compose restart vpn_proxy_1
# Restart all proxies
docker compose restart# Specific container
docker compose logs vpn_proxy_1 | grep "Connection successful"
# All containers
docker compose logs | grep "Connection successful"# Overview of all services
docker compose ps
# Specific container health check
docker compose exec vpn_proxy_1 /usr/local/bin/healthcheck.shcurl -s --proxy http://127.0.0.1:6101 https://ipinfo.io/country # vpn_proxy_1
curl -s --proxy http://127.0.0.1:6102 https://ipinfo.io/country # vpn_proxy_2
curl -s --proxy http://127.0.0.1:6103 https://ipinfo.io/country # vpn_proxy_3Monitor Container:
HOST_COUNTRY: Auto-detected by generate-compose.shCHECK_INTERVAL: Seconds between checks (default: 900, was 300)CONTAINER_PREFIX: Container name prefix (default: vpn_proxy_)IPINFO_TOKEN: Optional IPinfo.io API token for higher rate limits
VPN Containers:
PROXY_PORT: Tinyproxy listen port (auto: 6101, 6102, 6103...)HOST_COUNTRY: Host country code for leak detection
VPN_CONNECT_TIMEOUT=20: Seconds to wait for VPN connectionRETRY_DELAY=300: Seconds to wait after all configs fail
./fix-ovpn-warnings.shThis adds compatibility options to all .ovpn files. Backups are created automatically.
- Convert OpenVPN credentials to JSON for multi-account support
Convert ovpn_configs/proton_openvpn_userpass.txt into a structured .json file so multiple free ProtonVPN accounts can be managed and rotated programmatically.
Example: proton_openvpn_accounts.json
[
{
"username": "account1@example.com",
"password": "password1"
},
{
"username": "account2@example.com",
"password": "password2"
}
]Why this helps
- Enables easy rotation between accounts
- Simplifies automation and parsing
- Scales cleanly as more accounts are added
- Unified health-checked proxy endpoint (multi-container)
Create a single proxy container that acts as a unified entry point for multiple proxy containers. This container should continuously monitor the health of all underlying proxies and always route traffic to the latest working one.
Expected behavior
- Periodic health checks (latency, connectivity, or test requests)
- Automatic failover when a proxy becomes unavailable
- Zero manual intervention when proxies go down
- Stable endpoint for all clients
High-level flow
Client
โ
Unified Proxy Container
โ
[ Proxy A | Proxy B | Proxy C ]
โ โ โ
Health checks + automatic selection
Benefits
- High availability
- Clean architecture
- No client-side proxy switching logic required
- Reorganize internal scripts
Move all non-user-facing scripts into the scripts/ directory.
These scripts should only be invoked by the main entrypoint and must not be called directly by the user.