Compare commits

...

120 Commits
v3.2 ... v3.3

Author SHA1 Message Date
Dan Schaper
1e87850952 Merge pull request #1943 from pi-hole/release/3.3
Pi-hole v3.3
2018-02-14 12:48:40 -08:00
Dan Schaper
9f2ce0e296 Merge pull request #1910 from pi-hole/fix/BinaryFileLineInGravity
Potential fix for #1909
2018-01-28 03:23:19 -08:00
Adam Warner
55e10d8287 replace another grep -F as pointed out by @StarPicard
Signed-off-by: Adam Warner <adamw@rner.email>
2018-01-28 00:50:15 +00:00
Dan Schaper
94c772e1a8 Merge pull request #1936 from theel0ja/patch-fix-typo
Fixed a typo
2018-01-27 04:45:53 -08:00
Elias Ojala
2b6d9c34c9 Fixed a typo
Signed-off-by: Elias Ojala <ojala.s.elias@gmail.com>
2018-01-27 14:36:11 +02:00
Mark Drobnak
535b8458d4 Merge pull request #1901 from bcambl/epel_check
Fix epel-release install for CentOS
2018-01-20 14:03:24 -05:00
Dan Schaper
49b3f82675 Merge pull request #1925 from pi-hole/feature/installtweaks
Install log security
2018-01-20 08:59:49 -08:00
Dan Schaper
9543203610 Echo the right location for the log.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2018-01-20 08:45:41 -08:00
Dan Schaper
cacfe4d387 Linting changes
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2018-01-20 07:39:11 -08:00
Dan Schaper
a7f0137e5f Use more secure installation log process.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2018-01-20 05:55:48 -08:00
Dan Schaper
b2eb364a4b Update header
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2018-01-20 05:36:28 -08:00
Dan Schaper
bb3b1bc6ba Move ascii berry to after root check, stops the double berry for the sudo refire.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2018-01-20 05:13:55 -08:00
Dan Schaper
ae8eb3f177 Merge pull request #1920 from pi-hole/feature/pr_template
Internal - GitHub template edit.
2018-01-20 03:48:51 -08:00
DL6ER
27c7325174 Merge pull request #1918 from pi-hole/tweak/lan
Use "lan" as fallback TLD for DHCP generated domains
2018-01-20 10:29:11 +01:00
DL6ER
8ee3d810b0 Merge pull request #1922 from pi-hole/tweak/logging-noflush
Add "pihole logging off noflush" command
2018-01-20 10:21:23 +01:00
DL6ER
d7dde06552 Add "pihole logging off noflush" command
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-18 17:08:46 +01:00
Dan Schaper
448495a4a3 Remove references to issues.
Modify code blocks to italics and reformat the layout.

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2018-01-16 14:56:15 -08:00
DL6ER
52cc8e2fcf Use "lan" as fallback TLD for DHCP generated domains
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-16 22:10:27 +01:00
Dan Schaper
fb9cdea008 Merge pull request #1914 from deathbybandaid/development
Update README.md
2018-01-15 11:08:43 -08:00
Adam Warner
6c54bf036c Merge pull request #1913 from pi-hole/tweak/GravityFunctionNames
proposed gravity function renames
2018-01-15 17:51:19 +00:00
Deathbybandaid
657bc4edcd Update README.md
Signed-off-by: deathbybandaid
2018-01-15 08:05:43 -05:00
Deathbybandaid
b75dd5ff73 needed sign-off
Signed-off-by:
2018-01-15 08:04:27 -05:00
Deathbybandaid
094bd49f35 Update README.md 2018-01-14 20:29:20 -05:00
Adam Warner
18fbe60381 Merge pull request #1908 from pi-hole/tweak/RemoveCronPiholeUpdate
If this line is uncommented, it is re-commented on the next update an…
2018-01-14 20:58:58 +00:00
Adam Warner
f1956119fb proposed gravity function renames
Signed-off-by: Adam Warner <adamw@rner.email>
2018-01-14 20:38:39 +00:00
Adam Warner
876170767c Print actual domain instead of grep output of "Binary file /etc/pihole/list.preEventHorizon matches" when a domain with a unicode char is in a source list.
Signed-off-by: Adam Warner <adamw@rner.email>
2018-01-13 16:43:20 +00:00
Dan Schaper
f4f77ec88b Merge pull request #1900 from roots84/patch-1
Update README.md
2018-01-13 05:03:29 -08:00
Stefan
9ba2038702 Merge branch 'patch-1' of https://github.com/roots84/pi-hole into patch-1
Signed-off-by: Stefan <roots84@noreply.users.github.com>
2018-01-12 21:25:09 +01:00
Stefan
b176ba9e80 Merge branch 'patch-1' of https://github.com/roots84/pi-hole into patch-1
Signed-off-by: Stefan <roots84@noreply.users.github.com>
2018-01-12 21:24:39 +01:00
Stefan
cacb47ca7e Merge branch 'patch-1' of https://github.com/roots84/pi-hole into patch-1
Signed-off-by: Stefan <roots84@noreply.users.github.com>
2018-01-12 21:23:36 +01:00
Stefan
500e424fee Merge branch 'patch-1' of https://github.com/roots84/pi-hole into patch-1
Signed-off-by: Stefan <roots84@noreply.users.github.com>
2018-01-12 21:22:43 +01:00
Stefan
f1b02c0cab Merge branch 'patch-1' of https://github.com/roots84/pi-hole into patch-1 2018-01-12 21:21:26 +01:00
Stefan
828302702b Merge branch 'patch-1' of https://github.com/roots84/pi-hole into patch-1
Signed-off-by: Stefan <roots84@users.noreply.github.com>
2018-01-12 21:20:39 +01:00
Stefan
0827d4fe40 Merge branch 'patch-1' of https://github.com/roots84/pi-hole into patch-1 2018-01-12 21:18:30 +01:00
Stefan
ebff965414 Update README.md
Adding DNS-Swapper Project back after it was accidently removed

Signed-off-by: roots84 <stefan.bautz@gmail.com>
2018-01-12 21:17:10 +01:00
Dan Schaper
b45954c560 Merge pull request #1895 from pi-hole/feature/PR_templateDCO
Update PULL_REQUEST_TEMPLATE.md
2018-01-12 08:14:51 -08:00
Adam Warner
80307a3bcd Remove update line from cron
Signed-off-by: Adam Warner <adamw@rner.email>
2018-01-12 15:43:15 +00:00
Adam Warner
e8acb5967b Merge pull request #1904 from vgerak/patch-1
piholeDebug.sh: Correct typo mistake
2018-01-12 15:04:27 +00:00
Vasilis Gerakaris
939806f021 piholeDebug.sh: Correct typo mistake
Signed-off-by: Vasilis Gerakaris <vgerak@gmail.com>

**By submitting this pull request, I confirm the following:** 
`{please fill any appropriate checkboxes, e.g: [X]}`

- [x] I have read and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md), as well as this entire template.
- [x] I have made only one major change in my proposed changes.
- [] I have commented my proposed changes within the code.
- [] I have tested my proposed changes, and have included unit tests where possible.
- [] I am willing to help maintain this change if there are issues with it later.
- [x] I give this submission freely and claim no ownership.
- [x] It is compatible with the [EUPL 1.2 license](https://opensource.org/licenses/EUPL-1.1)
- [x] I have squashed any insignificant commits. ([`git rebase`](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html))
2018-01-12 02:17:31 +02:00
bcambl
cc47bf8f6c Fix epel-release install for CentOS
Signed-off-by: bcambl <blayne@blaynecampbell.com>
2018-01-07 22:21:04 -06:00
Stefan
8b80aaebf5 Update README.md
Adding DNS-Swapper Project back after it was accidently removed
2018-01-07 22:54:53 +01:00
DL6ER
8f35ebc0c2 Merge pull request #1897 from pi-hole/fix/webpage.sh_interface_setting
Add fallback interface in DNS settings
2018-01-07 16:56:01 +01:00
DL6ER
793bdd9743 No need for cat | sed here as we source setupVars.conf, so we can use interface="${PIHOLE_INTERFACE}"
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-07 14:36:03 +01:00
DL6ER
9d50f52bb2 Add fallback interface for DNS listening behavior in case PIHOLE_INTERFACE is not set in setupVars.conf
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-07 14:34:02 +01:00
Dan Schaper
db62afbb64 Update PULL_REQUEST_TEMPLATE.md
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2018-01-06 07:28:26 -08:00
DL6ER
3dc3e8e40e Merge pull request #1885 from pi-hole/new/FTL_Usocket
Create directories /etc/{var,log}/pihole on startup of pihole-FTL
2018-01-04 14:05:18 +01:00
Dan Schaper
c79fc81292 Merge pull request #1891 from pi-hole/feature/DCO_doc
Link to DCO wiki entry.
2018-01-03 16:31:06 -08:00
Dan Schaper
62a6a878d4 Link to DCO wiki entry.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2018-01-03 16:20:57 -08:00
DL6ER
4efb533d2e Create directories /etc/{var,log}/pihole on startup of pihole-FTL and set proper ownership
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-01 11:26:03 +01:00
Mark Drobnak
891473c7fc Merge pull request #1882 from pi-hole/tweak/jetbrains_codestyle
Just ignore the whole .idea directory, execpt for the codeStyles
2017-12-30 15:32:19 -05:00
Dan Schaper
81e8ef5c40 Just ignore the whole .idea directory, execpt for the codeStyles and the
legacy codeStyelSettings.xml.

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2017-12-30 12:23:46 -08:00
Mark Drobnak
e17885088b Merge pull request #1881 from pi-hole/tweak/jetbrains_codestyle
Jetbrains has moved codestyle locations. Development Internal
2017-12-30 14:38:24 -05:00
Dan Schaper
494340fe67 Add other JetBrains stuff to ignore 2017-12-30 10:37:17 -08:00
Dan Schaper
01625dfd49 JetBrains new codestyle storage location 2017-12-30 10:33:41 -08:00
DL6ER
a154f1540f Merge pull request #1778 from loganaden/development
Add secondary quad9 server
2017-12-30 18:19:55 +01:00
DL6ER
5254fc6efe Merge pull request #1880 from pi-hole/fix/chronometer_localhost
Small improvement for Chronometer
2017-12-30 17:51:59 +01:00
DL6ER
afa2e9c2f7 Exchange hard-coded domain "localhost" by hard-coded address "127.0.0.1"
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-30 17:44:59 +01:00
DL6ER
a4c8f1a0a4 Merge pull request #1859 from pi-hole/new/extra-logging
Enable dnsmasq's extra logging feature
2017-12-28 22:49:43 +01:00
Mark Drobnak
d5a9a9a2d8 Merge pull request #1878 from pi-hole/tweak/run_updatechecker_after_install
Force update of update checker for new installs
2017-12-28 14:43:28 -05:00
DL6ER
3b8f8fb0ef Merge pull request #1874 from pi-hole/uninitiate
Grammar change in debug script
2017-12-28 18:47:47 +01:00
DL6ER
677033afca Force update of "remote" part in th update checker (may take up to 24hrs for new installs otherwise)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-28 18:41:22 +01:00
Adam Warner
8e0d76b63b initiated -> initialized
Signed-off-by: Adam Warner <adamw@rner.email>
2017-12-24 13:26:32 +00:00
Adam Warner
64df41ed90 Merge pull request #1873 from pi-hole/fix/1871
Source setup vars before we attempt to do anything on an update/repair
2017-12-24 13:21:45 +00:00
Adam Warner
442a372142 Merge pull request #1870 from pi-hole/docs/gitsignoff
Add more informative link for Git Signoff
2017-12-24 13:16:37 +00:00
Adam Warner
95e5baa967 Source setup vars before we attempt to do anything on an update/repair
Signed-off-by: Adam Warner <adamw@rner.email>
2017-12-24 13:09:45 +00:00
Dan Schaper
b80edfb996 Add more informative link for Git Signoff
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2017-12-23 17:48:15 -08:00
Mark Drobnak
e06543bd17 Merge pull request #1866 from pi-hole/fix/FTL_branch_version_display
Store fourth entry in versions/branches files
2017-12-23 11:32:57 -05:00
DL6ER
cca8412921 Use "echo -n" to avoid haveing newlines in the files
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-23 11:52:27 +01:00
DL6ER
d15a5ad5c1 Add required documentation in the source code
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-23 00:46:51 +01:00
DL6ER
8ed75dd176 Add extra entry to the end of the saved branches and versions such that PHP's explode() subroutine can correctly disentangle the first three entries and does not get confused by the newline character at the end of the FTL version/branch...
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-23 00:42:41 +01:00
DL6ER
d43ad263ea Merge pull request #1863 from pi-hole/master
Sync with development branch
2017-12-22 22:00:49 +01:00
Jacob Salmela
e602008459 Merge pull request #1856 from pi-hole/release/v3.2.1
Pi-hole core v3.2.1
2017-12-22 14:53:38 -06:00
Dan Schaper
322a18f0e6 Merge pull request #1861 from pi-hole/fix/DNSSEC_trustanchor
Merge `fix/DNSSEC_trustanchor` into `release/3.2.1` again
2017-12-21 11:03:05 -08:00
Dan Schaper
05eb749e66 Merge branch 'release/v3.2.1' into fix/DNSSEC_trustanchor 2017-12-21 11:00:21 -08:00
Dan Schaper
7e8d31a62c Merge pull request #1860 from pi-hole/smarterNotHarder
Merge `smarterNotHarder` into `release/3.2.1` again
2017-12-21 10:59:55 -08:00
Dan Schaper
8ca0582afc Merge branch 'release/v3.2.1' into fix/DNSSEC_trustanchor 2017-12-21 10:56:37 -08:00
Dan Schaper
b9f5fca546 Merge branch 'release/v3.2.1' into smarterNotHarder 2017-12-21 10:53:40 -08:00
DL6ER
5c2dcb5e74 Enable dnsmasq's extra logging feature
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-21 16:42:55 +01:00
DL6ER
3ef4af9326 Merge pull request #1857 from pi-hole/tweak/randomize_updatechecker
Randomize update checker time
2017-12-21 13:28:03 +01:00
DL6ER
f89f7ecd3e Randomize GitHub API update check time
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-21 12:42:47 +01:00
DL6ER
be0c457445 Sleep 30 seconds after reboot to be sure that the system is ready
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-21 12:42:28 +01:00
DL6ER
3c04dbb4ed Update remote version at 17:59 as well as on reboot
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-21 12:33:08 +01:00
DL6ER
cfca367eef Quickly verified in dnsmasq's source code: It has to be "trust-anchor" (with "-")
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-18 21:45:24 -05:00
DL6ER
8a243c5872 Insert also old trust anchor
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-18 21:45:15 -05:00
DL6ER
b30b3f3aeb Update DNSSEC trust anchor
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-18 21:44:34 -05:00
Adam Warner
2d3906450a add back in str local var, and change ticks to info on whitelist lines
Signed-off-by: Adam Warner <adamw@rner.email>
2017-12-18 20:14:53 +00:00
Adam Warner
5ecc46d85b Accidentally too many spaces
Signed-off-by: Adam Warner <adamw@rner.email>
2017-12-16 14:03:12 +00:00
Adam Warner
ddd6f3dbe5 Grammar changes. Lets not work out programmatically whether we need to pluralise a word. It's not needed.
Signed-off-by: Adam Warner <adamw@rner.email>
2017-12-16 13:55:52 +00:00
Adam Warner
f5237db580 Merge pull request #1849 from pi-hole/fix/1826
Remove quotes from the uniqDomains array to actually whitelist the so…
2017-12-16 13:22:44 +00:00
Adam Warner
761fd13a70 Remove quotes from the uniqDomains array to actually whitelist the sources
Signed-off-by: Adam Warner <adamw@rner.email>
2017-12-16 13:15:26 +00:00
Mark Drobnak
e3fa06d7ff Merge pull request #1829 from keithbentrup/development
Must send HTTP headers before html
2017-12-13 13:37:32 -05:00
Mark Drobnak
61a76f4493 Merge pull request #1836 from pi-hole/tweak/packageInstall
Change package install notification from CROSS to INFO.
2017-12-13 12:27:47 -05:00
Adam Warner
c5f46702c8 Merge pull request #1840 from pi-hole/revert/GravityParseMethod
Revert parsing method to that of 3.1.4. New Method is allowing illega…
2017-12-12 17:49:36 +00:00
Adam Warner
c24e5cd3f6 :codacy: :codacy2: :codacy3:
Signed-off-by: Adam Warner <adamw@rner.email>
2017-12-12 12:45:25 +00:00
Adam Warner
cc3035267f Revert parsing method to that of 3.1.4. New Method is allowing illegal lists through, and that is causing issues such as blocking www.google.com. This method will just throw away invalid list entries.
Signed-off-by: Adam Warner <adamw@rner.email>
2017-12-12 12:36:09 +00:00
Dan Schaper
29ee8250e9 Change package install notification from CROSS to TICK.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2017-12-11 09:45:30 -08:00
Dan Schaper
47ed0b7627 Merge pull request #1830 from pi-hole/ops/stickler
Create .stickler.yml
2017-12-09 18:18:50 -08:00
Dan Schaper
423280cee1 Merge pull request #1817 from jjssoftware/development
pihole.log permissions
2017-12-09 14:15:12 -08:00
Dan Schaper
8c0faa0b9a Create .stickler.yml
Initial stickler yaml file.
2017-12-09 14:08:54 -08:00
Keith Bentrup
45ab2a3d7a send HTTP headers before HTML
Signed-off-by: Keith Bentrup <keith@keithbentrup.com>
2017-12-09 17:03:20 -05:00
Dan Schaper
8804f5c423 Merge pull request #1825 from pi-hole/tweak/updatechecker
Tweak update checker
2017-12-09 13:58:16 -08:00
Dan Schaper
1078aa499c Merge pull request #1812 from pi-hole/fix/resolvconf
Try dig +short if getent hosts fails when running gravity
2017-12-09 13:57:48 -08:00
DL6ER
05d015169c Check for local version and branches every 10 minutes, check for remote versions only once a day
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-09 19:00:46 +01:00
Jacob Salmela
6c9e7586d5 Merge pull request #1818 from pi-hole/fix/debug
Use systemctl or service commands in debug script
2017-12-08 19:57:37 -06:00
Jacob Salmela
28bed0041e remove comment
Signed-off-by: Jacob Salmela <github@decoy.email>
2017-12-08 18:29:28 -06:00
Jacob Salmela
6f03e30151 fixes #1537 by checking if systemctl is found
Signed-off-by: Jacob Salmela <github@decoy.email>
2017-12-08 18:23:55 -06:00
Joe
6085d6ffd1 Merge pull request #1 from jjssoftware/jjssoftware-patch-1
Jjssoftware patch 1
2017-12-08 22:38:22 +00:00
Joe
6ecd93d0c9 pihole.log permissions
This change makes pihole more friendly to the non-existence of the pihole.log file. This can help with systems that are configured to mount /var/log as a tmpfs volume. It may also help with systems where the pihole.log file is accidentally/unintentionally removed. 

Further discussion around the details of this change are in https://github.com/pi-hole/pi-hole/issues/1798
2017-12-08 22:25:01 +00:00
Dan Schaper
863ea7294f Merge pull request #1815 from pi-hole/release/3.2
Merge Release 3.2 in to development. GitFlow
2017-12-08 13:06:18 -08:00
Jacob Salmela
af59824819 Merge pull request #1811 from bcambl/nmcli_check
check NetworkManager status prior to using the cli (#1653)
2017-12-08 06:38:42 -06:00
Jacob Salmela
80e17ab721 potentially fixes #1806 by falling back to dig if getent fails
Signed-off-by: Jacob Salmela <github@decoy.email>
2017-12-07 22:38:47 -06:00
bcambl
f89d69b081 check NetworkManager status prior to using the cli (#1653)
Closes #1653

Signed-off-by: bcambl <blayne@blaynecampbell.com>
2017-12-07 21:43:14 -06:00
Mcat12
472f7725c7 Merge pull request #1779 from pi-hole/new/locallists
Add support for local blocking lists
2017-11-28 20:58:00 -05:00
Mcat12
8d721d086c Modify indentation 2017-11-21 18:37:38 -05:00
DL6ER
6f0bb30def Improve indentation
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-11-21 20:58:27 +01:00
DL6ER
c54f04ef4c Repair username:password filtering
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-11-21 20:55:47 +01:00
DL6ER
eb83081a5c Clarify error message: File could also have been of zero size
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-11-21 18:36:34 +01:00
DL6ER
8976930e20 Properly detect if local file was successfully downloaded
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-11-21 18:35:58 +01:00
DL6ER
164a81776e Allow to add local lists to gravity using e.g. file:///path/to/my.list in adlists.list
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-11-21 18:30:40 +01:00
Loganaden Velvindron
9c8526db49 Add secondary quad9 server 2017-11-20 22:05:41 +04:00
18 changed files with 316 additions and 172 deletions

View File

@@ -1,32 +1,31 @@
**By submitting this pull request, I confirm the following:** `{please fill any appropriate checkboxes, e.g: [X]}` **By submitting this pull request, I confirm the following:**
*please fill any appropriate checkboxes, e.g: [X]*
`{Please ensure that your pull request is for the 'development' branch!}` - [ ] I have read and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md), as well as this entire template.
- [ ] I have made only one major change in my proposed changes.
- [ ] I have commented my proposed changes within the code.
- [ ] I have tested my proposed changes, and have included unit tests where possible.
- [ ] I am willing to help maintain this change if there are issues with it later.
- [ ] I give this submission freely and claim no ownership.
- [ ] It is compatible with the [EUPL 1.2 license](https://opensource.org/licenses/EUPL-1.1)
- [ ] I have squashed any insignificant commits. ([`git rebase`](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html))
- [] I have read and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md), as well as this entire template. Please make sure you [Sign Off](https://github.com/pi-hole/pi-hole/wiki/How-to-signoff-your-commits.) all commits. Pi-hole enforces the [DCO](https://github.com/pi-hole/pi-hole/wiki/Contributing-to-the-project).
- [] I have made only one major change in my proposed changes.
- [] I have commented my proposed changes within the code.
- [] I have tested my proposed changes, and have included unit tests where possible.
- [] I am willing to help maintain this change if there are issues with it later.
- [] I give this submission freely and claim no ownership.
- [] It is compatible with the [EUPL 1.2 license](https://opensource.org/licenses/EUPL-1.1)
- [] I have squashed any insignificant commits. ([`git rebase`](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html))
- [] I have Signed Off all commits. ([`git commit --signoff`](https://git-scm.com/docs/git-commit#git-commit---signoff))
--- ---
**What does this PR aim to accomplish?:** **What does this PR aim to accomplish?:**
*A detailed description, screenshots (if necessary), as well as links to any relevant GitHub issues*
`{A detailed description, screenshots (if necessary), as well as links to any relevant GitHub issues}`
**How does this PR accomplish the above?:** **How does this PR accomplish the above?:**
*A detailed description (such as a changelog) and screenshots (if necessary) of the implemented fix*
`{A detailed description (such as a changelog) and screenshots (if necessary) of the implemented fix}`
**What documentation changes (if any) are needed to support this PR?:** **What documentation changes (if any) are needed to support this PR?:**
*A detailed list of any necessary changes*
`{A detailed list of any necessary changes}`
> * `{Please delete this quoted section when opening your pull request}` ---
> * You must follow the template instructions. Failure to do so will result in your issue being closed. * You must follow the template instructions. Failure to do so will result in your pull request being closed.
> * Please respect that Pi-hole is developed by volunteers, who can only reply in their spare time. * Please respect that Pi-hole is developed by volunteers, who can only reply in their spare time.
> * Detail helps us understand an issue quicker, but please ensure it's relevant.

66
.gitignore vendored
View File

@@ -3,3 +3,69 @@
*.swp *.swp
__pycache__ __pycache__
.cache .cache
# Created by https://www.gitignore.io/api/jetbrains+iml
### JetBrains+iml ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# All idea files, with execptions
.idea
!.idea/codeStyles/*
!.idea/codeStyleSettings.xml
# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
# Gradle:
.idea/**/gradle.xml
.idea/**/libraries
# CMake
cmake-build-debug/
# Mongo Explorer plugin:
.idea/**/mongoSettings.xml
## File-based project format:
*.iws
## Plugin-specific files:
# IntelliJ
/out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Ruby plugin and RubyMine
/.rakeTasks
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
### JetBrains+iml Patch ###
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
*.iml
.idea/misc.xml
*.ipr
# End of https://www.gitignore.io/api/jetbrains+iml

13
.idea/codeStyles/Project.xml generated Normal file
View File

@@ -0,0 +1,13 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</value>
</option>
<MarkdownNavigatorCodeStyleSettings>
<option name="RIGHT_MARGIN" value="72" />
</MarkdownNavigatorCodeStyleSettings>
</code_scheme>
</component>

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View File

@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

3
.stickler.yml Normal file
View File

@@ -0,0 +1,3 @@
linters:
shellcheck:
shell: bash

View File

@@ -28,6 +28,7 @@ When requesting or submitting new features, first consider whether it might be u
- Check the codebase to ensure that your feature doesn't already exist. - Check the codebase to ensure that your feature doesn't already exist.
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix. - Check the pull requests to ensure that another person hasn't already submitted the feature or fix.
- Read and understand the [DCO guidelines](https://github.com/pi-hole/pi-hole/wiki/Contributing-to-the-project) for the project.
## Technical Requirements ## Technical Requirements

View File

@@ -185,7 +185,7 @@ While quite outdated at this point, [this original blog post about Pi-hole](http
- [CHiP-hole: Network-wide Ad-blocker](https://www.hackster.io/jacobsalmela/chip-hole-network-wide-ad-blocker-98e037) - [CHiP-hole: Network-wide Ad-blocker](https://www.hackster.io/jacobsalmela/chip-hole-network-wide-ad-blocker-98e037)
- [Chrome Extension: Pi-Hole List Editor](https://chrome.google.com/webstore/detail/pi-hole-list-editor/hlnoeoejkllgkjbnnnhfolapllcnaglh) ([Source Code](https://github.com/packtloss/pihole-extension)) - [Chrome Extension: Pi-Hole List Editor](https://chrome.google.com/webstore/detail/pi-hole-list-editor/hlnoeoejkllgkjbnnnhfolapllcnaglh) ([Source Code](https://github.com/packtloss/pihole-extension))
- [Splunk: Pi-hole Visualiser](https://splunkbase.splunk.com/app/3023/) - [Splunk: Pi-hole Visualiser](https://splunkbase.splunk.com/app/3023/)
- [Adblocking with P-hole and Ubuntu 14.04 on VirtualBox](https://hbalagtas.blogspot.com.au/2016/02/adblocking-with-pi-hole-and-ubuntu-1404.html) - [Adblocking with Pi-hole and Ubuntu 14.04 on VirtualBox](https://hbalagtas.blogspot.com.au/2016/02/adblocking-with-pi-hole-and-ubuntu-1404.html)
- [Pi-hole stats in your Mac's menu bar](https://getbitbar.com/plugins/Network/pi-hole.1m.py) - [Pi-hole stats in your Mac's menu bar](https://getbitbar.com/plugins/Network/pi-hole.1m.py)
- [Pi-hole unRAID Template](https://forums.lime-technology.com/topic/36810-support-spants-nodered-mqtt-dashing-couchdb/) - [Pi-hole unRAID Template](https://forums.lime-technology.com/topic/36810-support-spants-nodered-mqtt-dashing-couchdb/)
- [Copernicus: Windows Tray Application](https://github.com/goldbattle/copernicus) - [Copernicus: Windows Tray Application](https://github.com/goldbattle/copernicus)
@@ -193,7 +193,7 @@ While quite outdated at this point, [this original blog post about Pi-hole](http
- [Pi-hole metrics](https://github.com/nlamirault/pihole_exporter) exporter for [Prometheus](https://prometheus.io/) - [Pi-hole metrics](https://github.com/nlamirault/pihole_exporter) exporter for [Prometheus](https://prometheus.io/)
- [Magic Mirror with DNS Filtering](https://zonksec.com/blog/magic-mirror-dns-filtering/#dnssoftware) - [Magic Mirror with DNS Filtering](https://zonksec.com/blog/magic-mirror-dns-filtering/#dnssoftware)
- [Pi-hole Droid: Android client](https://github.com/friimaind/pi-hole-droid) - [Pi-hole Droid: Android client](https://github.com/friimaind/pi-hole-droid)
- [Windows DNS Swapper](https://github.com/roots84/DNS-Swapper), see [#1400](https://github.com/pi-hole/pi-hole/issues/1400)
----- -----
## Coverage ## Coverage

View File

@@ -39,7 +39,7 @@ interface=@INT@
cache-size=10000 cache-size=10000
log-queries log-queries=extra
log-facility=/var/log/pihole.log log-facility=/var/log/pihole.log
local-ttl=2 local-ttl=2

View File

@@ -15,7 +15,7 @@ pihole-FTL() {
ftl_port=$(cat /var/run/pihole-FTL.port 2> /dev/null) ftl_port=$(cat /var/run/pihole-FTL.port 2> /dev/null)
if [[ -n "$ftl_port" ]]; then if [[ -n "$ftl_port" ]]; then
# Open connection to FTL # Open connection to FTL
exec 3<>"/dev/tcp/localhost/$ftl_port" exec 3<>"/dev/tcp/127.0.0.1/$ftl_port"
# Test if connection is open # Test if connection is open
if { "true" >&3; } 2> /dev/null; then if { "true" >&3; } 2> /dev/null; then

View File

@@ -215,14 +215,14 @@ copy_to_debug_log() {
sed 's/\[[0-9;]\{1,5\}m//g' > "${PIHOLE_DEBUG_LOG_SANITIZED}" <<< cat "${PIHOLE_DEBUG_LOG}" sed 's/\[[0-9;]\{1,5\}m//g' > "${PIHOLE_DEBUG_LOG_SANITIZED}" <<< cat "${PIHOLE_DEBUG_LOG}"
} }
initiate_debug() { initialize_debug() {
# Clear the screen so the debug log is readable # Clear the screen so the debug log is readable
clear clear
show_disclaimer show_disclaimer
# Display that the debug process is beginning # Display that the debug process is beginning
log_write "${COL_PURPLE}*** [ INITIALIZING ]${COL_NC}" log_write "${COL_PURPLE}*** [ INITIALIZING ]${COL_NC}"
# Timestamp the start of the log # Timestamp the start of the log
log_write "${INFO} $(date "+%Y-%m-%d:%H:%M:%S") debug log has been initiated." log_write "${INFO} $(date "+%Y-%m-%d:%H:%M:%S") debug log has been initialized."
} }
# This is a function for visually displaying the curent test that is being run. # This is a function for visually displaying the curent test that is being run.
@@ -547,7 +547,7 @@ detect_ip_addresses() {
log_write "" log_write ""
else else
# If there are no IPs detected, explain that the protocol is not configured # If there are no IPs detected, explain that the protocol is not configured
log_write "${CROSS} ${COL_RED}No IPv${protocol} address(es) found on the ${PIHOLE_INTERFACE}${COL_NC} interace.\n" log_write "${CROSS} ${COL_RED}No IPv${protocol} address(es) found on the ${PIHOLE_INTERFACE}${COL_NC} interface.\n"
return 1 return 1
fi fi
# If the protocol is v6 # If the protocol is v6
@@ -809,8 +809,14 @@ process_status(){
local i local i
# For each process, # For each process,
for i in "${PIHOLE_PROCESSES[@]}"; do for i in "${PIHOLE_PROCESSES[@]}"; do
# get its status via systemctl # If systemd
local status_of_process=$(systemctl is-active "${i}") if command -v systemctl &> /dev/null; then
# get its status via systemctl
local status_of_process=$(systemctl is-active "${i}")
else
# Otherwise, use the service command
local status_of_process=$(service "${i}" status | awk '/Active:/ {print $2}') &> /dev/null
fi
# and print it out to the user # and print it out to the user
if [[ "${status_of_process}" == "active" ]]; then if [[ "${status_of_process}" == "active" ]]; then
# If it's active, show it in green # If it's active, show it in green
@@ -1143,7 +1149,7 @@ upload_to_tricorder() {
# Run through all the functions we made # Run through all the functions we made
make_temporary_log make_temporary_log
initiate_debug initialize_debug
# setupVars.conf needs to be sourced before the networking so the values are # setupVars.conf needs to be sourced before the networking so the values are
# available to the other functions # available to the other functions
source_setup_variables source_setup_variables

View File

@@ -3,7 +3,7 @@
# (c) 2017 Pi-hole, LLC (https://pi-hole.net) # (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your own hardware. # Network-wide ad blocking via your own hardware.
# #
# Checks for updates via GitHub # Checks for local or remote versions and branches
# #
# This file is copyright under the latest version of the EUPL. # This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license. # Please see LICENSE file for your rights under this license.
@@ -25,35 +25,42 @@ function json_extract() {
fi fi
} }
GITHUB_CORE_VERSION="$(json_extract tag_name "$(curl -q 'https://api.github.com/repos/pi-hole/pi-hole/releases/latest' 2> /dev/null)")"
GITHUB_WEB_VERSION="$(json_extract tag_name "$(curl -q 'https://api.github.com/repos/pi-hole/AdminLTE/releases/latest' 2> /dev/null)")"
GITHUB_FTL_VERSION="$(json_extract tag_name "$(curl -q 'https://api.github.com/repos/pi-hole/FTL/releases/latest' 2> /dev/null)")"
echo "${GITHUB_CORE_VERSION} ${GITHUB_WEB_VERSION} ${GITHUB_FTL_VERSION}" > "/etc/pihole/GitHubVersions"
function get_local_branch() { function get_local_branch() {
# Return active branch # Return active branch
cd "${1}" 2> /dev/null || return 1 cd "${1}" 2> /dev/null || return 1
git rev-parse --abbrev-ref HEAD || return 1 git rev-parse --abbrev-ref HEAD || return 1
} }
CORE_BRANCH="$(get_local_branch /etc/.pihole)"
WEB_BRANCH="$(get_local_branch /var/www/html/admin)"
#FTL_BRANCH="$(pihole-FTL branch)"
# Don't store FTL branch until the next release of FTL which
# supports returning the branch in an easy way
FTL_BRANCH="XXX"
echo "${CORE_BRANCH} ${WEB_BRANCH} ${FTL_BRANCH}" > "/etc/pihole/localbranches"
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 || return 1
} }
CORE_VERSION="$(get_local_version /etc/.pihole)" if [[ "$2" == "remote" ]]; then
WEB_VERSION="$(get_local_version /var/www/html/admin)"
FTL_VERSION="$(pihole-FTL version)"
echo "${CORE_VERSION} ${WEB_VERSION} ${FTL_VERSION}" > "/etc/pihole/localversions" if [[ "$3" == "reboot" ]]; then
sleep 30
fi
GITHUB_CORE_VERSION="$(json_extract tag_name "$(curl -q 'https://api.github.com/repos/pi-hole/pi-hole/releases/latest' 2> /dev/null)")"
GITHUB_WEB_VERSION="$(json_extract tag_name "$(curl -q 'https://api.github.com/repos/pi-hole/AdminLTE/releases/latest' 2> /dev/null)")"
GITHUB_FTL_VERSION="$(json_extract tag_name "$(curl -q 'https://api.github.com/repos/pi-hole/FTL/releases/latest' 2> /dev/null)")"
echo -n "${GITHUB_CORE_VERSION} ${GITHUB_WEB_VERSION} ${GITHUB_FTL_VERSION}" > "/etc/pihole/GitHubVersions"
else
CORE_BRANCH="$(get_local_branch /etc/.pihole)"
WEB_BRANCH="$(get_local_branch /var/www/html/admin)"
FTL_BRANCH="$(pihole-FTL branch)"
echo -n "${CORE_BRANCH} ${WEB_BRANCH} ${FTL_BRANCH}" > "/etc/pihole/localbranches"
CORE_VERSION="$(get_local_version /etc/.pihole)"
WEB_VERSION="$(get_local_version /var/www/html/admin)"
FTL_VERSION="$(pihole-FTL version)"
echo -n "${CORE_VERSION} ${WEB_VERSION} ${FTL_VERSION}" > "/etc/pihole/localversions"
fi

View File

@@ -153,6 +153,7 @@ ProcessDNSSettings() {
if [[ "${DNSSEC}" == true ]]; then if [[ "${DNSSEC}" == true ]]; then
echo "dnssec echo "dnssec
trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE32F24E8FB5 trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE32F24E8FB5
trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC683457104237C7F8EC8D
" >> "${dnsmasqconfig}" " >> "${dnsmasqconfig}"
fi fi
@@ -174,6 +175,11 @@ trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE3
add_dnsmasq_setting "local-service" add_dnsmasq_setting "local-service"
else else
# Listen only on one interface # Listen only on one interface
# Use eth0 as fallback interface if interface is missing in setupVars.conf
if [ -z "${PIHOLE_INTERFACE}" ]; then
PIHOLE_INTERFACE="eth0"
fi
add_dnsmasq_setting "interface" "${PIHOLE_INTERFACE}" add_dnsmasq_setting "interface" "${PIHOLE_INTERFACE}"
fi fi
@@ -240,7 +246,7 @@ ProcessDHCPSettings() {
source "${setupVars}" source "${setupVars}"
if [[ "${DHCP_ACTIVE}" == "true" ]]; then if [[ "${DHCP_ACTIVE}" == "true" ]]; then
interface=$(grep 'PIHOLE_INTERFACE=' /etc/pihole/setupVars.conf | sed "s/.*=//") interface="${PIHOLE_INTERFACE}"
# Use eth0 as fallback interface # Use eth0 as fallback interface
if [ -z ${interface} ]; then if [ -z ${interface} ]; then
@@ -248,7 +254,7 @@ ProcessDHCPSettings() {
fi fi
if [[ "${PIHOLE_DOMAIN}" == "" ]]; then if [[ "${PIHOLE_DOMAIN}" == "" ]]; then
PIHOLE_DOMAIN="local" PIHOLE_DOMAIN="lan"
change_setting "PIHOLE_DOMAIN" "${PIHOLE_DOMAIN}" change_setting "PIHOLE_DOMAIN" "${PIHOLE_DOMAIN}"
fi fi

View File

@@ -213,6 +213,8 @@ if (explode("-", $phVersion)[1] != "0")
// Please Note: Text is added via CSS to allow an admin to provide a localised // Please Note: Text is added via CSS to allow an admin to provide a localised
// language without the need to edit this file // language without the need to edit this file
setHeader();
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<!-- Pi-hole: A black hole for Internet advertisements <!-- Pi-hole: A black hole for Internet advertisements
@@ -224,7 +226,6 @@ if (explode("-", $phVersion)[1] != "0")
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<?=$viewPort ?> <?=$viewPort ?>
<?=setHeader() ?>
<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="<?=$proto ?>://pi.hole/admin/img/favicon.png" type="image/x-icon"/>

View File

@@ -25,9 +25,13 @@ start() {
if is_running; then if is_running; then
echo "pihole-FTL is already running" echo "pihole-FTL is already running"
else else
touch /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port touch /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
mkdir -p /var/run/pihole
mkdir -p /var/log/pihole
chown pihole:pihole /var/run/pihole /var/log/pihole
rm /var/run/pihole/FTL.sock
chown pihole:pihole /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /etc/pihole chown pihole:pihole /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /etc/pihole
chmod 0644 /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port chmod 0644 /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
su -s /bin/sh -c "/usr/bin/pihole-FTL" "$FTLUSER" su -s /bin/sh -c "/usr/bin/pihole-FTL" "$FTLUSER"
echo echo
fi fi

View File

@@ -18,9 +18,6 @@
# early morning. Download any updates from the adlists # early morning. Download any updates from the adlists
59 1 * * 7 root PATH="$PATH:/usr/local/bin/" pihole updateGravity 59 1 * * 7 root PATH="$PATH:/usr/local/bin/" pihole updateGravity
# Pi-hole: Update Pi-hole! Uncomment to enable auto update
#30 2 * * 7 root PATH="$PATH:/usr/local/bin/" pihole updatePihole
# Pi-hole: Flush the log daily at 00:00 # Pi-hole: Flush the log daily at 00:00
# The flush script will use logrotate if available # The flush script will use logrotate if available
# parameter "once": logrotate only once (default is twice) # parameter "once": logrotate only once (default is twice)
@@ -29,5 +26,9 @@
@reboot root /usr/sbin/logrotate /etc/pihole/logrotate @reboot root /usr/sbin/logrotate /etc/pihole/logrotate
# Pi-hole: Grab remote version and branch every 10 minutes # Pi-hole: Grab local version and branch every 10 minutes
*/10 * * * * root PATH="$PATH:/usr/local/bin/" pihole updatechecker */10 * * * * root PATH="$PATH:/usr/local/bin/" pihole updatechecker local
# Pi-hole: Grab remote version every 24 hours
59 17 * * * root PATH="$PATH:/usr/local/bin/" pihole updatechecker remote
@reboot root PATH="$PATH:/usr/local/bin/" pihole updatechecker remote reboot

View File

@@ -2,7 +2,7 @@
# shellcheck disable=SC1090 # shellcheck disable=SC1090
# Pi-hole: A black hole for Internet advertisements # Pi-hole: A black hole for Internet advertisements
# (c) 2017 Pi-hole, LLC (https://pi-hole.net) # (c) 2017-2018 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your own hardware. # Network-wide ad blocking via your own hardware.
# #
# Installs and Updates Pi-hole # Installs and Updates Pi-hole
@@ -14,7 +14,7 @@
# #
# Install with this command (from your Linux machine): # Install with this command (from your Linux machine):
# #
# curl -L install.pi-hole.net | bash # curl -sSL https://install.pi-hole.net | bash
# -e option instructs bash to immediately exit if any command [1] has a non-zero exit status # -e option instructs bash to immediately exit if any command [1] has a non-zero exit status
# We do not want users to end up with a partially working install, so we exit the script # We do not want users to end up with a partially working install, so we exit the script
@@ -28,9 +28,8 @@ 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
# We write to a temporary file before moving the log to the pihole folder # Location for final installation log storage
tmpLog=/tmp/pihole-install.log installLogLoc=/etc/pihole/install.log
instalLogLoc=/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
setupVars=/etc/pihole/setupVars.conf setupVars=/etc/pihole/setupVars.conf
# Pi-hole uses lighttpd as a Web server, and this is the config file for it # Pi-hole uses lighttpd as a Web server, and this is the config file for it
@@ -210,7 +209,8 @@ elif command -v rpm &> /dev/null; then
INSTALLER_DEPS=(dialog git iproute net-tools newt procps-ng) INSTALLER_DEPS=(dialog git iproute net-tools newt procps-ng)
PIHOLE_DEPS=(bc bind-utils cronie curl dnsmasq findutils nmap-ncat sudo unzip wget libidn2 psmisc) PIHOLE_DEPS=(bc bind-utils cronie curl dnsmasq findutils nmap-ncat sudo unzip wget libidn2 psmisc)
PIHOLE_WEB_DEPS=(lighttpd lighttpd-fastcgi php php-common php-cli php-pdo) PIHOLE_WEB_DEPS=(lighttpd lighttpd-fastcgi php php-common php-cli php-pdo)
if ! grep -q 'Fedora' /etc/redhat-release; then # EPEL (https://fedoraproject.org/wiki/EPEL) is required for lighttpd on CentOS
if grep -qi 'centos' /etc/redhat-release; then
INSTALLER_DEPS=("${INSTALLER_DEPS[@]}" "epel-release"); INSTALLER_DEPS=("${INSTALLER_DEPS[@]}" "epel-release");
fi fi
LIGHTTPD_USER="lighttpd" LIGHTTPD_USER="lighttpd"
@@ -715,8 +715,8 @@ setStaticIPv4() {
}> "${IFCFG_FILE}" }> "${IFCFG_FILE}"
# Use ip to immediately set the new address # Use ip to immediately set the new address
ip addr replace dev "${PIHOLE_INTERFACE}" "${IPV4_ADDRESS}" ip addr replace dev "${PIHOLE_INTERFACE}" "${IPV4_ADDRESS}"
# If NetworkMangler command line interface exists, # If NetworkMangler command line interface exists and ready to mangle,
if command -v nmcli &> /dev/null;then if command -v nmcli &> /dev/null && nmcli general status &> /dev/null; then
# Tell NetworkManagler to read our new sysconfig file # Tell NetworkManagler to read our new sysconfig file
nmcli con load "${IFCFG_FILE}" > /dev/null nmcli con load "${IFCFG_FILE}" > /dev/null
fi fi
@@ -815,6 +815,7 @@ setDNS() {
Quad9) Quad9)
echo "Quad9 servers" echo "Quad9 servers"
PIHOLE_DNS_1="9.9.9.9" PIHOLE_DNS_1="9.9.9.9"
PIHOLE_DNS_2="149.112.112.112"
;; ;;
Custom) Custom)
# Until the DNS settings are selected, # Until the DNS settings are selected,
@@ -1243,7 +1244,7 @@ install_dependent_packages() {
echo -e "${OVER} ${TICK} Checking for $i" echo -e "${OVER} ${TICK} Checking for $i"
else else
# #
echo -e "${OVER} ${CROSS} Checking for $i (will be installed)" echo -e "${OVER} ${INFO} Checking for $i (will be installed)"
# #
installArray+=("${i}") installArray+=("${i}")
fi fi
@@ -1268,7 +1269,7 @@ install_dependent_packages() {
if ${PKG_MANAGER} -q list installed "${i}" &> /dev/null; then if ${PKG_MANAGER} -q list installed "${i}" &> /dev/null; then
echo -e "${OVER} ${TICK} Checking for $i" echo -e "${OVER} ${TICK} Checking for $i"
else else
echo -e "${OVER} ${CROSS} Checking for $i (will be installed)" echo -e "${OVER} ${INFO} Checking for $i (will be installed)"
# #
installArray+=("${i}") installArray+=("${i}")
fi fi
@@ -1368,7 +1369,9 @@ installCron() {
# Copy the cron file over from the local repo # Copy the cron file over from the local repo
cp ${PI_HOLE_LOCAL_REPO}/advanced/pihole.cron /etc/cron.d/pihole cp ${PI_HOLE_LOCAL_REPO}/advanced/pihole.cron /etc/cron.d/pihole
# Randomize gravity update time # Randomize gravity update time
sed -i "s/59 1/$((1 + RANDOM % 58)) $((3 + RANDOM % 2))/" /etc/cron.d/pihole sed -i "s/59 1 /$((1 + RANDOM % 58)) $((3 + RANDOM % 2))/" /etc/cron.d/pihole
# Randomize update checker time
sed -i "s/59 17/$((1 + RANDOM % 58)) $((12 + RANDOM % 8))/" /etc/cron.d/pihole
echo -e "${OVER} ${TICK} ${str}" echo -e "${OVER} ${TICK} ${str}"
} }
@@ -1888,14 +1891,28 @@ FTLdetect() {
# Install FTL # Install FTL
FTLinstall "${binary}" || return 1 FTLinstall "${binary}" || return 1
fi fi
}
make_temporary_log() {
# Create a random temporary file for the log
TEMPLOG=$(mktemp /tmp/pihole_temp.XXXXXX)
# Open handle 3 for templog
# https://stackoverflow.com/questions/18460186/writing-outputs-to-log-file-and-console
exec 3>"$TEMPLOG"
# Delete templog, but allow for addressing via file handle
# This lets us write to the log without having a temporary file on the drive, which
# is meant to be a security measure so there is not a lingering file on the drive during the install process
rm "$TEMPLOG"
}
copy_to_install_log() {
# Copy the contents of file descriptor 3 into the install log
# Since we use color codes such as '\e[1;33m', they should be removed
sed 's/\[[0-9;]\{1,5\}m//g' < /proc/$$/fd/3 > "${installLogLoc}"
} }
main() { main() {
######## FIRST CHECK ######## ######## FIRST CHECK ########
# Show the Pi-hole logo so people know it's genuine since the logo and name are trademarked
show_ascii_berry
# Must be root to install # Must be root to install
local str="Root user check" local str="Root user check"
echo "" echo ""
@@ -1904,12 +1921,15 @@ main() {
if [[ "${EUID}" -eq 0 ]]; then if [[ "${EUID}" -eq 0 ]]; then
# they are root and all is good # they are root and all is good
echo -e " ${TICK} ${str}" echo -e " ${TICK} ${str}"
# Show the Pi-hole logo so people know it's genuine since the logo and name are trademarked
show_ascii_berry
make_temporary_log
# Otherwise, # Otherwise,
else else
# They do not have enough privileges, so let the user know # They do not have enough privileges, so let the user know
echo -e " ${CROSS} ${str} echo -e " ${CROSS} ${str}
${COL_LIGHT_RED}Script called with non-root privileges${COL_NC} ${COL_LIGHT_RED}Script called with non-root privileges${COL_NC}
The Pi-hole requires elevated privleges to install and run The Pi-hole requires elevated privileges to install and run
Please check the installer for any concerns regarding this requirement Please check the installer for any concerns regarding this requirement
Make sure to download this script from a trusted source\\n" Make sure to download this script from a trusted source\\n"
echo -ne " ${INFO} Sudo utility check" echo -ne " ${INFO} Sudo utility check"
@@ -2028,14 +2048,14 @@ main() {
fi fi
# Install and log everything to a file # Install and log everything to a file
installPihole | tee ${tmpLog} installPihole | tee -a /proc/$$/fd/3
else else
# Source ${setupVars} to use predefined user variables in the functions
source ${setupVars}
# Clone/Update the repos # Clone/Update the repos
clone_or_update_repos clone_or_update_repos
# Source ${setupVars} for use in the rest of the functions
source ${setupVars}
# Install packages used by the Pi-hole # Install packages used by the Pi-hole
if [[ "${INSTALL_WEB}" == true ]]; then if [[ "${INSTALL_WEB}" == true ]]; then
# Install the Web dependencies # Install the Web dependencies
@@ -2054,12 +2074,11 @@ main() {
# Value will either be 1, if true, or 0 # Value will either be 1, if true, or 0
LIGHTTPD_ENABLED=$(service lighttpd status | awk '/Loaded:/ {print $0}' | grep -c 'enabled' || true) LIGHTTPD_ENABLED=$(service lighttpd status | awk '/Loaded:/ {print $0}' | grep -c 'enabled' || true)
fi fi
updatePihole | tee -a /proc/$$/fd/3
updatePihole | tee ${tmpLog}
fi fi
# Move the log file into /etc/pihole for storage # Copy the temp log file into final log location for storage
mv ${tmpLog} ${instalLogLoc} copy_to_install_log
if [[ "${INSTALL_WEB}" == true ]]; then if [[ "${INSTALL_WEB}" == true ]]; then
# Add password to web UI if there is none # Add password to web UI if there is none
@@ -2099,6 +2118,7 @@ main() {
# Force an update of the updatechecker # Force an update of the updatechecker
. /opt/pihole/updatecheck.sh . /opt/pihole/updatecheck.sh
. /opt/pihole/updatecheck.sh x remote
# #
if [[ "${useUpdateVars}" == false ]]; then if [[ "${useUpdateVars}" == false ]]; then
@@ -2135,7 +2155,7 @@ main() {
fi fi
# Display where the log file is # Display where the log file is
echo -e "\\n ${INFO} The install log is located at: /etc/pihole/install.log echo -e "\\n ${INFO} The install log is located at: ${installLogLoc}
${COL_LIGHT_GREEN}${INSTALL_TYPE} Complete! ${COL_NC}" ${COL_LIGHT_GREEN}${INSTALL_TYPE} Complete! ${COL_NC}"
} }

View File

@@ -68,8 +68,8 @@ if [[ -r "${piholeDir}/pihole.conf" ]]; then
fi fi
# Determine if DNS resolution is available before proceeding # Determine if DNS resolution is available before proceeding
gravity_DNSLookup() { gravity_CheckDNSResolutionAvailable() {
local lookupDomain="pi.hole" plural="" local lookupDomain="pi.hole"
# Determine if $localList does not exist # Determine if $localList does not exist
if [[ ! -e "${localList}" ]]; then if [[ ! -e "${localList}" ]]; then
@@ -88,6 +88,19 @@ gravity_DNSLookup() {
exit 1 exit 1
fi fi
# If the /etc/resolv.conf contains resolvers other than 127.0.0.1 then the local dnsmasq will not be queried and pi.hole is NXDOMAIN.
# This means that even though name resolution is working, the getent hosts check fails and the holddown timer keeps ticking and eventualy fails
# So we check the output of the last command and if it failed, attempt to use dig +short as a fallback
if timeout 1 dig +short "${lookupDomain}" &> /dev/null; then
if [[ -n "${secs:-}" ]]; then
echo -e "${OVER} ${TICK} DNS resolution is now available\\n"
fi
return 0
elif [[ -n "${secs:-}" ]]; then
echo -e "${OVER} ${CROSS} DNS resolution is not available"
exit 1
fi
# Determine error output message # Determine error output message
if pidof dnsmasq &> /dev/null; then if pidof dnsmasq &> /dev/null; then
echo -e " ${CROSS} DNS resolution is currently unavailable" echo -e " ${CROSS} DNS resolution is currently unavailable"
@@ -98,21 +111,20 @@ gravity_DNSLookup() {
# Ensure DNS server is given time to be resolvable # Ensure DNS server is given time to be resolvable
secs="120" secs="120"
echo -ne " ${INFO} Waiting up to ${secs} seconds before continuing..." echo -ne " ${INFO} Time until retry: ${secs}"
until timeout 1 getent hosts "${lookupDomain}" &> /dev/null; do until timeout 1 getent hosts "${lookupDomain}" &> /dev/null; do
[[ "${secs:-}" -eq 0 ]] && break [[ "${secs:-}" -eq 0 ]] && break
[[ "${secs:-}" -ne 1 ]] && plural="s" echo -ne "${OVER} ${INFO} Time until retry: ${secs}"
echo -ne "${OVER} ${INFO} Waiting up to ${secs} second${plural} before continuing..."
: $((secs--)) : $((secs--))
sleep 1 sleep 1
done done
# Try again # Try again
gravity_DNSLookup gravity_CheckDNSResolutionAvailable
} }
# Retrieve blocklist URLs and parse domains from adlists.list # Retrieve blocklist URLs and parse domains from adlists.list
gravity_Collapse() { gravity_GetBlocklistUrls() {
echo -e " ${INFO} ${COL_BOLD}Neutrino emissions detected${COL_NC}..." echo -e " ${INFO} ${COL_BOLD}Neutrino emissions detected${COL_NC}..."
# Determine if adlists file needs handling # Determine if adlists file needs handling
@@ -139,7 +151,8 @@ gravity_Collapse() {
awk -F '[/:]' '{ awk -F '[/:]' '{
# Remove URL protocol & optional username:password@ # Remove URL protocol & optional username:password@
gsub(/(.*:\/\/|.*:.*@)/, "", $0) gsub(/(.*:\/\/|.*:.*@)/, "", $0)
print $1 if(length($1)>0){print $1}
else {print "local"}
}' <<< "$(printf '%s\n' "${sources[@]}")" 2> /dev/null }' <<< "$(printf '%s\n' "${sources[@]}")" 2> /dev/null
)" )"
@@ -152,7 +165,7 @@ gravity_Collapse() {
} }
# Define options for when retrieving blocklists # Define options for when retrieving blocklists
gravity_Supernova() { gravity_SetDownloadOptions() {
local url domain agent cmd_ext str local url domain agent cmd_ext str
echo "" echo ""
@@ -177,7 +190,7 @@ gravity_Supernova() {
if [[ "${skipDownload}" == false ]]; then if [[ "${skipDownload}" == false ]]; then
echo -e " ${INFO} Target: ${domain} (${url##*/})" echo -e " ${INFO} Target: ${domain} (${url##*/})"
gravity_Pull "${url}" "${cmd_ext}" "${agent}" gravity_DownloadBlocklistFromUrl "${url}" "${cmd_ext}" "${agent}"
echo "" echo ""
fi fi
done done
@@ -185,16 +198,17 @@ gravity_Supernova() {
} }
# Download specified URL and perform checks on HTTP status and file content # Download specified URL and perform checks on HTTP status and file content
gravity_Pull() { gravity_DownloadBlocklistFromUrl() {
local url="${1}" cmd_ext="${2}" agent="${3}" heisenbergCompensator="" patternBuffer str httpCode success="" local url="${1}" cmd_ext="${2}" agent="${3}" heisenbergCompensator="" patternBuffer str httpCode success=""
# Create temp file to store content on disk instead of RAM # Create temp file to store content on disk instead of RAM
patternBuffer=$(mktemp -p "/tmp" --suffix=".phgpb") patternBuffer=$(mktemp -p "/tmp" --suffix=".phgpb")
# Determine if $saveLocation has read permission # Determine if $saveLocation has read permission
if [[ -r "${saveLocation}" ]]; then if [[ -r "${saveLocation}" && $url != "file"* ]]; then
# Have curl determine if a remote file has been modified since last retrieval # Have curl determine if a remote file has been modified since last retrieval
# Uses "Last-Modified" header, which certain web servers do not provide (e.g: raw github urls) # Uses "Last-Modified" header, which certain web servers do not provide (e.g: raw github urls)
# Note: Don't do this for local files, always download them
heisenbergCompensator="-z ${saveLocation}" heisenbergCompensator="-z ${saveLocation}"
fi fi
@@ -203,20 +217,32 @@ gravity_Pull() {
# shellcheck disable=SC2086 # shellcheck disable=SC2086
httpCode=$(curl -s -L ${cmd_ext} ${heisenbergCompensator} -w "%{http_code}" -A "${agent}" "${url}" -o "${patternBuffer}" 2> /dev/null) httpCode=$(curl -s -L ${cmd_ext} ${heisenbergCompensator} -w "%{http_code}" -A "${agent}" "${url}" -o "${patternBuffer}" 2> /dev/null)
# Determine "Status:" output based on HTTP response case $url in
case "${httpCode}" in # Did we "download" a remote file?
"200") echo -e "${OVER} ${TICK} ${str} Retrieval successful"; success=true;; "http"*)
"304") echo -e "${OVER} ${TICK} ${str} No changes detected"; success=true;; # Determine "Status:" output based on HTTP response
"000") echo -e "${OVER} ${CROSS} ${str} Connection Refused";; case "${httpCode}" in
"403") echo -e "${OVER} ${CROSS} ${str} Forbidden";; "200") echo -e "${OVER} ${TICK} ${str} Retrieval successful"; success=true;;
"404") echo -e "${OVER} ${CROSS} ${str} Not found";; "304") echo -e "${OVER} ${TICK} ${str} No changes detected"; success=true;;
"408") echo -e "${OVER} ${CROSS} ${str} Time-out";; "000") echo -e "${OVER} ${CROSS} ${str} Connection Refused";;
"451") echo -e "${OVER} ${CROSS} ${str} Unavailable For Legal Reasons";; "403") echo -e "${OVER} ${CROSS} ${str} Forbidden";;
"500") echo -e "${OVER} ${CROSS} ${str} Internal Server Error";; "404") echo -e "${OVER} ${CROSS} ${str} Not found";;
"504") echo -e "${OVER} ${CROSS} ${str} Connection Timed Out (Gateway)";; "408") echo -e "${OVER} ${CROSS} ${str} Time-out";;
"521") echo -e "${OVER} ${CROSS} ${str} Web Server Is Down (Cloudflare)";; "451") echo -e "${OVER} ${CROSS} ${str} Unavailable For Legal Reasons";;
"522") echo -e "${OVER} ${CROSS} ${str} Connection Timed Out (Cloudflare)";; "500") echo -e "${OVER} ${CROSS} ${str} Internal Server Error";;
* ) echo -e "${OVER} ${CROSS} ${str} ${httpCode}";; "504") echo -e "${OVER} ${CROSS} ${str} Connection Timed Out (Gateway)";;
"521") echo -e "${OVER} ${CROSS} ${str} Web Server Is Down (Cloudflare)";;
"522") echo -e "${OVER} ${CROSS} ${str} Connection Timed Out (Cloudflare)";;
* ) echo -e "${OVER} ${CROSS} ${str} ${httpCode}";;
esac;;
# Did we "download" a local file?
"file"*)
if [[ -s "${patternBuffer}" ]]; then
echo -e "${OVER} ${TICK} ${str} Retrieval successful"; success=true
else
echo -e "${OVER} ${CROSS} ${str} Not found / empty list"
fi;;
*) echo -e "${OVER} ${CROSS} ${str} ${url} ${httpCode}";;
esac esac
# Determine if the blocklist was downloaded and saved correctly # Determine if the blocklist was downloaded and saved correctly
@@ -243,36 +269,22 @@ gravity_Pull() {
# Parse source files into domains format # Parse source files into domains format
gravity_ParseFileIntoDomains() { gravity_ParseFileIntoDomains() {
local source="${1}" destination="${2}" commentPattern firstLine abpFilter local source="${1}" destination="${2}" firstLine abpFilter
# Determine if we are parsing a consolidated list # Determine if we are parsing a consolidated list
if [[ "${source}" == "${piholeDir}/${matterAndLight}" ]]; then if [[ "${source}" == "${piholeDir}/${matterAndLight}" ]]; then
# Define symbols used as comments: #;@![/ # Remove comments and print only the domain name
commentPattern="[#;@![\\/]" # Most of the lists downloaded are already in hosts file format but the spacing/formating is not contigious
# This helps with that and makes it easier to read
# It also helps with debugging so each stage of the script can be researched more in depth
#Awk -F splits on given IFS, we grab the right hand side (chops trailing #coments and /'s to grab the domain only.
#Last awk command takes non-commented lines and if they have 2 fields, take the left field (the domain) and leave
#+ the right (IP address), otherwise grab the single field.
# Parse Domains/Hosts files by removing comments & host IPs < ${source} awk -F '#' '{print $1}' | \
# Logic: Ignore lines which begin with comments awk -F '/' '{print $1}' | \
awk '!/^'"${commentPattern}"'/ { awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' | \
# Determine if there are multiple words seperated by a space sed -nr -e 's/\.{2,}/./g' -e '/\./p' > ${destination}
if(NF>1) {
# Remove comments (including prefixed spaces/tabs)
if($0 ~ /'"${commentPattern}"'/) { gsub("( |\t)'"${commentPattern}"'.*", "", $0) }
# Determine if there are aliased domains
if($3) {
# Remove IP address
$1=""
# Remove space which is left in $0 when removing $1
gsub("^ ", "", $0)
print $0
} else if($2) {
# Print single domain without IP
print $2
}
# If there are no words seperated by space
} else if($1) {
print $1
}
}' "${source}" 2> /dev/null > "${destination}"
return 0 return 0
fi fi
@@ -318,7 +330,7 @@ gravity_ParseFileIntoDomains() {
}' "${source}" > "${destination}.exceptionsFile.tmp" }' "${source}" > "${destination}.exceptionsFile.tmp"
# Remove exceptions # Remove exceptions
grep -F -x -v -f "${destination}.exceptionsFile.tmp" "${destination}" > "${source}" comm -23 "${destination}" <(sort "${destination}.exceptionsFile.tmp") > "${source}"
mv "${source}" "${destination}" mv "${source}" "${destination}"
fi fi
@@ -353,7 +365,7 @@ gravity_ParseFileIntoDomains() {
} }
# Create (unfiltered) "Matter and Light" consolidated list # Create (unfiltered) "Matter and Light" consolidated list
gravity_Schwarzschild() { gravity_ConsolidateDownloadedBlocklists() {
local str lastLine local str lastLine
str="Consolidating blocklists" str="Consolidating blocklists"
@@ -381,7 +393,7 @@ gravity_Schwarzschild() {
} }
# Parse consolidated list into (filtered, unique) domains-only format # Parse consolidated list into (filtered, unique) domains-only format
gravity_Filter() { gravity_SortAndFilterConsolidatedList() {
local str num local str num
str="Extracting domains from blocklists" str="Extracting domains from blocklists"
@@ -393,7 +405,7 @@ gravity_Filter() {
# Format $parsedMatter line total as currency # Format $parsedMatter line total as currency
num=$(printf "%'.0f" "$(wc -l < "${piholeDir}/${parsedMatter}")") num=$(printf "%'.0f" "$(wc -l < "${piholeDir}/${parsedMatter}")")
echo -e "${OVER} ${TICK} ${str} echo -e "${OVER} ${TICK} ${str}
${INFO} ${COL_BLUE}${num}${COL_NC} domains being pulled in by gravity" ${INFO} Number of domains being pulled in by gravity: ${COL_BLUE}${num}${COL_NC}"
str="Removing duplicate domains" str="Removing duplicate domains"
echo -ne " ${INFO} ${str}..." echo -ne " ${INFO} ${str}..."
@@ -402,31 +414,30 @@ gravity_Filter() {
# Format $preEventHorizon line total as currency # Format $preEventHorizon line total as currency
num=$(printf "%'.0f" "$(wc -l < "${piholeDir}/${preEventHorizon}")") num=$(printf "%'.0f" "$(wc -l < "${piholeDir}/${preEventHorizon}")")
echo -e " ${INFO} ${COL_BLUE}${num}${COL_NC} unique domains trapped in the Event Horizon" echo -e " ${INFO} Number of unique domains trapped in the Event Horizon: ${COL_BLUE}${num}${COL_NC}"
} }
# Whitelist unique blocklist domain sources # Whitelist unique blocklist domain sources
gravity_WhitelistBLD() { gravity_WhitelistBlocklistSourceUrls() {
local uniqDomains plural="" str local uniqDomains str
echo "" echo ""
# Create array of unique $sourceDomains # Create array of unique $sourceDomains
mapfile -t uniqDomains <<< "$(awk '{ if(!a[$1]++) { print $1 } }' <<< "$(printf '%s\n' "${sourceDomains[@]}")")" mapfile -t uniqDomains <<< "$(awk '{ if(!a[$1]++) { print $1 } }' <<< "$(printf '%s\n' "${sourceDomains[@]}")")"
[[ "${#uniqDomains[@]}" -ne 1 ]] && plural="s"
str="Adding ${#uniqDomains[@]} blocklist source domain${plural} to the whitelist" str="Number of blocklist source domains being added to the whitelist: ${#uniqDomains[@]}"
echo -ne " ${INFO} ${str}..." echo -ne " ${INFO} ${str}..."
# Whitelist $uniqDomains # Whitelist $uniqDomains
"${PIHOLE_COMMAND}" -w -nr -q "${uniqDomains[*]}" &> /dev/null "${PIHOLE_COMMAND}" -w -nr -q ${uniqDomains[*]} &> /dev/null
echo -e "${OVER} ${TICK} ${str}" echo -e "${OVER} ${INFO} ${str}"
} }
# Whitelist user-defined domains # Whitelist user-defined domains
gravity_Whitelist() { gravity_Whitelist() {
local num plural="" str local num str
if [[ ! -f "${whitelistFile}" ]]; then if [[ ! -f "${whitelistFile}" ]]; then
echo -e " ${INFO} Nothing to whitelist!" echo -e " ${INFO} Nothing to whitelist!"
@@ -434,24 +445,22 @@ gravity_Whitelist() {
fi fi
num=$(wc -l < "${whitelistFile}") num=$(wc -l < "${whitelistFile}")
[[ "${num}" -ne 1 ]] && plural="s" str="Number of whitelisted domains: ${num}"
str="Whitelisting ${num} domain${plural}"
echo -ne " ${INFO} ${str}..." echo -ne " ${INFO} ${str}..."
# Print everything from preEventHorizon into whitelistMatter EXCEPT domains in $whitelistFile # Print everything from preEventHorizon into whitelistMatter EXCEPT domains in $whitelistFile
grep -F -x -v -f "${whitelistFile}" "${piholeDir}/${preEventHorizon}" > "${piholeDir}/${whitelistMatter}" comm -23 "${piholeDir}/${preEventHorizon}" <(sort "${whitelistFile}") > "${piholeDir}/${whitelistMatter}"
echo -e "${OVER} ${TICK} ${str}" echo -e "${OVER} ${INFO} ${str}"
} }
# Output count of blacklisted domains and wildcards # Output count of blacklisted domains and wildcards
gravity_ShowBlockCount() { gravity_ShowBlockCount() {
local num plural local num
if [[ -f "${blacklistFile}" ]]; then if [[ -f "${blacklistFile}" ]]; then
num=$(printf "%'.0f" "$(wc -l < "${blacklistFile}")") num=$(printf "%'.0f" "$(wc -l < "${blacklistFile}")")
plural=; [[ "${num}" -ne 1 ]] && plural="s" echo -e " ${INFO} Number of blacklisted domains: ${num}"
echo -e " ${INFO} Blacklisted ${num} domain${plural}"
fi fi
if [[ -f "${wildcardFile}" ]]; then if [[ -f "${wildcardFile}" ]]; then
@@ -460,8 +469,7 @@ gravity_ShowBlockCount() {
if [[ -n "${IPV4_ADDRESS}" ]] && [[ -n "${IPV6_ADDRESS}" ]];then if [[ -n "${IPV4_ADDRESS}" ]] && [[ -n "${IPV6_ADDRESS}" ]];then
num=$(( num/2 )) num=$(( num/2 ))
fi fi
plural=; [[ "${num}" -ne 1 ]] && plural="s" echo -e " ${INFO} Number of wildcard blocked domains: ${num}"
echo -e " ${INFO} Wildcard blocked ${num} domain${plural}"
fi fi
} }
@@ -555,7 +563,7 @@ gravity_Cleanup() {
rm ${piholeDir}/*.tmp 2> /dev/null rm ${piholeDir}/*.tmp 2> /dev/null
rm /tmp/*.phgpb 2> /dev/null rm /tmp/*.phgpb 2> /dev/null
# Ensure this function only runs when gravity_Supernova() has completed # Ensure this function only runs when gravity_SetDownloadOptions() has completed
if [[ "${gravity_Blackbody:-}" == true ]]; then if [[ "${gravity_Blackbody:-}" == true ]]; then
# Remove any unused .domains files # Remove any unused .domains files
for file in ${piholeDir}/*.${domainsExtension}; do for file in ${piholeDir}/*.${domainsExtension}; do
@@ -617,12 +625,12 @@ fi
# Determine which functions to run # Determine which functions to run
if [[ "${skipDownload}" == false ]]; then if [[ "${skipDownload}" == false ]]; then
# Gravity needs to download blocklists # Gravity needs to download blocklists
gravity_DNSLookup gravity_CheckDNSResolutionAvailable
gravity_Collapse gravity_GetBlocklistUrls
gravity_Supernova gravity_SetDownloadOptions
gravity_Schwarzschild gravity_ConsolidateDownloadedBlocklists
gravity_Filter gravity_SortAndFilterConsolidatedList
gravity_WhitelistBLD gravity_WhitelistBlocklistSourceUrls
else else
# Gravity needs to modify Blacklist/Whitelist/Wildcards # Gravity needs to modify Blacklist/Whitelist/Wildcards
echo -e " ${INFO} Using cached Event Horizon list..." echo -e " ${INFO} Using cached Event Horizon list..."

10
pihole
View File

@@ -444,13 +444,17 @@ Specify whether the Pi-hole log should be used
Options: Options:
on Enable the Pi-hole log at /var/log/pihole.log on Enable the Pi-hole log at /var/log/pihole.log
off Disable the Pi-hole log at /var/log/pihole.log" off Disable and flush the Pi-hole log at /var/log/pihole.log
off noflush Disable the Pi-hole log at /var/log/pihole.log"
exit 0 exit 0
elif [[ "${1}" == "off" ]]; then elif [[ "${1}" == "off" ]]; then
# Disable logging # Disable logging
sed -i 's/^log-queries/#log-queries/' /etc/dnsmasq.d/01-pihole.conf sed -i 's/^log-queries/#log-queries/' /etc/dnsmasq.d/01-pihole.conf
sed -i 's/^QUERY_LOGGING=true/QUERY_LOGGING=false/' /etc/pihole/setupVars.conf sed -i 's/^QUERY_LOGGING=true/QUERY_LOGGING=false/' /etc/pihole/setupVars.conf
pihole -f if [[ "${2}" != "noflush" ]]; then
# Flush logs
pihole -f
fi
echo -e " ${INFO} Disabling logging..." echo -e " ${INFO} Disabling logging..."
local str="Logging has been disabled!" local str="Logging has been disabled!"
elif [[ "${1}" == "on" ]]; then elif [[ "${1}" == "on" ]]; then
@@ -658,6 +662,6 @@ case "${1}" in
"-t" | "tail" ) tailFunc;; "-t" | "tail" ) tailFunc;;
"checkout" ) piholeCheckoutFunc "$@";; "checkout" ) piholeCheckoutFunc "$@";;
"tricorder" ) tricorderFunc;; "tricorder" ) tricorderFunc;;
"updatechecker" ) updateCheckFunc;; "updatechecker" ) updateCheckFunc "$@";;
* ) helpFunc;; * ) helpFunc;;
esac esac