说明
Socks5代理是一种常见的代理协议,它允许用户在客户端和服务器之间建立一个中转通道。对于使用SSH连接到远程服务器(例如VPS)的用户,尤其是在网络延迟高、丢包严重的情况下,Socks5代理可以显著提高连接的稳定性和速度。
安装
wget --no-check-certificate https://raw.github.com/Lozy/danted/master/install.sh -O install.sh
#!/bin/bash
#
# Dante Socks5 Server AutoInstall
# -- Owner: https://www.inet.no/dante
# -- Provider: https://sockd.info
# -- Author: Lozy
#
# Check if user is root
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script, please use root to install"
exit 1
fi
REQUEST_SERVER="https://raw.github.com/Lozy/danted/master"
SCRIPT_SERVER="https://public.sockd.info"
SYSTEM_RECOGNIZE=""
[ "$1" == "--no-github" ] && REQUEST_SERVER=${SCRIPT_SERVER}
if [ -s "/etc/os-release" ];then
os_name=$(sed -n 's/PRETTY_NAME="\(.*\)"/\1/p' /etc/os-release)
if [ -n "$(echo ${os_name} | grep -Ei 'Debian|Ubuntu' )" ];then
printf "Current OS: %s\n" "${os_name}"
SYSTEM_RECOGNIZE="debian"
elif [ -n "$(echo ${os_name} | grep -Ei 'CentOS')" ];then
printf "Current OS: %s\n" "${os_name}"
SYSTEM_RECOGNIZE="centos"
else
printf "Current OS: %s is not support.\n" "${os_name}"
fi
elif [ -s "/etc/issue" ];then
if [ -n "$(grep -Ei 'CentOS' /etc/issue)" ];then
printf "Current OS: %s\n" "$(grep -Ei 'CentOS' /etc/issue)"
SYSTEM_RECOGNIZE="centos"
else
printf "+++++++++++++++++++++++\n"
cat /etc/issue
printf "+++++++++++++++++++++++\n"
printf "[Error] Current OS: is not available to support.\n"
fi
else
printf "[Error] (/etc/os-release) OR (/etc/issue) not exist!\n"
printf "[Error] Current OS: is not available to support.\n"
fi
if [ -n "$SYSTEM_RECOGNIZE" ];then
wget -qO- --no-check-certificate ${REQUEST_SERVER}/install_${SYSTEM_RECOGNIZE}.sh | \
bash -s -- $* | tee /tmp/danted_install.log
else
printf "[Error] Installing terminated"
exit 1
fi
exit 0
安装说明
bash install.sh --port=端口 --user=用户名 --passwd=密码
使用
vi /etc/danted/sockd.conf
修改以下代码,改成你需要设置的白名单IP或IP段即可,然后重启使其生效;
client pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
}
卸载
bash install.sh --uninstall