You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

188 lines
6.6 KiB

12 years ago
12 years ago
12 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
12 years ago
11 years ago
12 years ago
11 years ago
11 years ago
11 years ago
11 years ago
12 years ago
12 years ago
12 years ago
12 years ago
11 years ago
12 years ago
11 years ago
12 years ago
11 years ago
12 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
12 years ago
11 years ago
12 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. shadowsocks-libev
  2. =================
  3. Intro
  4. -----
  5. [Shadowsocks-libev](http://shadowsocks.org) is a lightweight secured scoks5
  6. proxy for embedded devices and low end boxes.
  7. It is a port of [shadowsocks](https://github.com/clowwindy/shadowsocks)
  8. created by [@clowwindy](https://github.com/clowwindy) maintained by
  9. [@madeye](https://github.com/madeye).
  10. Current version: 1.4.0 | [![Build Status](https://travis-ci.org/madeye/shadowsocks-libev.png?branch=master)](https://travis-ci.org/madeye/shadowsocks-libev)
  11. Changelog
  12. ---------
  13. 1.4.0 -- Sun, 08 Sep 2013 02:20:40 +0000
  14. * Add standard socks5 udp support.
  15. 1.3.3 -- Fri, 21 Jun 2013 09:59:20 +0800
  16. * Provide more info in verbose mode.
  17. 1.3.2 -- Sun, 09 Jun 2013 09:52:31 +0000
  18. * Fix some ciphers by @linusyang.
  19. 1.3.1 -- Tue, 04 Jun 2013 00:56:17 +0000
  20. * Support more cihpers: camellia, idea, rc2 and seed.
  21. 1.3 -- Thu, 16 May 2013 10:51:15 +0800
  22. * Able to bind connections to specific interface
  23. * Support more ciphers: aes-128-cfb, aes-192-cfb, aes-256-cfb, bf-cfb, cast5-cfb, des-cfb
  24. 1.2 -- Tue, 07 May 2013 14:10:33 +0800
  25. * Close timeouted TCP connections
  26. * Fix a high load issue
  27. 1.1 -- Wed, 10 Apr 2013 12:11:36 +0800
  28. * Fix a IPV6 resolve issue
  29. 1.0 -- Sat, 06 Apr 2013 16:59:15 +0800
  30. * Initial release
  31. Features
  32. --------
  33. Shadowsocks-libev is writen in pure C and only depends on
  34. [libev](http://software.schmorp.de/pkg/libev.html) and
  35. [openssl](http://www.openssl.org/).
  36. In normal usage, the memory consumption is about 600KB and the CPU utilization is
  37. no more than 5% on a low-end router (Buffalo WHR-G300N V2 with a 400MHz MIPS CPU,
  38. 32MB memory and 4MB flash).
  39. Installation
  40. ------------
  41. For Unix-like systems, especially Debian-based systems,
  42. e.g. Ubuntu, Debian or Linux Mint, you can build the binary like this:
  43. ```bash
  44. sudo apt-get install build-essential autoconf libtool libssl-dev
  45. ./configure && make
  46. sudo make install
  47. ```
  48. For Windows, use either MinGW (msys) or Cygwin to build.
  49. At the moment, only `ss-local` is supported to build against MinGW (msys).
  50. If you are using MinGW (msys), please download OpenSSL source tarball
  51. to the home directory of msys, and build it like this (may take a few minutes):
  52. ```bash
  53. tar zxf openssl-1.0.1e.tar.gz
  54. cd openssl-1.0.1e
  55. ./config --prefix="$HOME/prebuilt" --openssldir="$HOME/prebuilt/openssl"
  56. make && make install
  57. ```
  58. Then, build the binary using the commands below, and all `.exe` files
  59. will be built at `$HOME/ss/bin`:
  60. ```bash
  61. ./configure --prefix="$HOME/ss" --with-openssl="$HOME/prebuilt"
  62. make && make install
  63. ```
  64. Usage
  65. -----
  66. ```
  67. usage:
  68. ss-[local|redir|server]
  69. -s <server_host> host name or ip address of your remote server
  70. -p <server_port> port number of your remote server
  71. -l <local_port>> port number of your local server
  72. -k <password> password of your remote server
  73. [-m <encrypt_method>] encrypt method, supporting table, rc4,
  74. aes-128-cfb, aes-192-cfb, aes-256-cfb,
  75. bf-cfb, camellia-128-cfb, camellia-192-cfb,
  76. camellia-256-cfb, cast5-cfb, des-cfb,
  77. idea-cfb, rc2-cfb and seed-cfb
  78. [-f <pid_file>] valid path to the pid file
  79. [-t <timeout>] socket timeout in seconds
  80. [-c <config_file>] json format config file
  81. [-i <interface>] specific network interface to bind,
  82. only avaliable in local and server modes
  83. [-b <local_address>] specific local address to bind,
  84. only avaliable in local and redir modes
  85. [-u] udprelay mode to supprot udp traffic
  86. only avaliable in local and server modes
  87. [-v] verbose mode, debug output in console
  88. notes:
  89. ss-redir provides a transparent proxy function and only works on the
  90. Linux platform with iptables.
  91. ```
  92. ## Advanced usage
  93. The latest shadowsocks-libev has provided a *redir* mode. You can configure your linux based box or router to proxy all tcp traffic transparently.
  94. # Create new chain
  95. root@Wrt:~# iptables -t nat -N SHADOWSOCKS
  96. # Ignore your shadowsocks server's addresses
  97. # It's very IMPORTANT, just be careful.
  98. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 123.123.123.123 -j RETURN
  99. # Ignore LANs and any other addresses you'd like to bypass the proxy
  100. # See Wikipedia and RFC5735 for full list of reserved networks.
  101. # See ashi009/bestroutetb for a highly optimized CHN route list.
  102. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 0.0.0.0/8 -j RETURN
  103. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 10.0.0.0/8 -j RETURN
  104. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 127.0.0.0/8 -j RETURN
  105. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 169.254.0.0/16 -j RETURN
  106. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 172.16.0.0/12 -j RETURN
  107. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 192.168.0.0/16 -j RETURN
  108. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 224.0.0.0/4 -j RETURN
  109. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -d 240.0.0.0/4 -j RETURN
  110. # Anything else should be redirected to shadowsocks's local port
  111. root@Wrt:~# iptables -t nat -A SHADOWSOCKS -p tcp -j REDIRECT --to-ports 12345
  112. # Apply the rules
  113. root@Wrt:~# iptables -t nat -A OUTPUT -p tcp -j SHADOWSOCKS
  114. # Start the shadowsocks-redir
  115. root@Wrt:~# ss-redir -c /etc/config/shadowsocks.json -f /var/run/shadowsocks.pid
  116. ## Security Tips
  117. Although shadowsocks-libev can handle thousands of concurrent connections nicely, we still recommend to
  118. set up your server's firewall rules to limit connections from each user.
  119. # Up to 32 connections are enough for normal usages
  120. iptables -A INPUT -p tcp --syn --dport ${SHADOWSOCKS_PORT} -m connlimit --connlimit-above 32 -j REJECT --reject-with tcp-reset
  121. ## License
  122. Copyright (C) 2013 Max Lv <max.c.lv@gmail.com>
  123. This program is free software: you can redistribute it and/or modify
  124. it under the terms of the GNU General Public License as published by
  125. the Free Software Foundation, either version 3 of the License, or
  126. (at your option) any later version.
  127. This program is distributed in the hope that it will be useful,
  128. but WITHOUT ANY WARRANTY; without even the implied warranty of
  129. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  130. GNU General Public License for more details.
  131. You should have received a copy of the GNU General Public License
  132. along with this program. If not, see <http://www.gnu.org/licenses/>.