https://github.com/idowza/vpn-start
Simple BASH script used to start Mullvad VPN while enabling split tunneling for specified PID's
https://github.com/idowza/vpn-start
bash-script mullvad-vpn split-tunneling vpn
Last synced: about 1 month ago
JSON representation
Simple BASH script used to start Mullvad VPN while enabling split tunneling for specified PID's
- Host: GitHub
- URL: https://github.com/idowza/vpn-start
- Owner: Idowza
- License: gpl-3.0
- Created: 2024-02-05T01:50:27.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-12-06T03:08:42.000Z (6 months ago)
- Last Synced: 2025-12-09T19:25:41.889Z (6 months ago)
- Topics: bash-script, mullvad-vpn, split-tunneling, vpn
- Language: Shell
- Homepage:
- Size: 29.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# VPN Start
A Bash script to automate starting Mullvad VPN while enabling split tunneling for specific applications.
## Description
This script is designed to streamline the process of connecting to Mullvad VPN on Linux systems. It automatically identifies running processes based on a user-defined list and excludes them from the VPN tunnel (split tunneling) before establishing the connection. It also handles graceful shutdown by disconnecting the VPN when the script is terminated.
## Features
- **Automated Split Tunneling**: Automatically finds PIDs for specified applications (e.g., Plex, SSH, Sonarr) and adds them to Mullvad's split tunnel.
- **Auto-Connect**: Connects to Mullvad VPN after configuring split tunneling.
- **Status Check**: Verifies and displays the connection status.
- **Graceful Exit**: Disconnects the VPN when the script is stopped (e.g., via Ctrl+C or systemd).
## Prerequisites
- **Mullvad VPN**: The Mullvad VPN application and CLI must be installed and configured.
- **Bash**: A standard Bash shell environment.
- **Root/Sudo Privileges**: May be required depending on your Mullvad CLI configuration and permissions.
## Installation
1. Clone the repository:
```bash
git clone https://github.com/Idowza/VPN-Start.git
cd VPN-Start
```
2. Make the script executable:
```bash
chmod +x VPNstart
```
## Configuration
The list of applications to exclude from the VPN is defined in the `VPNstart` script.
1. Open `VPNstart` in a text editor.
2. Locate the `EXCLUDED_PROCESSES` array:
```bash
EXCLUDED_PROCESSES=(
"vnc"
"plex"
"ssh"
# ... add your applications here
)
```
3. Add or remove process names as needed.
## Usage
### Manual Execution
Run the script directly from the terminal:
```bash
./VPNstart
```
To stop the script and disconnect the VPN, press `Ctrl+C`.
### Running as a Systemd Service
The script is designed to work well as a systemd service (daemon).
1. Create a service file (e.g., `/etc/systemd/system/vpn-start.service`).
2. Add the following configuration (adjust paths as necessary):
```ini
[Unit]
Description=Mullvad VPN Start Script
After=network.target
[Service]
ExecStart=/path/to/VPN-Start/VPNstart
Restart=always
User=root
[Install]
WantedBy=multi-user.target
```
3. Enable and start the service:
```bash
sudo systemctl enable --now vpn-start
```
## License
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.