时间:2021-07-01 10:21:17 帮助过:201人阅读
这里主要介绍电脑无需任何设置,就能够自动加密代理特定网站的HTTP/HTTPS协议。由于某墙的存在,作用你懂的。敏感磁太多,这里就不多说了。使用bind、stunnel、sni proxy,其中stunnel非必需的。 涉及到的软件 BIND: 一个流行的域名解析服务器,我们可以设置
这里主要介绍电脑无需任何设置,就能够自动加密代理特定网站的HTTP/HTTPS协议。由于某墙的存在,作用你懂的。敏感磁太多,这里就不多说了。使用bind、stunnel、sni proxy,其中stunnel非必需的。wget http://www.isc.org/downloads/file/bind-9-10-0b1-2/?version=tar.gz -O bind-9-10-0b1-2.tar.gz tar xzf bind-9-10-0b1-2.tar.gz cd bind-9-10-0b1-2 ./configure --prefix=/usr/local/bind make && make install2、配置主DNS服务器(10.96.153.201) 2.1、生成/usr/local/bind/etc/rndc.key密钥文件
/usr/local/bind/sbin/rndc-confgen -a -k rndckey -c /usr/local/bind/etc/rndc.key2.2、编辑/usr/local/bind/etc/named.conf,写入如何内容:
include "/usr/local/bind/etc/rndc.key"; controls { inet 127.0.0.1 port 953 allow { 127.0.0.1; } keys { "rndckey"; }; }; logging { channel default_syslog { syslog local2; severity notice; }; channel audit_log { file "/var/log/bind.log"; severity notice; print-time yes; }; category default { default_syslog; }; category general { default_syslog; }; category security { audit_log; default_syslog; }; category config { default_syslog; }; category resolver { audit_log; }; category xfer-in { audit_log; }; category xfer-out { audit_log; }; category notify { audit_log; }; category client { audit_log; }; category network { audit_log; }; category update { audit_log; }; category queries { audit_log; }; category lame-servers { audit_log; }; }; options { directory "/usr/local/bind/etc"; pid-file "/usr/local/bind/var/run/bind.pid"; transfer-format many-answers; interface-interval 0; forward only; forwarders { 202.96.128.166;202.96.134.133; }; allow-query {any;}; }; zone "google.com" { type master; file "google.com.zone"; allow-transfer { 10.96.153.204; }; };在这个named.conf文件中,我们只需要关心如下内容: 对于options{}区域,202.96.128.166和202.96.134.133这两个是ISP提供的本地DNS,需要修改为自己所在ISP的本地DNS。 对于zone "google.com"{}区域,这里定义了google.com域名的区域文件google.com.zone,还有允许10.96.153.204(即从DNS)同步区域文件。 2.3、建立google.com.zone区域文件
$TTL 3600 @ IN SOA ns1.google.com. hostmaster.google.com. ( 2014072015? ; Serial 3600 ; Refresh 900 ; Retry 3600000 ; Expire 3600 ) ; Minimum @ IN NS ns1.google.com. @ IN NS ns2.google.com. ns1 IN A 10.96.153.201 ns2 IN A 10.96.153.204 @ IN A 10.96.153.204 * IN A 10.96.153.204对于这个区域文件, ns1 IN A 10.96.153.201 指向第一个dns服务器,即主DNS。 ns2 IN A 10.96.153.204 指向第二个dns服务器,即从DNS。 @ IN A 10.96.153.204和* IN A 10.96.153.204指向内网的代理服务器(stunnel)。我们只需要修改这三个地方就好了。 3、配置从DNS服务器(10.96.153.204) 编辑named.conf,写入如下内容
logging { channel default_syslog { syslog local2; severity notice; }; channel audit_log { file "/var/log/bind.log"; severity notice; print-time yes; }; category default { default_syslog; }; category general { default_syslog; }; category security { audit_log; default_syslog; }; category config { default_syslog; }; category resolver { audit_log; }; category xfer-in { audit_log; }; category xfer-out { audit_log; }; category notify { audit_log; }; category client { audit_log; }; category network { audit_log; }; category update { audit_log; }; category queries { audit_log; }; category lame-servers { audit_log; }; }; options { directory "/usr/local/bind/etc"; pid-file "/usr/local/bind/var/run/bind.pid"; transfer-format many-answers; interface-interval 0; forward only; forwarders { 202.96.128.166;202.96.134.133; }; allow-query {any;}; }; zone "google.com" { type slave; file "google.com.zone"; masters { 10.96.153.201; }; };配置从DNS就简单得多,只需要写入如上内容到named.conf文件。同样的, options{}中202.96.128.166和202.96.134.133这两个是当地ISP本地dns。 zone "google.com"{}中10.96.153.201指明主DNS服务器IP。 4、启动bind dns服务器 /usr/local/bind/sbin/named
apt-get install stunnel42、内网代理服务器stunnel配置 编辑/etc/default/stunnel4,设置ENABLED=1。 编辑/etc/stunnel/stunnel.conf,内容如下:
client = yes pid = /etc/stunnel/stunnel.pid [http] accept = 80 connect = 1.2.3.4:8082 [https] accept = 443 connect = 1.2.3.4:4433此配置文件表示,监听了80端口,并把此端口流量转发到1.2.3.4:8082,监听了443端口,并把此端口流量转发到1.2.3.4:4433 3、国外服务器stunnel配置 3.1、生成ssl证书stunnel.pem文件
openssl genrsa -out key.pem 2048 openssl req -new -x509 -key key.pem -out cert.pem -days 1095 cat key.pem cert.pem >> /etc/stunnel/stunnel.pem3.2、编辑/etc/stunnel/stunnel.conf文件 client = no [http] accept = 1.2.3.4:8082 connect = 127.0.0.1:8082 cert = /etc/stunnel/stunnel.pem [https] accept = 1.2.3.4:4433 connect = 127.0.0.1:4433 cert = /etc/stunnel/stunnel.pem 此配置文件表示,监听了1.2.3.4:8082,并转发此地址流量到127.0.0.1:8082,监听了1.2.3.4:4433,并转发给地址流量到127.0.0.1:4433。 3.3、编辑/etc/default/stunnel4,设置ENABLED=1。 4、启动stunnel service stunnel4 start
原文地址:bind+stunnel+sni proxy加密代理翻墙, 感谢原作者分享。