dns over https 已经成为了标准了,给予我们的dns 解析添加了安全的支持

测试项目使用docker && docker-compose 运行

一张参考图

环境准备

  • dnscrypt-proxy (dns 代理的)
直接下载了linux 版本,并安装依赖
https://github.com/jedisct1/dnscrypt-proxy/releases
  • doh server
使用源码编译安装,使用docker 的multi stage 构建
  • nginx
使用openresty

docker-compose

  • 文件
version: "3"
services:
nginx:
image: openresty/openresty:alpine
ports:
- "443:443"
- "8080:80"
volumes:
- "./nginx/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf"
- "./nginx/cert/apicaddy.com/cert1.pem:/usr/local/openresty/nginx/conf/cert1.pem"
- "./nginx/cert/apicaddy.com/privkey1.pem:/usr/local/openresty/nginx/conf/privkey1.pem" dns-server:
image: dalongrong/doh-server
volumes:
- "./dns-server/doh-server.conf:/app/doh-server.conf"
build:
context: ./dns-server
dockerfile: Dockerfile
dns-proxy:
image: dalongrong/dnscrypt-proxy
build:
context: ./dns-proxy
dockerfile: Dockerfile
  • nginx 配置
worker_processes auto;
events {
worker_connections 65535;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
server {
listen 80;
server_name localhost;
charset utf-8;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
client_body_buffer_size 10M;
client_max_body_size 10G;
proxy_buffers 1024 4k;
proxy_pass http://dns-server:8053;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
}
location /dns-query {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_redirect off;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 86400;
proxy_pass http://dns-server:8053/dns-query ;
}
}
server {
listen 443 ssl http2;
server_name app.apicaddy.com;
ssl_certificate cert1.pem;
ssl_certificate_key privkey1.pem;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:AES256+EECDH:AES256+EDH';
ssl_prefer_server_ciphers on;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
client_body_buffer_size 10M;
client_max_body_size 10G;
proxy_buffers 1024 4k;
proxy_pass http://dns-server:8053;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
}
location /dns-query {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_redirect off;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 86400;
proxy_pass http://dns-server:8053/dns-query ;
}
}
}
  • 修改配置文件
因为运行的时候没有启动ipv6 ,同时默认大部分软件绑定的端口是127.0.0.1
doh-server 配置修改
listen = [
"0.0.0.0:8053",
]
。。。。
upstream = [
# "1.1.1.1:53",
# "1.0.0.1:53",
# "8.8.8.8:53",
# "8.8.4.4:53",
"dns-proxy:53"
]
dnscrypt-proxy 配置:
listen_addresses = ['0.0.0.0:53']

构建&测试

  • 构建
docker-compose up -d

说明

dns over https 是很不错的东西,从安全以及灵活性,都是比较方便的,更多的使用还有待仔细研究

参考资料

https://github.com/jedisct1/dnscrypt-proxy/releases
https://www.aaflalo.me/2018/10/tutorial-setup-dns-over-https-server/
https://github.com/rongfengliang/dns-proxy-demo
https://github.com/m13253/dns-over-https
https://developers.google.com/speed/public-dns/docs/dns-over-https

 
 
 
 

dns over https 简单测试(docker 运行)的更多相关文章

  1. apache airflow docker 运行简单试用

    airflow 是一个编排.调度和监控workflow的平台,由Airbnb开源,现在在Apache Software Foundation 孵化. airflow 将workflow编排为tasks ...

  2. springboot+nginx+https+linux实现负载均衡加域名访问简单测试

    把springboot项目打包成三个jar包,并指定端口为 14341,14342,14343 下载腾讯云免费ssl证书,解压后会出现如下图文件夹 把nginx文件夹下的 .crt 和 .key文件复 ...

  3. Docker安装canal、mysql进行简单测试与实现redis和mysql缓存一致性

    一.简介 canal [kə'næl],译意为水道/管道/沟渠,主要用途是基于 MySQL 数据库增量日志解析,提供增量数据订阅和消费. 早期阿里巴巴因为杭州和美国双机房部署,存在跨机房同步的业务需求 ...

  4. 在 Azure 上使用 Docker运行 Mono

    Docker 是最近相当热门的一个名词,它是一个基于 Linux Container 的轻量化的虚拟技术,而微软也相当积极与 Docker 合作,在 Azure 上支持这个火热的技术,并且提供简单的方 ...

  5. Docker学习笔记之搭建Docker运行环境

    0x00 概述 既然 Docker 是一款实用软件,我们就不得不先从它的安装说起,只有让 Docker 运行在我们的计算机上,才能更方便我们对 Docker 相关知识和使用方式的学习.得益于与商业性的 ...

  6. 使用Docker运行Java Web应用

    前言 Tomcat是目前比较流行的Web应用服务器,深受Java爱好者的喜爱.通常J2EE应用的产出物是一个war包,这篇文章将为你介绍如何使用Docker运行Tomcat+war包的Java Web ...

  7. Docker运行GUI软件的方法

    转自 https://www.csdn.net/article/2015-07-30/2825340 简介: Docker通过namespace将容器与主机上的网络和运行环境进行了隔离,默认情况下,在 ...

  8. Docker运行MongoDB及Redis及ssh端口映射远程连接

    Docker运行MongoDB及Redis及ssh端口映射远程连接 本节内容简介 在本实验里我们将通过完成 MongoDB 和 Redis 两个容器来学习Dockerfile及Docker的运行机制. ...

  9. Docker运行 Mono

    Docker运行 Mono Docker 是最近相当热门的一个名词,它是一个基于 Linux Container 的轻量化的虚拟技术,而微软也相当积极与 Docker 合作,在 Azure 上支持这个 ...

随机推荐

  1. 20170728xlVba SSC_TODAY

    Public Sub SSC_TODAY() Dim strText As String Dim Reg As Object, Mh As Object, OneMh As Object Dim i ...

  2. codeforces 494a//Treasure// Codeforces Round #282(Div. 1)

    题意:一个'('  ,  ')'  ,  '#'组成的串,可将'#'换成至少一个')'.问一个换法能使串匹配. 至少换成一个,那么就先都换成一个,记结果为str.最后一个')'的后面没有未匹配的'(' ...

  3. 最短路-Prim算法 dijkstra算法

    HDU-1233 #include <iostream> #define INF 1000000 using namespace std; ][]; ]; ]; ]; ]; int mai ...

  4. 37mysql 表操作

    创建表 #语法: create table 表名( 字段名1 类型[(宽度) 约束条件], 字段名2 类型[(宽度) 约束条件], 字段名3 类型[(宽度) 约束条件] ); #注意: 1. 在同一张 ...

  5. zzuli1985(dp/水dfs郑轻比赛)

    再一次感受到dp的威力 1985: 即将到来的新生赛 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 112  Solved: 28 SubmitStat ...

  6. Oracle11g温习-第六章:控制文件

    2013年4月27日 星期六 10:33  .控制文件的功能和特点 1) [定义数据库当前物理状态] 2) [维护数据的一致性]  如果控制文件中的检查点与数据文件中的一致,则说明数据一致,可以启动到 ...

  7. iOS UI-UIScrollView控件实现图片缩放功能

    一.缩放 1.简单说明: 有些时候,我们可能要对某些内容进行手势缩放,如下图所示 UIScrollView不仅能滚动显示大量内容,还能对其内容进行缩放处理.也就是说,要完成缩放功能的话,只需要将需要缩 ...

  8. ubuntu下安装go语言;sublime+gocode搭建;go的卸载和环境变量配个人.bashrc;2空位3个网

    https://blog.csdn.net/needkane/article/details/36891949 https://www.jianshu.com/p/4f79ae4f081c http: ...

  9. Dos命令下目录操作

    Dos命令下目录操作 1.cd 操作 显示当前目录名或改变当前目录 cd [盘符][路径]                      进入指定盘符下的目录 cd [..]               ...

  10. 小程序中的bindtap和catchtap的区别(交流QQ群:604788754)

    bindtap绑定的节点,如果他的父节点也有绑定事件,点击之后就会出现冒泡. catchtap绑定的节点,如果他的父节点也有绑定事件,点击之后不会出现冒泡.