Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

obfs服务端配置完毕,ss服务端用的teddysun的脚本部署的,无法使用obfs,具体见下文。 #103

Open
flashbarry opened this issue Sep 10, 2017 · 12 comments

Comments

@flashbarry
Copy link

最近在鼓捣obfs,用了这个方法:

git clone https://github.com/shadowsocks/simple-obfs.git
cd simple-obfs
git submodule update --init --recursive
./autogen.sh
./configure && make
make install
,安装了obfs,然后在/etc/shadowsocks-libev/config.json中添加了

"plugin":"obfs-server",
"plugin_opts":"obfs=http"
按照网上的说法,服务端启用obfs,客户端即使不启用obfs也是应该能够上网的,
奇怪就奇怪在,我现在还不会使用obfs客户端,我想先试试不启用obfs,ss能够上网,
于是我用/etc/init.d/shadowsocks start启动ss服务端,客户端ss却上不了网了,
而如果用ss-server -c /etc/shadowsocks-libev/config.json -v开启ss服务端,ss客户端就算不启用obfs也能正常上网,两种方法有区别吗?我vi看了/etc/init.d/shadowsocks的内容,好像也没什么区别,
shadowsocks内容大概是这样的:

#!/bin/bash

chkconfig: 2345 90 10

description: A secure socks5 proxy, designed to protect your Internet traffic.

BEGIN INIT INFO

Provides: Shadowsocks-libev

Required-Start: $network $syslog

Required-Stop: $network

Default-Start: 2 3 4 5

Default-Stop: 0 1 6

Short-Description: Fast tunnel proxy that helps you bypass firewalls

Description: Start or stop the Shadowsocks-libev server

END INIT INFO

Author: Teddysun [email protected]

Source function library

. /etc/rc.d/init.d/functions

Check that networking is up.

[ ${NETWORKING} ="yes" ] || exit 0

if [ -f /usr/local/bin/ss-server ]; then
DAEMON=/usr/local/bin/ss-server
elif [ -f /usr/bin/ss-server ]; then
DAEMON=/usr/bin/ss-server
fi
NAME=Shadowsocks-libev
CONF=/etc/shadowsocks-libev/config.json
PID_DIR=/var/run
PID_FILE=$PID_DIR/shadowsocks-libev.pid
RET_VAL=0

[ -x $DAEMON ] || exit 0

if [ ! -d $PID_DIR ]; then
mkdir -p $PID_DIR
if [ $? -ne 0 ]; then
echo "Creating PID directory $PID_DIR failed"
exit 1
fi
fi

if [ ! -f $CONF ]; then
echo "$NAME config file $CONF not found"
exit 1
fi

do_start() {
if [ -f $PID_FILE ]; then
read PID < $PID_FILE
echo "$NAME (pid $PID) is already running..."
exit 0
else
echo -n $"Starting ${NAME}: "
daemon $DAEMON -u -c $CONF -f $PID_FILE
fi

RETVAL=$?
[ $RETVAL -eq 0 ] && success
echo
}

do_stop() {
echo -n $"Stopping ${NAME}: "
killproc -p $PID_FILE
RETVAL=$?
[ $RETVAL -eq 0 ]
rm -f $PID_FILE
echo
}

do_status() {
if [ -f $PID_FILE ]; then
read PID < $PID_FILE
echo "$NAME (pid $PID) is running..."
else
echo "$NAME is stopped"
RETVAL=1
fi
}

do_restart() {
do_stop
do_start
}

case "$1" in
start|stop|restart|status)
do_$1
;;
*)
echo "Usage: $0 { start | stop | restart | status }"
RET_VAL=1
;;
esac

exit $RETVAL

shadowsocks/shadowsocks-windows#1368 (comment)

shadowsocks/shadowsocks-libev#1674

@Windendless
Copy link

服务端和客户端要同时启用obfs

@lrinQVQ
Copy link
Contributor

lrinQVQ commented Sep 12, 2017

shadowsocks/shadowsocks-libev#1443

It's not a real ERROR. Actually, shadowsocks always closes connections with TCP reset, which is expected. by madeye

@flashbarry
Copy link
Author

could it because, I installed the kcptun server on the ss server,, and kcptun server cannot work with obfs-server?

@lrinQVQ
Copy link
Contributor

lrinQVQ commented Sep 12, 2017

@flashbarry maybe you can try Standalone mode?
but ony one plugin can chose in client(android,i know)

@aoxue
Copy link

aoxue commented Sep 18, 2017

ln -s /usr/local/bin/obfs-server /usr/bin
执行一下这个命令
然后再restart一下你的shadowsocks-libev

@flashbarry
Copy link
Author

@aoxue thanks

@dragon100a
Copy link

@aoxue
执行那一行后,/usr/bin多出来一个带快捷方式箭头的obfs-server
这就是预期效果吗?

@dragon100a
Copy link

dragon100a commented Sep 20, 2017

@flashbarry
总结了一下步骤,看起来大概是这样:
先用teddysun的脚本装ss-libev

然后执行如下一组命令 来装 obfs
git clone https://github.com/shadowsocks/simple-obfs.git
cd simple-obfs
git submodule update --init --recursive
./autogen.sh
./configure && make
make install
上述步骤来自于https://github.com/shadowsocks/simple-obfs 的usage一节
接下来在/usr/bin 给obfs-server 添加个 快捷方式(shadowsocks/shadowsocks-libev#1082 (comment) 这楼的第三行代码提到的)
ln -s /usr/local/bin/obfs-server /usr/bin
最后在配置文件
/etc/shadowsocks-libev/config.json
的大括号里添加这些
,
"plugin":"obfs-server",
"plugin_opts":"obfs=http"
然后重启 /etc/init.d/shadowsocks restart

这样一来,服务器端的obfs就完成了。我刚才测试了一下客户端访问y2b和之前一样是正常的。

不过 接下来 客户端已经是4.06了,有 插件选项的地方如何写来开启 obfs?如何验证 obfs 是否在工作了呢?

@aoxue
Copy link

aoxue commented Sep 20, 2017

@dragon100a 是的,执行完之后会在/usr/bin添加一个软链接,原因是在用户bin目录下没有找到obfs服务。或者在配置obfs时直接使用./configure --prefix=/usr && make然后再install也是可以解决的

@dragon100a
Copy link

dragon100a commented Sep 20, 2017

@aoxue
谢谢 告知。看起来在 服务器端开 obfs 就是 上一楼 那几行了。不过这样要是写成脚本就好多了。
接下来在 询问如何在客户端开启 obfs

@flashbarry
Copy link
Author

@dragon100a 客户端的配置请看shadowsocks/shadowsocks-windows#1368

@szmichaelyb
Copy link

@flashbarry MacOS中该怎样使用?使用Shadowsocks-NG客户端怎么关联的?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants