diff --git a/.dockerignore b/.dockerignore index d16cb6a..b68852a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,4 +4,3 @@ target/ log/ plugins/ -legacy/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 86f2c3b..4cba6d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,18 @@ You should also include the user name that made the change. --> -## 0.1.6 (unreleased) +## 0.3.0 (Unreleased) + +### Improvements + +- Totally restructured and reimplemented all components +- Support multiple bootstrap resolvers. +- Periodic health check of all path candidates. +- Periodic nexthop IP address resolution via the proxy itself, bootstrap resolver is only used at the first time and fall-back. +- Periodic fetching of access token with refresh token. +- Hot reloading of configuration files, including block and override files. + +## 0.2.0 ### Improvements @@ -22,6 +33,7 @@ You should also include the user name that made the change. - Change inner structure of proxy's supplemental services other than UDP/TCP acceptors. ## 0.1.5 (Jun. 6, 2022) + ### Improvements - Update override-list format to use individual lines for representing multiple matching for a name, i.e., (name, IPv4) and (name, IPv6). diff --git a/README.md b/README.md index 82546f4..639fd3a 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,9 @@ If you run without `--config` option, i.e., simply hit `$ ./doh-auth-proxy`, the ```:toml:config.toml listen_addresses = ['127.0.0.1:50053', '[::1]:50053'] -bootstrap_dns = "1.1.1.1:53" -reboot_period = 3 # mins +bootstrap_dns = ["1.1.1.1"] +endpoint_resolution_period = 60 # mins +healthcheck_period = 10 # mins max_cache_size = 16384 target_urls = ["https://dns.google/dns-query"] ``` @@ -77,7 +78,7 @@ where we assume that `config.toml` is configured as follows. ```toml:config.toml listen_addresses = ['127.0.0.1:50053', '[::1]:50053'] -bootstrap_dns = "8.8.8.8:53" +bootstrap_dns = ["8.8.8.8"] target_urls = ["https://odoh.cloudflare-dns.com/dns-query"] @@ -159,10 +160,14 @@ OPTIONS: listen_addresses = ['127.0.0.1:50053', '[::1]:50053'] ## DNS (Do53) resolver address for bootstrap -bootstrap_dns = "8.8.8.8:53" +bootstrap_dns = ['8.8.8.8'] + +## Minutes to re-resolve the IP addr of the nexthop and authentication endpoint url +## Ip addresses are first resolved by bootstrap DNS, after that, they will be resolved by (MO)DoH resolver itself. +# endpoint_resolution_period = 60 -## Minutes to re-fetch the IP addr of the target url host via the bootstrap DNS -reboot_period = 3 +## Health check period in minitus. Check health of all path candidates and purge DNS cache. +# healthcheck_period = 10 ## Cache entry size (Default 16384) max_cache_size = 16384 @@ -240,7 +245,7 @@ odoh_relay_randomization = true You can run this proxy as a docker container, where the docker image is hosted at [Docker Hub](https://hub.docker.com/r/jqtype/doh-auth-proxy). You can run the docker container by appropriately configure env vers or an env file imported by the container. -See the [`./docker/](./docker) directory and [`./docker/README.md`](./docker/README.md) for the detailed configuration for the docker container. +See the [`./docker`](./docker) directory and [`./docker/README.md`](./docker/README.md) for the detailed configuration for the docker container. ## Authentication at the next hop node (DoH target or ODoH relay) diff --git a/TODO.md b/TODO.md index 7cf4ee1..010f977 100644 --- a/TODO.md +++ b/TODO.md @@ -7,10 +7,8 @@ - `crates.io` -- Sophistication of mu-ODNS based on ODoH, such as loop detection - Docker container packaged with token server (server-side) - Override with command line options over TOML configuration - Tweaks for anonymization - Override user-agent for DoH/ODoH/MODoH by specifying one in `config.toml` - Refactor -- More sophisticated url building for query. Currently there exist cases of 'loop'. diff --git a/dap-bin/src/config/target_config.rs b/dap-bin/src/config/target_config.rs index 68d148f..26095b9 100644 --- a/dap-bin/src/config/target_config.rs +++ b/dap-bin/src/config/target_config.rs @@ -85,7 +85,7 @@ impl TryInto for &TargetConfig { ///////////////////////////// // endpoint re-resolution period - if let Some(val) = self.config_toml.endoint_resolution_period { + if let Some(val) = self.config_toml.endpoint_resolution_period { proxy_config.endpoint_resolution_period_sec = Duration::from_secs((val as u64) * 60); } info!( diff --git a/dap-bin/src/config/toml.rs b/dap-bin/src/config/toml.rs index fb116ca..0ec8150 100644 --- a/dap-bin/src/config/toml.rs +++ b/dap-bin/src/config/toml.rs @@ -6,7 +6,7 @@ use std::fs; pub struct ConfigToml { pub listen_addresses: Option>, pub bootstrap_dns: Option>, - pub endoint_resolution_period: Option, + pub endpoint_resolution_period: Option, pub healthcheck_period: Option, pub max_cache_size: Option, pub target_urls: Option>, diff --git a/docker/.env.example b/docker/.env.example index 7f4c503..e2ab943 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -4,8 +4,7 @@ # TARGET_URLS=https://dns.google/dns-query TARGET_URLS=https://odoh.cloudflare-dns.com/dns-query TARGET_RANDOMIZATION=true -BOOTSTRAP_DNS_ADDR=1.1.1.1 -BOOTSTRAP_DNS_PORT=53 +BOOTSTRAP_DNS=1.1.1.1 ## ODoH ## If specified, ODoH is enabled. diff --git a/docker/Dockerfile b/docker/Dockerfile index 83eedbf..4b22c46 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -21,7 +21,7 @@ RUN apt-get update && apt-get install -qy --no-install-recommends $BUILD_DEPS && curl -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain stable && \ export PATH="$HOME/.cargo/bin:$PATH" && \ echo "Building DoH Auth Proxy from source" && \ - cargo build --release --no-default-features && \ + cargo build --release --no-default-features --package doh-auth-proxy && \ mkdir -p /opt/doh-auth-proxy/sbin && \ strip --strip-all /tmp/target/release/doh-auth-proxy diff --git a/docker/run.sh b/docker/run.sh index 62e0c90..8329686 100644 --- a/docker/run.sh +++ b/docker/run.sh @@ -2,11 +2,10 @@ CONFIG_FILE=/modoh/doh-auth-proxy.toml DEFAULT_LOG_LEVEL="info" DEFAULT_TARGET_URLS="https://dns.google/dns-query" -DEFAULT_BOOTSTRAP_DNS_ADDR="8.8.8.8" -DEFAULT_BOOTSTRAP_DNS_PORT="53" +DEFAULT_BOOTSTRAP_DNS="8.8.8.8" # bootstrap DNS -echo "Bootstrap DNS: ${BOOTSTRAP_DNS_ADDR:-${DEFAULT_BOOTSTRAP_DNS_ADDR}}:${BOOTSTRAP_DNS_PORT:-${DEFAULT_BOOTSTRAP_DNS_PORT}}" +echo "Bootstrap DNS: ${BOOTSTRAP_DNS:-${DEFAULT_BOOTSTRAP_DNS}}" ########################## # authentication and authorization @@ -89,7 +88,7 @@ fi # export as a config toml file cat > ${CONFIG_FILE} << EOF listen_addresses = ["0.0.0.0:53"] -bootstrap_dns = "${BOOTSTRAP_DNS_ADDR:-${DEFAULT_BOOTSTRAP_DNS_ADDR}}:${BOOTSTRAP_DNS_PORT:-${DEFAULT_BOOTSTRAP_DNS_PORT}}" +bootstrap_dns = ["${BOOTSTRAP_DNS:-${DEFAULT_BOOTSTRAP_DNS}}"] ${TARGET_URL_STRING} ${TARGET_RAND_STRING} diff --git a/doh-auth-proxy.toml b/doh-auth-proxy.toml index 1a66709..c106a8c 100644 --- a/doh-auth-proxy.toml +++ b/doh-auth-proxy.toml @@ -17,7 +17,7 @@ bootstrap_dns = ["8.8.8.8", "1.1.1.1"] ## Minutes to re-resolve the IP addr of the nexthop and authentication endpoint url ## Ip addresses are first resolved by bootstrap DNS, after that, they will be resolved by (MO)DoH resolver itself. ## default is 60 minutes -# endoint_resolution_period = 60 +# endpoint_resolution_period = 60 ## Health check period in minitus. Check health of all path candidates and purge DNS cache. ## Default is 10 minutes.