文章目录
- 1.安装squid
- 2.管理squid服务
- 3.安装Stunnel服务器端
- 4.安装Stunnel客户端
- 5.在目标使用位置开启代理
1.安装squid
yum install squid
2.管理squid服务
systemctl start squid
systemctl stop squid
systemctl status squid
查看端口
netstat -lntpo | grep 8****
修改配置
vim /etc/squid/squid.conf
http_port 0.0.0.0:8801 # 修改端口,默认为 3128
http_access allow all # 添加 ,为允许所有ip
3.安装Stunnel服务器端
yum install stunnel
生成自签名证书
openssl req -new -x509 -days 3650 -nodes -out stunnel.pem -keyout stunnel.pem
修改配置文件
/etc/stunnel/stunnel.conf
内容如下:
chroot = /var/run/stunnel/
pid = /stunnel.pid
setuid = root
setgid = root
debug = 7
;compression = zlib
output = stunnel.log
cert = /etc/stunnel/stunnel.pem
key = /etc/stunnel/stunnel.pem
CAfile = /etc/stunnel/stunnel.pem
client = no
[squid-proxy]
accept = 8002 ;监听客户端端口
connect = localhost:8001 ;
【注意】如果为云服务器,需要在服务器上打开相应的外接端口供客户端访问(8002 )。
4.安装Stunnel客户端
cert = stunnel.pem
key = stunnel.pem
CAfile = certs.pem
options = NO_SSLv2
[httpssl]
client = yes
accept = 127.0.0.1:8002 ;客户端代理网址
connect = 43.103.61.34:8002 ;服务器端监听网址
5.在目标使用位置开启代理
如window系统代理设置,火狐浏览器代理设置等。然后即可进行加密访问。