From 973c609a8536b985f07176f2af7eff36495d2081 Mon Sep 17 00:00:00 2001 From: gumadozucia Date: Sun, 14 Jun 2020 16:37:07 +0200 Subject: [PATCH 1/5] Update README.md Per client configuration was added in Pi-hole 5.0, --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9cf5953e10a..f1de0ad2426 100644 --- a/README.md +++ b/README.md @@ -121,10 +121,10 @@ AdGuard Home provides a lot of features out-of-the-box with no need to install a | Encrypted DNS upstream servers (DNS-over-HTTPS, DNS-over-TLS, DNSCrypt) | ✅ | ❌ (requires additional software) | | Cross-platform | ✅ | ❌ (not natively, only via Docker) | | Running as a DNS-over-HTTPS or DNS-over-TLS server | ✅ | ❌ (requires additional software) | -| Blocking phishing and malware domains | ✅ | ❌ | +| Blocking phishing and malware domains | ✅ | ❌ (requires non-default blocklists) | | Parental control (blocking adult domains) | ✅ | ❌ | | Force Safe search on search engines | ✅ | ❌ | -| Per-client (device) configuration | ✅ | ❌ | +| Per-client (device) configuration | ✅ | ✅ | | Access settings (choose who can use AGH DNS) | ✅ | ❌ | From bbc4eda39e7bda7f2f476aab75e16ccd4e91c01b Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Tue, 16 Jun 2020 12:10:17 +0300 Subject: [PATCH 2/5] If there are no more older entries, `"oldest":""` is returned. --- AGHTechDoc.md | 2 ++ querylog/querylog_search.go | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/AGHTechDoc.md b/AGHTechDoc.md index b2f4ab734b3..ad9854d312c 100644 --- a/AGHTechDoc.md +++ b/AGHTechDoc.md @@ -1302,6 +1302,8 @@ Response: The most recent entries are at the top of list. +If there are no more older entries, `"oldest":""` is returned. + ### API: Set querylog parameters diff --git a/querylog/querylog_search.go b/querylog/querylog_search.go index eda1f92d869..afa8afc2b36 100644 --- a/querylog/querylog_search.go +++ b/querylog/querylog_search.go @@ -129,7 +129,9 @@ func (l *queryLog) searchFiles(params *searchParams) ([]*logEntry, time.Time, in } } - oldest = time.Unix(0, oldestNano) + if oldestNano != 0 { + oldest = time.Unix(0, oldestNano) + } return entries, oldest, total } From 59c4a2886a97143e3a36912ec895dc1a06be88cc Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Tue, 16 Jun 2020 12:12:32 +0300 Subject: [PATCH 3/5] openapi --- openapi/openapi.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index 858ae73596a..13e330eb1dc 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -174,9 +174,14 @@ paths: schema: type: string enum: - - "" + - all + - filtered - blocked + - blocked_safebrowsing + - blocked_parental - whitelisted + - rewritten + - safe_search - processed responses: "200": From ec6ca93acdcd364676e002d3db1e45b451fcb552 Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Tue, 16 Jun 2020 15:13:38 +0300 Subject: [PATCH 4/5] * dns: disable cache with "cache_size: 0" setting Close #1591 Squashed commit of the following: commit 547a971f5c4f11c519dfabd52d42fa626abf931a Author: Simon Zolin Date: Tue Jun 16 14:46:06 2020 +0300 * dns: disable cache with "cache_size: 0" setting --- dnsforward/config.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dnsforward/config.go b/dnsforward/config.go index 51b510ff9d4..db4a043fe7a 100644 --- a/dnsforward/config.go +++ b/dnsforward/config.go @@ -138,8 +138,6 @@ func (s *Server) createProxyConfig() (proxy.Config, error) { Ratelimit: int(s.conf.Ratelimit), RatelimitWhitelist: s.conf.RatelimitWhitelist, RefuseAny: s.conf.RefuseAny, - CacheEnabled: true, - CacheSizeBytes: int(s.conf.CacheSize), CacheMinTTL: s.conf.CacheMinTTL, CacheMaxTTL: s.conf.CacheMaxTTL, UpstreamConfig: s.conf.UpstreamConfig, @@ -148,6 +146,11 @@ func (s *Server) createProxyConfig() (proxy.Config, error) { EnableEDNSClientSubnet: s.conf.EnableEDNSClientSubnet, } + if s.conf.CacheSize != 0 { + proxyConfig.CacheEnabled = true + proxyConfig.CacheSizeBytes = int(s.conf.CacheSize) + } + proxyConfig.UpstreamMode = proxy.UModeLoadBalance if s.conf.AllServers { proxyConfig.UpstreamMode = proxy.UModeParallel From 4870da7f94e040fea63f2ff99bf1b79ee5da457e Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Wed, 17 Jun 2020 19:36:35 +0300 Subject: [PATCH 5/5] * auto-hosts: support '#' comments after ip and hosts Close #1807 Squashed commit of the following: commit 9d3e2809df056354bb6195abf8106616c1e214b1 Author: Simon Zolin Date: Wed Jun 17 19:23:15 2020 +0300 improve commit 9b8c7104560c9c80f848f15818d49a065a38e498 Author: Simon Zolin Date: Wed Jun 17 11:07:56 2020 +0300 * auto-hosts: support '#' comments after ip and hosts --- util/auto_hosts.go | 10 ++++++++++ util/auto_hosts_test.go | 8 ++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/util/auto_hosts.go b/util/auto_hosts.go index a980f5a2bd4..f36ee1e7b81 100644 --- a/util/auto_hosts.go +++ b/util/auto_hosts.go @@ -172,8 +172,18 @@ func (a *AutoHosts) load(table map[string][]net.IP, tableRev map[string]string, if len(host) == 0 { break } + sharp := strings.IndexByte(host, '#') + if sharp == 0 { + break // skip the rest of the line after # + } else if sharp > 0 { + host = host[:sharp] + } + a.updateTable(table, host, ipAddr) a.updateTableRev(tableRev, host, ipAddr) + if sharp >= 0 { + break // skip the rest of the line after # + } } } } diff --git a/util/auto_hosts_test.go b/util/auto_hosts_test.go index 17055e50d8f..322e7e9ce81 100644 --- a/util/auto_hosts_test.go +++ b/util/auto_hosts_test.go @@ -29,8 +29,8 @@ func TestAutoHostsResolution(t *testing.T) { defer func() { _ = os.Remove(f.Name()) }() defer f.Close() - _, _ = f.WriteString(" 127.0.0.1 host localhost \n") - _, _ = f.WriteString(" ::1 localhost \n") + _, _ = f.WriteString(" 127.0.0.1 host localhost # comment \n") + _, _ = f.WriteString(" ::1 localhost#comment \n") ah.Init(f.Name()) @@ -47,6 +47,10 @@ func TestAutoHostsResolution(t *testing.T) { ips = ah.Process("newhost", dns.TypeA) assert.Nil(t, ips) + // Unknown host (comment) + ips = ah.Process("comment", dns.TypeA) + assert.Nil(t, ips) + // Test hosts file table := ah.List() name, ok := table["127.0.0.1"]