Giter Club home page Giter Club logo

transmissionvpn's Introduction

transmissionVPN

This is a special script for Synology NAS that helps you force Transmission's connection under the VPN you specify. It works with L2TP, PPTP, and OpenVPN connections. The script connects to VPN then sets Transmission to your VPN port. If it cannot find one, it will shut off VPN and prevent Transmission from working.

In other words, Transmission ONLY connects to VPN while other applications DO NOT!

To use this script, here are the steps you need to follow:

  1. Create the VPN using DiskStation Manager
  2. Install Transmission from SynoCommunity's repo
  3. Fill Out the VPN Settings/Optionals (below)

Retrieve Variables

These are the descriptions of the variables that may be changed depending on your configuration. Examples are located inside the script. Please follow the exact format unless you know what you're doing. If you need help, feel free to open an issue on GitHub!

VPN Settings
  1. VPN_CONFID - Synology Configuration ID (e.g. l1234567890, instructions below)
  2. VPN_CONFNAME - Synology Configuration Name (l2tpclient, pptpclient, or ovpnclient)
  3. VPN_PROTO - Synology Protocol (l2tp, pptp, or openvpn)
  4. VPN_UINAME - Synology VPN Name (Control Panel > Network > Network Interface)
VPN Optionals
  1. VPN_TYPE - The type of connection you will route though (ppp for L2TP/PPTP VPN, or tun for OpenVPN)
  2. VPN_INTERFACE - The default interface you will be connecting to (ppp0 for L2TP/PPTP, or tun0 for OpenVPN)
  3. VPN_RETRY - How many retries (times) if VPN fails to connect (default is 10)
  4. VPN_INTERVAL - The time (in seconds) to wait between each retry (default is 30)
VPN Features
  1. PORT_FWD - Carries an additional port forwarding check (default is empty, 51413 for Transmission default)
  2. IP_CHECK - Which URL to use to check your external IP address (default is http://ipinfo.io/ip)
App Settings
  1. TRANS_USER - The user running under Transmission (default is transmission)
  2. TRANS_GROUP - The group of Transmission's user (default is users)
  3. TRANS_VAR - Path where the settings.json file is located (full path, no ending backslash)
  4. TRANS_SSSS - Path where the Transmission start-stop-status file is located (full path)

Get Synology Configuration ID

To retrieve the VPN_CONFID, follow these steps:

  1. SSH or Telnet into your Synology NAS Box
  2. Type cd /usr/syno/etc/synovpnclient/
  3. Type cd PROTOCOL (Replace PROTOCOL with l2tp, openvpn, or pptp)
  4. Type in ls -l to list out the files
  5. Find a file called connect_l1234567890
  6. Copy the text l1234567890 to the VPN_CONFID above
  7. Type exit once to logout of SSH or Telnet

NOTE: l1234567890 is an example. Each configuration ID (per VPN connection) is UNIQUE and YOU MUST connect to your Synology NAS though SSH or Telnet to retrieve it.

Task Scheduling

If you want to automate the script, you can use the Task Scheduler application provided inside the DiskStation Manager. Make sure the script is ran under root to prevent any issues occurring.

This script is purely useful for checking if your Transmission connection is working properly, and breaks Transmission if the VPN connection is off to prevent a leak. Here is one scenario where I would use it:

  • Run /volume1/transmissionvpn.sh repair every 1 or 5 minutes.

How to Use this Script

Before you use this script, use the following commands:

  1. sh transmissionvpn.sh install - Installer. Stops VPN, binds 127.0.0.1 to Transmission
  2. sh transmissionvpn.sh uninstall - Uninstaller. Stops VPN, binds 0.0.0.0 to Transmission

To run this script, use the following commands:

  1. sh transmissionvpn.sh start - Start. Starts the VPN, binds VPN address to Transmission
  2. sh transmissionvpn.sh stop - Stop. Stops the VPN, binds 127.0.0.1 to Transmission
  3. sh transmissionvpn.sh repair - Repair. Fixes stalled VPNs, decides which IP address to bind

NOTE: If the script is located in /volume1/examplefolder/, navigate to that folder (using the cd command) before executing the commands above.

transmissionvpn's People

Contributors

mrjackyliang avatar

Watchers

James Cloos avatar  avatar

Forkers

ozmoroz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.