Commit Graph
51 Commits
Author SHA1 Message Date
Mcat12 d06decad80 Send client name and IP through telnet as well
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-06-06 18:00:55 -04:00
Mcat12 2ed2115f54 Only send client names (and IP for socket connection) in getClientNames
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-06-03 16:03:25 -04:00
Mark Drobnak 94d25c5883 Merge branch 'development' into new/regex-lists 2018-05-25 18:18:09 -04:00
DL6ER 218e599dd1 Add dns_queries_all_types field to ">stats". While dns_queries is the number of entires in the query log (only A and AAAA queries), the new counter also takes PTR, SOA, etc. into account.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-05-25 09:22:07 +02:00
DL6ER 9b5eb62263 Don't set regex status for domains read from database as we don't add them to the resolvers cache here (performance reasons)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-05-19 17:40:34 +02:00
DL6ER db7dbda9da Use status == QUERY_WILDCARD to identify regex blocked queries
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-05-19 16:37:25 +02:00
DL6ER decef2e5fd Remove special support for old type of wildcard lists as dnsmasq config file
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-05-19 14:46:21 +02:00
DL6ER 24b98093e8 Merge branch 'development' into ftldns/remove_old_debug_options
Signed-off-by: DL6ER <dl6er@dl6er.de>

Conflicts:
	args.c
2018-05-12 13:38:36 +02:00
DL6ER c606ad75ab Remove undocumented, old, and unused debug commands
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-05-10 19:24:02 +02:00
DL6ER db2e0d9361 Implement API changed to add new option (e.g. ">top-clients blocked withzero (20)")
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-05-10 14:37:39 +02:00
DL6ER 3fd61b6367 Use "blocklist" instead of "blocked" in the forward destions graphic
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-04-29 17:14:13 +02:00
DL6ER eec4a2c553 Add "blocked" as another "forward destination". So far, "local" was the sum of queries answered from cache and blocked domains
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-04-28 23:07:55 +02:00
DL6ER cf6ccdf5e0 There is no reason to allocate space for a constant string. Remove this.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-04-14 11:45:17 +02:00
DL6ER 9f5ae9495d Return only names if we actually have them
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-04-12 17:18:52 +02:00
DL6ER e2d0529993 Implement name resolving power back for FTLDNS. This re-implements lots of already extensively tested code that was present in pre-FTLDNS for over a year. This implementation is only slightly different by ensuring that name resolution is done in a specific non-blocking way.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-04-11 18:20:06 +02:00
DL6ER dfc32a6204 Move reply type and dnssec status to per-query (not per-domain) for more accurate data at negligible additional costs
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-04-06 23:32:32 +02:00
DL6ER be5e8fe63e Measure and store response time for individual queries
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-04-01 16:11:55 +02:00
DL6ER 6f55827297 Ensure that we only send overTime data for intervals that are fully specified. Intervals older than the set window (e.g. 24h) are incomplete and subject to removal of queries from history
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-03-23 20:24:04 +01:00
DL6ER c56357d525 Return A and AAAA instead of IPv4 and IPv6 as query type for the Query Log as this is more correct.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-03-23 20:18:14 +01:00
DL6ER 4cd86e35a3 Use skipclient boolean in getClientNames()
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-02-23 23:09:08 +01:00
DL6ER ea3309e7b1 Initial commit for FTLDNS
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-02-22 20:21:06 +01:00
DL6ER 672b6acca2 Merge pull request #225 from pi-hole/fix/showblocked
Bugfix for API_QUERY_LOG_SHOW option
2018-02-09 23:28:06 +01:00
DL6ER f11b6c892d Don't show queries with status 5 (blocked by black.list) when API_QUERY_LOG_SHOW=permittedonly or API_QUERY_LOG_SHOW=nothing is set
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-02-08 20:00:17 +01:00
DL6ER 10962a07a6 Improve memory handling in api.c
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-02-07 12:29:21 +01:00
Mcat12 5341b18ecf Handle possible pack_fixstr or pack_str32 error
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-21 15:40:58 -05:00
Mcat12 9bc056248f Use a static buffer for getallqueries string arguments
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-21 15:02:41 -05:00
Mcat12 42bf9a4c6f Fix status output in getStats
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-21 11:37:37 -05:00
Mcat12 9007af7dbb Fix under-allocation in getVersion
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-21 10:54:59 -05:00
Mcat12 be5815fbda Use float instead of double in getQueryTypesOverTime
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-21 10:54:21 -05:00
Mcat12 4e8027b74d Use float instead of double in getForwardDestinationsOverTime
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-21 10:53:29 -05:00
Mcat12 ad99f975fe Fix under-allocation in getTopDomains
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-21 10:43:03 -05:00
Mcat12 76aff45eb5 Clarify getOverTime comment
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-21 10:41:23 -05:00
Mcat12 173efff918 Don't use buffers in getStats
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-21 10:38:34 -05:00
Mcat12 cf0cdfed7d Reword api.c license header description
Removed reference to the HTTP API.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-20 11:11:52 -05:00
Mcat12 d3d70983ad Merge remote-tracking branch 'origin/development' into new/API
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>

# Conflicts:
#	main.c
#	request.c
#	routines.h
#	socket.c
2018-01-14 17:48:37 -05:00
Mcat12 c88af99ebd Add *. to domains in getTopDomains if it's for audit and a wildcard
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-14 17:30:55 -05:00
Mcat12 9b8b232a02 Fix incorrect merging
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-12 17:44:48 -05:00
Mcat12 0013edb1c6 Merge remote-tracking branch 'origin/development' into new/API
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>

# Conflicts:
#	main.c
#	request.c
#	routines.h
#	socket.c
2018-01-12 17:12:08 -05:00
Mcat12 1983d3d116 Rename api_stats.c to api.c
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-12 14:55:58 -05:00
Mcat12 071f924f70 Remove the rest of the DNS commands and unused helpers
They now live in the API

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-12 14:55:24 -05:00
Mcat12 595ab259ca Remove HTTP API specific code so it can be replaced with a new protocol
Adjusted tests to fit the current lack of output on the unix socket.
Added TELNET enum and used it in place of the old SOCKET to better fit
with the rest of the code base.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-03 20:16:50 -05:00
Mcat12 6050aa5ad7 Add IP address into the authentication check
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-12-25 23:56:56 -05:00
Mcat12 ae81270817 Fix invalid for loop error
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-12-24 17:04:55 -05:00
Mcat12 5005f285ec Implement simple password-protection to the HTTP API
Currently has the hardcoded password of "password". You gain a session
by sending JSON to the API with the key of `password` and the value
set to the password you are trying to use. Then it will return a success
response with the session and will add a Set-Cookie header to set the
FTL_SESSION cookie to the session number.

The summary, queries graph, and status are accessible without
authentication.

The internal data structure used to store the sessions is valid for up
to 24 minutes after the last query. If it becomes invalid then it is
eligible to be reused for a new session. The garbage collection can be
optimized further, but it is not a problem at the moment.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-12-24 16:11:46 -05:00
Mcat12 3331c42971 Move getPayload to api.c
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-11-26 22:59:24 -05:00
Mcat12 4842c16e34 Fix broken domain verification if the domain includes numbers
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-09-04 16:16:07 -04:00
Mcat12 a743931d15 Improve API response method to use enums 2017-08-10 22:00:13 -04:00
Mcat12 3a5752d908 Actually add the domain to the list
This requires the `pihole` user to have sudo access to the `pihole`
command (will require a core update). Many future API commands will have
this requirement, as they too will be using the `pihole` command.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-08-09 22:40:33 -04:00
Mcat12 2f8e5409eb Check if domain is invalid
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-08-09 22:05:51 -04:00
Mcat12 9ec7bd8722 Implement simple JSON parsing for addList
Uses cJSON to parse, but output will still be handled directly.
I implemented different API response methods to allow for different HTTP
response codes to be sent.
The addList code is still dumb and doesn't do anything, but it's getting
there.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-08-09 21:28:38 -04:00