Commit Graph

3311 Commits

Author SHA1 Message Date
Simon Kelley 75648b4def Make --filter-rr=ANY filter the answer to ANY queries.
Thanks to Dominik Derigs for an earlier patch which inspired this.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-02-13 07:15:03 +01:00
Simon Kelley 8cdead96a5 Tweak logging and special handling of T_ANY in rr-filter code.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-02-13 07:12:25 +01:00
DL6ER e3e839880e Merge branch 'development-v6' into update/dnsmasq 2024-02-13 07:12:16 +01:00
Dominik 9e3ccd917d Merge pull request #1797 from pi-hole/new/multi_revServer
Add support for multiple reverse servers
2024-02-11 06:52:31 +01:00
Dominik 54262aeba2 Merge pull request #1878 from pi-hole/fix/debug_api_description
Fix debug.api config options description.
2024-02-10 20:56:25 +01:00
Dominik 5940c62763 Merge pull request #1719 from pi-hole/tweak/env_vars_list
Check all env vars and suggest alternatives for misspelled keys
2024-02-10 16:21:42 +01:00
DL6ER ec37efd77f Fix debug.api config options description.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-02-10 09:34:25 +01:00
DL6ER 16cc1027fb DNSSEC validation should not be enabled by default - it wasn't in v5, either. The reason for this is that it may be causing issues on devices with broken/missing RTCs where NTP time synchronization relies on DNS resolution
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-02-09 21:51:31 +01:00
DL6ER 6a74642232 Fix failed auto-merge in https://github.com/pi-hole/FTL/pull/1841
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-02-09 21:14:40 +01:00
Dominik 276ba4210f Merge pull request #1841 from pi-hole/tweak/list_id
Make adlist ID available, rename queries.regex_id -> queries.list_id
2024-02-09 20:52:35 +01:00
Dominik 34a885ab1c Merge pull request #1869 from pi-hole/update/sqlite_3.45.1
Update embedded SQLite3 to 3.45.1
2024-02-09 20:41:35 +01:00
Heikki Linnakangas 48a0c4591f Don't create a useless inotify file desrcriptor when --port=0
If there are no dynamic configuration directories configured with
dhcp-hostsdir, dhcp-optsdir and hostsdir then we need to use inotify
only to track changes to resolv-files, but we don't need to do
that when DNS is disabled (port=0) or no resolv-files are configured.

It turns out that inotify slots can be a scarce resource, so not
using one when it's not needed is a Goood Thing.

Patch by HL, description above from SRK.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-02-08 18:11:37 +01:00
Simon Kelley ef007f2bb1 Refactor the accumulated crud of years in process_reply().
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-02-08 18:11:37 +01:00
Simon Kelley 68594df9b7 Handle caching SOA for negative PTR queries.
Also deal with the fact that a root SOA is a thing.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-02-08 18:11:37 +01:00
Simon Kelley 027d1587cb Fix logic error in signed RR handling.
In extract_addresses() the "secure" argument is only set if the
whole reply is validated (ie the AD bit can be set). Even without
that, some records may be validated, and should be marked
as such in the cache.

Related, the DNS doctor code has to update the flags for individual
RRs as it works, not the global "secure" flag.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-02-08 18:11:37 +01:00
Simon Kelley 31a6b2dbc7 Fix compiler warning.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-02-08 18:11:37 +01:00
Simon Kelley 54658e9058 Cache SOAs and return them with cached NXDOMAIN/NODATA replies.
Now we can cache arbirary RRs, give more correct answers when
replying negative answers from cache.

To implement this needed the DNS-doctor code to be untangled from
find_soa(), so it should be under suspicion for any regresssions
in that department.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-02-08 18:11:37 +01:00
Simon Kelley ae46201c59 Fix FTBFS introduced in 2748d4e901193c919614276e42d6d54b11f3232d
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-02-03 22:07:22 +01:00
DL6ER f8c07fd78c Merge branch 'development-v6' into update/dnsmasq 2024-02-03 22:06:02 +01:00
Mat Booth 2059ac2017 Fix failure to build from source on Fedora 39
FTL build was failing at link-time due to undefined references to all
idn2_* functions.

This change fixes an incorrect search name for the idn2 library in the
CMake script.

Signed-off-by: Mat Booth <mbooth@fedoraproject.org>
2024-02-01 16:24:00 +00:00
Dominik 3262d7d7c3 Merge pull request #1826 from pi-hole/fix/resolver
Improve and fix host name resolution
2024-01-30 19:11:54 +01:00
DL6ER f198a4fee4 Update embedded SQLite3 to 3.45.1
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-30 19:05:02 +01:00
Dominik 32d5af1893 Merge pull request #1864 from pi-hole/fix/dhcp_infinity
Amend description of expiration field in GET /dhcp/leases
2024-01-26 19:22:56 +01:00
DL6ER 52a260ffad Amend description of expiration field in GET /dhcp/leases: 0 means "infinite". No functional changes
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-26 16:24:19 +01:00
Dominik 1218151ef9 Merge pull request #1860 from pi-hole/tweak/x509_ca
X.509: Create and export CA certificate
2024-01-22 13:17:07 +01:00
DL6ER 689cee7ec6 Merge branch 'development-v6' into new/multi_revServer
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-21 19:57:01 +01:00
DL6ER 619a8b1cf4 Fix pointer magic going wrong
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-20 12:44:03 +01:00
DL6ER bafbc780ed Apply review comments
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-20 09:38:50 +01:00
DL6ER 24b6df4cb4 Reduce code duplication by factoring out filter regex compilation
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-20 09:33:06 +01:00
DL6ER 0a48d7a4c4 Change how Pi-hole generates from self-signing our certificate to first creating a self-signed root certificate authority (CA) and then using this CA to ordinarily sign the server's certificate. This has the advantage of being able to import the CA in places where importing a self-signed certificate is discouraged or not possible (e.g. Firefox browser)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-16 22:55:02 +01:00
DL6ER 862d4922e1 Merge branch 'development-v6' into new/queryLogRegex
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-16 22:46:31 +01:00
Dominik c39261131a Merge pull request #1832 from pi-hole/tweak/limit_history_clients
Limit number of clients returned by /api/history/clients
2024-01-16 22:37:33 +01:00
DL6ER 5c4355f1b1 Compile exclude regexes only once, not N^2 times
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-16 22:35:53 +01:00
DL6ER 3c58e3089b Change order of objects in documentation (small nit pick)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-16 21:51:55 +01:00
Dominik ff452fc68d Merge pull request #1859 from pi-hole/fix/remote_version
Return null as version in /api/info/version if not available
2024-01-15 22:09:33 +01:00
DL6ER 12e7f44b92 Return null as version in /api/info/version if not available
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-15 20:58:44 +01:00
DL6ER 1bf26f0de8 Update embedded SQLite 3 to 3.45.0
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-15 20:09:08 +01:00
DL6ER edc4da9f49 Merge branch 'development-v6' into update/dnsmasq 2024-01-14 17:33:44 +01:00
Simon Kelley 9eb920ad7c Bump copyright to 2024.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-14 17:33:35 +01:00
Petr Menšík 18bf4fd530 Introduce new --local-service=host parameter
Similar to local-service, but more strict. Listen only on localhost
unless other interface is specified. Has no effect when interface is
provided explicitly. I had multiple bugs fillen on Fedora, because I have
changed default configuration to:

interface=lo
bind-interfaces

People just adding configuration parts to /etc/dnsmasq.d or appending to
existing configuration often fail to see some defaults are already there.
Give them auto-ignored configuration as smart default.

Signed-off-by: Petr Menšík <pemensik@redhat.com>

Do not add a new parameter on command line. Instead add just parameter
for behaviour modification of existing local-service option. Now it
accepts two optional values:
- net: exactly the same as before
- host: bind only to lo interface, do not listen on any other addresses
  than loopback.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-14 17:33:35 +01:00
Simon Kelley da901cbd23 Fix --synth-domain NXDOMAIN responses.
By design, dnsmasq forwards queries for RR-types it has no data
on, even if it has data for the same domain and other RR-types.

This can lead to an inconsitent view of the DNS when an upstream
server returns NXDOMAIN for an RR-type and domain but the same domain
but a different RR-type gets an answer from dnsmasq. To avoid this,
dnsmasq converts NXDOMAIN answer from upstream to NODATA answers if
it would answer a query for the domain and a different RR-type.

An oversight missed out --synth-domain from the code to do this, so
--synth-domain=thekelleys.org.uk,192.168.0.0/24
would result in the correct answer to an A query for
192-168.0.1.thekelleys.org.uk and an AAAA query for the same domain
would be forwarded upstream and the resulting NXDOMAIN reply
returned.

After the fix, the reply gets converted to NODATA.

Thanks to Matt Wong for spotting the bug.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-14 17:33:35 +01:00
Simon Kelley 6ce28da714 Fix problem with domains associated with DHCP hosts at startup.
At startup, the leases file is read by lease_init(), and
in lease_init() undecorated hostnames are expanded into
FQDNs by adding the domain associated with the address
of the lease.

lease_init() happens relavtively early in the startup, party because
if it calls  the dhcp-lease helper script, we don't want that to inherit
a load of sensitive file descriptors. This has implications if domains
are defined using the --domain=example.com,eth0 format since it's long
before we call enumerate_interfaces(), so get_domain fails for such domains.

The patch just moves the hostname expansion function to a seperate
subroutine that gets called later, after enumerate_interfaces().

Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-14 17:33:33 +01:00
DL6ER 4e5521f400 Add new config option to API
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-13 10:50:18 +01:00
DL6ER b05fe82a3f Merge branch 'development-v6' into tweak/env_vars_list 2024-01-13 10:46:51 +01:00
Dominik 833291323f Merge pull request #1752 from pi-hole/remove/local.list
Remove obsolet local.list
2024-01-13 10:45:27 +01:00
DL6ER 03466460c3 Add webserver.api.maxClients setting to set default number of clients to be returned for the client activity graph. This setting can be overwritten at run-time
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-13 10:39:22 +01:00
DL6ER 58637597bf Merge branch 'development-v6' into tweak/limit_history_clients 2024-01-13 10:32:56 +01:00
DL6ER 55339f01b5 Adjust webserver.api.exclude{Clients,Domains} description
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-13 10:17:58 +01:00
DL6ER e35aa78030 Only free API data when the API was started
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-13 10:08:43 +01:00
DL6ER b7f49e9636 Add Pi-hole v5 -> v6 regex migration for webserver.api.exclude{Domains,Clients}
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-01-13 08:24:55 +01:00