Compare commits

...

76 Commits

Author SHA1 Message Date
DL6ER
eaaa0c1f7f Also use killproc.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-08-14 23:13:26 +02:00
DL6ER
cea9205136 Use start_daemon to start pihole-FTL.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-08-14 23:00:33 +02:00
DL6ER
0cc1e88608 Remove is_running from init.d script.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-08-14 22:59:25 +02:00
Mark Drobnak
1a741f696e Merge pull request #2816 from RamSet/hotfix/lighttpdMime
Fix lighttpd mime
2019-06-29 15:45:33 -04: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
Mark Drobnak
1d43c0a2fa Merge pull request #2693 from pi-hole/release/v4.3
Pi-hole Core v4.3
2019-05-18 16:08:49 -04:00
Mark Drobnak
ff5894d772 Merge pull request #2744 from pi-hole/fix/cron-job-errors-untagged
Fix for preventing git error message in cron logs
2019-05-11 22:59:32 -04: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
54ae458b61 Merge pull request #2733 from pi-hole/fix/debug-curl
Pi-hole Debug - tricorder upload function calls
2019-05-11 10:54:30 +02:00
Mark Drobnak
55ab3b2dc7 Merge pull request #2739 from pi-hole/new/stickermule_reflink
README StickerMule URL
2019-05-07 23:26:20 -04:00
Mark Drobnak
bdc8cf2bc8 Merge pull request #2738 from pi-hole/fix/untagged_version_fresh_install
Fix Untagged display on new installs
2019-05-07 23:25:33 -04:00
Dan Schaper
74836bebe4 README StickerMule URL
Change StickerMule reflink to Team Pi-hole link.
2019-05-07 11:10:51 -07:00
DL6ER
95150a5d85 Clone twenty instead of only one commit when installing Pi-hole. This ensures that we clone at least one tagged commit in case we need to push changes to master.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-07 19:42:11 +02:00
DL6ER
8abeb2204b Merge pull request #2735 from pi-hole/fix/gravity-blocked-domain
Fix incorrect adlist query when an adlist is blocked during gravity
2019-05-04 23:14:49 +02:00
Mcat12
ec06fd0ad4 Fix incorrect adlist query when an adlist is blocked during gravity
hosts-file.net was hard-coded as the domain to check instead of the
actual domain.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-05-04 11:35:21 -07: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
Dan Schaper
b3898b9b2a Merge pull request #2732 from pi-hole/dschaper-patch-1
Update cryptocoin addresses
2019-05-03 02:42:41 -07:00
Dan Schaper
9ce84714cd Update cryptocoin addresses
We no longer have access to the old coinbase account. Updating to new Coinbase Commerce account.
2019-05-02 18:08:10 -07: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
Mark Drobnak
b27e4c3dc3 Merge pull request #2725 from pi-hole/fix/get-ip-similar-subnets
Fix getting IP address in the presence of similar subnets
2019-04-28 14:24:47 -04: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
Mcat12
466fd79c66 Fix getting IP address in the presence of similar subnets
Change was suggested by @computergeek125 in #2387

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-04-27 12:39:45 -07:00
DL6ER
e3d9cf0ac1 Merge pull request #2718 from Piskvor/basic-install-package-manager-typo
Show $UPDATE_PKG_CACHE content in error message.
2019-04-24 10:17:23 +02:00
Mark Drobnak
bd572d8843 Merge pull request #2717 from pi-hole/fix/teleporter-extension
Fix teleporter backup file extension
2019-04-23 13:23:43 -04:00
Jan Piskvor Martinec
037737d653 Show $UPDATE_PKG_CACHE content in error message.
Fixes the typo in update_package_cache(), where the error message
 contained the color code twice, instead of the $UPDATE_PKG_CACHE text.

Signed-off-by: Jan Piskvor Martinec <github@piskvor.org>
2019-04-23 16:02:25 +02:00
Mark Drobnak
d2c7c426de Fix teleporter backup file extension
Fixes #2714 

Signed-off-by: Mark Drobnak <mark.drobnak@gmail.com>
2019-04-22 19:43:26 -07:00
Mark Drobnak
1d09c6e47d Merge pull request #2709 from pi-hole/fix/checkout_indentation
Fix pihole checkout indentation
2019-04-16 22:51:01 -04:00
DL6ER
84244b7cd5 Fix indentation in display of branches available during pihole checkout
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-04-16 18:30:04 +02:00
Mcat12
422680ee9f Fix chronometer refresh incorrectly reading the long argument sleep time
`-r` worked, but `--refresh` did not.

Fixes #2703

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-04-14 13:03:25 -07:00
Mark Drobnak
42c7653e99 Merge pull request #2696 from pi-hole/tweak/FTL-privacy-doc-link
Add a link to the documentation on FTL privacy levels during install
2019-04-07 15:12:10 -04:00
Mcat12
78c0c58946 Add a link to the documentation on FTL privacy levels during install
Closes #2695

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-04-07 12:00:43 -07:00
Mark Drobnak
cae61614f4 Merge pull request #2688 from pi-hole/fix/2687
Add Check to `pihole -q -exact` to ensure there is no `#` char preceding a space before the domain
2019-03-28 23:20:41 -04:00
Adam Warner
a7f6c9b3a0 Ignore matches that start # using negative lookbehind
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2019-03-29 00:08:04 +00:00
Mark Drobnak
5950b4bb78 Merge pull request #2646 from pi-hole/fix/FTL_arch_detect_rpm
Don't fail when trying to detect OS architecture on RPM-based systems
2019-03-24 15:23:05 -04:00
DL6ER
817b19888f Merge branch 'development' into fix/FTL_arch_detect_rpm 2019-03-23 08:55:46 +01:00
Mark Drobnak
b64fb578fc Merge pull request #2674 from NiGhTTraX/development
Fix uninstalling lighttpd when it's not installed
2019-03-15 22:11:34 -04:00
Andrei Picus
e9e92368b0 Fix uninstalling lighttpd when it's not installed
Signed-off-by: Andrei Picus <NiGhTTraX@users.noreply.github.com>
2019-03-15 15:05:58 +01:00
Dan Schaper
ffcb173a7f Merge pull request #2672 from pi-hole/fix/test-version-pinning
Pin Python package versions to the versions in the last successful build
2019-03-15 07:04:40 -07:00
Mcat12
b9c9c2797f Pin Python package versions to the versions in the last successful build
The last successful build was
https://travis-ci.org/pi-hole/pi-hole/builds/500825408

When `testinfra` became `2.0.0`, it removed the deprecated features that
the tests currently use.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-03-13 20:14:21 -07:00
Mark Drobnak
204a4e459b Merge pull request #2637 from TheNoim/patch-1
Support pi hole behind a reverse proxy with ssl
2019-03-13 22:12:00 -04:00
DL6ER
0a53e966ea Merge pull request #2659 from pi-hole/tweak/warn_if_FTL_not_on_master
Warn user during update if FTL is on a custom branch
2019-03-03 09:34:11 +01:00
DL6ER
2e17c23333 Don't warn if user is on development as this branch is constantly updated
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-03-02 16:40:59 +01:00
DL6ER
63f3381a2b Warn user if FTL is not on branch master
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-03-02 16:36:49 +01:00
Mark Drobnak
2292720fed Merge pull request #2650 from mmphego/patch-1
Update README.md
2019-03-01 13:19:31 -05:00
Mpho Mphego
b77efa521f Update README.md
Removed the extra double quote.

Signed-off-by: Mpho Mphego <mpho112@gmail.com>
2019-03-01 09:38:36 +02:00
Mpho Mphego
cfe221706b Update README.md
Changed badges from HTML code to markdown for consistency

Signed-off-by: Mpho Mphego <mpho112@gmail.com>
2019-02-27 09:57:23 +02:00
Dan Schaper
293e2a8e80 Merge pull request #2647 from pi-hole/feature/curl_debug
Use `curl` instead of `openssl` for debug upload.
2019-02-23 09:11:02 -08:00
Dan Schaper
71cd6c137b Use curl instead of openssl for transmission of unmodified
log file. We want ansi color codes to be sent.

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2019-02-23 04:13:44 -08:00
DL6ER
9867b7fccf Don't fail when trying to detect OS architecture on RPM-based systems
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-02-22 18:41:01 +01:00
Mark Drobnak
58f198626a Merge pull request #2640 from pi-hole/new/DebugAdditions
Add git status/diff to debug log
2019-02-18 19:28:21 -05:00
Adam Warner
a145f1d931 Be more verbose with debug script output
If output of `git status -s` is non-null display changes
if output of `git diff` is non-null, display diff

Signed-off-by: Adam Warner <adamw@rner.email>
2019-02-18 22:32:53 +00:00
Mark Drobnak
9748f19172 Merge pull request #2639 from pi-hole/hotfix/v4.2.2
Update development from hotfix/v4.2.2
2019-02-18 13:54:08 -05:00
DL6ER
ba1e94d3d9 Merge pull request #2626 from pi-hole/hotfix/v4.2.2
Pi-hole Core v4.2.2
2019-02-18 18:36:13 +01:00
Nils Bergmann
cd9fadbc44 Remove protocol determination
No protocol determination is neede, if you just use double slash.

Signed-off-by: Nils Bergmann <nilsbergmann@noim.io>
2019-02-16 15:32:56 +01:00
Mark Drobnak
062a180a1c Merge pull request #2621 from cryptomilk/development-fix
A bunch of fixes for basic-install.sh
2019-02-10 20:06:26 -05:00
Andreas Schneider
860ec1a7c4 basic_install: Use install for sudoers
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-02-10 08:45:03 +01:00
DL6ER
5ca1bfc11c Delete /dev/shm/FTL-* files on (re)start of pihole-FTL
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-02-08 15:00:35 +01:00
Andreas Schneider
2f189cd076 basic_install: There is no pihole group, remove it
Only a user has been created beforehand. Only some distributions create
a group with the same name based on their configuration. We cannot
assume this is always the default.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-02-08 08:06:12 +01:00
Andreas Schneider
2f0e6a6dda basic_install: Make sure the PI_HOLE_CONFIG_DIR exists
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-02-08 08:06:12 +01:00
Andreas Schneider
f187b42a98 basic_install: Define webroot globally as a variable
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-02-08 08:06:02 +01:00
Andreas Schneider
838e1b19ec basic_install: Set permissons for PI_HOLE_DASHBOARD_DIR
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-02-06 10:41:37 +01:00
Andreas Schneider
d5bbb2b640 basic_install: Use a varibale for the pihole dashboard dir
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-02-06 10:40:47 +01:00
Andreas Schneider
dc91d4b1f9 basic_install: If a static interface is already set up we are done
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-02-06 07:50:21 +01:00
Dan Schaper
e967fe2266 Merge pull request #2612 from pi-hole/hotfix/v4.2.1
Remove user/group from dnsmasq config
2019-02-03 11:36:57 -08:00
Dan Schaper
b5c7657e01 Merge pull request #2614 from pi-hole/hotfix/v4.2.1
Merge v4.2.1 hotfix to dev
2019-02-03 11:36:00 -08:00
Mcat12
680d6e2d31 Merge branch 'release/v4.2' into development
# Conflicts:
#	automated install/basic-install.sh
2019-02-03 11:14:09 -08:00
Mcat12
7a19d24058 Remove user/group from dnsmasq config
In the case that FTL is started under root, dnsmasq changes the user to
pihole due to this setting. The shared memory is created before this
switch, and may cause issues such as failing to delete or reallocate
the shared memory.

These config lines were necessary before dnsmasq became part of FTL, but
now since dnsmasq runs under FTL, we can configure the user/group
through FTL.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-02-03 10:55:18 -08:00
Mark Drobnak
1e284f69ea Merge pull request #2587 from pi-hole/new/network-table
Download macvendor database
2019-01-28 20:27:13 -05:00
DL6ER
516ed83638 Add "|| true" to the curl command as a failed download is no show-stopper for the overall install process.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-01-28 20:48:30 +01:00
Mark Drobnak
f7ca74cf1d Merge pull request #2598 from pi-hole/fix/remove-norton
Remove Norton DNS
2019-01-19 20:52:37 -05:00
Mark Drobnak
ebba32e1c4 Remove Norton DNS
Signed-off-by: Mark Drobnak <mark.drobnak@gmail.com>
2019-01-19 20:45:19 -05:00
Mark Drobnak
7d2507527a Merge pull request #2593 from TheLastProject/feature/standardized-dns-list
Standardize DNS list and write to file for AdminLTE
2019-01-13 11:10:45 -08:00
Sylvia van Os
97decb3a73 Standardize DNS list and write to file for AdminLTE
Signed-off-by: Sylvia van Os <sylvia@hackerchick.me>
2019-01-13 19:38:04 +01:00
DL6ER
f360959efc Download macvendor database from ftl.pi-hole.net when downloading a new FTL binary. Users who want to update the database more frequently than on each FTL release can use the python script from the FTL repository to generate the database themselves. The macvendor database is an optional component so a failing download is no reason to interrupt the installer.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-01-09 19:26:19 +01:00
16 changed files with 255 additions and 219 deletions

View File

@@ -17,9 +17,9 @@ The Pi-hole[®](https://pi-hole.net/trademark-rules-and-brand-guidelines/) is a
- **Free**: open source software which helps ensure _you_ are the sole person in control of your privacy - **Free**: open source software which helps ensure _you_ are the sole person in control of your privacy
----- -----
<a href="https://www.codacy.com/app/Pi-hole/pi-hole?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=pi-hole/pi-hole&amp;utm_campaign=Badge_Grade"><img src="https://api.codacy.com/project/badge/Grade/c558a0f8d7124c99b02b84f0f5564238" alt="Codacy Grade"/></a> [![Codacy Badge](https://api.codacy.com/project/badge/Grade/c558a0f8d7124c99b02b84f0f5564238)](https://www.codacy.com/app/Pi-hole/pi-hole?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=pi-hole/pi-hole&amp;utm_campaign=Badge_Grade)
<a href="https://travis-ci.org/pi-hole/pi-hole"><img src="https://travis-ci.org/pi-hole/pi-hole.svg?branch=development" alt="Travis Build Status"/></a> [![Build Status](https://travis-ci.org/pi-hole/pi-hole.svg?branch=development)](https://travis-ci.org/pi-hole/pi-hole)
<a href="https://www.bountysource.com/trackers/3011939-pi-hole-pi-hole?utm_source=3011939&utm_medium=shield&utm_campaign=TRACKER_BADGE"><img src="https://www.bountysource.com/badge/tracker?tracker_id=3011939" alt="BountySource"/></a> [![BountySource](https://www.bountysource.com/badge/tracker?tracker_id=3011939)](https://www.bountysource.com/trackers/3011939-pi-hole-pi-hole?utm_source=3011939&utm_medium=shield&utm_campaign=TRACKER_BADGE)
## One-Step Automated Install ## One-Step Automated Install
Those who want to get started quickly and conveniently may install Pi-hole using the following command: Those who want to get started quickly and conveniently may install Pi-hole using the following command:
@@ -61,16 +61,13 @@ Make no mistake: **your support is absolutely vital to help keep us innovating!*
Sending a donation using our links below is **extremely helpful** in offsetting a portion of our monthly expenses: Sending a donation using our links below is **extremely helpful** in offsetting a portion of our monthly expenses:
- <img src="https://pi-hole.github.io/graphics/Badges/paypal-badge-black.svg" width="24" height="24" alt="PP"/> <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY">Donate via PayPal</a><br/> - <img src="https://pi-hole.github.io/graphics/Badges/paypal-badge-black.svg" width="24" height="24" alt="PP"/> <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY">Donate via PayPal</a><br/>
- <img src="https://pi-hole.github.io/graphics/Badges/bitcoin-badge-black.svg" width="24" height="24" alt="BTC"/> [Bitcoin](https://commerce.coinbase.com/checkout/fb7facaf-bebd-46be-bb77-b358f4546763): <code> - <img src="https://pi-hole.github.io/graphics/Badges/bitcoin-badge-black.svg" width="24" height="24" alt="BTC"/> [Bitcoin, Bitcoin Cash, Ethereum, Litecoin](https://commerce.coinbase.com/checkout/dd304d04-f324-4a77-931b-0db61c77a41b)
3MDPzjXu2hjw5sGLJvKUi1uXbvQPzVrbpF</code></br>
- <img src="https://pi-hole.github.io/graphics/Badges/bitcoin-badge-black.svg" width="24" height="24" alt="BTC"/> [Bitcoin Cash](https://commerce.coinbase.com/checkout/fb7facaf-bebd-46be-bb77-b358f4546763): <code>qzqsz4aju2eecc6uhs7tus4vlwhhela24sdruf4qp5</code></br>
- <img src="https://pi-hole.github.io/graphics/Badges/ethereum-badge-black.svg" width="24" height="24" alt="BTC"/> [Ethereum](https://commerce.coinbase.com/checkout/fb7facaf-bebd-46be-bb77-b358f4546763): <code>0x79d4e90A4a0C732819526c93e21A3F1356A2FAe1</code>
### Alternative support ### Alternative support
If you'd rather not [donate](https://pi-hole.net/donate/) (_which is okay!_), there are other ways you can help support us: If you'd rather not [donate](https://pi-hole.net/donate/) (_which is okay!_), there are other ways you can help support us:
- [Patreon](https://patreon.com/pihole) _Become a patron for rewards_ - [Patreon](https://patreon.com/pihole) _Become a patron for rewards_
- [Digital Ocean](http://www.digitalocean.com/?refcode=344d234950e1) _affiliate link_ - [Digital Ocean](http://www.digitalocean.com/?refcode=344d234950e1) _affiliate link_
- [Stickermule](https://www.stickermule.com/unlock?ref_id=6055890701&utm_medium=link&utm_source=invite) _earn a $10 credit after your first purchase_ - [Stickermule](https://www.stickermule.com/unlock?ref_id=9127301701&utm_medium=link&utm_source=invite) _earn a $10 credit after your first purchase_
- [Pi-hole Swag Store](https://pi-hole.net/shop/) _affiliate link_ - [Pi-hole Swag Store](https://pi-hole.net/shop/) _affiliate link_
- [Amazon](http://www.amazon.com/exec/obidos/redirect-home/pihole09-20) _affiliate link_ - [Amazon](http://www.amazon.com/exec/obidos/redirect-home/pihole09-20) _affiliate link_
- [DNS Made Easy](https://cp.dnsmadeeasy.com/u/133706) _affiliate link_ - [DNS Made Easy](https://cp.dnsmadeeasy.com/u/133706) _affiliate link_

View File

@@ -22,9 +22,6 @@ addn-hosts=/etc/pihole/gravity.list
addn-hosts=/etc/pihole/black.list addn-hosts=/etc/pihole/black.list
addn-hosts=/etc/pihole/local.list addn-hosts=/etc/pihole/local.list
user=pihole
group=pihole
domain-needed domain-needed
localise-queries localise-queries

View File

@@ -444,6 +444,9 @@ get_strings() {
} }
chronoFunc() { chronoFunc() {
local extra_arg="$1"
local extra_value="$2"
get_init_stats get_init_stats
for (( ; ; )); do for (( ; ; )); do
@@ -461,10 +464,8 @@ chronoFunc() {
fi fi
# Get refresh number # Get refresh number
if [[ "$*" == *"-r"* ]]; then if [[ "${extra_arg}" = "refresh" ]]; then
num="$*" num="${extra_value}"
num="${num/*-r /}"
num="${num/ */}"
num_str="Refresh set for every $num seconds" num_str="Refresh set for every $num seconds"
else else
num_str="" num_str=""
@@ -473,7 +474,7 @@ chronoFunc() {
clear clear
# Remove exit message heading on third refresh # Remove exit message heading on third refresh
if [[ "$count" -le 2 ]] && [[ "$*" != *"-e"* ]]; then if [[ "$count" -le 2 ]] && [[ "${extra_arg}" != "exit" ]]; then
echo -e " ${COL_LIGHT_GREEN}Pi-hole Chronometer${COL_NC} echo -e " ${COL_LIGHT_GREEN}Pi-hole Chronometer${COL_NC}
$num_str $num_str
${COL_LIGHT_RED}Press Ctrl-C to exit${COL_NC} ${COL_LIGHT_RED}Press Ctrl-C to exit${COL_NC}
@@ -521,10 +522,10 @@ chronoFunc() {
fi fi
# Handle exit/refresh options # Handle exit/refresh options
if [[ "$*" == *"-e"* ]]; then if [[ "${extra_arg}" == "exit" ]]; then
exit 0 exit 0
else else
if [[ "$*" == *"-r"* ]]; then if [[ "${extra_arg}" == "refresh" ]]; then
sleep "$num" sleep "$num"
else else
sleep 5 sleep 5
@@ -561,12 +562,10 @@ if [[ $# = 0 ]]; then
chronoFunc chronoFunc
fi fi
for var in "$@"; do case "$1" in
case "$var" in "-j" | "--json" ) jsonFunc;;
"-j" | "--json" ) jsonFunc;; "-h" | "--help" ) helpFunc;;
"-h" | "--help" ) helpFunc;; "-r" | "--refresh" ) chronoFunc refresh "$2";;
"-r" | "--refresh" ) chronoFunc "$@";; "-e" | "--exit" ) chronoFunc exit;;
"-e" | "--exit" ) chronoFunc "$@";; * ) helpFunc "?";;
* ) helpFunc "?";; esac
esac
done

View File

@@ -115,7 +115,7 @@ checkout() {
if [[ "${corebranches[*]}" == *"master"* ]]; then if [[ "${corebranches[*]}" == *"master"* ]]; then
echo -e "${OVER} ${TICK} $str" echo -e "${OVER} ${TICK} $str"
echo -e "${INFO} ${#corebranches[@]} branches available for Pi-hole Core" echo -e " ${INFO} ${#corebranches[@]} branches available for Pi-hole Core"
else else
# Print STDERR output from get_available_branches # Print STDERR output from get_available_branches
echo -e "${OVER} ${CROSS} $str\\n\\n${corebranches[*]}" echo -e "${OVER} ${CROSS} $str\\n\\n${corebranches[*]}"
@@ -142,7 +142,7 @@ checkout() {
if [[ "${webbranches[*]}" == *"master"* ]]; then if [[ "${webbranches[*]}" == *"master"* ]]; then
echo -e "${OVER} ${TICK} $str" echo -e "${OVER} ${TICK} $str"
echo -e "${INFO} ${#webbranches[@]} branches available for Web Admin" echo -e " ${INFO} ${#webbranches[@]} branches available for Web Admin"
else else
# Print STDERR output from get_available_branches # Print STDERR output from get_available_branches
echo -e "${OVER} ${CROSS} $str\\n\\n${webbranches[*]}" echo -e "${OVER} ${CROSS} $str\\n\\n${webbranches[*]}"

View File

@@ -109,7 +109,6 @@ FTL_PORT="${RUN_DIRECTORY}/pihole-FTL.port"
PIHOLE_LOG="${LOG_DIRECTORY}/pihole.log" PIHOLE_LOG="${LOG_DIRECTORY}/pihole.log"
PIHOLE_LOG_GZIPS="${LOG_DIRECTORY}/pihole.log.[0-9].*" PIHOLE_LOG_GZIPS="${LOG_DIRECTORY}/pihole.log.[0-9].*"
PIHOLE_DEBUG_LOG="${LOG_DIRECTORY}/pihole_debug.log" PIHOLE_DEBUG_LOG="${LOG_DIRECTORY}/pihole_debug.log"
PIHOLE_DEBUG_LOG_SANITIZED="${LOG_DIRECTORY}/pihole_debug-sanitized.log"
PIHOLE_FTL_LOG="${LOG_DIRECTORY}/pihole-FTL.log" PIHOLE_FTL_LOG="${LOG_DIRECTORY}/pihole-FTL.log"
PIHOLE_WEB_SERVER_ACCESS_LOG_FILE="${WEB_SERVER_LOG_DIRECTORY}/access.log" PIHOLE_WEB_SERVER_ACCESS_LOG_FILE="${WEB_SERVER_LOG_DIRECTORY}/access.log"
@@ -209,11 +208,6 @@ log_write() {
copy_to_debug_log() { copy_to_debug_log() {
# Copy the contents of file descriptor 3 into the debug log # Copy the contents of file descriptor 3 into the debug log
cat /proc/$$/fd/3 > "${PIHOLE_DEBUG_LOG}" cat /proc/$$/fd/3 > "${PIHOLE_DEBUG_LOG}"
# Since we use color codes such as '\e[1;33m', they should be removed before being
# uploaded to our server, since it can't properly display in color
# This is accomplished by use sed to remove characters matching that patter
# The entire file is then copied over to a sanitized version of the log
sed 's/\[[0-9;]\{1,5\}m//g' > "${PIHOLE_DEBUG_LOG_SANITIZED}" <<< cat "${PIHOLE_DEBUG_LOG}"
} }
initialize_debug() { initialize_debug() {
@@ -269,6 +263,9 @@ compare_local_version_to_git_version() {
# The commit they are on # The commit they are on
local remote_commit local remote_commit
remote_commit=$(git describe --long --dirty --tags --always) remote_commit=$(git describe --long --dirty --tags --always)
# Status of the repo
local local_status
local_status=$(git status -s)
# echo this information out to the user in a nice format # echo this information out to the user in a nice format
# If the current version matches what pihole -v produces, the user is up-to-date # If the current version matches what pihole -v produces, the user is up-to-date
if [[ "${remote_version}" == "$(pihole -v | awk '/${search_term}/ {print $6}' | cut -d ')' -f1)" ]]; then if [[ "${remote_version}" == "$(pihole -v | awk '/${search_term}/ {print $6}' | cut -d ')' -f1)" ]]; then
@@ -291,6 +288,16 @@ compare_local_version_to_git_version() {
fi fi
# echo the current commit # echo the current commit
log_write "${INFO} Commit: ${remote_commit}" log_write "${INFO} Commit: ${remote_commit}"
# if `local_status` is non-null, then the repo is not clean, display details here
if [[ ${local_status} ]]; then
#Replace new lines in the status with 12 spaces to make the output cleaner
log_write "${INFO} Status: ${local_status//$'\n'/'\n '}"
local local_diff
local_diff=$(git diff)
if [[ ${local_diff} ]]; then
log_write "${INFO} Diff: ${local_diff//$'\n'/'\n '}"
fi
fi
# If git status failed, # If git status failed,
else else
# Return an error message # Return an error message
@@ -1134,20 +1141,20 @@ analyze_pihole_log() {
IFS="$OLD_IFS" IFS="$OLD_IFS"
} }
tricorder_use_nc_or_ssl() { tricorder_use_nc_or_curl() {
# Users can submit their debug logs using nc (unencrypted) or openssl (enrypted) if available # Users can submit their debug logs using nc (unencrypted) or curl (encrypted) if available
# Check for openssl first since encryption is a good thing # Check for curl first since encryption is a good thing
if command -v openssl &> /dev/null; then if command -v curl &> /dev/null; then
# If the command exists, # If the command exists,
log_write " * Using ${COL_GREEN}openssl${COL_NC} for transmission." log_write " * Using ${COL_GREEN}curl${COL_NC} for transmission."
# encrypt and transmit the log and store the token returned in a variable # transmit he log via TLS and store the token returned in a variable
tricorder_token=$(< ${PIHOLE_DEBUG_LOG_SANITIZED} openssl s_client -quiet -connect tricorder.pi-hole.net:${TRICORDER_SSL_PORT_NUMBER} 2> /dev/null) tricorder_token=$(curl --silent --upload-file ${PIHOLE_DEBUG_LOG} https://tricorder.pi-hole.net:${TRICORDER_SSL_PORT_NUMBER})
# Otherwise, # Otherwise,
else else
# use net cat # use net cat
log_write "${INFO} Using ${COL_YELLOW}netcat${COL_NC} for transmission." log_write "${INFO} Using ${COL_YELLOW}netcat${COL_NC} for transmission."
# Save the token returned by our server in a variable # Save the token returned by our server in a variable
tricorder_token=$(< ${PIHOLE_DEBUG_LOG_SANITIZED} nc tricorder.pi-hole.net ${TRICORDER_NC_PORT_NUMBER}) tricorder_token=$(< ${PIHOLE_DEBUG_LOG} nc tricorder.pi-hole.net ${TRICORDER_NC_PORT_NUMBER})
fi fi
} }
@@ -1173,7 +1180,7 @@ upload_to_tricorder() {
# let the user know # let the user know
log_write "${INFO} Debug script running in automated mode" log_write "${INFO} Debug script running in automated mode"
# and then decide again which tool to use to submit it # and then decide again which tool to use to submit it
tricorder_use_nc_or_ssl tricorder_use_nc_or_curl
# If we're not running in automated mode, # If we're not running in automated mode,
else else
echo "" echo ""
@@ -1182,7 +1189,7 @@ upload_to_tricorder() {
read -r -p "[?] Would you like to upload the log? [y/N] " response read -r -p "[?] Would you like to upload the log? [y/N] " response
case ${response} in case ${response} in
# If they say yes, run our function for uploading the log # If they say yes, run our function for uploading the log
[yY][eE][sS]|[yY]) tricorder_use_nc_or_ssl;; [yY][eE][sS]|[yY]) tricorder_use_nc_or_curl;;
# If they choose no, just exit out of the script # If they choose no, just exit out of the script
*) log_write " * Log will ${COL_GREEN}NOT${COL_NC} be uploaded to tricorder.";exit; *) log_write " * Log will ${COL_GREEN}NOT${COL_NC} be uploaded to tricorder.";exit;
esac esac
@@ -1209,7 +1216,7 @@ upload_to_tricorder() {
log_write " * Please try again or contact the Pi-hole team for assistance." log_write " * Please try again or contact the Pi-hole team for assistance."
fi fi
# Finally, show where the log file is no matter the outcome of the function so users can look at it # Finally, show where the log file is no matter the outcome of the function so users can look at it
log_write " * A local copy of the debug log can be found at: ${COL_CYAN}${PIHOLE_DEBUG_LOG_SANITIZED}${COL_NC}\\n" log_write " * A local copy of the debug log can be found at: ${COL_CYAN}${PIHOLE_DEBUG_LOG}${COL_NC}\\n"
} }
# Run through all the functions we made # Run through all the functions we made

View File

@@ -54,7 +54,7 @@ scanList(){
# /dev/null forces filename to be printed when only one list has been generated # /dev/null forces filename to be printed when only one list has been generated
# shellcheck disable=SC2086 # shellcheck disable=SC2086
case "${type}" in case "${type}" in
"exact" ) grep -i -E -l "(^|\\s)${domain}($|\\s|#)" ${lists} /dev/null 2>/dev/null;; "exact" ) grep -i -E -l "(^|(?<!#)\\s)${domain}($|\\s|#)" ${lists} /dev/null 2>/dev/null;;
"wc" ) grep -i -o -m 1 "/${domain}/" ${lists} 2>/dev/null;; "wc" ) grep -i -o -m 1 "/${domain}/" ${lists} 2>/dev/null;;
* ) grep -i "${domain}" ${lists} /dev/null 2>/dev/null;; * ) grep -i "${domain}" ${lists} /dev/null 2>/dev/null;;
esac esac

View File

@@ -146,6 +146,20 @@ main() {
FTL_update=false FTL_update=false
fi fi
# Determine FTL branch
local ftlBranch
if [[ -f "/etc/pihole/ftlbranch" ]]; then
ftlBranch=$(</etc/pihole/ftlbranch)
else
ftlBranch="master"
fi
if [[ ! "${ftlBranch}" == "master" && ! "${ftlBranch}" == "development" ]]; then
# Notify user that they are on a custom branch which might mean they they are lost
# behind if a branch was merged to development and got abandoned
printf " %b %bWarning:%b You are using FTL from a custom branch (%s) and might be missing future releases.\\n" "${INFO}" "${COL_LIGHT_RED}" "${COL_NC}" "${ftlBranch}"
fi
if [[ "${core_update}" == false && "${web_update}" == false && "${FTL_update}" == false ]]; then if [[ "${core_update}" == false && "${web_update}" == false && "${FTL_update}" == false ]]; then
echo "" echo ""
echo -e " ${TICK} Everything is up to date!" echo -e " ${TICK} Everything is up to date!"

View File

@@ -34,7 +34,7 @@ function get_local_branch() {
function get_local_version() { function get_local_version() {
# Return active branch # Return active branch
cd "${1}" 2> /dev/null || return 1 cd "${1}" 2> /dev/null || return 1
git describe --long --dirty --tags || return 1 git describe --long --dirty --tags 2> /dev/null || return 1
} }
# Source the setupvars config file # Source the setupvars config file

View File

@@ -530,7 +530,7 @@ Interfaces:
Teleporter() { Teleporter() {
local datetimestamp=$(date "+%Y-%m-%d_%H-%M-%S") local datetimestamp=$(date "+%Y-%m-%d_%H-%M-%S")
php /var/www/html/admin/scripts/pi-hole/php/teleporter.php > "pi-hole-teleporter_${datetimestamp}.zip" php /var/www/html/admin/scripts/pi-hole/php/teleporter.php > "pi-hole-teleporter_${datetimestamp}.tar.gz"
} }
addAudit() addAudit()

View File

@@ -10,20 +10,14 @@
### END INIT INFO ### END INIT INFO
FTLUSER=pihole FTLUSER=pihole
BINARY="/usr/bin/pihole-FTL"
PIDFILE=/var/run/pihole-FTL.pid PIDFILE=/var/run/pihole-FTL.pid
get_pid() { . /lib/lsb/init-functions
pidof "pihole-FTL"
}
is_running() {
ps "$(get_pid)" > /dev/null 2>&1
}
# Start the service # Start the service
start() { start() {
if is_running; then if pidofproc -p "${PIDFILE}" > /dev/null 2>&1; then
echo "pihole-FTL is already running" echo "pihole-FTL is already running"
else else
# Touch files to ensure they exist (create if non-existing, preserve if existing) # Touch files to ensure they exist (create if non-existing, preserve if existing)
@@ -33,6 +27,8 @@ start() {
mkdir -p /var/run/pihole mkdir -p /var/run/pihole
mkdir -p /var/log/pihole mkdir -p /var/log/pihole
chown pihole:pihole /var/run/pihole /var/log/pihole chown pihole:pihole /var/run/pihole /var/log/pihole
# Remove possible leftovers from previous pihole-FTL processes
rm -f /dev/shm/FTL-* 2> /dev/null
rm /var/run/pihole/FTL.sock 2> /dev/null rm /var/run/pihole/FTL.sock 2> /dev/null
# Ensure that permissions are set so that pihole-FTL can edit all necessary files # Ensure that permissions are set so that pihole-FTL can edit all necessary files
chown pihole:pihole /run/pihole-FTL.pid /run/pihole-FTL.port chown pihole:pihole /run/pihole-FTL.pid /run/pihole-FTL.port
@@ -41,10 +37,10 @@ start() {
chmod 0644 /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log chmod 0644 /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
echo "nameserver 127.0.0.1" | /sbin/resolvconf -a lo.piholeFTL echo "nameserver 127.0.0.1" | /sbin/resolvconf -a lo.piholeFTL
if setcap CAP_NET_BIND_SERVICE,CAP_NET_RAW,CAP_NET_ADMIN+eip "$(which pihole-FTL)"; then if setcap CAP_NET_BIND_SERVICE,CAP_NET_RAW,CAP_NET_ADMIN+eip "$(which pihole-FTL)"; then
su -s /bin/sh -c "/usr/bin/pihole-FTL" "$FTLUSER" start_daemon -p "${PIDFILE}" /usr/bin/su -s /bin/sh -c "${BINARY} -f" "$FTLUSER" &
else else
echo "Warning: Starting pihole-FTL as root because setting capabilities is not supported on this system" echo "Warning: Starting pihole-FTL as root because setting capabilities is not supported on this system"
pihole-FTL start_daemon -p "${PIDFILE}" "${BINARY}" -f &
fi fi
echo echo
fi fi
@@ -52,11 +48,11 @@ start() {
# Stop the service # Stop the service
stop() { stop() {
if is_running; then if pidofproc -p "${PIDFILE}" > /dev/null 2>&1; then
/sbin/resolvconf -d lo.piholeFTL /sbin/resolvconf -d lo.piholeFTL
kill "$(get_pid)" killproc -p "${PIDFILE}" "${BINARY}"
for i in {1..5}; do for i in {1..5}; do
if ! is_running; then if ! pidofproc -p "${PIDFILE}" > /dev/null 2>&1; then
break break
fi fi
@@ -65,9 +61,9 @@ stop() {
done done
echo echo
if is_running; then if pidofproc -p "${PIDFILE}" > /dev/null 2>&1; then
echo "Not stopped; may still be shutting down or shutdown may have failed, killing now" echo "Not stopped; may still be shutting down or shutdown may have failed, killing now"
kill -9 "$(get_pid)" killproc -p "${PIDFILE}" "${BINARY}" 9
exit 1 exit 1
else else
echo "Stopped" echo "Stopped"
@@ -80,7 +76,7 @@ stop() {
# Indicate the service status # Indicate the service status
status() { status() {
if is_running; then if pidofproc -p "${PIDFILE}" > /dev/null 2>&1; then
echo "[ ok ] pihole-FTL is running" echo "[ ok ] pihole-FTL is running"
exit 0 exit 0
else else

View File

@@ -40,13 +40,6 @@ $validExtTypes = array("asp", "htm", "html", "php", "rss", "xml", "");
// Get extension of current URL // Get extension of current URL
$currentUrlExt = pathinfo($_SERVER["REQUEST_URI"], PATHINFO_EXTENSION); $currentUrlExt = pathinfo($_SERVER["REQUEST_URI"], PATHINFO_EXTENSION);
// Check if this is served over HTTP or HTTPS
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") {
$proto = "https";
} else {
$proto = "http";
}
// Set mobile friendly viewport // Set mobile friendly viewport
$viewPort = '<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>'; $viewPort = '<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>';
@@ -229,10 +222,10 @@ setHeader();
<?=$viewPort ?> <?=$viewPort ?>
<meta name="robots" content="noindex,nofollow"/> <meta name="robots" content="noindex,nofollow"/>
<meta http-equiv="x-dns-prefetch-control" content="off"> <meta http-equiv="x-dns-prefetch-control" content="off">
<link rel="shortcut icon" href="<?=$proto ?>://pi.hole/admin/img/favicon.png" type="image/x-icon"/> <link rel="shortcut icon" href="//pi.hole/admin/img/favicon.png" type="image/x-icon"/>
<link rel="stylesheet" href="<?=$proto ?>://pi.hole/pihole/blockingpage.css" type="text/css"/> <link rel="stylesheet" href="//pi.hole/pihole/blockingpage.css" type="text/css"/>
<title>● <?=$serverName ?></title> <title>● <?=$serverName ?></title>
<script src="<?=$proto ?>://pi.hole/admin/scripts/vendor/jquery.min.js"></script> <script src="//pi.hole/admin/scripts/vendor/jquery.min.js"></script>
<script> <script>
window.onload = function () { window.onload = function () {
<?php <?php

View File

@@ -44,9 +44,18 @@ static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
compress.cache-dir = "/var/cache/lighttpd/compress/" compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" ) compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" )
mimetype.assign = ( ".png" => "image/png",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".html" => "text/html",
".css" => "text/css; charset=utf-8",
".js" => "application/javascript",
".json" => "application/json",
".txt" => "text/plain",
".svg" => "image/svg+xml" )
# default listening port for IPv6 falls back to the IPv4 port # default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
# Prevent Lighttpd from enabling Let's Encrypt SSL for every blocked domain # Prevent Lighttpd from enabling Let's Encrypt SSL for every blocked domain
#include_shell "/usr/share/lighttpd/include-conf-enabled.pl" #include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

View File

@@ -28,6 +28,20 @@ set -e
# Local variables will be in lowercase and will exist only within functions # Local variables will be in lowercase and will exist only within functions
# It's still a work in progress, so you may see some variance in this guideline until it is complete # It's still a work in progress, so you may see some variance in this guideline until it is complete
# List of supported DNS servers
DNS_SERVERS=$(cat << EOM
Google (ECS);8.8.8.8;8.8.4.4;2001:4860:4860:0:0:0:0:8888;2001:4860:4860:0:0:0:0:8844
OpenDNS (ECS);208.67.222.222;208.67.220.220;2620:0:ccc::2;2620:0:ccd::2
Level3;4.2.2.1;4.2.2.2;;
Comodo;8.26.56.26;8.20.247.20;;
DNS.WATCH;84.200.69.80;84.200.70.40;2001:1608:10:25:0:0:1c04:b12f;2001:1608:10:25:0:0:9249:d69b
Quad9 (filtered, DNSSEC);9.9.9.9;149.112.112.112;2620:fe::fe;2620:fe::9
Quad9 (unfiltered, no DNSSEC);9.9.9.10;149.112.112.10;2620:fe::10;2620:fe::fe:10
Quad9 (filtered + ECS);9.9.9.11;149.112.112.11;2620:fe::11;
Cloudflare;1.1.1.1;1.0.0.1;2606:4700:4700::1111;2606:4700:4700::1001
EOM
)
# Location for final installation log storage # Location for final installation log storage
installLogLoc=/etc/pihole/install.log installLogLoc=/etc/pihole/install.log
# This is an important file as it contains information specific to the machine it's being installed on # This is an important file as it contains information specific to the machine it's being installed on
@@ -38,9 +52,12 @@ lighttpdConfig=/etc/lighttpd/lighttpd.conf
# This is a file used for the colorized output # This is a file used for the colorized output
coltable=/opt/pihole/COL_TABLE coltable=/opt/pihole/COL_TABLE
# Root of the web server
webroot="/var/www/html"
# We store several other directories and # We store several other directories and
webInterfaceGitUrl="https://github.com/pi-hole/AdminLTE.git" webInterfaceGitUrl="https://github.com/pi-hole/AdminLTE.git"
webInterfaceDir="/var/www/html/admin" webInterfaceDir="${webroot}/admin"
piholeGitUrl="https://github.com/pi-hole/pi-hole.git" piholeGitUrl="https://github.com/pi-hole/pi-hole.git"
PI_HOLE_LOCAL_REPO="/etc/.pihole" PI_HOLE_LOCAL_REPO="/etc/.pihole"
# These are the names of pi-holes files, stored in an array # These are the names of pi-holes files, stored in an array
@@ -48,6 +65,7 @@ PI_HOLE_FILES=(chronometer list piholeDebug piholeLogFlush setupLCD update versi
# This directory is where the Pi-hole scripts will be installed # This directory is where the Pi-hole scripts will be installed
PI_HOLE_INSTALL_DIR="/opt/pihole" PI_HOLE_INSTALL_DIR="/opt/pihole"
PI_HOLE_CONFIG_DIR="/etc/pihole" PI_HOLE_CONFIG_DIR="/etc/pihole"
PI_HOLE_BLOCKPAGE_DIR="${webroot}/pihole"
useUpdateVars=false useUpdateVars=false
adlistFile="/etc/pihole/adlists.list" adlistFile="/etc/pihole/adlists.list"
@@ -395,7 +413,7 @@ make_repo() {
rm -rf "${directory}" rm -rf "${directory}"
fi fi
# Clone the repo and return the return code from this command # Clone the repo and return the return code from this command
git clone -q --depth 1 "${remoteRepo}" "${directory}" &> /dev/null || return $? git clone -q --depth 20 "${remoteRepo}" "${directory}" &> /dev/null || return $?
# Show a colored message showing it's status # Show a colored message showing it's status
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}" printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
# Always return 0? Not sure this is correct # Always return 0? Not sure this is correct
@@ -507,7 +525,7 @@ find_IPv4_information() {
fi fi
# Append the CIDR notation to the IP address, if valid_ip fails this should return 127.0.0.1/8 # Append the CIDR notation to the IP address, if valid_ip fails this should return 127.0.0.1/8
IPV4_ADDRESS=$(ip -oneline -family inet address show | grep "${IPv4bare}" | awk '{print $4}' | awk 'END {print}') IPV4_ADDRESS=$(ip -oneline -family inet address show | grep "${IPv4bare}/" | awk '{print $4}' | awk 'END {print}')
} }
# Get available interfaces that are UP # Get available interfaces that are UP
@@ -859,6 +877,13 @@ setStaticIPv4() {
# Local, named variables # Local, named variables
local IFCFG_FILE local IFCFG_FILE
local CONNECTION_NAME local CONNECTION_NAME
# If a static interface is already configured, we are done.
if [[ -r "/etc/sysconfig/network/ifcfg-${PIHOLE_INTERFACE}" ]]; then
if grep -q '^BOOTPROTO=.static.' "/etc/sysconfig/network/ifcfg-${PIHOLE_INTERFACE}"; then
return 0
fi
fi
# For the Debian family, if dhcpcd.conf exists, # For the Debian family, if dhcpcd.conf exists,
if [[ -f "/etc/dhcpcd.conf" ]]; then if [[ -f "/etc/dhcpcd.conf" ]]; then
# configure networking via dhcpcd # configure networking via dhcpcd
@@ -919,15 +944,26 @@ setDNS() {
local DNSSettingsCorrect local DNSSettingsCorrect
# In an array, list the available upstream providers # In an array, list the available upstream providers
DNSChooseOptions=(Google "" DNSChooseOptions=()
OpenDNS "" local DNSServerCount=0
Level3 "" # Save the old Internal Field Separator in a variable
Comodo "" OIFS=$IFS
DNSWatch "" # and set the new one to newline
Quad9 "" IFS=$'\n'
FamilyShield "" # Put the DNS Servers into an array
Cloudflare "" for DNSServer in ${DNS_SERVERS}
Custom "") do
DNSName="$(cut -d';' -f1 <<< "${DNSServer}")"
DNSChooseOptions[DNSServerCount]="${DNSName}"
(( DNSServerCount=DNSServerCount+1 ))
DNSChooseOptions[DNSServerCount]=""
(( DNSServerCount=DNSServerCount+1 ))
done
DNSChooseOptions[DNSServerCount]="Custom"
(( DNSServerCount=DNSServerCount+1 ))
DNSChooseOptions[DNSServerCount]=""
# Restore the IFS to what it was
IFS=${OIFS}
# In a whiptail dialog, show the options # In a whiptail dialog, show the options
DNSchoices=$(whiptail --separate-output --menu "Select Upstream DNS Provider. To use your own, select Custom." ${r} ${c} 7 \ DNSchoices=$(whiptail --separate-output --menu "Select Upstream DNS Provider. To use your own, select Custom." ${r} ${c} 7 \
"${DNSChooseOptions[@]}" 2>&1 >/dev/tty) || \ "${DNSChooseOptions[@]}" 2>&1 >/dev/tty) || \
@@ -937,113 +973,90 @@ setDNS() {
# Display the selection # Display the selection
printf " %b Using " "${INFO}" printf " %b Using " "${INFO}"
# Depending on the user's choice, set the GLOBAl variables to the IP of the respective provider # Depending on the user's choice, set the GLOBAl variables to the IP of the respective provider
case ${DNSchoices} in if [[ "${DNSchoices}" == "Custom" ]]
Google) then
printf "Google DNS servers\\n" # Until the DNS settings are selected,
PIHOLE_DNS_1="8.8.8.8" until [[ "${DNSSettingsCorrect}" = True ]]; do
PIHOLE_DNS_2="8.8.4.4" #
;; strInvalid="Invalid"
OpenDNS) # If the first
printf "OpenDNS servers\\n" if [[ ! "${PIHOLE_DNS_1}" ]]; then
PIHOLE_DNS_1="208.67.222.222" # and second upstream servers do not exist
PIHOLE_DNS_2="208.67.220.220" if [[ ! "${PIHOLE_DNS_2}" ]]; then
;; prePopulate=""
Level3)
printf "Level3 servers\\n"
PIHOLE_DNS_1="4.2.2.1"
PIHOLE_DNS_2="4.2.2.2"
;;
Comodo)
printf "Comodo Secure servers\\n"
PIHOLE_DNS_1="8.26.56.26"
PIHOLE_DNS_2="8.20.247.20"
;;
DNSWatch)
printf "DNS.WATCH servers\\n"
PIHOLE_DNS_1="84.200.69.80"
PIHOLE_DNS_2="84.200.70.40"
;;
Quad9)
printf "Quad9 servers\\n"
PIHOLE_DNS_1="9.9.9.9"
PIHOLE_DNS_2="149.112.112.112"
;;
FamilyShield)
printf "FamilyShield servers\\n"
PIHOLE_DNS_1="208.67.222.123"
PIHOLE_DNS_2="208.67.220.123"
;;
Cloudflare)
printf "Cloudflare servers\\n"
PIHOLE_DNS_1="1.1.1.1"
PIHOLE_DNS_2="1.0.0.1"
;;
Custom)
# Until the DNS settings are selected,
until [[ "${DNSSettingsCorrect}" = True ]]; do
#
strInvalid="Invalid"
# If the first
if [[ ! "${PIHOLE_DNS_1}" ]]; then
# and second upstream servers do not exist
if [[ ! "${PIHOLE_DNS_2}" ]]; then
prePopulate=""
# Otherwise,
else
prePopulate=", ${PIHOLE_DNS_2}"
fi
elif [[ "${PIHOLE_DNS_1}" ]] && [[ ! "${PIHOLE_DNS_2}" ]]; then
prePopulate="${PIHOLE_DNS_1}"
elif [[ "${PIHOLE_DNS_1}" ]] && [[ "${PIHOLE_DNS_2}" ]]; then
prePopulate="${PIHOLE_DNS_1}, ${PIHOLE_DNS_2}"
fi
# Dialog for the user to enter custom upstream servers
piholeDNS=$(whiptail --backtitle "Specify Upstream DNS Provider(s)" --inputbox "Enter your desired upstream DNS provider(s), separated by a comma.\\n\\nFor example '8.8.8.8, 8.8.4.4'" ${r} ${c} "${prePopulate}" 3>&1 1>&2 2>&3) || \
{ printf " %bCancel was selected, exiting installer%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"; exit 1; }
# Clean user input and replace whitespace with comma.
piholeDNS=$(sed 's/[, \t]\+/,/g' <<< "${piholeDNS}")
printf -v PIHOLE_DNS_1 "%s" "${piholeDNS%%,*}"
printf -v PIHOLE_DNS_2 "%s" "${piholeDNS##*,}"
# If the IP is valid,
if ! valid_ip "${PIHOLE_DNS_1}" || [[ ! "${PIHOLE_DNS_1}" ]]; then
# store it in the variable so we can use it
PIHOLE_DNS_1=${strInvalid}
fi
# Do the same for the secondary server
if ! valid_ip "${PIHOLE_DNS_2}" && [[ "${PIHOLE_DNS_2}" ]]; then
PIHOLE_DNS_2=${strInvalid}
fi
# If either of the DNS servers are invalid,
if [[ "${PIHOLE_DNS_1}" == "${strInvalid}" ]] || [[ "${PIHOLE_DNS_2}" == "${strInvalid}" ]]; then
# explain this to the user
whiptail --msgbox --backtitle "Invalid IP" --title "Invalid IP" "One or both entered IP addresses were invalid. Please try again.\\n\\n DNS Server 1: $PIHOLE_DNS_1\\n DNS Server 2: ${PIHOLE_DNS_2}" ${r} ${c}
# and set the variables back to nothing
if [[ "${PIHOLE_DNS_1}" == "${strInvalid}" ]]; then
PIHOLE_DNS_1=""
fi
if [[ "${PIHOLE_DNS_2}" == "${strInvalid}" ]]; then
PIHOLE_DNS_2=""
fi
# Since the settings will not work, stay in the loop
DNSSettingsCorrect=False
# Otherwise, # Otherwise,
else else
# Show the settings prePopulate=", ${PIHOLE_DNS_2}"
if (whiptail --backtitle "Specify Upstream DNS Provider(s)" --title "Upstream DNS Provider(s)" --yesno "Are these settings correct?\\n DNS Server 1: $PIHOLE_DNS_1\\n DNS Server 2: ${PIHOLE_DNS_2}" ${r} ${c}); then
# and break from the loop since the servers are valid
DNSSettingsCorrect=True
# Otherwise,
else
# If the settings are wrong, the loop continues
DNSSettingsCorrect=False
fi
fi fi
done elif [[ "${PIHOLE_DNS_1}" ]] && [[ ! "${PIHOLE_DNS_2}" ]]; then
;; prePopulate="${PIHOLE_DNS_1}"
esac elif [[ "${PIHOLE_DNS_1}" ]] && [[ "${PIHOLE_DNS_2}" ]]; then
prePopulate="${PIHOLE_DNS_1}, ${PIHOLE_DNS_2}"
fi
# Dialog for the user to enter custom upstream servers
piholeDNS=$(whiptail --backtitle "Specify Upstream DNS Provider(s)" --inputbox "Enter your desired upstream DNS provider(s), separated by a comma.\\n\\nFor example '8.8.8.8, 8.8.4.4'" ${r} ${c} "${prePopulate}" 3>&1 1>&2 2>&3) || \
{ printf " %bCancel was selected, exiting installer%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"; exit 1; }
# Clean user input and replace whitespace with comma.
piholeDNS=$(sed 's/[, \t]\+/,/g' <<< "${piholeDNS}")
printf -v PIHOLE_DNS_1 "%s" "${piholeDNS%%,*}"
printf -v PIHOLE_DNS_2 "%s" "${piholeDNS##*,}"
# If the IP is valid,
if ! valid_ip "${PIHOLE_DNS_1}" || [[ ! "${PIHOLE_DNS_1}" ]]; then
# store it in the variable so we can use it
PIHOLE_DNS_1=${strInvalid}
fi
# Do the same for the secondary server
if ! valid_ip "${PIHOLE_DNS_2}" && [[ "${PIHOLE_DNS_2}" ]]; then
PIHOLE_DNS_2=${strInvalid}
fi
# If either of the DNS servers are invalid,
if [[ "${PIHOLE_DNS_1}" == "${strInvalid}" ]] || [[ "${PIHOLE_DNS_2}" == "${strInvalid}" ]]; then
# explain this to the user
whiptail --msgbox --backtitle "Invalid IP" --title "Invalid IP" "One or both entered IP addresses were invalid. Please try again.\\n\\n DNS Server 1: $PIHOLE_DNS_1\\n DNS Server 2: ${PIHOLE_DNS_2}" ${r} ${c}
# and set the variables back to nothing
if [[ "${PIHOLE_DNS_1}" == "${strInvalid}" ]]; then
PIHOLE_DNS_1=""
fi
if [[ "${PIHOLE_DNS_2}" == "${strInvalid}" ]]; then
PIHOLE_DNS_2=""
fi
# Since the settings will not work, stay in the loop
DNSSettingsCorrect=False
# Otherwise,
else
# Show the settings
if (whiptail --backtitle "Specify Upstream DNS Provider(s)" --title "Upstream DNS Provider(s)" --yesno "Are these settings correct?\\n DNS Server 1: $PIHOLE_DNS_1\\n DNS Server 2: ${PIHOLE_DNS_2}" ${r} ${c}); then
# and break from the loop since the servers are valid
DNSSettingsCorrect=True
# Otherwise,
else
# If the settings are wrong, the loop continues
DNSSettingsCorrect=False
fi
fi
done
else
# Save the old Internal Field Separator in a variable
OIFS=$IFS
# and set the new one to newline
IFS=$'\n'
for DNSServer in ${DNS_SERVERS}
do
DNSName="$(cut -d';' -f1 <<< "${DNSServer}")"
if [[ "${DNSchoices}" == "${DNSName}" ]]
then
printf "%s\\n" "${DNSName}"
PIHOLE_DNS_1="$(cut -d';' -f2 <<< "${DNSServer}")"
PIHOLE_DNS_2="$(cut -d';' -f3 <<< "${DNSServer}")"
break
fi
done
# Restore the IFS to what it was
IFS=${OIFS}
fi
} }
# Allow the user to enable/disable logging # Allow the user to enable/disable logging
@@ -1081,7 +1094,7 @@ setPrivacyLevel() {
local LevelCommand local LevelCommand
local LevelOptions local LevelOptions
LevelCommand=(whiptail --separate-output --radiolist "Select a privacy mode for FTL." "${r}" "${c}" 6) LevelCommand=(whiptail --separate-output --radiolist "Select a privacy mode for FTL. https://docs.pi-hole.net/ftldns/privacylevels/" "${r}" "${c}" 6)
# The default selection is level 0 # The default selection is level 0
LevelOptions=( LevelOptions=(
@@ -1342,9 +1355,16 @@ installConfigs() {
printf "\\n %b Installing configs from %s...\\n" "${INFO}" "${PI_HOLE_LOCAL_REPO}" printf "\\n %b Installing configs from %s...\\n" "${INFO}" "${PI_HOLE_LOCAL_REPO}"
# Make sure Pi-hole's config files are in place # Make sure Pi-hole's config files are in place
version_check_dnsmasq version_check_dnsmasq
# Install list of DNS servers
# Format: Name;Primary IPv4;Secondary IPv4;Primary IPv6;Secondary IPv6
# Some values may be empty (for example: DNS servers without IPv6 support)
echo "${DNS_SERVERS}" > "${PI_HOLE_CONFIG_DIR}/dns-servers.conf"
# Install empty file if it does not exist # Install empty file if it does not exist
if [[ ! -f "${PI_HOLE_CONFIG_DIR}/pihole-FTL.conf" ]]; then if [[ ! -r "${PI_HOLE_CONFIG_DIR}/pihole-FTL.conf" ]]; then
if ! install -o pihole -g pihole -m 664 /dev/null "${PI_HOLE_CONFIG_DIR}/pihole-FTL.conf" &>/dev/null; then install -d -m 0755 ${PI_HOLE_CONFIG_DIR}
if ! install -o pihole -m 664 /dev/null "${PI_HOLE_CONFIG_DIR}/pihole-FTL.conf" &>/dev/null; then
printf " %bError: Unable to initialize configuration file %s/pihole-FTL.conf\\n" "${COL_LIGHT_RED}" "${PI_HOLE_CONFIG_DIR}" printf " %bError: Unable to initialize configuration file %s/pihole-FTL.conf\\n" "${COL_LIGHT_RED}" "${PI_HOLE_CONFIG_DIR}"
return 1 return 1
fi fi
@@ -1372,7 +1392,7 @@ installConfigs() {
# Make sure the external.conf file exists, as lighttpd v1.4.50 crashes without it # Make sure the external.conf file exists, as lighttpd v1.4.50 crashes without it
touch /etc/lighttpd/external.conf touch /etc/lighttpd/external.conf
# if there is a custom block page in the html/pihole directory, replace 404 handler in lighttpd config # if there is a custom block page in the html/pihole directory, replace 404 handler in lighttpd config
if [[ -f "/var/www/html/pihole/custom.php" ]]; then if [[ -f "${PI_HOLE_BLOCKPAGE_DIR}/custom.php" ]]; then
sed -i 's/^\(server\.error-handler-404\s*=\s*\).*$/\1"pihole\/custom\.php"/' /etc/lighttpd/lighttpd.conf sed -i 's/^\(server\.error-handler-404\s*=\s*\).*$/\1"pihole\/custom\.php"/' /etc/lighttpd/lighttpd.conf
fi fi
# Make the directories if they do not exist and set the owners # Make the directories if they do not exist and set the owners
@@ -1540,7 +1560,7 @@ update_package_cache() {
else else
# show an error and exit # show an error and exit
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}" printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
printf " %bError: Unable to update package cache. Please try \"%s\"%b" "${COL_LIGHT_RED}" "${COL_LIGHT_RED}" "${COL_NC}" printf " %bError: Unable to update package cache. Please try \"%s\"%b" "${COL_LIGHT_RED}" "${UPDATE_PKG_CACHE}" "${COL_NC}"
return 1 return 1
fi fi
} }
@@ -1638,13 +1658,13 @@ installPiholeWeb() {
local str="Creating directory for blocking page, and copying files" local str="Creating directory for blocking page, and copying files"
printf " %b %s..." "${INFO}" "${str}" printf " %b %s..." "${INFO}" "${str}"
# Install the directory # Install the directory
install -d /var/www/html/pihole install -d -m 0755 ${PI_HOLE_BLOCKPAGE_DIR}
# and the blockpage # and the blockpage
install -D ${PI_HOLE_LOCAL_REPO}/advanced/{index,blockingpage}.* /var/www/html/pihole/ install -D ${PI_HOLE_LOCAL_REPO}/advanced/{index,blockingpage}.* ${PI_HOLE_BLOCKPAGE_DIR}/
# Remove superseded file # Remove superseded file
if [[ -e "/var/www/html/pihole/index.js" ]]; then if [[ -e "${PI_HOLE_BLOCKPAGE_DIR}/index.js" ]]; then
rm "/var/www/html/pihole/index.js" rm "${PI_HOLE_BLOCKPAGE_DIR}/index.js"
fi fi
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}" printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
@@ -1652,9 +1672,9 @@ installPiholeWeb() {
local str="Backing up index.lighttpd.html" local str="Backing up index.lighttpd.html"
printf " %b %s..." "${INFO}" "${str}" printf " %b %s..." "${INFO}" "${str}"
# If the default index file exists, # If the default index file exists,
if [[ -f "/var/www/html/index.lighttpd.html" ]]; then if [[ -f "${webroot}/index.lighttpd.html" ]]; then
# back it up # back it up
mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.orig mv ${webroot}/index.lighttpd.html ${webroot}/index.lighttpd.orig
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}" printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
# Otherwise, # Otherwise,
else else
@@ -1669,7 +1689,7 @@ installPiholeWeb() {
# Make the .d directory if it doesn't exist # Make the .d directory if it doesn't exist
mkdir -p /etc/sudoers.d/ mkdir -p /etc/sudoers.d/
# and copy in the pihole sudoers file # and copy in the pihole sudoers file
cp ${PI_HOLE_LOCAL_REPO}/advanced/Templates/pihole.sudo /etc/sudoers.d/pihole install -m 0640 ${PI_HOLE_LOCAL_REPO}/advanced/Templates/pihole.sudo /etc/sudoers.d/pihole
# Add lighttpd user (OS dependent) to sudoers file # Add lighttpd user (OS dependent) to sudoers file
echo "${LIGHTTPD_USER} ALL=NOPASSWD: /usr/local/bin/pihole" >> /etc/sudoers.d/pihole echo "${LIGHTTPD_USER} ALL=NOPASSWD: /usr/local/bin/pihole" >> /etc/sudoers.d/pihole
@@ -1864,15 +1884,15 @@ installPihole() {
# If the user wants to install the Web interface, # If the user wants to install the Web interface,
if [[ "${INSTALL_WEB_INTERFACE}" == true ]]; then if [[ "${INSTALL_WEB_INTERFACE}" == true ]]; then
if [[ ! -d "/var/www/html" ]]; then if [[ ! -d "${webroot}" ]]; then
# make the Web directory if necessary # make the Web directory if necessary
mkdir -p /var/www/html install -d -m 0755 ${webroot}
fi fi
if [[ "${INSTALL_WEB_SERVER}" == true ]]; then if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
# Set the owner and permissions # Set the owner and permissions
chown ${LIGHTTPD_USER}:${LIGHTTPD_GROUP} /var/www/html chown ${LIGHTTPD_USER}:${LIGHTTPD_GROUP} ${webroot}
chmod 775 /var/www/html chmod 0775 ${webroot}
# Give pihole access to the Web server group # Give pihole access to the Web server group
usermod -a -G ${LIGHTTPD_GROUP} pihole usermod -a -G ${LIGHTTPD_GROUP} pihole
# If the lighttpd command is executable, # If the lighttpd command is executable,
@@ -2178,6 +2198,9 @@ FTLinstall() {
if sha1sum --status --quiet -c "${binary}".sha1; then if sha1sum --status --quiet -c "${binary}".sha1; then
printf "transferred... " printf "transferred... "
# Before stopping FTL, we download the macvendor database
curl -sSL "https://ftl.pi-hole.net/macvendor.db" -o "${PI_HOLE_CONFIG_DIR}/macvendor.db" || true
# Stop pihole-FTL service if available # Stop pihole-FTL service if available
stop_service pihole-FTL &> /dev/null stop_service pihole-FTL &> /dev/null
@@ -2271,10 +2294,12 @@ get_binary_name() {
elif [[ "${machine}" == "x86_64" ]]; then elif [[ "${machine}" == "x86_64" ]]; then
# This gives the architecture of packages dpkg installs (for example, "i386") # This gives the architecture of packages dpkg installs (for example, "i386")
local dpkgarch local dpkgarch
dpkgarch=$(dpkg --print-architecture 2> /dev/null) dpkgarch=$(dpkg --print-architecture 2> /dev/null || true)
# Special case: This is a 32 bit OS, installed on a 64 bit machine # Special case: This is a 32 bit OS, installed on a 64 bit machine
# -> change machine architecture to download the 32 bit executable # -> change machine architecture to download the 32 bit executable
# We only check this for Debian-based systems as this has been an issue
# in the past (see https://github.com/pi-hole/pi-hole/pull/2004)
if [[ "${dpkgarch}" == "i386" ]]; then if [[ "${dpkgarch}" == "i386" ]]; then
printf "%b %b Detected 32bit (i686) architecture\\n" "${OVER}" "${TICK}" printf "%b %b Detected 32bit (i686) architecture\\n" "${OVER}" "${TICK}"
binary="pihole-FTL-linux-x86_32" binary="pihole-FTL-linux-x86_32"

View File

@@ -131,8 +131,7 @@ removeNoPurge() {
echo -e " ${TICK} Removed /etc/cron.d/pihole" echo -e " ${TICK} Removed /etc/cron.d/pihole"
fi fi
package_check lighttpd > /dev/null if package_check lighttpd > /dev/null; then
if [[ $? -eq 1 ]]; then
${SUDO} rm -rf /etc/lighttpd/ &> /dev/null ${SUDO} rm -rf /etc/lighttpd/ &> /dev/null
echo -e " ${TICK} Removed lighttpd" echo -e " ${TICK} Removed lighttpd"
else else

View File

@@ -268,7 +268,7 @@ gravity_DownloadBlocklistFromUrl() {
port=443; port=443;
else port=80 else port=80
fi fi
bad_list=$(pihole -q -adlist hosts-file.net | head -n1 | awk -F 'Match found in ' '{print $2}') bad_list=$(pihole -q -adlist "${domain}" | head -n1 | awk -F 'Match found in ' '{print $2}')
echo -e "${OVER} ${CROSS} ${str} ${domain} is blocked by ${bad_list%:}. Using DNS on ${PIHOLE_DNS_1} to download ${url}"; echo -e "${OVER} ${CROSS} ${str} ${domain} is blocked by ${bad_list%:}. Using DNS on ${PIHOLE_DNS_1} to download ${url}";
echo -ne " ${INFO} ${str} Pending..." echo -ne " ${INFO} ${str} Pending..."
cmd_ext="--resolve $domain:$port:$ip $cmd_ext" cmd_ext="--resolve $domain:$port:$ip $cmd_ext"

View File

@@ -1,6 +1,6 @@
docker-compose docker-compose==1.23.2
pytest pytest==4.3.0
pytest-xdist pytest-xdist==1.26.1
pytest-cov pytest-cov==2.6.1
testinfra testinfra==1.19.0
tox tox==3.7.0