mirror of
https://github.com/pi-hole/docs.git
synced 2024-12-06 19:27:12 +01:00
Database section. Rationalise section names to match titles and add redirects.
Replace references to renamed pages Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
## Group management
|
||||
---
|
||||
title: Group Management
|
||||
---
|
||||
|
||||
Groups are defined in the `group` table and can have an optional description in addition to the mandatory name of the group.
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: Domain Database
|
||||
---
|
||||
|
||||
Pi-hole uses the well-known relational database management system SQLite3 for managing the various domains that are used to control the DNS filtering system. The database-based domain management has been added with Pi-hole v5.0. The ability to subscribe to external *allow*lists has been added with Pi-hole v6.0.
|
||||
|
||||
## Priorities
|
||||
@@ -2,5 +2,5 @@ Pi-hole uses the well-known relational database management system SQLite3 both f
|
||||
|
||||
Details concerning the databases, their contained tables and exemplary SQL commands allowing even complex requests to Pi-hole's databases are described on the subpages of this category.
|
||||
|
||||
- [Query database `/etc/pihole/pihole-FTL.db`](ftl.md)
|
||||
- [Domain database `/etc/pihole/gravity.db`](gravity/index.md)
|
||||
- [Query database `/etc/pihole/pihole-FTL.db`](query-database.md)
|
||||
- [Domain database `/etc/pihole/gravity.db`](domain-database/index.md)
|
||||
|
||||
@@ -44,15 +44,15 @@ Label | Type | Allowed to by empty | Content
|
||||
--- | --- | ---- | -----
|
||||
`id` | integer | No | autoincrement ID for the table, only used by SQLite3, not by *FTL*DNS
|
||||
`timestamp` | integer | No | Unix timestamp when this query arrived at *FTL*DNS (used as index)
|
||||
`type` | integer | No | Type of this query (see [Supported query types](ftl.md#supported-query-types))
|
||||
`status` | integer | No | How was this query handled by *FTL*DNS? (see [Supported status types](ftl.md#supported-status-types))
|
||||
`type` | integer | No | Type of this query (see [Supported query types](query-database.md#supported-query-types))
|
||||
`status` | integer | No | How was this query handled by *FTL*DNS? (see [Supported status types](query-database.md#supported-status-types))
|
||||
`domain` | text | No | Requested domain
|
||||
`client` | text | No | Requesting client (IP address)
|
||||
`forward` | text | Yes | Forward destination used for this query (only set if `status == 2`)
|
||||
`additional_info` | blob | Yes | Data-dependent content, see below
|
||||
`reply_type` | integer | Yes | Type of the reply for this query (see [Supported reply types](ftl.md#supported-reply-types))
|
||||
`reply_type` | integer | Yes | Type of the reply for this query (see [Supported reply types](query-database.md#supported-reply-types))
|
||||
`reply_time` | real | Yes | Seconds it took until the final reply was received
|
||||
`dnssec` | integer | Yes | Type of the DNSSEC status for this query (see [DNSSEC status](ftl.md#dnssec-status))
|
||||
`dnssec` | integer | Yes | Type of the DNSSEC status for this query (see [DNSSEC status](query-database.md#dnssec-status))
|
||||
`regex_id` | integer | Yes | ID of the regex filter that matched this query (only set if blocked by a regex filter)
|
||||
|
||||
The `queries` `VIEW` is dynamically generated from the data actually stored in the `query_storage` table and the linking tables `domain_by_id`, `client_by_id`, `forward_by_id`, and `addinfo_by_id` (see below). The table `query_storage` will contains integer IDs pointing to the respective entries of the linking tables to save space and make searching the database faster. If you haven't upgraded for some time, the table may still contain strings instead of integer IDs.
|
||||
@@ -67,7 +67,7 @@ If a query was blocked due to a CNAME inspection (status 9, 10, 11), this field
|
||||
|
||||
##### Query influenced by a black- or whitelist entry {#additional_info_list data-toc-label='domainlist_id'}
|
||||
|
||||
If a query was influenced by a black- or whitelist entry, this field contains the ID of the corresponding entry in the [`domainlist`](gravity/index.md#domain-tables-domainlist) table.
|
||||
If a query was influenced by a black- or whitelist entry, this field contains the ID of the corresponding entry in the [`domainlist`](domain-database/index.md#domain-tables-domainlist) table.
|
||||
|
||||
### Counters table
|
||||
|
||||
@@ -115,17 +115,17 @@ Any other query type will be stored with an offset of 100, i.e., `TYPE66` will b
|
||||
ID | Status | | Details
|
||||
--- | --- | --- | ---
|
||||
0 | Unknown | ❔ | Unknown status (not yet known)
|
||||
1 | Blocked | ❌ | Domain contained in [gravity database](gravity/index.md#gravity-tables-gravity-and-antigravity)
|
||||
1 | Blocked | ❌ | Domain contained in [gravity database](domain-database/index.md#gravity-tables-gravity-and-antigravity)
|
||||
2 | Allowed | ✅ | Forwarded
|
||||
3 | Allowed | ✅ | Replied from cache
|
||||
4 | Blocked | ❌ | Domain matched by a [regex blacklist](gravity/index.md#domain-tables-domainlist) filter
|
||||
5 | Blocked | ❌ | Domain contained in [exact blacklist](gravity/index.md#domain-tables-domainlist)
|
||||
4 | Blocked | ❌ | Domain matched by a [regex blacklist](domain-database/index.md#domain-tables-domainlist) filter
|
||||
5 | Blocked | ❌ | Domain contained in [exact blacklist](domain-database/index.md#domain-tables-domainlist)
|
||||
6 | Blocked | ❌ | By upstream server (known blocking page IP address)
|
||||
7 | Blocked | ❌ | By upstream server (`0.0.0.0` or `::`)
|
||||
8 | Blocked | ❌ | By upstream server (`NXDOMAIN` with `RA` bit unset)
|
||||
9 | Blocked | ❌ | Domain contained in [gravity database](gravity/index.md#gravity-tables-gravity-and-antigravity)<br>*Blocked during deep CNAME inspection*
|
||||
10 | Blocked | ❌ | Domain matched by a [regex blacklist](gravity/index.md#domain-tables-domainlist) filter<br>*Blocked during deep CNAME inspection*
|
||||
11 | Blocked | ❌ | Domain contained in [exact blacklist](gravity/index.md#domain-tables-domainlist)<br>*Blocked during deep CNAME inspection*
|
||||
9 | Blocked | ❌ | Domain contained in [gravity database](domain-database/index.md#gravity-tables-gravity-and-antigravity)<br>*Blocked during deep CNAME inspection*
|
||||
10 | Blocked | ❌ | Domain matched by a [regex blacklist](domain-database/index.md#domain-tables-domainlist) filter<br>*Blocked during deep CNAME inspection*
|
||||
11 | Blocked | ❌ | Domain contained in [exact blacklist](domain-database/index.md#domain-tables-domainlist)<br>*Blocked during deep CNAME inspection*
|
||||
12 | Allowed | ✅ | Retried query
|
||||
13 | Allowed | ✅ | Retried but ignored query (this may happen during ongoing DNSSEC validation)
|
||||
14 | Allowed | ✅ | Already forwarded, not forwarding again
|
||||
@@ -201,7 +201,7 @@ Label | Type | Allowed to by empty | Content
|
||||
Valid `type` IDs are currently
|
||||
|
||||
- `ADDINFO_CNAME_DOMAIN = 1` - `content` is a string (the related CNAME)
|
||||
- `ADDINFO_DOMAIN_ID = 2` - `content` is an integer (ID pointing to a domain in the [`domainlist` table](gravity/index.md#domain-tables-domainlist))
|
||||
- `ADDINFO_DOMAIN_ID = 2` - `content` is an integer (ID pointing to a domain in the [`domainlist` table](domain-database/index.md#domain-tables-domainlist))
|
||||
|
||||
### Example for interaction with the long-term query database
|
||||
|
||||
@@ -53,7 +53,7 @@ See [Regex Blocking](../regex/overview.md) for more information about using Rege
|
||||
**Basic Script Process**:
|
||||
|
||||
* Each domain is validated using regex (except when using `--regex`), to ensure invalid domains and IDNs are not added
|
||||
* A domain gets added to or removed from the `domainlist` table in [`/etc/pihole/gravity.db`](../database/gravity/index.md)
|
||||
* A domain gets added to or removed from the `domainlist` table in [`/etc/pihole/gravity.db`](../database/domain-database/index.md)
|
||||
* The DNS server is then reloaded
|
||||
|
||||
### Debugger
|
||||
@@ -116,11 +116,11 @@ Gravity is one of the most important scripts of Pi-hole. Its main purpose is to
|
||||
**Basic Script Process**:
|
||||
|
||||
* It will determine Internet connectivity, and give time for `pihole-FTL` to be resolvable on low-end systems if has just been restarted
|
||||
* It extracts all URLs and domains from the `adlists` table in [`/etc/pihole/gravity.db`](../database/gravity/index.md)
|
||||
* It extracts all URLs and domains from the `adlists` table in [`/etc/pihole/gravity.db`](../database/domain-database/index.md)
|
||||
* It runs through each URL, downloading it if necessary
|
||||
* `curl` checks the servers `Last-Modified` header to ensure it is getting a newer version
|
||||
* It will attempt to parse the file into a domains-only format if necessary
|
||||
* Lists are merged, comments removed, sorted uniquely and stored in the `gravity` table of [`/etc/pihole/gravity.db`](../database/gravity/index.md)
|
||||
* Lists are merged, comments removed, sorted uniquely and stored in the `gravity` table of [`/etc/pihole/gravity.db`](../database/domain-database/index.md)
|
||||
* Gravity cleans up temporary content and reloads the DNS server
|
||||
|
||||
### Logging
|
||||
@@ -147,7 +147,7 @@ This command will query your whitelist, blacklist, wildcards and adlists for a s
|
||||
|
||||
* User-specified options are handled
|
||||
* Using `idn`, it will convert [Internationalized domain names](https://en.wikipedia.org/wiki/Internationalized_domain_name) into [punycode](https://en.wikipedia.org/wiki/Punycode)
|
||||
* Database at [`/etc/pihole/gravity.db`](../database/gravity/index.md) is queried to return a list of adlists in which the queried domain exists.
|
||||
* Database at [`/etc/pihole/gravity.db`](../database/domain-database/index.md) is queried to return a list of adlists in which the queried domain exists.
|
||||
|
||||
### Update
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ There are two locations where regex filters are important:
|
||||
|
||||
## How to use regular expressions for filtering domains
|
||||
|
||||
*FTL*DNS reads in regular expression filters from the two [`regex` database views](../database/gravity/index.md).
|
||||
*FTL*DNS reads in regular expression filters from the two [`regex` database views](../database/domain-database/index.md).
|
||||
To tell *FTL*DNS to reload the list of regex filters, either:
|
||||
|
||||
- Execute `pihole restartdns reload-lists` or
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
## Only match specific query types
|
||||
|
||||
You can amend the regular expressions by special keywords added at the end to fine-tine regular expressions to match only specific [query types](../database/ftl.md#supported-query-types). In contrast to the description of `OTHER` as being deprecated for storing queries in the database, it is still supported for regular expressions and will match all queries that are not *explicitly* covered by the other query types (see also example below).
|
||||
You can amend the regular expressions by special keywords added at the end to fine-tine regular expressions to match only specific [query types](../database/query-database.md#supported-query-types). In contrast to the description of `OTHER` as being deprecated for storing queries in the database, it is still supported for regular expressions and will match all queries that are not *explicitly* covered by the other query types (see also example below).
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
+10
-6
@@ -122,12 +122,12 @@ nav:
|
||||
- 'Uninstalling': main/uninstall.md
|
||||
- 'The  <samp>pihole</samp>  Command': main/pihole-command.md
|
||||
- 'Databases':
|
||||
- 'Overview': database/index.md
|
||||
- 'Query database': database/ftl.md
|
||||
- 'Domain database':
|
||||
- 'Overview': database/gravity/index.md
|
||||
- 'Group management': database/gravity/groups.md
|
||||
- 'Database recovery': database/gravity/recovery.md
|
||||
- 'Databases': database/index.md
|
||||
- 'Query Database': database/query-database.md
|
||||
- 'Domain Database':
|
||||
- 'Domain Database': database/domain-database/index.md
|
||||
- 'Group Management': database/domain-database/groups.md
|
||||
- 'Database Recovery': database/domain-database/recovery.md
|
||||
- 'Pi-hole API':
|
||||
- 'Overview': api/index.md
|
||||
- 'Authentication': api/auth.md
|
||||
@@ -267,3 +267,7 @@ plugins:
|
||||
'ftldns/regex/tutorial.md': regex/tutorial.md
|
||||
'database/gravity/example.md': group_management/example.md
|
||||
'core/pihole-command.md': main/pihole-command.md
|
||||
'database/ftl.md': database/query-database.md
|
||||
'database/gravity/index.md': database/domain-database/index.md
|
||||
'database/gravity/recovery.md': database/domain-database/recovery.md
|
||||
'database/gravity/groups.md': database/domain-database/groups.md
|
||||
|
||||
Reference in New Issue
Block a user