Skip to content

Idowza/VPN-Start

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

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:

    git clone https://github.com/Idowza/VPN-Start.git
    cd VPN-Start
  2. Make the script executable:

    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:
    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:

./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):
    [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:
    sudo systemctl enable --now vpn-start

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

About

Simple BASH script used to start Mullvad VPN while enabling split tunneling for specified PID's

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages