mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-09-03 17:45:44 +00:00
plan: add zone-wise acl control
plan: fix config example
This commit is contained in:
+32
-16
@@ -1,15 +1,21 @@
|
||||
目标
|
||||
---
|
||||
## 目标
|
||||
|
||||
将 `instance/dns_server` 重写为单独的 `dns` 模块,为如下的配置项提供支持:
|
||||
|
||||
```toml
|
||||
[dns]
|
||||
name = "localhost" # optional, replaces hostname, default to system hostname
|
||||
domain = "localdomain" # optional, replaces tld_dns_zone, default to et.net
|
||||
|
||||
[[dns.zone]]
|
||||
broadcast = true # optional, propogate this config to all connected peers, default to false
|
||||
# this policy applies to all zones with origin "example.com"
|
||||
[dns."example.com".import]
|
||||
whitelist = ["*"]
|
||||
blacklist = []
|
||||
disabled = true # optional, whether to reject zones with this origin from connected peers, default to false
|
||||
recursive = true # optional, apply this policy to all subzones, default to false
|
||||
|
||||
origin = "example.com"
|
||||
[[dns.zone]]
|
||||
origin = "example.com" # required, name of the zone
|
||||
ttl = 3600 # optional, default to 0
|
||||
records = [
|
||||
"www 60 IN A 123.123.123.123",
|
||||
@@ -20,7 +26,12 @@ forwarders = [
|
||||
"1.1.1.1",
|
||||
] # optional, forward DNS requests to these servers
|
||||
|
||||
# same zone, but not broadcasted
|
||||
# this policy applies to the current zone block
|
||||
[dns.zone.export] # if present, export this zone to connected peers
|
||||
whitelist = ["*"]
|
||||
blacklist = []
|
||||
|
||||
# same zone, but not exported
|
||||
[[dns.zone]]
|
||||
origin = "example.com"
|
||||
|
||||
@@ -28,7 +39,9 @@ forwarders = [
|
||||
"tcp://192.168.0.53:5353",
|
||||
]
|
||||
```
|
||||
|
||||
可能会支持的配置
|
||||
|
||||
```toml
|
||||
[dns]
|
||||
addresses = [
|
||||
@@ -49,8 +62,8 @@ listeners = [
|
||||
<details>
|
||||
<summary><h2>计划和进展</h2></summary>
|
||||
|
||||
protobuf
|
||||
---
|
||||
## protobuf
|
||||
|
||||
- `ZoneConfigPb`:包含所有 Zone 配置,以及一个 ID,该 ID 在读取 TOML 时生成
|
||||
- `DnsConfigPb`:包含 `name`、`domain` 和需要广播的 `ZoneConfigPb`
|
||||
- `DnsMessageId`: 标记 DnsClient 和它发送的 RPC 消息,避免乱序,包含:instance id, sequence number
|
||||
@@ -58,9 +71,10 @@ protobuf
|
||||
- `DnsPersistentConfig`: 用于 DnsServer 的长期接口,包含:id、listeners 和 addresses
|
||||
- `DnsHeartbeat`: DnsClient 发送的心跳,包含:id
|
||||
|
||||
DnsClient
|
||||
---
|
||||
## DnsClient
|
||||
|
||||
对于每个实例,它启动时读取 TOML 配置,然后用这个配置启动一个 DnsClient ,它需要做到:
|
||||
|
||||
1. 启动时(配置更新时?)向 DnsServer 发送 listeners 和 addresses
|
||||
2. 使用自己的 name 和 domain 创建一个专用 zone,让 name 指向自身 IP,并监听 IP 地址变化事件(为 DNS 一致性避免使用 127.0.0.1 作为 IP,若没有 IP 则不创建这个 zone)
|
||||
3. 每次获得 PeerRouteInfo 时,读取其中的 dns 字段(和一些别的身份标记字段),这是个 protobuf message (DnsConfigPb),保存了远程 Peer 的 dns 配置(不含 addresses 和 listeners),接收后它需要:
|
||||
@@ -68,8 +82,8 @@ DnsClient
|
||||
2. 检查 2., 3.i. 中得到的 zone、PeerRouteInfo 报告的 zone、本机 TOML 配置中的 zone 是否有变化,将所有有变化的 zone 报告给 DnsServer,如果没变化就不要上报
|
||||
4. 每隔一小段时间向 DnsServer 发送心跳
|
||||
|
||||
DnsServer
|
||||
---
|
||||
## DnsServer
|
||||
|
||||
每个 EasyTier 实例都会启动一个 DnsClient,但是一台机器上的所有实例共享一个唯一的 DnsServer。
|
||||
每个实例启动时:
|
||||
|
||||
@@ -98,16 +112,16 @@ DnsServer 需要做到:
|
||||
|
||||
另外任何关于系统 DNS 的操作,清理都参考现有的 magic dns。
|
||||
|
||||
问题
|
||||
---
|
||||
## 问题
|
||||
|
||||
- [ ] [minor] the ttl option isn't working because of https://github.com/hickory-dns/hickory-dns/pull/3450
|
||||
- [minor] address 路由绑定必须在有 tun 的实例上做;listener 绑定则与 tun 无关,现有竞选机制无法保证有 tun 的实例能优先启动 DnsServer
|
||||
- 或许让 DnsClient 控制关于 address 的路由和 filter,并通过 RPC 转发 DNS 请求?有两个问题:DnsServer 必须得知 addresses 否则无法进行环路检测;多个 DnsClient 同时修改 resolv.conf 添加自己得 address 容易出问题
|
||||
- 或许不妨假设大多数情况下一台机器上所有实例的 no_tun 设置相同,这时候这个问题实际上不存在
|
||||
- [minor] DnsServer 更新 zone 的时候需要更精细的合并/去重控制
|
||||
|
||||
TODO
|
||||
---
|
||||
## TODO
|
||||
|
||||
- [x] 配置解析
|
||||
- [ ] 用 OSPF 传播需要广播的配置
|
||||
- [ ] 用 DNS RPC 更新收到的配置,合并相同的域,延迟低的 peer 配置优先
|
||||
@@ -128,7 +142,9 @@ TODO
|
||||
- related to https://github.com/EasyTier/EasyTier/issues/1645
|
||||
- related to https://github.com/EasyTier/EasyTier/issues/1764
|
||||
- related to https://github.com/EasyTier/EasyTier/issues/1814
|
||||
|
||||
---
|
||||
|
||||
- (maybe) related to https://github.com/EasyTier/EasyTier/issues/937
|
||||
- (maybe) related to https://github.com/EasyTier/EasyTier/issues/1873
|
||||
|
||||
|
||||
Reference in New Issue
Block a user