我使用 apt 包管理器在 ubuntu 22.04.1 上安装了 danted,一切正常,直到我尝试连接它。
这是我的/etc/danted.conf
logoutput: /var/log/socks.log
internal: ens160 port = 110
external: ens160
clientmethod: none
socksmethod: username
user.privileged: root
user.notprivileged: nobody
client pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: error connect disconnect
}
client block {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect error
}
socks pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
command: bind connect udpassociate
log: error connect disconnect
socksmethod: username
}
socks block {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect error
}
这是systemctl status danted.service
输出:
● danted.service - SOCKS (v4 and v5) proxy daemon (danted)
Loaded: loaded (/lib/systemd/system/danted.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-09-28 10:08:31 +0330; 5min ago
Docs: man:danted(8)
man:danted.conf(5)
Process: 7117 ExecStartPre=/bin/sh -c uid=`sed -n -e "s/[[:space:]]//g" -e "s/#.*//" -e "/^user\.privileged/{s/[^:]*://p;q;}" /etc/danted.conf`; if [ -n "$uid" ]; then touch /var/run/danted.pid; chown $uid /var/run/danted.pid; fi (code=exited, status=0/SUCCESS)
Main PID: 7121 (danted)
Tasks: 20 (limit: 1030)
Memory: 7.3M
CPU: 647ms
⠇
netstat -tulp
输出:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 localhost:domain 0.0.0.0:* LISTEN 838/systemd-resolve
tcp 0 0 static.<server-ip backward without the first three digits>:pop3 0.0.0.0:* LISTEN 7121/danted
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN 1034/sshd: /usr/sbi
tcp6 0 0 ubuntu20:pop3 [::]:* LISTEN 7121/danted
tcp6 0 0 [::]:ssh [::]:* LISTEN 1034/sshd: /usr/sbi
udp 0 0 localhost:domain 0.0.0.0:* 838/systemd-resolve
udp 0 0 localhost:snmp 0.0.0.0:* 847/snmpd
udp6 0 0 ip6-localhost:snmp [::]:* 847/snmpd
但是当我尝试运行 curl 时curl -x socks5://danteduser:<user pass>@<my server ip address>:110 google.com
,我得到了这个:
curl: (97) Unable to receive initial SOCKS5 response.
journalctl -l | grep danted
输出(最后一个systemctl restart danted
):
Sep 28 10:08:31 ubuntu20 systemd[1]: Stopping SOCKS (v4 and v5) proxy daemon (danted)...
Sep 28 10:08:31 ubuntu20 systemd[1]: danted.service: Deactivated successfully.
Sep 28 10:08:31 ubuntu20 systemd[1]: Stopped SOCKS (v4 and v5) proxy daemon (danted).
Sep 28 10:08:31 ubuntu20 systemd[1]: Starting SOCKS (v4 and v5) proxy daemon (danted)...
Sep 28 10:08:31 ubuntu20 systemd[1]: Started SOCKS (v4 and v5) proxy daemon (danted).
显然端口 110 甚至没有打开,当我telnet <server ip> 110
在本地机器上尝试时,我得到了这个:
Trying <server ip>...
telnet: Unable to connect to remote host: No route to host
这是/var/log/socks.log
启动服务后的文件内容:
Sep 28 11:58:44 (1664353724.536076) danted[8351]: info: Dante/server[1/1] v1.4.2 running
发送 curl 请求后,此文件中没有新日志!