DL6ER
8382f4d727
Rename table to domain_audit and simplify subroutine addAudit().
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-07-07 21:21:56 +02:00
DL6ER
be3e198f9a
Address linting errors.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-07-07 10:46:20 +02:00
DL6ER
acc50b709e
Only migrate files once (domain and adlist lists druing initial creation of gravity.db auditlog.list on database upgrade from version 1 to 2.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-07-07 10:33:08 +02:00
DL6ER
efe8216445
Fix further stickler complaint.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-07-06 09:45:07 +02:00
DL6ER
0405aaa3da
Review comments and fixing stickler complaints.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-07-06 09:32:41 +02:00
Mark Drobnak
6bb213e56f
Merge pull request #2826 from Forceflow/development
...
Fix for 404 error when browsing to pi.hole (without /admin)
2019-07-05 17:18:50 -04:00
DL6ER
2fb4256f84
Rename table to "auditlist"
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-07-05 16:28:36 +02:00
DL6ER
82476138c1
Instead of calling sqlite3 multiple times within a loop, we use the ability to add multiple rows within one INSERT clause. This is supported since sqlite3 3.7.11 (2012-03-20) and should be available on all systems.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-07-05 16:09:13 +02:00
DL6ER
5293beeb77
Update audit script to store domains in new database table.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-07-05 14:10:33 +02:00
DL6ER
0c8f5f1221
Remove comment field from audit table
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-07-05 14:06:05 +02:00
DL6ER
4f4a12bb40
Upgrade database if necessary and store audit domains therein.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-07-05 14:03:57 +02:00
DL6ER
1dbe6c83c3
Add database upgrading mechanism for adding the audit table.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-07-05 13:54:18 +02:00
Mcat12
2b5033e732
Add missing spaces found by linter
...
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-07-04 13:49:39 -07:00
Mcat12
8d9ff550d4
Fix blockpage error if whitelisted, blacklisted, or regex filtered
...
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-07-04 13:44:14 -07:00
Mcat12
f1733f9c5d
Fetch adlists for the block page from gravity.db
...
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-07-04 13:11:46 -07:00
Mark Drobnak
92c3c86be4
Merge pull request #2769 from pi-hole/new/arp-flush
...
Add new "pihole arpflush" command
2019-07-04 14:00:16 -04:00
DL6ER
7a1b6fd205
Merge branch 'development' into new/gravity.db_domain_groups
2019-07-03 19:21:55 +02:00
MMotti
04abcb71f6
Fix potential invalid result for pihole -q
...
Signed-off-by: MMotti <matthew.w.motti@gmail.com>
2019-07-03 13:04:57 +01:00
DL6ER
1fe3507bc5
Adlists table was renamed to Adlist. Adapt further places in the code to match the new name.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-07-03 07:56:10 +02:00
Jeroen Baert
9fedafed15
Fix 404 error when browsing to pi.hole (without /admin) (for fedora)
...
Signed-off-by: Jeroen Baert <3607063+Forceflow@users.noreply.github.com>
2019-07-03 04:28:44 +02:00
DL6ER
23b3a9a650
Add DISTINCT to the view\'s SELECT queries to avoid domain duplication in case they are enabled in multiple groups at the same time.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-07-01 09:44:20 +02:00
Jeroen Baert
7b2ac25a52
Fix for 404 error when browsing to pi.hole (without /admin)
...
Signed-off-by: Jeroen Baert <3607063+Forceflow@users.noreply.github.com>
2019-07-01 03:42:02 +02:00
DL6ER
f91421418a
Rename adlists -> adlist table.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-06-30 23:21:10 +02:00
DL6ER
3a14e8b013
Check whitelist_by_group.group_id instead of group.enabled against NULL.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-06-30 23:20:13 +02:00
DL6ER
ad97e95f2f
Add required name column in group table.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-06-30 23:06:15 +02:00
DL6ER
5b01facd73
Fix logix on the views: AND ( OR )
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-06-30 20:03:22 +02:00
DL6ER
6fe637b9ee
Rename groups -> group
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-06-30 19:43:18 +02:00
DL6ER
94d83dbb2d
Unify the two group tables into a single "groups" table. This allows managing adlists and domains together.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-06-30 19:33:02 +02:00
Mark Drobnak
c9a843b417
Merge pull request #2823 from pi-hole/fix/lighttpd-mime
...
Update with v4.3.1 changes
2019-06-30 13:27:55 -04:00
DL6ER
87c115fc86
Change implementation to use linking tables (domain_groups, adlists_groups). This allows adding domains to multiple lists conveniently.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-06-30 19:04:38 +02:00
RamSet
b5af125be6
Removed line
...
Signed-off-by: RamSet <RamSet@gmail.com>
2019-06-25 15:45:01 -06:00
RamSet
ecc49318f0
Fixed MIME related issue present in lighttpd/1.4.53
...
Signed-off-by: RamSet <RamSet@gmail.com>
2019-06-25 15:45:01 -06:00
DL6ER
0774c4e5ca
vw_gravity should actually filter using vw_whitelist.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-06-16 18:52:23 +02:00
DL6ER
01850c2128
Automatically recreate standard group after deletion to avoid violating foreign key constraints even if foreign key enforcing is disabled (SQLite's default behavior)
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-06-16 17:15:36 +02:00
DL6ER
cbc210b014
Add adlist_groups and mark group_id columns as NOT NULL.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-06-16 17:05:33 +02:00
DL6ER
c53ee4202b
Add filtering by domain groups to gravity database.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-06-16 16:50:51 +02:00
DL6ER
6996ffa451
Also flush network_addresses table
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-06-15 09:15:12 +02:00
DL6ER
4947350ca5
Add arpflush to help and bash autocompletion
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-06-15 09:08:33 +02:00
DL6ER
c1495b0fa8
Merge branch 'development' into new/arp-flush
2019-06-15 09:04:30 +02:00
MMotti
bcf03647ef
Add comment and remove blankspace
...
Signed-off-by: MMotti <matthew.w.motti@gmail.com>
2019-06-12 16:02:59 +01:00
MMotti
a9d0690f4d
Change the case of some variables
...
Just for consistency
Signed-off-by: MMotti <matthew.w.motti@gmail.com>
2019-06-10 18:50:52 +01:00
MMotti
10fbed50f3
Shellcheck
...
Suggesting to use parameter expansion but we need to be able to identify the start of each line
Signed-off-by: MMotti <matthew.w.motti@gmail.com>
2019-06-10 18:10:25 +01:00
MMotti
785f1fedd9
Tidy regexp queries
...
Signed-off-by: MMotti <matthew.w.motti@gmail.com>
2019-06-10 17:52:58 +01:00
MMotti
cf21efa103
Minor grammar changes
...
Signed-off-by: MMotti <matthew.w.motti@gmail.com>
2019-06-05 14:36:43 +01:00
MMotti
7613e94ef6
Minor tweaks
...
Mainly for consistency
Signed-off-by: MMotti <matthew.w.motti@gmail.com>
2019-06-04 06:06:17 +01:00
MMotti
b49c702f33
Consistency tweak
...
Signed-off-by: MMotti <matthew.w.motti@gmail.com>
2019-06-04 00:03:37 +01:00
MMotti
09532638d5
Read from DB instead of regex.list
...
Signed-off-by: MMotti <matthew.w.motti@gmail.com>
2019-06-04 00:00:25 +01:00
MMotti
97df6d7415
Stickler fix
...
Signed-off-by: MMotti <matthew.w.motti@gmail.com>
2019-06-03 19:56:10 +01:00
MMotti
54bfaa28c1
Fix for regexp queries through pihole -q
...
Taking inspiration from: https://github.com/pi-hole/pi-hole/pull/2346
We will use awk to iterate through each regexp and print any that match the domain query.
Signed-off-by: MMotti <matthew.w.motti@gmail.com>
2019-06-03 19:32:59 +01:00
Mark Drobnak
afd28fab03
Merge pull request #2767 from pi-hole/fix/multiple_pihole-FTL_PIDs
...
Improve PID detection in pihole-FTL.service
2019-06-01 01:03:55 -04:00
Mark Drobnak
d92ced6fb6
Merge pull request #2734 from pi-hole/fix/query_black_and_whitelists_database
...
Query black and whitelists database
2019-06-01 00:55:05 -04:00
DL6ER
ae98fde321
Try to obtain PID from PIDFILE. If this fails (file does not exist or is empty), fall back to using pidof + awk
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-31 09:18:12 +02:00
DL6ER
9ddce88092
Review comments
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-31 08:42:22 +02:00
DL6ER
44f8fcb600
We can print the table name without any extra check as we already returned early in case there are no results.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-31 08:39:18 +02:00
Mark Drobnak
814fdcf9b6
Merge pull request #2768 from pi-hole/fix/dhcp-ignore-names
...
Add dhcp-ignore-names option when enabling DHCP service
2019-05-30 22:35:52 -04:00
DL6ER
5060605626
Print table name before entering the loop for the sake of simplicity
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-30 21:44:59 +02:00
DL6ER
285e6fe090
Address lint complaints
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-30 21:32:35 +02:00
DL6ER
c3023fe681
Add new "pihole arpflush" command to flush both the ARP cache as well as the network table in pihole-FTL.db
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-30 21:25:10 +02:00
DL6ER
c5df104a66
Add dhcp-ignore-names option when enabling DHCP service. We currently remove anything that starts with "dhcp-" to have a clean configuration and removed these lines without noticing when enabling the DHCP server.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-30 16:41:37 +02:00
DL6ER
f6213d4f4d
Use last PID in case pidof returns multiple PIDs for pihole-FTL
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-30 15:26:27 +02:00
Mcat12
bfb99c361c
Note that the gravity size does not include the blacklist entries
...
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-05-21 17:12:47 -07:00
Mcat12
5796054305
Increase ID column width to 4
...
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-05-20 21:59:18 -07:00
Mcat12
a3e1473ac1
Set explicit column widths to prevent text from getting cut off
...
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-05-20 21:33:09 -07:00
Mcat12
7b5fc60e00
Improve table formatting
...
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-05-20 21:20:38 -07:00
Mcat12
807ce0af4e
Show whitelist, blacklist, and regexlist details
...
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-05-20 21:15:22 -07:00
Mcat12
3f05efd60f
Add extra newline
...
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-05-20 21:02:31 -07:00
Mcat12
03d93aa19a
Update debug script with gravity DB changes
...
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-05-20 20:58:57 -07:00
Dan Schaper
7de6bbca61
Merge branch 'development' into release/v4.3
2019-05-18 13:18:14 -07:00
Mcat12
8e1bf6e3d4
Merge branch 'development' into new/gravitydb
...
# Conflicts:
# advanced/Scripts/list.sh
# gravity.sh
# pihole
2019-05-12 15:20:52 -07:00
mpiederiet
3220e2b978
Fix for preventing git error message in cron logs
...
Fix to prevent "fatal: No names found, cannot describe anything" git message during scheduled update checks
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-11 10:57:44 +02:00
DL6ER
a904c183df
Use printf to escape domain content. This prevents possible SQL injection issues
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-04 18:25:11 +02:00
DL6ER
5246b3e496
Explicitly escape backslash in ESCAPE clause. This has been suggested by Stickler bot.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-04 13:24:36 +02:00
DL6ER
f80fdd7e83
Improve comments
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-04 13:19:50 +02:00
DL6ER
6ba58896d2
Simplify code
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-04 13:15:30 +02:00
DL6ER
3aa838bbe4
Implement black- and whitelist searching with SQL statements. We use the ESCAPE clause in the LIKE query as the underscore "_" wildcard matches any single character but we want to suppress this behavior (underscores can be legitimate part of domains)
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-04 13:02:14 +02:00
Dan Schaper
5532df24e4
Pi-hole Debug - tricorder upload function calls
...
Fix tricorder upload function calls to use new curl function.
2019-05-03 02:46:27 -07:00
DL6ER
0bc112ce52
Query only those columns we actually use when showing domains on the CLI. Show date of last modification instead of addition date for domains.
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-02 17:11:39 +02:00
DL6ER
d46ff1d2d7
Remove UNIQUE on gravity table as the only column is already PRIMARY KEY. Primary keys must contain UNIQUE values, and cannot contain NULL values
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-01 22:08:30 +02:00
DL6ER
2f698904e4
Use PRIMARY KEY instead of NOT NULL also in gravity and info tables
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-01 18:03:35 +02:00
DL6ER
106f079afc
Improve indentation (single tab) in SQLite template
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-01 17:57:23 +02:00
DL6ER
6c1e3a17f7
Remove NOT NULL constraint on list ids as this is implied by PRIMARY KEY (even though most, if not all, examples on the web still use both attributes at the same time)
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-01 17:54:29 +02:00
DL6ER
5e26e8245b
Order results of queries to list views by id key
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-01 17:51:10 +02:00
DL6ER
983117d788
Add id (primary key, autoincrement) field to lists tables
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-01 17:47:15 +02:00
DL6ER
b372f808dd
Fix lint errors
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-01 17:06:14 +02:00
DL6ER
bc9b623638
Modify query.sh to use the gravity database
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-01 16:56:16 +02:00
DL6ER
d5781fb110
Fix extra space in front on END statement in CREATE TRIGGER commands
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-01 16:38:41 +02:00
DL6ER
487718512d
Remove DISTINCT attribute from views. They are not needed as the corresponding data is obtained from fields with UNIQUE attribute so duplications are already prevented at domain insertion. The elimination of the duplication check on imort through the views slightly reduces the load during import (I observed about 8 percent time saved on my NanoPi NEO).
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-01 16:37:23 +02:00
pvogt09
8a92fb24c4
Incorporates changes requested by @Mcat12
...
Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>
2019-05-01 11:20:26 +02:00
pvogt09
5c575e73c7
Adds world readable attribute to files created by Pi-hole to circumvent #2724
...
Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>
2019-04-30 22:41:12 +02:00
DL6ER
2180531a84
Add trigger for automatic updates of the date_modified column and improve formating in the gravity.db template
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-04-29 19:43:35 +02:00
Mark Drobnak
6812e8880e
Merge pull request #2705 from pi-hole/fix/chronometer-refresh-arg
...
Fix chronometer refresh incorrectly reading the long argument sleep time
2019-04-29 11:43:07 -04:00
DL6ER
a932209143
Set default for date_modified to be the current time
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-04-29 17:21:59 +02:00
DL6ER
efeba594ae
Add support for manipulating adlists from the CLI
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-04-28 21:39:06 +02:00
DL6ER
126f7101ff
Add (optional) date_modified field and use vw_whitelist view in vw_blacklist
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-04-28 14:44:03 +02:00
Mcat12
b320e74921
Improve argument handling
...
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-04-27 14:05:04 -07:00
Mcat12
add5e4ca5e
Explicitly allow only -r and --refresh in argument handler
...
It is already checked, but this make the code explicit.
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-04-27 13:39:44 -07:00
DL6ER
b4ae142149
Remove printf escaping (we will realize it differently) and ensure we're using single quotes for strings (although double quotes are possible, too)
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-04-26 20:54:01 +02:00
DL6ER
3fe43ce1d9
Rely on default value (database provided) for date_added when adding a new domain
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-04-26 18:16:04 +02:00
DL6ER
e04dc9d2bb
Remove sqlitekey variable as the first column of the regex table is now called domain as well
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-04-26 17:44:42 +02:00
DL6ER
bd0215524b
Add vw_adlists view which returns only enabled adlists
...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-04-26 17:36:00 +02:00