使用 cloudflared 将 9 绑定到容器和主机中。为什么外部分辨率未加密?

问题描述 投票:0回答:1

前几天我在docker上用bind9做一些实验,遇到了一些异常行为 在等待上游服务器上的 Bind 更新到稳定版 9.20 并支持 DOH 时,我一直在我的 DNS 服务器中使用本指南: Cloudflared 指南

当我检查 1.1.1.1/help 时,我总是得到这个结果 DOHOK

但是,如果我在运行 cloudflared 的主机上运行 docker bind9,我会得到这个结果

DOHKO

我的named.conf:

tls local-tls {
   key-file "/etc/bind/ssl/privkey.pem";
   cert-file "/etc/bind/ssl/fullchain.pem";
};

options {
        listen-on port 53 {any;};
        listen-on port 443 tls local-tls http default {any;};
        allow-query {any;};
        recursion yes;
        forwarders {
                127.0.0.1 port 5053;
        };
};

还尝试使用:

tls local-tls {
   key-file "/etc/bind/ssl/privkey.pem";
   cert-file "/etc/bind/ssl/fullchain.pem";
};

options {
        listen-on port 53 {any;};
        listen-on port 443 tls local-tls http default {any;};
        allow-query {any;};
        recursion yes;
        forwarders {
                172.17.0.1 port 5053;
        };
};

但是结果是一样的

我的 docker 撰写文件:

version: '3'

services:
  bind9:
    image: ubuntu/bind9
    container_name: bind9
    environment:
      - BIND9_USER=root
      - TZ=Europe/Rome
    ports:
      - "53:53"
      - "53:53/udp"
      - "443:443/tcp"
    volumes:
      - ./config:/etc/bind
      - ./cache:/var/cache/bind
      - ./records:/var/lib/bind
      - ./ssl:/etc/bind/ssl
      - ./zones:/etc/bind/zones
      - ./keys:/etc/bind/keys
      - ./run:/var/run
    restart: unless-stopped

有谁能指出我正确的方向吗? 谢谢:)

在 dockerized BIND9 环境中的上游服务器中启用 DOH

docker-compose dns cloudflare bind9
1个回答
0
投票

我已经找到解决办法了

在此文件中 /etc/default/cloudflared

添加选项-地址0.0.0.0 这边走: CLOUDFLARED_OPTS=-地址 0.0.0.0 --端口 5053 --上游 https://1.1.1.1/dns-query --上游 https://1.0.0.1/dns-query

然后到named.conf文件中添加docker主机地址广告转发器,一般是172.17.0.1

    forwarders {
            172.17.0.1 port 5053;
    };

现在可以了!!!

© www.soinside.com 2019 - 2024. All rights reserved.