Skip to content

Commit f998eee

Browse files
authored
Release 5.12 (#4889)
2 parents aefbe1f + d6cfa57 commit f998eee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+524
-1728
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
steps:
2626
-
2727
name: Checkout repository
28-
uses: actions/checkout@v3
28+
uses: actions/checkout@v3.0.2
2929
# Initializes the CodeQL tools for scanning.
3030
-
3131
name: Initialize CodeQL

.github/workflows/stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
issues: write
1414

1515
steps:
16-
- uses: actions/stale@v5
16+
- uses: actions/stale@v5.1.1
1717
with:
1818
repo-token: ${{ secrets.GITHUB_TOKEN }}
1919
days-before-stale: 30

.github/workflows/sync-back-to-dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
name: Syncing branches
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@v3.0.2
1515
- name: Opening pull request
1616
id: pull
1717
uses: tretuna/sync-branches@1.4.0
@@ -20,7 +20,7 @@ jobs:
2020
FROM_BRANCH: 'master'
2121
TO_BRANCH: 'development'
2222
- name: Label the pull request to ignore for release note generation
23-
uses: actions-ecosystem/action-add-labels@v1
23+
uses: actions-ecosystem/action-add-labels@v1.1.3
2424
with:
2525
labels: internal
2626
repo: ${{ github.repository }}

.github/workflows/test.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
steps:
1515
-
1616
name: Checkout repository
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v3.0.2
1818
-
1919
name: Check scripts in repository are executable
2020
run: |
@@ -30,7 +30,7 @@ jobs:
3030
ignore_words_file: .codespellignore
3131
-
3232
name: Get editorconfig-checker
33-
uses: editorconfig-checker/action-editorconfig-checker@main
33+
uses: editorconfig-checker/action-editorconfig-checker@main # tag v1.0.0 is really out of date
3434
-
3535
name: Run editorconfig-checker
3636
run: editorconfig-checker
@@ -41,17 +41,18 @@ jobs:
4141
runs-on: ubuntu-latest
4242
needs: smoke-tests
4343
strategy:
44+
fail-fast: false
4445
matrix:
45-
distro: [debian_10, debian_11, ubuntu_18, ubuntu_20, ubuntu_21, ubuntu_22, centos_7, centos_8, fedora_34]
46+
distro: [debian_10, debian_11, ubuntu_18, ubuntu_20, ubuntu_22, centos_8, fedora_34]
4647
env:
4748
DISTRO: ${{matrix.distro}}
4849
steps:
4950
-
5051
name: Checkout repository
51-
uses: actions/checkout@v3
52+
uses: actions/checkout@v3.0.2
5253
-
5354
name: Set up Python 3.8
54-
uses: actions/setup-python@v4
55+
uses: actions/setup-python@v4.2.0
5556
with:
5657
python-version: 3.8
5758
-

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
#
44

55
<p align="center">
6-
<a href="https://pi-hole.net/#gh-light-mode-only">
7-
<img src="https://github.com/pi-hole/graphics/blob/master/Vortex/Vortex_Vertical_wordmark_lightmode.png?raw=true)" alt="Pi-hole">
8-
</a>
9-
<a href="https://pi-hole.net/#gh-dark-mode-only">
10-
<img src="https://github.com/pi-hole/graphics/blob/master/Vortex/Vortex_Vertical_wordmark_darkmode.png?raw=true" alt="Pi-hole">
11-
</a>
6+
<picture>
7+
<source media="(prefers-color-scheme: dark)" srcset="https://pi-hole.github.io/graphics/Vortex/Vortex_Vertical_wordmark_darkmode.png">
8+
<source media="(prefers-color-scheme: light)" srcset="https://pi-hole.github.io/graphics/Vortex/Vortex_Vertical_wordmark_lightmode.png">
9+
<img src="https://pi-hole.github.io/graphics/Vortex/Vortex_Vertical_wordmark_lightmode.png" width="168" height="270" alt="Pi-hole website">
10+
</picture>
1211
<br>
1312
<strong>Network-wide ad blocking via your own Linux hardware</strong>
1413
</p>
14+
1515
<!-- markdownlint-enable MD033 -->
1616

1717
The Pi-hole® is a [DNS sinkhole](https://en.wikipedia.org/wiki/DNS_Sinkhole) that protects your devices from unwanted content without installing any client-side software.
@@ -22,7 +22,7 @@ The Pi-hole® is a [DNS sinkhole](https://en.wikipedia.org/wiki/DNS_Sinkhole) th
2222
- **Lightweight**: runs smoothly with [minimal hardware and software requirements](https://docs.pi-hole.net/main/prerequisites/)
2323
- **Robust**: a command line interface that is quality assured for interoperability
2424
- **Insightful**: a beautiful responsive Web Interface dashboard to view and control your Pi-hole
25-
- **Versatile**: can optionally function as a [DHCP server](https://discourse.pi-hole.net/t/how-do-i-use-pi-holes-built-in-dhcp-server-and-why-would-i-want-to/3026), ensuring *all* your devices are protected automatically
25+
- **Versatile**: can optionally function as a [DHCP server](https://discourse.pi-hole.net/t/how-do-i-use-pi-holes-built-in-dhcp-server-and-why-would-i-want-to/3026), ensuring _all_ your devices are protected automatically
2626
- **Scalable**: [capable of handling hundreds of millions of queries](https://pi-hole.net/2017/05/24/how-much-traffic-can-pi-hole-handle/) when installed on server-grade hardware
2727
- **Modern**: blocks ads over both IPv4 and IPv6
2828
- **Free**: open source software that helps ensure _you_ are the sole person in control of your privacy
@@ -53,7 +53,9 @@ sudo bash basic-install.sh
5353
wget -O basic-install.sh https://install.pi-hole.net
5454
sudo bash basic-install.sh
5555
```
56+
5657
### Method 3: Using Docker to deploy Pi-hole
58+
5759
Please refer to the [Pi-hole docker repo](https://github.com/pi-hole/docker-pi-hole) to use the Official Docker Images.
5860

5961
## [Post-install: Make your network take advantage of Pi-hole](https://docs.pi-hole.net/main/post-install/)
@@ -115,7 +117,7 @@ While we are primarily reachable on our [Discourse User Forum](https://discourse
115117

116118
### [Faster-than-light Engine](https://github.com/pi-hole/ftl)
117119

118-
[FTLDNS](https://github.com/pi-hole/ftl) is a lightweight, purpose-built daemon used to provide statistics needed for the Web Interface, and its API can be easily integrated into your own projects. As the name implies, FTLDNS does this all *very quickly*!
120+
[FTLDNS](https://github.com/pi-hole/ftl) is a lightweight, purpose-built daemon used to provide statistics needed for the Web Interface, and its API can be easily integrated into your own projects. As the name implies, FTLDNS does this all _very quickly_!
119121

120122
Some of the statistics you can integrate include:
121123

@@ -142,7 +144,7 @@ Some notable features include:
142144
- [Updating Ad Lists](https://docs.pi-hole.net/core/pihole-command/#gravity)
143145
- [Querying Ad Lists for blocked domains](https://docs.pi-hole.net/core/pihole-command/#query)
144146
- [Enabling and Disabling Pi-hole](https://docs.pi-hole.net/core/pihole-command/#enable-disable)
145-
- ... and *many* more!
147+
- ... and _many_ more!
146148

147149
You can read our [Core Feature Breakdown](https://docs.pi-hole.net/core/pihole-command/#pi-hole-core) for more information.
148150

advanced/GIFs/25Bytes.gif

-35 Bytes
Binary file not shown.

advanced/GIFs/26Bytes.gif

-26 Bytes
Binary file not shown.

advanced/GIFs/37Bytes.gif

-37 Bytes
Binary file not shown.

advanced/GIFs/43Bytes.gif

-43 Bytes
Binary file not shown.

advanced/Scripts/piholeDebug.sh

Lines changed: 127 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -332,17 +332,34 @@ compare_local_version_to_git_version() {
332332

333333
check_ftl_version() {
334334
local ftl_name="FTL"
335+
local FTL_VERSION FTL_COMMIT FTL_BRANCH
335336
echo_current_diagnostic "${ftl_name} version"
336337
# Use the built in command to check FTL's version
337-
FTL_VERSION=$(pihole-FTL version)
338+
FTL_VERSION=$(pihole-FTL -vv | grep -m 1 Version | awk '{printf $2}')
339+
FTL_BRANCH=$(pihole-FTL -vv | grep -m 1 Branch | awk '{printf $2}')
340+
FTL_COMMIT=$(pihole-FTL -vv | grep -m 1 Commit | awk '{printf $2}')
341+
338342
# Compare the current FTL version to the remote version
339343
if [[ "${FTL_VERSION}" == "$(pihole -v | awk '/FTL/ {print $6}' | cut -d ')' -f1)" ]]; then
340344
# If they are the same, FTL is up-to-date
341345
log_write "${TICK} ${ftl_name}: ${COL_GREEN}${FTL_VERSION}${COL_NC}"
342346
else
343347
# If not, show it in yellow, signifying there is an update
344-
log_write "${TICK} ${ftl_name}: ${COL_YELLOW}${FTL_VERSION}${COL_NC} (${FAQ_UPDATE_PI_HOLE})"
348+
log_write "${INFO} ${ftl_name}: ${COL_YELLOW}${FTL_VERSION}${COL_NC} (${FAQ_UPDATE_PI_HOLE})"
349+
fi
350+
351+
# If they use the master branch, they are on the stable codebase
352+
if [[ "${FTL_BRANCH}" == "master" ]]; then
353+
# so the color of the text is green
354+
log_write "${INFO} Branch: ${COL_GREEN}${FTL_BRANCH}${COL_NC}"
355+
# If it is any other branch, they are in a development branch
356+
else
357+
# So show that in yellow, signifying it's something to take a look at, but not a critical error
358+
log_write "${INFO} Branch: ${COL_YELLOW}${FTL_BRANCH}${COL_NC} (${FAQ_CHECKOUT_COMMAND})"
345359
fi
360+
361+
# echo the current commit
362+
log_write "${INFO} Commit: ${FTL_COMMIT}"
346363
}
347364

348365
# Checks the core version of the Pi-hole codebase
@@ -797,29 +814,13 @@ check_x_headers() {
797814
# server is operating correctly
798815
echo_current_diagnostic "Dashboard and block page"
799816
# Use curl -I to get the header and parse out just the X-Pi-hole one
800-
local block_page
801-
block_page=$(curl -Is localhost | awk '/X-Pi-hole/' | tr -d '\r')
802-
# Do it for the dashboard as well, as the header is different than above
817+
local full_curl_output_dashboard
803818
local dashboard
804-
dashboard=$(curl -Is localhost/admin/ | awk '/X-Pi-hole/' | tr -d '\r')
819+
full_curl_output_dashboard="$(curl -Is localhost/admin/)"
820+
dashboard=$(echo "${full_curl_output_dashboard}" | awk '/X-Pi-hole/' | tr -d '\r')
805821
# Store what the X-Header should be in variables for comparison later
806-
local block_page_working
807-
block_page_working="X-Pi-hole: A black hole for Internet advertisements."
808822
local dashboard_working
809823
dashboard_working="X-Pi-hole: The Pi-hole Web interface is working!"
810-
local full_curl_output_block_page
811-
full_curl_output_block_page="$(curl -Is localhost)"
812-
local full_curl_output_dashboard
813-
full_curl_output_dashboard="$(curl -Is localhost/admin/)"
814-
# If the X-header found by curl matches what is should be,
815-
if [[ $block_page == "$block_page_working" ]]; then
816-
# display a success message
817-
log_write "$TICK Block page X-Header: ${COL_GREEN}${block_page}${COL_NC}"
818-
else
819-
# Otherwise, show an error
820-
log_write "$CROSS Block page X-Header: ${COL_RED}X-Header does not match or could not be retrieved.${COL_NC}"
821-
log_write "${COL_RED}${full_curl_output_block_page}${COL_NC}"
822-
fi
823824

824825
# Same logic applies to the dashboard as above, if the X-Header matches what a working system should have,
825826
if [[ $dashboard == "$dashboard_working" ]]; then
@@ -828,6 +829,7 @@ check_x_headers() {
828829
else
829830
# Otherwise, it's a failure since the X-Headers either don't exist or have been modified in some way
830831
log_write "$CROSS Web interface X-Header: ${COL_RED}X-Header does not match or could not be retrieved.${COL_NC}"
832+
831833
log_write "${COL_RED}${full_curl_output_dashboard}${COL_NC}"
832834
fi
833835
}
@@ -1230,7 +1232,7 @@ check_dhcp_servers() {
12301232
OLD_IFS="$IFS"
12311233
IFS=$'\n'
12321234
local entries=()
1233-
mapfile -t entries < <(pihole-FTL dhcp-discover)
1235+
mapfile -t entries < <(pihole-FTL dhcp-discover & spinner)
12341236

12351237
for line in "${entries[@]}"; do
12361238
log_write " ${line}"
@@ -1259,12 +1261,21 @@ show_messages() {
12591261
show_FTL_db_entries "Pi-hole diagnosis messages" "SELECT count (message) as count, datetime(max(timestamp),'unixepoch','localtime') as 'last timestamp', type, message, blob1, blob2, blob3, blob4, blob5 FROM message GROUP BY type, message, blob1, blob2, blob3, blob4, blob5;" "6 19 20 60 20 20 20 20 20"
12601262
}
12611263

1264+
database_permissions() {
1265+
local permissions
1266+
permissions=$(ls -lhd "${1}")
1267+
log_write "${COL_GREEN}${permissions}${COL_NC}"
1268+
}
1269+
12621270
analyze_gravity_list() {
12631271
echo_current_diagnostic "Gravity Database"
12641272

1265-
local gravity_permissions
1266-
gravity_permissions=$(ls -lhd "${PIHOLE_GRAVITY_DB_FILE}")
1267-
log_write "${COL_GREEN}${gravity_permissions}${COL_NC}"
1273+
database_permissions "${PIHOLE_GRAVITY_DB_FILE}"
1274+
1275+
# if users want to check database integrity
1276+
if [[ "${CHECK_DATABASE}" = true ]]; then
1277+
database_integrity_check "${PIHOLE_FTL_DB_FILE}"
1278+
fi
12681279

12691280
show_db_entries "Info table" "SELECT property,value FROM info" "20 40"
12701281
gravity_updated_raw="$(pihole-FTL sqlite3 "${PIHOLE_GRAVITY_DB_FILE}" "SELECT value FROM info where property = 'updated'")"
@@ -1286,6 +1297,95 @@ analyze_gravity_list() {
12861297
IFS="$OLD_IFS"
12871298
}
12881299

1300+
analyze_ftl_db() {
1301+
echo_current_diagnostic "Pi-hole FTL Query Database"
1302+
database_permissions "${PIHOLE_FTL_DB_FILE}"
1303+
# if users want to check database integrity
1304+
if [[ "${CHECK_DATABASE}" = true ]]; then
1305+
database_integrity_check "${PIHOLE_FTL_DB_FILE}"
1306+
fi
1307+
}
1308+
1309+
database_integrity_check(){
1310+
local result
1311+
local database="${1}"
1312+
1313+
log_write "${INFO} Checking integrity of ${database} ... (this can take several minutes)"
1314+
result="$(pihole-FTL "${database}" "PRAGMA integrity_check" 2>&1 & spinner)"
1315+
if [[ ${result} = "ok" ]]; then
1316+
log_write "${TICK} Integrity of ${database} intact"
1317+
1318+
1319+
log_write "${INFO} Checking foreign key constraints of ${database} ... (this can take several minutes)"
1320+
unset result
1321+
result="$(pihole-FTL sqlite3 "${database}" -cmd ".headers on" -cmd ".mode column" "PRAGMA foreign_key_check" 2>&1 & spinner)"
1322+
if [[ -z ${result} ]]; then
1323+
log_write "${TICK} No foreign key errors in ${database}"
1324+
else
1325+
log_write "${CROSS} ${COL_RED}Foreign key errors in ${database} found.${COL_NC}"
1326+
while IFS= read -r line ; do
1327+
log_write " $line"
1328+
done <<< "$result"
1329+
fi
1330+
1331+
else
1332+
log_write "${CROSS} ${COL_RED}Integrity errors in ${database} found.\n${COL_NC}"
1333+
while IFS= read -r line ; do
1334+
log_write " $line"
1335+
done <<< "$result"
1336+
fi
1337+
1338+
}
1339+
1340+
check_database_integrity() {
1341+
echo_current_diagnostic "Gravity Database"
1342+
database_permissions "${PIHOLE_GRAVITY_DB_FILE}"
1343+
database_integrity_check "${PIHOLE_GRAVITY_DB_FILE}"
1344+
1345+
echo_current_diagnostic "Pi-hole FTL Query Database"
1346+
database_permissions "${PIHOLE_FTL_DB_FILE}"
1347+
database_integrity_check "${PIHOLE_FTL_DB_FILE}"
1348+
}
1349+
1350+
# Show a text spinner during a long process run
1351+
spinner(){
1352+
# Show the spinner only if there is a tty
1353+
if tty -s; then
1354+
# PID of the most recent background process
1355+
_PID=$!
1356+
_spin="/-\|"
1357+
_start=0
1358+
_elapsed=0
1359+
_i=1
1360+
1361+
# Start the counter
1362+
_start=$(date +%s)
1363+
1364+
# Hide the cursor
1365+
tput civis > /dev/tty
1366+
1367+
# ensures cursor is visible again, in case of premature exit
1368+
trap 'tput cnorm > /dev/tty' EXIT
1369+
1370+
while [ -d /proc/$_PID ]; do
1371+
_elapsed=$(( $(date +%s) - _start ))
1372+
# use hours only if needed
1373+
if [ "$_elapsed" -lt 3600 ]; then
1374+
printf "\r${_spin:_i++%${#_spin}:1} %02d:%02d" $((_elapsed/60)) $((_elapsed%60)) >"$(tty)"
1375+
else
1376+
printf "\r${_spin:_i++%${#_spin}:1} %02d:%02d:%02d" $((_elapsed/3600)) $(((_elapsed/60)%60)) $((_elapsed%60)) >"$(tty)"
1377+
fi
1378+
sleep 0.25
1379+
done
1380+
1381+
# Return to the begin of the line after completion (the spinner will be overwritten)
1382+
printf "\r" >"$(tty)"
1383+
1384+
# Restore cursor visibility
1385+
tput cnorm > /dev/tty
1386+
fi
1387+
}
1388+
12891389
obfuscated_pihole_log() {
12901390
local pihole_log=("$@")
12911391
local line
@@ -1431,7 +1531,7 @@ upload_to_tricorder() {
14311531
if [[ "${WEBCALL}" ]] && [[ ! "${AUTOMATED}" ]]; then
14321532
:
14331533
else
1434-
log_write "${CROSS} ${COL_RED}There was an error uploading your debug log.${COL_NC}"
1534+
log_write "${CROSS} ${COL_RED}There was an error uploading your debug log.${COL_NC}"
14351535
log_write " * Please try again or contact the Pi-hole team for assistance."
14361536
fi
14371537
fi
@@ -1460,6 +1560,7 @@ process_status
14601560
ftl_full_status
14611561
parse_setup_vars
14621562
check_x_headers
1563+
analyze_ftl_db
14631564
analyze_gravity_list
14641565
show_groups
14651566
show_domainlist

0 commit comments

Comments
 (0)