Commit Graph
3445 Commits
Author SHA1 Message Date
DL6ER ae5d6e2c19 Add /api/stats/summary documentation
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-30 14:00:54 +01:00
DL6ER 0758dc9cc7 Add /api/version documentation
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-30 14:00:54 +01:00
DL6ER afb154e402 Add /api/auth documentation, change expected payload from form to JSON for consistency
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-30 14:00:54 +01:00
DL6ER d9015367fd Add /api/ftl documentation
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-30 14:00:54 +01:00
DL6ER 865c4345e2 Add /api/dns documentation
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-30 14:00:52 +01:00
DL6ER e4c55ec52a Embed API documentation into FTL. This ensures it is (a) always available locally, and (b) always corresponds to the API you have available locally.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-26 17:46:11 +01:00
DL6ER b851566372 Our JSON targets are NULL-tolerant.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-26 17:46:11 +01:00
DL6ER c99a3bc15e Store comments for groups as well
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-26 17:46:11 +01:00
DL6ER 0271a38ce8 Groups don't have the groups property
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-26 17:46:11 +01:00
DL6ER 73b3d680ca Improve error reporting for missing/incorrect sets of payload/URI arguments
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-26 17:46:11 +01:00
DL6ER 54cd12e895 Split type and kind into two fields for domains
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-26 17:46:11 +01:00
DL6ER c1f29ed978 Improving error reporting of the API
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-26 17:46:11 +01:00
DL6ER fa4c194045 Improve URI matching algorithm
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-26 17:46:11 +01:00
DL6ER e8e4c5f180 Move id, date_added, date_modified into extra database object
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-26 17:46:09 +01:00
DL6ER efd5951968 POST should not include the target to get pushed
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-24 16:07:27 +01:00
DL6ER 0358c3b861 Test compile regex before adding to the database (we may want to reject it)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-23 08:31:21 +01:00
DL6ER f12aa58f3f Rename /api/adlists -> /api/lists
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-23 07:49:41 +01:00
DL6ER 5e616f4ac2 Fix a bug in CivetWeb server
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-23 07:11:38 +01:00
DL6ER 8b3df9f554 Implement /api/clients
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-22 15:25:49 +01:00
DL6ER 9a2a2cdf10 Actually reload gravity data on list add/edit/remove
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-22 11:58:36 +01:00
DL6ER 98e74256ae Send domains/clients/groups/adlists counts in a new ftl object
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-22 11:47:57 +01:00
DL6ER 45801543db Remove obsolete ping/pong test
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-22 11:20:12 +01:00
DL6ER 54e206a273 Shorten history JSON keys
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-22 10:28:27 +01:00
DL6ER f67becc3e1 Introduce new ftl_conn struct that makes it easier to share stuff across processing subroutines in the same thread.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-21 16:24:16 +01:00
DL6ER 15ba45e50f Extract payload only once
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-21 13:52:31 +01:00
DL6ER 0d91fcd55d Rename /api/list -> /api/domains, /api/adlist -> /api/adlists, /api/group -> /api/groups, added /api/clients
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-21 08:28:37 +01:00
DL6ER 1fc05034ef Set table columns comment/description to NULL if empty
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-20 17:07:36 +01:00
DL6ER 5c3a2b509c Implement changing group assignments through the API
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-20 16:36:02 +01:00
DL6ER 7fa2dac90a Allow domains/groups/adlists to be removed from the database
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-20 12:33:16 +01:00
DL6ER b08954aec7 http_get_payload(): Extract body payload also for PUT and PATCH
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-20 11:51:23 +01:00
DL6ER 5e1c75fb84 Include system object in /api/stats/summary to need one AJAX call less
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-20 11:12:47 +01:00
DL6ER 24aa5537a0 Merge branch 'master' into new/http 2021-01-20 10:12:09 +01:00
DL6ER 3ecec151b6 Merge branch 'release/v5.5' v5.5.1 2021-01-19 15:56:18 +01:00
DL6ER d6b1fe9569 Fix incorrect "FATAL" error message during garbage collection
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-19 15:54:37 +01:00
DL6ER 7acaeb72c7 Merge branch 'development' into new/http
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-19 15:35:46 +01:00
DL6ER 4457a1ad29 Merge pull request #1035 from pi-hole/master
Update development
2021-01-19 14:15:06 +01:00
DL6ER fb9b2744b4 Merge pull request #1034 from pi-hole/release/v5.5
Pi-hole FTL v5.5
v5.5
2021-01-19 13:17:26 +01:00
Simon Kelley 1ecb3ff96e Update to new struct frec fields in conntrack code.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-19 13:08:08 +01:00
Simon Kelley 8e84016f54 Fix warning message logic.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-19 13:07:59 +01:00
DL6ER 845890fea1 Update dnsmasq version string
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-19 10:34:36 +01:00
DL6ER df2df56c51 Adapt for change in struct forward to forward->frec_src
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-19 10:34:36 +01:00
Simon Kelley fab1f64db1 Small cleanups in frec_src datastucture handling.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-19 10:34:36 +01:00
Petr Menšík dad7959f2b Support hash function from nettle (only)
Unlike COPTS=-DHAVE_DNSSEC, allow usage of just sha256 function from
nettle, but keep DNSSEC disabled at build time. Skips use of internal
hash implementation without support for validation built-in.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-19 10:34:36 +01:00
Simon Kelley a4864cf5dd Handle caching with EDNS options better.
If we add the EDNS client subnet option, or the client's
MAC address, then the reply we get back may very depending on
that. Since the cache is ignorant of such things, it's not safe to
cache such replies. This patch determines when a dangerous EDNS
option is being added and disables caching.

Note that for much the same reason, we can't combine multiple
queries for the same question when dangerous EDNS options are
being added, and the code now handles that in the same way. This
query combining is required for security against cache poisoning,
so disabling the cache has a security function as well as a
correctness one.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-19 10:34:36 +01:00
Simon Kelley 3774edeba8 Handle multiple identical near simultaneous DNS queries better.
Previously, such queries would all be forwarded
independently. This is, in theory, inefficent but in practise
not a problem, _except_ that is means that an answer for any
of the forwarded queries will be accepted and cached.
An attacker can send a query multiple times, and for each repeat,
another {port, ID} becomes capable of accepting the answer he is
sending in the blind, to random IDs and ports. The chance of a
succesful attack is therefore multiplied by the number of repeats
of the query. The new behaviour detects repeated queries and
merely stores the clients sending repeats so that when the
first query completes, the answer can be sent to all the
clients who asked. Refer: CERT VU#434904.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-19 10:34:36 +01:00
Simon Kelley a5743a1643 Add missing check for NULL return from allocate_rfd().
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-19 10:34:36 +01:00
Simon Kelley 17cb5d4d81 Fix DNS reply when asking for DNSSEC and a validated CNAME is already cached.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-19 10:34:36 +01:00
Simon Kelley 58c6b8d56e Optimse RR digest calculation in DNSSEC.
If an RR is of a type which doesn't need canonicalisation,
bypass the relatively slow canonicalisation code, and insert
it direct into the digest.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-19 10:34:36 +01:00
Simon Kelley afff889e82 Use SHA-256 to provide security against DNS cache poisoning.
Use the SHA-256 hash function to verify that DNS answers
received are for the questions originally asked. This replaces
the slightly insecure SHA-1 (when compiled with DNSSEC) or
the very insecure CRC32 (otherwise). Refer: CERT VU#434904.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-19 10:34:36 +01:00
Simon Kelley 9002e99cd8 Check destination of DNS UDP query replies.
At any time, dnsmasq will have a set of sockets open, bound to
random ports, on which it sends queries to upstream nameservers.
This patch fixes the existing problem that a reply for ANY in-flight
query would be accepted via ANY open port, which increases the
chances of an attacker flooding answers "in the blind" in an
attempt to poison the DNS cache. CERT VU#434904 refers.

Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-01-19 10:34:36 +01:00