Signed-off-by: shirakun <nico@ni-co.moe>

This commit is contained in:
shirakun 2018-03-21 15:02:45 +09:00
parent 32b3a3bf9d
commit 296fc869a5
5 changed files with 99 additions and 95 deletions

View File

@ -1,38 +0,0 @@
#!/bin/bash
build_ss_libev(){
SS_DIR = $BUILD_DIR/shadowsocks-libev
set -ex && \
apk add --no-cache --virtual .build-deps git autoconf automake libtool build-base libev-dev linux-headers libsodium-dev mbedtls-dev pcre-dev c-ares-dev
git clone https://github.com/shadowsocks/shadowsocks-libev $SS_DIR
cd $SS_DIR
./autogen.sh
./configure --prefix=/usr --disable-documentation
make install
runDeps="$( \
scanelf --needed --nobanner /usr/bin/ss-* \
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
| xargs -r apk info --installed \
| sort -u \
)"
apk add --no-cache --virtual .run-deps rng-tools $runDeps
apk del .build-deps
rm -rf $SS_DIR/*
}
build_obfs(){
OBFS_DIR = $BUILD_DIR/simple-obfs
apk add gcc autoconf make libtool automake zlib-devel openssl asciidoc xmlto libpcre32 libev-dev g++ linux-headers
git clone https://github.com/shadowsocks/simple-obfs.git $OBFS_DIR
cd $OBFS_DIR
git submodule update --init --recursive
./autogen.sh && ./configure
make && make install
}
mkdir $ASSETS_DIR/.build_dir
BUILD_DIR = $ASSETS_DIR/.build_dir
apk update
build_ss_libev
build_obfs
rm -rf $BUILD_DIR/*

View File

@ -1,11 +0,0 @@
BIND_IP = 0.0.0.0
BIND_PORT = 8981
ENCRYPT_METHOD = aes-256-cfb
PASSWD = 123456
DNS_1 = 8.8.8.8
DNS_2 = 8.8.4.4
TIMEOUT = 300
FAST_OPEN = false
OBFS = true
OBFS_METHOD = tls

View File

@ -1,9 +0,0 @@
#!/bin/sh
exec ss-libev
if [ $OBFS -eq true ]
then
exec ss-server -s $BIND_IP -p $BIND_PORT -k $PASSWD -m $ENCRYPT_METHOD -t TIMEOUT -d $DNS_1 -d $DNS_2 -u --plugin obfs-server --plugin-opts "obfs=$OBFS_METHOD"
else
exec ss-server -s $BIND_IP -p $BIND_PORT -k $PASSWD -m $ENCRYPT_METHOD -t TIMEOUT -d $DNS_1 -d $DNS_2 -u
fi

View File

@ -3,20 +3,16 @@
# #
FROM alpine FROM alpine
LABEL maintainer="Kaugrazaka Shira <nico@ni-co.moe>" LABEL maintainer="kev <noreply@datageek.info>, Sah <contact@leesah.name>"
ENV BIND_ADDR 0.0.0.0 ENV SERVER_ADDR 0.0.0.0
ENV BIND_PORT 8981 ENV PASSWORD=
ENV PASSWORD 123456
ENV METHOD aes-256-cfb ENV METHOD aes-256-cfb
ENV TIMEOUT 300 ENV TIMEOUT 300
ENV DNS_1 8.8.8.8 ENV DNS_ADDR 8.8.8.8
ENV DNS_2 8.8.4.4 ENV DNS_ADDR_2 8.8.4.4
ENV ARGS= ENV ARGS=
ENV OBFS tls
ENV SS_DIR /tmp/shadowsocks-libev
ENV OBFS_DIR /tmp/simple-obfs
RUN set -ex && \ RUN set -ex && \
apk add --no-cache --virtual .build-deps \ apk add --no-cache --virtual .build-deps \
@ -30,17 +26,10 @@ RUN set -ex && \
libsodium-dev \ libsodium-dev \
mbedtls-dev \ mbedtls-dev \
pcre-dev \ pcre-dev \
c-ares-dev \ c-ares-dev && \
gcc \ git clone https://github.com/shadowsocks/shadowsocks-libev /tmp/shadowsocks-libev &&\
make \
zlib-devel \ cd /tmp/shadowsocks-libev && \
openssl \
asciidoc \
xmlto \
libpcre32 \
g++ && \
git clone https://github.com/shadowsocks/shadowsocks-libev $SS_DIR && \
cd $SS_DIR && \
./autogen.sh && \ ./autogen.sh && \
./configure --prefix=/usr --disable-documentation && \ ./configure --prefix=/usr --disable-documentation && \
make install && \ make install && \
@ -54,27 +43,20 @@ RUN set -ex && \
apk add --no-cache --virtual .run-deps \ apk add --no-cache --virtual .run-deps \
rng-tools \ rng-tools \
$runDeps && \ $runDeps && \
git clone https://github.com/shadowsocks/simple-obfs $OBFS_DIR && \
cd $OBFS_DIR && \
git submodule update --init --recursive && \
./autogen.sh && \
./configure && make && \
make install && \
apk del .build-deps && \ apk del .build-deps && \
rm -rf $SS_DIR/* $OBFS_DIR/* rm -rf /tmp/shadowsocks-libev/*
USER nobody USER nobody
EXPOSE 8388/tcp 8388/udp EXPOSE 8388/tcp 8388/udp
CMD ss-server -s $BIND_ADDR \ CMD ss-server -s $SERVER_ADDR \
-p $BIND_PORT \ -p 8388 \
-k $PASSWORD \ -k ${PASSWORD:-$(hostname)} \
-m $METHOD \ -m $METHOD \
-t $TIMEOUT \ -t $TIMEOUT \
-d $DNS_1 \ --fast-open \
-d $DNS_2 \ -d $DNS_ADDR \
-d $DNS_ADDR_2 \
-u \ -u \
--plugin obfs-server \
--plugin-opts "obfs=$OBFS" \
$ARGS $ARGS

80
Dockerfile.bak Normal file
View File

@ -0,0 +1,80 @@
#
# Dockerfile for shadowsocks-libev
#
FROM alpine
LABEL maintainer="Kaugrazaka Shira <nico@ni-co.moe>"
ENV BIND_ADDR 0.0.0.0
ENV BIND_PORT 8981
ENV PASSWORD 123456
ENV METHOD aes-256-cfb
ENV TIMEOUT 300
ENV DNS_1 8.8.8.8
ENV DNS_2 8.8.4.4
ENV ARGS=
ENV OBFS tls
ENV SS_DIR /tmp/shadowsocks-libev
ENV OBFS_DIR /tmp/simple-obfs
RUN set -ex && \
apk add --no-cache --virtual .build-deps \
git \
autoconf \
automake \
libtool \
build-base \
libev-dev \
linux-headers \
libsodium-dev \
mbedtls-dev \
pcre-dev \
c-ares-dev \
gcc \
make \
zlib-devel \
openssl \
asciidoc \
xmlto \
libpcre32 \
g++ && \
git clone https://github.com/shadowsocks/shadowsocks-libev $SS_DIR && \
cd $SS_DIR && \
./autogen.sh && \
./configure --prefix=/usr --disable-documentation && \
make install && \
runDeps="$( \
scanelf --needed --nobanner /usr/bin/ss-* \
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
| xargs -r apk info --installed \
| sort -u \
)" && \
apk add --no-cache --virtual .run-deps \
rng-tools \
$runDeps && \
git clone https://github.com/shadowsocks/simple-obfs $OBFS_DIR && \
cd $OBFS_DIR && \
git submodule update --init --recursive && \
./autogen.sh && \
./configure && make && \
make install && \
apk del .build-deps && \
rm -rf $SS_DIR/* $OBFS_DIR/*
USER nobody
EXPOSE 8388/tcp 8388/udp
CMD ss-server -s $BIND_ADDR \
-p $BIND_PORT \
-k $PASSWORD \
-m $METHOD \
-t $TIMEOUT \
-d $DNS_1 \
-d $DNS_2 \
-u \
--plugin obfs-server \
--plugin-opts "obfs=$OBFS" \
$ARGS