├── Dockerfile ├── Dockerfile.temp ├── README.md ├── conf ├── ss-tproxy.conf └── ssr-local.json ├── debian-installss-tproxy.sh ├── docker-compose.yml ├── install-ss-tproxy.sh └── install-ss-tproxy.temp.sh /Dockerfile: -------------------------------------------------------------------------------- 1 | # 拉取 CentOS 2 | #FROM hub.c.163.com/library/centos:latest 3 | FROM yahuiwong/centos:7.5.1804Linux4.19.2-1.el7.elrepo.x86_64 4 | # 维护者 5 | MAINTAINER YahuiWong 6 | 7 | COPY install-ss-tproxy.sh /install-ss-tproxy.sh 8 | RUN sh /install-ss-tproxy.sh 9 | RUN ss-tproxy update-gfwlist && ss-tproxy update-chnroute && ss-tproxy update-chnonly && ss-tproxy restart && tail -f /var/log/ssr-redir.log 10 | -------------------------------------------------------------------------------- /Dockerfile.temp: -------------------------------------------------------------------------------- 1 | # 拉取 CentOS 2 | #FROM hub.c.163.com/library/centos:latest 3 | FROM yahuiwong/centos:7.6.1810.5.2.11-1.el7.elrepo.x86_64 4 | # 维护者 5 | MAINTAINER YahuiWong 6 | 7 | COPY install-ss-tproxy.temp.sh /install-ss-tproxy.temp.sh 8 | RUN sh /install-ss-tproxy.temp.sh 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # docker-ss-tproxy 2 | [![](https://images.microbadger.com/badges/image/yahuiwong/ss-tproxy.svg)](https://microbadger.com/images/yahuiwong/ss-tproxy "Get your own image badge on microbadger.com") 3 | [![](https://images.microbadger.com/badges/version/yahuiwong/ss-tproxy.svg)](https://microbadger.com/images/yahuiwong/ss-tproxy "Get your own version badge on microbadger.com") 4 | 5 | 6 | 7 | ss-redir 全局透明代理 (REDIRECT + TPROXY) 8 | 封装自 https://github.com/YahuiWong/ss-tproxy 9 | 10 | ## 注意: 11 | 12 | 你的docker宿主内核版本要是:4.19.2-1.el7.elrepo.x86_64 13 | 如果不是的话 使用一下方式修改 14 | ```sh 15 | wget http://mirror.rc.usf.edu/compute_lock/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-4.19.2-1.el7.elrepo.x86_64.rpm 16 | yum install kernel-ml-4.19.2-1.el7.elrepo.x86_64.rpm -y 17 | vim /etc/default/grub # GRUB_DEFAULT=0 18 | grub2-mkconfig -o /boot/grub2/grub.cfg 19 | reboot 20 | ``` 21 | 使用时请使用 注意使用 `conf/`下的配置文件,并注意把`ss-tproxy.conf`里的ss配置信息修改为自己的 22 | `您的ss必须支持udp转发` 23 | -------------------------------------------------------------------------------- /conf/ss-tproxy.conf: -------------------------------------------------------------------------------- 1 | ## mode 2 | #mode='global' 3 | mode='gfwlist' 4 | #mode='chnroute' 5 | 6 | ## proxy 7 | proxy_tproxy='false' # 纯TPROXY方式 8 | proxy_server='server ip' # 服务器的地址 9 | proxy_tcport='60080' # TCP 监听端口 10 | proxy_udport='60080' # UDP 监听端口 11 | proxy_runcmd='(ssr-redir -c /etc/ss-tproxy/ssr-local.json -u -v >/var/log/ssr-redir.log &)' # 启动的命令行 12 | proxy_kilcmd='kill -9 $(pidof ssr-redir)' # 停止的命令行 13 | 14 | ## dnsmasq 15 | dnsmasq_cache_size='10240' # DNS 缓存条目 16 | dnsmasq_cache_time='3600' # DNS 缓存时间 17 | dnsmasq_log_enable='true' # 是否记录日志 18 | dnsmasq_log_file='/var/log/dnsmasq.log' # 日志文件路径 19 | 20 | ## chinadns 21 | chinadns_mutation='true' # DNS 压缩指针 22 | chinadns_verbose='true' # 记录详细日志 23 | chinadns_logfile='/var/log/chinadns.log' # 日志文件路径 24 | 25 | ## dns 26 | dns_modify='false' # 直接修改 resolv.conf 27 | dns_remote='8.8.8.8:53' # 国外 DNS,必须指定端口 28 | dns_direct='114.114.114.114' # 国内 DNS,不能指定端口 29 | 30 | ## ipts 31 | ipts_rt_tab='100' # iproute2 路由表名或 ID 32 | ipts_rt_mark='0x2333' # iproute2 策略路由的标记 33 | ipts_non_snat='false' # 不设置 SNAT iptables 规则 34 | ipts_intranet=(192.168.0.0/16) # 内网网段,多个请用空格隔开 35 | 36 | ## file 37 | file_gfwlist_txt='/etc/ss-tproxy/gfwlist.txt' # gfwlist 黑名单文件 (默认规则) 38 | file_gfwlist_ext='/etc/ss-tproxy/gfwlist.ext' # gfwlist 黑名单文件 (扩展规则) 39 | file_chnroute_txt='/etc/ss-tproxy/chnroute.txt' # chnroute 地址段文件 (chinadns) 40 | file_chnroute_set='/etc/ss-tproxy/chnroute.set' # chnroute 地址段文件 (iptables) 41 | -------------------------------------------------------------------------------- /conf/ssr-local.json: -------------------------------------------------------------------------------- 1 | { 2 | "server": "server ip", 3 | "server_port": 8989, 4 | "local_address": "0.0.0.0", 5 | "local_port": 60080, 6 | "password": "passwrod", 7 | "method": "rc4-md5", 8 | "udp_timeout":60, 9 | "workers": 1, 10 | "protocol": "origin", 11 | "protocol_param": "", 12 | "obfs": "plain", 13 | "obfs_param": "" 14 | } -------------------------------------------------------------------------------- /debian-installss-tproxy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | apt update 3 | apt install procps kmod zlib1g-dev libpcre3 libpcre3-dev sysvinit-utils dnsmasq git gettext gcc autoconf libtool make asciidoc xmlto libc-ares-dev libev-dev libssl-dev net-tools curl ipset iproute perl wget gcc dnsutils vim haveged -y 4 | 5 | update-rc.d haveged defaults 6 | service haveged start 7 | 8 | # Build aclocal-1.15, it's needed by dnsforwarder 9 | if ! type aclocal-1.15 2>/dev/null; then 10 | bigecho "Build aclocal-1.15, Pleast wait..." 11 | AUTOMAKE_VER=1.15 12 | AUTOMAKE_FILE="automake-$AUTOMAKE_VER" 13 | AUTOMAKE_URL="https://ftp.gnu.org/gnu/automake/$AUTOMAKE_FILE.tar.gz" 14 | if ! wget --no-check-certificate -O $AUTOMAKE_FILE.tar.gz $AUTOMAKE_URL; then 15 | bigecho "Failed to download file!" 16 | exit 1 17 | fi 18 | tar xf $AUTOMAKE_FILE.tar.gz 19 | pushd $AUTOMAKE_FILE 20 | ./configure 21 | make && make install 22 | popd 23 | fi 24 | 25 | # Build dnsforwarder 26 | if ! type dnsforwarder 2>/dev/null; then 27 | bigecho "Build dnsforwarder, Pleast wait..." 28 | git clone https://github.com/holmium/dnsforwarder.git 29 | pushd dnsforwarder 30 | ./configure --enable-downloader=no 31 | make && make install 32 | popd 33 | fi 34 | 35 | # Build chinadns 36 | if ! type chinadns 2>/dev/null; then 37 | bigecho "Build chinadns, Pleast wait..." 38 | CHINADNS_VER=1.3.2 39 | CHINADNS_FILE="chinadns-$CHINADNS_VER" 40 | CHINADNS_URL="https://github.com/shadowsocks/ChinaDNS/releases/download/$CHINADNS_VER/$CHINADNS_FILE.tar.gz" 41 | if ! wget --no-check-certificate -O $CHINADNS_FILE.tar.gz $CHINADNS_URL; then 42 | bigecho "Failed to download file!" 43 | exit 1 44 | fi 45 | tar xf $CHINADNS_FILE.tar.gz 46 | pushd $CHINADNS_FILE 47 | ./configure 48 | make && make install 49 | popd 50 | fi 51 | 52 | # Build Libsodium 53 | if [ ! -f "/usr/lib/libsodium.so" ]; then 54 | bigecho "Build Libsodium, Pleast wait..." 55 | LIBSODIUM_VER=1.0.17 56 | LIBSODIUM_FILE="libsodium-$LIBSODIUM_VER" 57 | LIBSODIUM_URL="https://download.libsodium.org/libsodium/releases/$LIBSODIUM_FILE.tar.gz" 58 | if ! wget --no-check-certificate -O $LIBSODIUM_FILE.tar.gz $LIBSODIUM_URL; then 59 | bigecho "Failed to download file!" 60 | exit 1 61 | fi 62 | tar xf $LIBSODIUM_FILE.tar.gz 63 | pushd $LIBSODIUM_FILE 64 | ./configure --prefix=/usr && make 65 | make install 66 | popd 67 | ldconfig 68 | fi 69 | 70 | # Build MbedTLS 71 | if [ ! -f "/usr/lib/libmbedtls.so" ]; then 72 | bigecho "Build MbedTLS, Pleast wait..." 73 | MBEDTLS_VER=2.6.0 74 | MBEDTLS_FILE="mbedtls-$MBEDTLS_VER" 75 | MBEDTLS_URL="https://tls.mbed.org/code/releases/$MBEDTLS_FILE-gpl.tgz" 76 | if ! wget --no-check-certificate -O $MBEDTLS_FILE-gpl.tgz $MBEDTLS_URL; then 77 | bigecho "Failed to download file!" 78 | exit 1 79 | fi 80 | tar xf $MBEDTLS_FILE-gpl.tgz 81 | pushd $MBEDTLS_FILE 82 | make SHARED=1 CFLAGS=-fPIC 83 | make DESTDIR=/usr install 84 | popd 85 | ldconfig 86 | fi 87 | 88 | #Build shadowsocksr-libev 89 | if ! type ssr-redir 2>/dev/null; then 90 | bigecho "Build shadowsocksr-libev, Pleast wait..." 91 | git clone https://github.com/shadowsocksr-backup/shadowsocksr-libev.git 92 | pushd shadowsocksr-libev 93 | ./configure --prefix=/usr/local/ssr-libev 94 | make && make install 95 | popd 96 | pushd /usr/local/ssr-libev/bin 97 | mv ss-redir ssr-redir 98 | mv ss-local ssr-local 99 | ln -sf ssr-local ssr-tunnel 100 | mv ssr-* /usr/local/bin/ 101 | popd 102 | rm -fr /usr/local/ssr-libev 103 | fi 104 | 105 | # Install SS-TPROXY 106 | if ! type ss-tproxy 2>/dev/null; then 107 | bigecho "Install SS-TProxy, Pleast wait..." 108 | git clone https://github.com/YahuiWong/ss-tproxy.git 109 | pushd ss-tproxy 110 | cp -af ss-tproxy /usr/local/bin 111 | chmod 0755 /usr/local/bin/ss-tproxy 112 | chown root:root /usr/local/bin/ss-tproxy 113 | mkdir -m 0755 -p /etc/ss-tproxy 114 | cp -af ss-tproxy.conf gfwlist.* chnroute.* /etc/ss-tproxy 115 | chmod 0644 /etc/ss-tproxy/* && chown -R root:root /etc/ss-tproxy 116 | popd 117 | 118 | # Systemctl 119 | pushd ss-tproxy 120 | cp -af ss-tproxy.service /etc/systemd/system/ 121 | popd 122 | # update-rc.d ss-tproxy defaults 123 | # service ss-tproxy start 124 | fi -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | ss-tproxy: 4 | # 镜像的路径 5 | image: yahuiwong/ss-tproxy:3.1.0 6 | privileged: true 7 | volumes: 8 | - ./conf/ss-tproxy.conf:/etc/ss-tproxy/ss-tproxy.conf 9 | - ./conf/ssr-local.json:/etc/ss-tproxy/ssr-local.json 10 | - /lib/modules/4.19.2-1.el7.elrepo.x86_64/:/lib/modules/4.19.2-1.el7.elrepo.x86_64/ 11 | restart: always 12 | # 容器名称 13 | container_name: ss-tproxy 14 | -------------------------------------------------------------------------------- /install-ss-tproxy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Script for automatic setup of an SS-TPROXY server on CentOS 7.3 Minimal. 4 | # 5 | 6 | export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 7 | 8 | exiterr() { echo "Error: $1" >&2; exit 1; } 9 | exiterr2() { exiterr "'yum install' failed."; } 10 | bigecho() { echo; echo -e "\033[36m $1 \033[0m"; } 11 | 12 | # Disable FireWall 13 | bigecho "Disable Firewall..." 14 | systemctl stop firewalld.service 15 | systemctl disable firewalld.service 16 | 17 | # Install Lib 18 | bigecho "Install Library, Pleast wait..." 19 | rpm --rebuilddb && yum -y install sysvinit-tools dnsmasq git gettext gcc autoconf libtool make asciidoc xmlto c-ares-devel libev-devel \ 20 | openssl-devel net-tools curl ipset iproute perl wget gcc bind-utils vim || exiterr2 21 | 22 | # Install haveged 23 | if ! type haveged 2>/dev/null; then 24 | bigecho "Install Haveged, Pleast wait..." 25 | HAVEGED_VER=1.9.1-1 26 | HAVEGED_URL="http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/h/haveged-$HAVEGED_VER.el7.x86_64.rpm" 27 | yum -y install "$HAVEGED_URL" || exiterr2 28 | systemctl start haveged 29 | systemctl enable haveged 30 | fi 31 | 32 | # Install pdnsd 33 | if ! type pdnsd 2>/dev/null; then 34 | bigecho "Install Pdnsd, Pleast wait..." 35 | PDNSD_VER=1.2.9a 36 | PDNSD_URL="http://members.home.nl/p.a.rombouts/pdnsd/releases/pdnsd-$PDNSD_VER-par_sl6.x86_64.rpm" 37 | yum -y install "$PDNSD_URL" || exiterr2 38 | fi 39 | 40 | # Build aclocal-1.15, it's needed by dnsforwarder 41 | if ! type aclocal-1.15 2>/dev/null; then 42 | bigecho "Build aclocal-1.15, Pleast wait..." 43 | AUTOMAKE_VER=1.15 44 | AUTOMAKE_FILE="automake-$AUTOMAKE_VER" 45 | AUTOMAKE_URL="https://ftp.gnu.org/gnu/automake/$AUTOMAKE_FILE.tar.gz" 46 | if ! wget --no-check-certificate -O $AUTOMAKE_FILE.tar.gz $AUTOMAKE_URL; then 47 | bigecho "Failed to download file!" 48 | exit 1 49 | fi 50 | tar xf $AUTOMAKE_FILE.tar.gz 51 | pushd $AUTOMAKE_FILE 52 | ./configure 53 | make && make install 54 | popd 55 | fi 56 | 57 | # Build dnsforwarder 58 | if ! type dnsforwarder 2>/dev/null; then 59 | bigecho "Build dnsforwarder, Pleast wait..." 60 | git clone https://github.com/holmium/dnsforwarder.git 61 | pushd dnsforwarder 62 | ./configure --enable-downloader=no 63 | make && make install 64 | popd 65 | fi 66 | 67 | # Build chinadns 68 | if ! type chinadns 2>/dev/null; then 69 | bigecho "Build chinadns, Pleast wait..." 70 | CHINADNS_VER=1.3.2 71 | CHINADNS_FILE="chinadns-$CHINADNS_VER" 72 | CHINADNS_URL="https://github.com/shadowsocks/ChinaDNS/releases/download/$CHINADNS_VER/$CHINADNS_FILE.tar.gz" 73 | if ! wget --no-check-certificate -O $CHINADNS_FILE.tar.gz $CHINADNS_URL; then 74 | bigecho "Failed to download file!" 75 | exit 1 76 | fi 77 | tar xf $CHINADNS_FILE.tar.gz 78 | pushd $CHINADNS_FILE 79 | ./configure 80 | make && make install 81 | popd 82 | fi 83 | 84 | # Build Libsodium 85 | if [ ! -f "/usr/lib/libsodium.so" ]; then 86 | bigecho "Build Libsodium, Pleast wait..." 87 | LIBSODIUM_VER=1.0.18 88 | LIBSODIUM_FILE="libsodium-$LIBSODIUM_VER" 89 | LIBSODIUM_URL="https://download.libsodium.org/libsodium/releases/$LIBSODIUM_FILE.tar.gz" 90 | if ! wget --no-check-certificate -O $LIBSODIUM_FILE.tar.gz $LIBSODIUM_URL; then 91 | bigecho "Failed to download file!" 92 | exit 1 93 | fi 94 | tar xf $LIBSODIUM_FILE.tar.gz 95 | pushd $LIBSODIUM_FILE 96 | ./configure --prefix=/usr && make 97 | make install 98 | popd 99 | ldconfig 100 | fi 101 | 102 | # Build MbedTLS 103 | if [ ! -f "/usr/lib/libmbedtls.so" ]; then 104 | bigecho "Build MbedTLS, Pleast wait..." 105 | MBEDTLS_VER=2.16.2 106 | MBEDTLS_FILE="mbedtls-$MBEDTLS_VER" 107 | MBEDTLS_URL="https://tls.mbed.org/code/releases/$MBEDTLS_FILE-gpl.tgz" 108 | if ! wget --no-check-certificate -O $MBEDTLS_FILE-gpl.tgz $MBEDTLS_URL; then 109 | bigecho "Failed to download file!" 110 | exit 1 111 | fi 112 | tar xf $MBEDTLS_FILE-gpl.tgz 113 | pushd $MBEDTLS_FILE 114 | make SHARED=1 CFLAGS=-fPIC 115 | make DESTDIR=/usr install 116 | popd 117 | ldconfig 118 | fi 119 | 120 | #Build shadowsocksr-libev 121 | if ! type ssr-redir 2>/dev/null; then 122 | bigecho "Build shadowsocksr-libev, Pleast wait..." 123 | git clone https://github.com/shadowsocksr-backup/shadowsocksr-libev.git 124 | pushd shadowsocksr-libev 125 | ./configure --prefix=/usr/local/ssr-libev 126 | make && make install 127 | popd 128 | pushd /usr/local/ssr-libev/bin 129 | mv ss-redir ssr-redir 130 | mv ss-local ssr-local 131 | ln -sf ssr-local ssr-tunnel 132 | mv ssr-* /usr/local/bin/ 133 | popd 134 | rm -fr /usr/local/ssr-libev 135 | fi 136 | 137 | # Install SS-TPROXY 138 | if ! type ss-tproxy 2>/dev/null; then 139 | bigecho "Install SS-TProxy, Pleast wait..." 140 | git clone https://github.com/YahuiWong/ss-tproxy.git 141 | pushd ss-tproxy 142 | cp -af ss-tproxy /usr/local/bin 143 | chmod 0755 /usr/local/bin/ss-tproxy 144 | chown root:root /usr/local/bin/ss-tproxy 145 | mkdir -m 0755 -p /etc/ss-tproxy 146 | cp -af ss-tproxy.conf gfwlist.* chnroute.* /etc/ss-tproxy 147 | chmod 0644 /etc/ss-tproxy/* && chown -R root:root /etc/ss-tproxy 148 | popd 149 | 150 | # Systemctl 151 | pushd ss-tproxy 152 | cp -af ss-tproxy.service /etc/systemd/system/ 153 | popd 154 | systemctl daemon-reload 155 | systemctl enable ss-tproxy.service 156 | fi 157 | 158 | # Display info 159 | bigecho "#######################################################" 160 | bigecho "Please modify /etc/tproxy/ss-tproxy.conf before start." 161 | bigecho "#ss-tproxy start" 162 | bigecho "#######################################################" 163 | 164 | #bigecho "#####################TestBegin##################################" 165 | #curl https://google.com 166 | #dig @208.67.222.222 -p443 www.google.com 167 | #dig @8.8.8.8 -p53 www.google.com 168 | #bigecho "#####################TestEnd##################################" 169 | -------------------------------------------------------------------------------- /install-ss-tproxy.temp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Script for automatic setup of an SS-TPROXY server on CentOS 7.3 Minimal. 4 | # 5 | 6 | export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 7 | 8 | exiterr() { echo "Error: $1" >&2; exit 1; } 9 | exiterr2() { exiterr "'yum install' failed."; } 10 | bigecho() { echo; echo -e "\033[36m $1 \033[0m"; } 11 | 12 | # Disable FireWall 13 | bigecho "Disable Firewall..." 14 | systemctl stop firewalld.service 15 | systemctl disable firewalld.service 16 | 17 | # Install Lib 18 | bigecho "Install Library, Pleast wait..." 19 | rpm --rebuilddb && yum -y install sysvinit-tools dnsmasq git gettext gcc autoconf libtool make asciidoc xmlto c-ares-devel libev-devel \ 20 | openssl-devel net-tools curl ipset iproute perl wget gcc bind-utils vim || exiterr2 21 | 22 | # Install haveged 23 | if ! type haveged 2>/dev/null; then 24 | bigecho "Install Haveged, Pleast wait..." 25 | HAVEGED_VER=1.9.1-1 26 | HAVEGED_URL="http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/h/haveged-$HAVEGED_VER.el7.x86_64.rpm" 27 | yum -y install "$HAVEGED_URL" || exiterr2 28 | systemctl start haveged 29 | systemctl enable haveged 30 | fi 31 | 32 | # Install pdnsd 33 | if ! type pdnsd 2>/dev/null; then 34 | bigecho "Install Pdnsd, Pleast wait..." 35 | PDNSD_VER=1.2.9a 36 | PDNSD_URL="http://members.home.nl/p.a.rombouts/pdnsd/releases/pdnsd-$PDNSD_VER-par_sl6.x86_64.rpm" 37 | yum -y install "$PDNSD_URL" || exiterr2 38 | fi 39 | 40 | # Build aclocal-1.15, it's needed by dnsforwarder 41 | if ! type aclocal-1.15 2>/dev/null; then 42 | bigecho "Build aclocal-1.15, Pleast wait..." 43 | AUTOMAKE_VER=1.15 44 | AUTOMAKE_FILE="automake-$AUTOMAKE_VER" 45 | AUTOMAKE_URL="https://ftp.gnu.org/gnu/automake/$AUTOMAKE_FILE.tar.gz" 46 | if ! wget --no-check-certificate -O $AUTOMAKE_FILE.tar.gz $AUTOMAKE_URL; then 47 | bigecho "Failed to download file!" 48 | exit 1 49 | fi 50 | tar xf $AUTOMAKE_FILE.tar.gz 51 | pushd $AUTOMAKE_FILE 52 | ./configure 53 | make && make install 54 | popd 55 | fi 56 | 57 | # Build dnsforwarder 58 | if ! type dnsforwarder 2>/dev/null; then 59 | bigecho "Build dnsforwarder, Pleast wait..." 60 | git clone https://github.com/holmium/dnsforwarder.git 61 | pushd dnsforwarder 62 | ./configure --enable-downloader=no 63 | make && make install 64 | popd 65 | fi 66 | 67 | # Build chinadns 68 | if ! type chinadns 2>/dev/null; then 69 | bigecho "Build chinadns, Pleast wait..." 70 | CHINADNS_VER=1.3.2 71 | CHINADNS_FILE="chinadns-$CHINADNS_VER" 72 | CHINADNS_URL="https://github.com/shadowsocks/ChinaDNS/releases/download/$CHINADNS_VER/$CHINADNS_FILE.tar.gz" 73 | if ! wget --no-check-certificate -O $CHINADNS_FILE.tar.gz $CHINADNS_URL; then 74 | bigecho "Failed to download file!" 75 | exit 1 76 | fi 77 | tar xf $CHINADNS_FILE.tar.gz 78 | pushd $CHINADNS_FILE 79 | ./configure 80 | make && make install 81 | popd 82 | fi 83 | 84 | # Build Libsodium 85 | if [ ! -f "/usr/lib/libsodium.so" ]; then 86 | bigecho "Build Libsodium, Pleast wait..." 87 | LIBSODIUM_VER=1.0.18 88 | LIBSODIUM_FILE="libsodium-$LIBSODIUM_VER" 89 | LIBSODIUM_URL="https://download.libsodium.org/libsodium/releases/$LIBSODIUM_FILE.tar.gz" 90 | if ! wget --no-check-certificate -O $LIBSODIUM_FILE.tar.gz $LIBSODIUM_URL; then 91 | bigecho "Failed to download file!" 92 | exit 1 93 | fi 94 | tar xf $LIBSODIUM_FILE.tar.gz 95 | pushd $LIBSODIUM_FILE 96 | ./configure --prefix=/usr && make 97 | make install 98 | popd 99 | ldconfig 100 | fi 101 | 102 | # Build MbedTLS 103 | if [ ! -f "/usr/lib/libmbedtls.so" ]; then 104 | bigecho "Build MbedTLS, Pleast wait..." 105 | MBEDTLS_VER=2.16.2 106 | MBEDTLS_FILE="mbedtls-$MBEDTLS_VER" 107 | MBEDTLS_URL="https://tls.mbed.org/code/releases/$MBEDTLS_FILE-gpl.tgz" 108 | if ! wget --no-check-certificate -O $MBEDTLS_FILE-gpl.tgz $MBEDTLS_URL; then 109 | bigecho "Failed to download file!" 110 | exit 1 111 | fi 112 | tar xf $MBEDTLS_FILE-gpl.tgz 113 | pushd $MBEDTLS_FILE 114 | make SHARED=1 CFLAGS=-fPIC 115 | make DESTDIR=/usr install 116 | popd 117 | ldconfig 118 | fi 119 | 120 | #Build shadowsocksr-libev 121 | if ! type ssr-redir 2>/dev/null; then 122 | bigecho "Build shadowsocksr-libev, Pleast wait..." 123 | git clone https://github.com/shadowsocksr-backup/shadowsocksr-libev.git 124 | pushd shadowsocksr-libev 125 | ./configure --prefix=/usr/local/ssr-libev 126 | make && make install 127 | popd 128 | pushd /usr/local/ssr-libev/bin 129 | mv ss-redir ssr-redir 130 | mv ss-local ssr-local 131 | ln -sf ssr-local ssr-tunnel 132 | mv ssr-* /usr/local/bin/ 133 | popd 134 | rm -fr /usr/local/ssr-libev 135 | fi --------------------------------------------------------------------------------