首页 > 技术文章 > SS5 Proxy Server with Docker

aboa 2020-09-15 01:42 原文

Dockerfile:

FROM centos:7.6.1810

MAINTAINER Soar

RUN TOOLS="wget gcc make pam-devel openldap-devel openssl-devel" \
  && yum -y install $TOOLS --nogpgcheck \ 
  && wget https://superb-dca2.dl.sourceforge.net/project/ss5/ss5/3.8.9-8/ss5-3.8.9-8.tar.gz \
  && tar xvf ss5-3.8.9-8.tar.gz \
  && cd ss5-3.8.9 \
  && ./configure \
  && make \
  && make install \
  && cd / \
  && chmod +x /etc/init.d/ss5 \
  && rm -rf ss5-3.8.9 \
  && rm -f ss5-3.8.9-8.tar.gz \
  && yum remove -y $TOOLS \
  && rm -rf  /var/cache/yum \
  && sed -i "/#auth/a\auth 0.0.0.0\/0 - -" /etc/opt/ss5/ss5.conf \
  && sed -i "/#permit/a\permit - 0.0.0.0\/0 - 0.0.0.0\/0 - - - - -" /etc/opt/ss5/ss5.conf \
  && groupadd -r ss5 \
  && useradd -r -g ss5 ss5

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

EXPOSE 1080

ENTRYPOINT ["/entrypoint.sh"]

entrypoint.sh

#!/bin/bash
if [ -n "$USER" -a -n "$PASS" ]
then
    echo "$USER $PASS" > /etc/opt/ss5/ss5.passwd
    sed -i "s#auth 0.0.0.0/0 - -#auth 0.0.0.0/0 - u#g" /etc/opt/ss5/ss5.conf
    sed -i "s#permit - 0.0.0.0/0 - 0.0.0.0/0 - - - - -#permit u 0.0.0.0/0 - 0.0.0.0/0 - - - - -#g" /etc/opt/ss5/ss5.conf
fi
ss5 -t -u ss5
tail -f /var/log/ss5/ss5.log

image

Usage
Run SS5 Proxy Server
$ docker run -d --name ss5_proxy -p 1080:1080 --restart=always imdevops/ss5_proxy:latest
The default socks5 port is 1080, no authorization required.

Set authorization
You can set authorization, for example:

$ docker run -d --name ss5_proxy -p 1080:1080 -e USER=admin -e PASS=admin --restart=always imdevops/ss5_proxy:latest

 reference:

https://github.com/soar1688/ss5_proxy

推荐阅读