Commit Graph

189 Commits

Author SHA1 Message Date
DL6ER df3b049ede Remove clientips[]
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-20 21:41:12 +01:00
DL6ER 0aee819dc2 Implement some of the review comments
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-20 21:38:24 +01: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 4aee3645d6 Fix limit on top-domains, top-ads, and top-clients
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-12 18:17:15 -05:00
DL6ER d53371082f Replace sprintf() + swrite() by the new ssend() routine. This enhancement removes the fixed buffer we used before and allows for responses having arbitraty lengths
Signed-off-by: DL6ER <dl6er@dl6er.de>

Conflicts:
	request.c
	routines.h
2018-01-12 22:40:53 +01:00
Mcat12 353e0cb212 Move command() up to the top of the file so it isn't as hidden
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-12 14:58:02 -05:00
Mcat12 7d877223f4 Remove getList
Most DNS endpoints will be implemented in the API to keep FTL focused
on providing stats.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-11 16:54:36 -05:00
Mcat12 b9780dc295 Reimplement output for getPiholeStatus
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-10 23:05:05 -05:00
Mcat12 f02c4e81a5 Reimplement output for getList
Adds `>getWhitelist`, `>getBlacklist`, and `getWildlist`

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-10 22:46:45 -05:00
DL6ER 71434f81d8 Another descending (absteigend) and ascending (aufsteigend) tweak
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-08 23:55:39 +01:00
DL6ER 19a851c60f Fix meaning of ascending and descending
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-08 23:41:31 +01:00
DL6ER 684f334ef1 Implement improved algorithm in getTopClients(). As a by-product this also adds the optional "desc" feature to the top clients requests where it wasn't available before
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-08 22:27:40 +01:00
DL6ER 15f5c2aa72 Implement improved algorithm in getTopDomains(). Instead of assuming how many lines of data we have sent, we can also explicitly count them.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-08 22:22:50 +01:00
Mcat12 64a1408e5d Add socket implementation of getDBstats and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-07 22:51:04 -05:00
Mcat12 2671a6fde0 Add socket implementation of getVersion and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-07 22:40:30 -05:00
Mcat12 779a82468e Add socket implementation to getQueryTypesOverTime and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-07 22:29:06 -05:00
Mcat12 08143393f0 Add socket implementation to getClientID and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-07 22:23:01 -05:00
Mcat12 7d0f680347 Add socket implementation to getForwardDestinationsOverTime and istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-07 22:19:20 -05:00
Mcat12 81200a270d Add socket implementation to getMemoryUsage and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-07 21:10:14 -05:00
Mcat12 555a0cbc6c Add socket implementation to getRecentBlocked and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-07 15:48:09 -05:00
Mcat12 3f1ffafc8f Add socket implementation to getQueryTypes and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-07 15:24:48 -05:00
Mcat12 33dd350370 Add socket implementation to getForwardDestinations and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-07 14:53:11 -05:00
Mcat12 00f8877232 Add socket implementation to getTopClients and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-06 23:10:35 -05:00
Mcat12 05f86041cf Add socket implementation to getTopDomains and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-06 22:28:41 -05:00
Mcat12 adfcaccb36 Use istelnet for getAllQueries
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-05 22:36:19 -05:00
Mcat12 c0022a95c9 Use istelnet for getOverTime
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-05 22:15:55 -05:00
DL6ER 3483ee8407 Remove intermediate variables where we don't need them
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-05 23:03:23 +01:00
DL6ER d0d0dfede5 Extract first 7 characters of the hash as this is what "git --no-pager describe --always" gives as output
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-05 22:36:58 +01:00
DL6ER cf93110aee Final fix for Travis versioning and all the cosmetic issues we have seen
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-05 22:34:07 +01:00
DL6ER f0793be61b Use istelnet[] in getStats()
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-04 19:33:20 +01:00
Mcat12 e527985371 Implement getStats using MessagePack
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-04 12:04:04 -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 8adb3d335e Merge remote-tracking branch 'origin/development' into new/API
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-03 14:35:42 -05:00
DL6ER c9ee9f552a Store DNSSEC result per domain not per query
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-31 16:50:58 +01:00
DL6ER a722dbda82 Return DNSSEC result in getAllQueries result
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-31 15:21:09 +01:00
DL6ER 21e60e3f9a Merge pull request #174 from pi-hole/new/extra-logging
Handle dnsmasq "extra" logging
2017-12-28 22:44:01 +01:00
DL6ER dbc9457708 Worked on review comments
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-28 20:48:29 +01: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
DL6ER cd2fd11806 Make client IPs globally available in FTL (array of strings clientip[sockedidentifier]) for possible use in authentication
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-25 12:24:28 +01: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
DL6ER 12a46e5ccf Apply the same idea in the telnet request
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-23 12:04:41 +01:00
Mcat12 604ad7ec39 Merge remote-tracking branch 'origin/development' into new/API
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>

# Conflicts:
#	request.c
#	test/test_suite.sh
2017-12-22 23:08:18 -05:00
DL6ER 478568e1ee Extend the new debug command a little bit
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-21 15:54:52 +01:00
DL6ER 541d86bc74 Add (undocumented) debugging command over telnet (display unknown queries)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-21 15:45:42 +01:00
DL6ER c9d990f403 Use a better detection for '.' in the version string / commit hash
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-08 17:18:09 +01:00
DL6ER 32c2471e04 Check if version is of format vX.YYY or vXX.YYY to decide whether on a deployed version or not
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-07 22:42:24 +01:00
Mcat12 3331c42971 Move getPayload to api.c
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-11-26 22:59:24 -05:00
DL6ER 33132c72d6 Use GIT_BRANCH not GIT_TAG ...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-11-03 19:35:03 +01:00
DL6ER ff6af26d04 Apply the same logic for the API request ">version"
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-11-03 19:29:14 +01:00
DL6ER fbc5c6d914 Merge pull request #143 from pi-hole/new/pihole_status_stats
Detect pihole blocking status
2017-10-25 18:22:25 +02:00