Stunnel真是个好东西,可以使用SSL加密任意两点间的TCP连接,本文记录使用Stunnel加密Squid代理服务器来代替SSH数据转发。
服务器端配置Squid正向代理:
#https://www.haiyun.me
http_port 127.0.0.1:8080
icp_port 0
visible_hostname proxy.www.haiyun.me
cache_mgr admin@www.haiyun.me
cache_effective_user squid
cache_effective_group squid
via off
forwarded_for off
acl localnet src 127.0.0.0/24
http_access allow localnet
生成OpenSSL证书:
openssl req -new -x509 -days 365 -nodes -out stunnel.pem -keyout stunnel.pem
chmod 400 stunnel.pem
服务器端Stunnel安装配置:
yum install stunnel
compression=zlib
syslog=no
debug=7
output=/var/log/stunnel.log
setuid=nobody
setgid=nobody
pid=/var/run/stunnel.pid
cert=/etc/stunnel/stunnel.pem
key=/etc/stunnel/stunnel.pem
client=no
[squid]
accept=8000
connect=127.0.0.1:8080
Openwrt下安装配置Stunnel客户端:
opkg update
opkg install stunnel
compression=zlib
syslog=no
debug=7
output=/var/log/stunnel.log
pid=/var/run/stunnel.pid
client=yes
[squid]
accept=8080
connect=www.haiyun.me:8000
客户端服务器端启动Stunnel:
stunnel
此时客户端和Squid代理服务器之间的数据是使用SSL加密的,其它HTTP代理服务器也同样适用此方法,如Kingate代理服务器。
标签:openwrt, squid, openssl, stunnel, stunnel加密squid代理服务器, stunnel使用