美文网首页我用 LinuxLinuxLinux学习之路
UBUNTU 安装配置socket5 代理服务dante-ser

UBUNTU 安装配置socket5 代理服务dante-ser

作者: 土豆特别想爬山 | 来源:发表于2019-05-16 16:48 被阅读0次

UBUNTU 安装配置socket5 代理服务dante-server

背景:本来想直接安装socket5服务:ss5-3.8.9-6.tar.gz,但是在ubuntu上,实现源码的编译,即:

./configure &&make && make install

需要安装一些编译库,但是由于和centos不太一样,有些库安装不上,导致编译出现问题,怎么都无法安装成功,于是选择了dante-server。

一、 安装

安装比较容易,直接执行:

sudo apt-get install dante-server

二、配置

安装完毕后,有个配置文件:/etc/danted.conf,配置文件内容就是配置说明,建议好好阅读。

最好先cp /etc/danted.conf /etc/danted.conf_default,方便恢复查看原始配置。

可参考:官方文档 https://www.inet.no/dante/doc/latest/config/index.html

然后编辑配置文件:

sudo vi /etc/danted.conf

连接代理,需要有用户名密码的配置如下:

logoutput: syslog stdout /var/log/sockd/sockd.log

internal: eth0 port = 1080

external: eth0

method: username

clientmethod: none

user.privileged: root

user.notprivileged: proxyuser

client pass { from: 0.0.0.0/0 port 1-65535 to: 0.0.0.0/0}

pass {

from: 0.0.0.0/0 to: 0.0.0.0/0

command: bind connect udpassociate

log: error # connect disconnect iooperation

method: username

}

pass {

from: 0.0.0.0/0 to: 0.0.0.0/0

command: bindreply udpreply

log: error # connect disconnect iooperation

}

连接代理,不需要用户名密码的配置如下:

logoutput: syslog stdout /var/log/sockd/sockd.log

internal: eth0 port = 1080

external: eth0

method: none

clientmethod: none

user.privileged: root

user.notprivileged: proxyuser

client pass {

from: 0.0.0.0/0 port 1-65535 to: 0.0.0.0/0

}

pass {       

from: 0.0.0.0/0 to: 0.0.0.0/0       

command: bind connect udpassociate       

log: error # connect disconnect iooperation

}

pass {       

from: 0.0.0.0/0 to: 0.0.0.0/0       

command: bindreply udpreply       

log: error # connect disconnect iooperation

}


三、添加系统用户密码

sudo useradd proxyuser

sudo passwd proxyuser

添加好后,修改禁止proxyuser用户登录系统(安全考虑):

sudo vim /etc/passwd

将proxyuser的shell改成 /bin/false(即找到proxyuser那一行,在后面追加:bin/false)

四、创建log文件夹

sudo mkdir /var/log/sockd


五、启动服务

sudo /etc/init.d/danted start

启动成功

六、查看服务是否监听

sudo netstat -anp | grep 1080

七、用Proxifier 连接可以连接成功

总结:

查看端口占用情况,可以用命令: sudo lsof -i:端口号

查看iptables规则:sudo iptables -nvL

查看某端口是否开放,可以用telnet ip 端口号查看,比如:

telnet 127.0.0.1 80

当时配置有问题,telnet后,提示:

Escape character is '^]'.——说明telnet成功了

Connection closed by foreign host.——说明:成功后立刻被外界切断了,请求被拦截,可能配置问题

于是,再次阅读配置说明,找到配置问题,修改就可以连接。

参考资料:

https://www.inet.no/dante/doc/latest/config/index.html

https://github.com/Lozy/danted

https://www.mobibrw.com/2014/1259

相关文章

网友评论

    本文标题:UBUNTU 安装配置socket5 代理服务dante-ser

    本文链接:https://www.haomeiwen.com/subject/wlbiaqtx.html