Code Monkey home page Code Monkey logo

shadowsocks-auto-redir.sh's Introduction

shadowsocks-auto-redir.sh

Once upon a time, I wrote a blog post on how to set up shadowsocks-redir on ArchLinux as a system-wide proxy with chnroute as default.

And now I want to make the whole process automatic.

The following manual supports only distributions with systemd. ArchLinux is taken as default.
This script requires ROOT permission and comes with ABSOLUTELY NO WARRANTY. Use it at your own risk.

Installation

As this is no more than a simple script, I am not going to package it for any Linux distribution.

Install the dependencies first

# Execute as ROOT
pacman -S jq shadowsocks-libev ipset

Then clone this repo into any directory that the current user has access to. Take $HOME as an example.

# Execute as normal user
cd ~
git clone https://github.com/PeterCxy/shadowsocks-auto-redir.sh
cd shadowsocks-auto-redir.sh

Link itself to /opt and install the systemd unit

# Execute as ROOT
./install.sh link

Configuration

Now, put your Shadowsocks configuration file into /etc/shadowsocks/ (Please use a plain IP address for the server address, not a domain), for example, /etc/shadowsocks/config.json, and then run

# Execute as ROOT
systemctl start shadowsocks-auto-redir@config

After the unit get started properly, all the TCP traffic from your system will go through the Shadowsocks proxy.

In addition, this script supports some exta fields (under ss_redir_options) in the configuration JSON file.

  "ss_redir_options": {
    "bypass_ips": [
      ...
    ],
    "bypass_preset": "chnroute",
    "ota": true
  }

bypass_ips: A list of extra IPs to which traffic should not go through Shadowsocks proxy (by default, the server IP and the internal IP addresses are excluded from the proxy) bypass_preset: Include a predefined set of IPs to which traffic should not go through Shadowsocks proxy (currently only chnroute available which excludes all Chinese Mainland IPs) ota: Enable One-Time Authentication or not.

NOTE: This script does nothing to resolve DNS poisoning. If your network is subject to DNS poisoning, an anti-poisoning DNS server should be used or set up.

Updating

Switch to the directory of this project

# Execute as normal user
git pull
sudo ./install.sh update

Uninstallation

Stop all the relavent systemd services before uninstallation.

Switch to the directory of this project

# Execute as ROOT
./install.sh unlink

shadowsocks-auto-redir.sh's People

Contributors

petercxy avatar

Watchers

 avatar

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.