Ubuntu配置socket5代理服务器
配置socket5代理服务器
- 安装dante-server
apt-get install dante-server
- 创建代理用户
2.1 创建组
groupadd proxy
2.2 创建用户
useradd ss5 -g proxy
2.3 设置密码
passwd ss5
- 禁止ss5登录
编辑
/etc/passwd
在ss5用户那行后增加:
/bin/false
- 编辑配置文件
4.1 备份原配置文件
mv /etc/danted.conf /etc/danted.conf.back
4.2 增加新配置文件
vim /etc/danted.conf
将如下内容复制到文件并保存
logoutput: /var/log/sockd.log
internal: eth0 port = 65522
external: eth0
method: username
clientmethod: none
user.privileged: root
user.notprivileged: ss5
user.libwrap: nobody
compatibility: sameport
compatibility: reuseaddr
extension: bind
client pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
}
pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
protocol: tcp
}
配置不用身份验证方式
嗯,因为不需要验证,所以这里就都是none
一定要配,否则后续的client pass和socks pass策略都是不生效的,只有默认的拒绝策略会生效
clientmethod: none
socksmethod: none
logoutput: /var/log/dante.log
internal: eth0 port = 65522
external: eth0
socksmethod: none
clientmethod: none
user.privileged: root
user.notprivileged: nobody
client pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: error # To enable logging for troubleshooting purposes, you can change this to 'debug'
}
pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
protocol: tcp udp
}
用户名(注意前面的空格。。。。)
4.3 启动代理服务
/etc/init.d/danted start
4.4 重启代理服务
/etc/init.d/danted restart
- 检测是否成功
netstat -anp | grep 65522
6用curl测试一下
curl -v -x socks5h://8.218.xxx.xxx:65522 https://api.openai.com
Ubuntu配置socket5代理服务器