socat 的神奇使用方式

目的是实现科* 学 * 上*网,现在记录一下流程

先在服务器上安装(比如美国,香港,台湾,马来的云主机)squid,easy_rsa, centos 下可以用yum直接安装

$ yum install openvpn
$ cp /usr/share/openvpn/easy-rsa/2.0 ~/easy-rsa
$ cd ~/easy-rsa
$ source vars # 如果这一步提示缺少openssl.cnf,那么请查看下当前目录下有没有openssl-x.x.x.cnf的文件,将他重命名一下
$ ./clean-all
$ ./build-dh
$ ./build-ca
$ ./build-key-server example.com # 这里替换成你的域名,最好是用你服务器真实的域名
$ ./build-key user1 #这里替换成你的用户名,实际上问题不太大的

 

配置一下squid.conf

http_access allow all
http_port 5678

 

现在开始配置socat,对于服务器端

socat openssl-listen:5679,reuseaddr,fork,cert=/etc/squid/example.com.crt,key=/etc/squid/example.com.key,cafile=/etc/squid/ca.crt tcp4:127.0.0.1:5678

 

对于客户端:

socat tcp-listen:5679,reuseaddr,fork openssl:example.com:5679,cert=/exvar/opt/cert/user1.crt,key=/exvar/opt/cert/user1.key,cafile=/exvar/opt/cert/ca.crt

 

行了,fly~

 

 

 

 

posted @ 2014-06-24 17:51  KimSky  阅读(5744)  评论(0编辑  收藏  举报