https://sourceforge.net/projects/ss5/files/ss5/
https://nchc.dl.sourceforge.net/project/ss5/ss5/3.8.9-8/ss5-3.8.9-8.tar.gz
yum install -y pam-devel
yum install -y openldap-devel
yum install -y openssl-devel
tar xvf ss5-3.8.9-8.tar.gz
cd ss5-3.8.9
./configure && make && make install
##查找取消下面两行注释
vi /etc/opt/ss5/ss5.conf
auth 0.0.0.0/0 – –
permit – 0.0.0.0/0 – 0.0.0.0/0 – – – – –
安装好后这两行是注解掉的,将注解的这两行取消注解即可,此时为无认证状态,大家都能访问
chmod +x /etc/rc.d/init.d/ss5
/etc/rc.d/init.d/ss5 start
/etc/rc.d/init.d/ss5 stop
/etc/rc.d/init.d/ss5 restart
##需要将1.4步骤中的两行修改成:
auth 0.0.0.0/0 – u
permit u 0.0.0.0/0 – 0.0.0.0/0 – – – – –
##添加用户名及密码/etc/opt/ss5/ss5.passwd,每行一个用户+密码(之间用空格),然后重启服务:/etc/rc.d/init.d/ss5 restart
vi /etc/opt/ss5/ss5.passwd
admin admin123
vi /etc/sysconfig/ss5
#将SS5_OPTS=" -u root"取消注释,修改成下面这样,如将端口修改为9080,然后重启服务:/etc/rc.d/init.d/ss5 restart
SS5_OPTS=" -u root -b 0.0.0.0:9080"
[root@localhost ss5-3.8.9]# netstat -luntp|grep ss5
tcp 0 0 0.0.0.0:9080 0.0.0.0:* LISTEN 10616/ss5
如果没有netstat命令,执行yum install -y net-tools进行安装
步骤1中已搭建好sock5服务,那linux下sock5客户端的选择上,可以考虑使用proxychains,使用了下还是较稳定的。
ProxyChains is a UNIX program, that hooks network-related libc functions
in DYNAMICALLY LINKED programs via a preloaded DLL (dlsym(), LD_PRELOAD)
and redirects the connections through SOCKS4a/5 or HTTP proxies.
It supports TCP only (no UDP/ICMP etc).
https://github.com/rofl0r/proxychains-ng/tree/master
https://codeload.github.com/rofl0r/proxychains-ng/zip/refs/tags/v4.15
# unzip
unzip proxychains-ng-4.15.zip
cd proxychains-ng-4.15
# configure and install
./configure --prefix=/usr --sysconfdir=/etc
make && make install
# installs /etc/proxychains.conf
make install-config
以上的编绎需要gcc编绎器,如果没有gcc gcc-以++,执行yum install -y gcc gcc-c++安装
部分安装日志如下:
cc src/daemon/hsearch.o src/daemon/sblist.o src/daemon/sblist_delete.o src/daemon/daemon.o src/daemon/udpserver.o -o proxychains4-daemon
./tools/install.sh -D -m 644 libproxychains4.so /usr/lib/libproxychains4.so
./tools/install.sh -D -m 755 proxychains4 /usr/bin/proxychains4
./tools/install.sh -D -m 755 proxychains4-daemon /usr/bin/proxychains4-daemon
[root@localhost proxychains-ng-4.15]#
[root@localhost proxychains-ng-4.15]# make install-config
./tools/install.sh -D -m 644 src/proxychains.conf /etc/proxychains.conf
可以将步骤2中编绎安装的文件放在一个目录,然后制成tar.gz包,这样在其他的相同操作系统的机器上,就可以直接解压使用,不需要重新编绎,节省时间和步骤,如下:
##建立好目录如proxychains_bin_centos7.6
mkdir proxychains_bin_centos7.6
##将需要的文件拷进目录
cp /usr/lib/libproxychains4.so proxychains_bin_centos7.6/
cp /usr/bin/proxychains4 proxychains_bin_centos7.6/
cp /etc/proxychains.conf proxychains_bin_centos7.6/
##打成压缩包得到一个proxychains_bin_centos7.6.tar.gz
tar -zcvf proxychains_bin_centos7.6.tar.gz proxychains_bin_centos7.6
Usage: ./proxychains4 -q -f config_file program_name [arguments]
-q makes proxychains quiet - this overrides the config setting
-f allows one to manually specify a configfile to use
for example : proxychains telnet somehost.com
More help in README file
##需要进行的配置,告诉服务器连哪个sock5代理等,示例如下:
###附上一个简单的配置例子:
socks4 127.0.0.1 9050 #sock4
socks5 10.9.17.96 1080 #sock5,no auth
socks5 192.168.56.101 9080 admin admin123 #sock5 need auth
比如我在proxychains.conf的最后一行配置socks5 192.168.56.101 1080 admin admin123
,告诉服务器我需要通过192.168.56.101 的服务器进行代理访问,并且是认证的方式。
[testuser@localhost proxychains_bin_centos7.6]$ tail -f proxychains.conf
# proxy types: http, socks4, socks5, raw
# * raw: The traffic is simply forwarded to the proxy without modification.
# ( auth types supported: "basic"-http "user/pass"-socks )
#
[ProxyList]
# add proxy here ...
# meanwile
# defaults set to "tor"
socks5 192.168.56.101 9080 admin admin123
##使用方式一:会打印代理连接的信息
Usage: ./proxychains4 -f config_file program_name [arguments],如
cd /home/testuser/proxychains_bin_centos7.6
./proxychains4 -f proxychains.conf curl http://www.baidu.com
##使用方式二,加上-q参数,安静的使用,不打印代理的信息
cd /home/testuser/proxychains_bin_centos7.6
./proxychains4 -q -f proxychains.conf curl http://www.baidu.com
##直接采集命令绝对路径+program_name [arguments]的方式,如:
/home/testuser/proxychains_bin_centos7.6/proxychains4 -f /home/testuser/proxychains_bin_centos7.6/proxychains.conf curl http://www.baidu.com