首页 > 代码库 > 【GFW】FQ攻略

【GFW】FQ攻略

一、具体思路

  1.浏览器设置代理,将请求发送给Stunnel A进行加密

  2.加密的请求可以越过防火墙,发送给Stunnel B

  3.Stunnel B接收到请求,再将请求解密后转发到Squid B监听的端口

  4.Squid B会去请求资源,然后将具体获得的响应交给Stunnel B来加密

  5.Stunnel B加密后将信息返回Stunnel A

  6.Stunnel A再将消息解密后返回给请求端口。

技术分享

二、需要准备的服务清单如下:

    1. Server_A BigWall之内,运行stunnel_A服务
    2. Server_B BigWall之外,运行stunnel_B、squid_B
    3. 浏览器代理client

三、具体步骤

  服务器:CentOs7

  客户端:  Win7

1.在墙外的服务器安装Squid

  

yum install squid -y
# 启动squid,默认监听3128端口
service squid start

2.在墙外的服务器安装Stunnel

 

#安装stunnelyum install stunnel -ycd /etc/stunnel/#生成密钥 stunnel.pem,生成过程需要填写地域、邮箱等信息openssl req -new -x509 -days 365 -nodes -out stunnel.pem -keyout stunnel.pem#Diffie-Hellman密钥创建openssl gendh 512>> stunnel.pem#在/etc/stunnel/文件夹下创建配置文件vi stunnel.conf
#修改后启动,默认会读取/etc/stunnel/stunnel.conf文件,也可以自己指定
stunnel
#具体内容如下:
##########
技术分享
cert = /etc/stunnel/stunnel.pemCAfile = /etc/stunnel/stunnel.pemsocket = l:TCP_NODELAY=1socket = r:TCP_NODELAY=1;;;chroot = /var/run/stunnelpid = /etc/stunnel/stunnel.pidverify = 3;;; CApath = certs;;; CRLpath = crls;;; CRLfile = crls.pem;setuid = stunnel;setgid = stunnel;;; client=yescompression = zlib;;; taskbar = nodelay = no;;; failover = rr;;; failover = priosslVersion = TLSv1fips=nodebug = 7syslog = nooutput = /etc/stunnel/stunnel.log[sproxy]accept = 34567connect = 127.0.0.1:3128
View Code

 

3.在墙内服务器安装Stunnel

Win7 下载stunnel.exe安装即可

配置文件修改如下,其中stunnel.pem通过ftp从服务端弄下来就行

client = yes[https]
# accept为浏览器需要填写的代理端口号,代理ip写本机即可accept
= 9191
# connect stunnel将请求加密后会发送到该IP:Portconnect = 47.88.26.158:34567
# 加密用的证书和keycert = E:\stunnel\stunnel.pemkey = E:\stunnel\stunnel.pemTIMEOUTclose=0

【GFW】FQ攻略