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))
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
* Round $cpu_mhz to 1 decimal place
* Remove ".0" from $cpu_freq
* Silence non-numeric domains_being_blocked output
* Use "Core" and "Web" as appropriate
Signed off by WaLLy3K <wally3k@pi-hole.net>
* Use inverse if statement, instead of IF/ELSE when checking setupVars.conf
* Remove $svFQDN
* Add or elaborate on more comments
* Add $serverName to $authorizedHosts if admin has specified `setenv.add-environment = ("fqdn" => "true")` within lighttpd's external.conf
* e.g: `$HTTP["host"] == "pihole.domain.com" { setenv.add-environment = ("fqdn" => "true") }`
* Move "No exact results" check to top of exception handling
* Remove unnecessary IF/ELSE when handling $queryAds error
Signed off by WaLLy3K <wally3k@pi-hole.net>
If Pi-Hole is behind a reverse proxy that uses SSL, then the block page will not load resources such as `blockingpage.css` and `jquery.min.js` as the insecure `http://` is hard coded. Browsers will block attempts to load insecure resources if the page is loaded of SSL.
The fix is acheived by checking `$_SERVER['HTTPS']` and setting the variable `$proto` to either `http` or `https`. The harcoded `http` is replaced by the contents of this variable.
* Comment file for review-ability
* Add BOLD and UNDERLINE options
* Select most readable colours out of LIGHT/DARK options
* Provide empty variables for `set -u`
* Deprecate unnecessary variables
* Correct colours for TICK/CROSS/DONE
* Escape r twice and add ESC to OVER
* Optimise $validDomain function by using bashism and `grep`
* Add black/white/wildcard variables to pass to Reload()
* Revert reload variable behaviour
* Ensure Reload() function passes correct options to gravity.sh
Signed-off-by: WaLLy3K <wally3k@pi-hole.net>
* Print newline on error message
* Output last three lines of error if update fails
* Consistent error messages & housekeeping
* Add shellcheck directive to ignore COL_TABLE
* Quoted and braced variables for codebase consistency
* Escaped newlines correctly
* Made error messages consistent (indenting and wording)
* Removed consecutive echos
* Conditional formatting consistency
* Braced, quoted and used [[ on conditionals
* Fix specific ShellCheck issues
* Fixed issues that could be safely changed without extensive testing
* Update SELinux whiptail behaviour & more
* Colourised some strings
* Fixed multiple line string indenting
* Made output consistent with existing codebase
* Removed sequential echos
* Make SELinux whiptail use "--defaultno", and change text wording
* Add help text for hostrecord, and colourise output
* this should fix the tests...
Signed-off-by: Adam Warner <adamw@rner.email>
* revert changes to `update_package_cache()` to prove tests
Signed-off-by: Adam Warner <adamw@rner.email>
* Always process DNS and DHCP settings in installer
* Make sure dnsmasq config exists before modifying it
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
* Make sure the dnsmasq config directory exists
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
* Only remove the DHCP config if it exists (fixes tests, hopefully)
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
* Provide correct FTL stats
* Use the correct lines in the array when displaying FTL stats
* Treat ads_blocked_today/dns_queries_today as currency, like domains_being_blocked is on large screens
* Chronometer Shellcheck validation
* Remove unnecessary \ from CPU usage readout
* Add "--blacklist-only" to only run essential gravity functions
* Pass "--wildcard" option to `gravity.sh` to ensure dnsmasq is restarted
Signed-off-by: WaLLy3K <wally3k@pi-hole.net>
* Only attempt to install FTL if branch was found
* ~~corebranches~~ webbranches (web branches now actually listed)
Signed-off-by: Adam Warner <adamw@rner.email>
* check for CIDR notation when comparing IPv6 address to that found in setupVars.conf
* highlight bad address entries in pihole.log and reference a corresponding FAQ
* show header output if Pi-holes x-header does not match
* fix automated mode when running from the dashboard. It would previously not automatically upload and generate a token.
* show disclaimer message
* undocumented feature for now: obfuscate domains in pihole.log so they are not visible when sent to the Pi-hole developers. We need to make an additonal flag for this in the pihole command. if the variable OBFUSCATE has a value, it will replace the domain in the log with a placeholder value
* fix small typo in the disclaimer
* Define colours within COL_TABLE
* Do not output colours for non-terminal instances
* Removed ":::"
* Fixed indenting & spacing
* Made output consistent throughout project
* Reworded text to fit on standard 80 char wide Terminal screen
* Made 'sudo raspi-config' warning (insufficient disk space) only show on RPi
* Make "Installation/Update Complete" the final msg
* Remove redundant messages
* Simplify update available message
* Confirm user would like to begin uninstall
* If "git pull" string says "Already up-to-date.", place [i] before it
* Colour Temp/Interface output
* Made `pihole disable 5z` invalid
* Added error fallback if invalid argument (not s/m) is detected
* Quoted "$2" for consistency
* Updated help text
* L185/286: Replaced echo with redirect
* User agents for adblock.mahakala.is/adaway.org unnecessary
* Print newline on confirmation of repository reset
* Add output to admin-related dnsmasq restarts
* Return error message for "pihole -q"
* Imply default checkout behaviour with y/N
* Fix uninstall failing to remove pihole user
* Print checkout 'git remote show origin' STDERR on new line
* Replaced checkout "AdminLTE" wording with "Web Admin"
* File consistency
* Tabs to 2 spaces
* Corrected indenting
* Double braced conditionals
* Quoted variables within conditionals
* Standardise core help text
* Added help text for disable command
* Added help text for logging command
* Clean up
* Fixed certain new lines and spaces
* Sync with development branch
* Formatting consistency
* Tabs to 2 spaces
* Corrected indenting
* Double braced conditionals
* Quoted variables within conditionals
* Fixed certain newlines and spaces
* Admin help text
* Added help text for interface command
* Sync with development branch
* Formatting consistency
* Tabs to 2 spaces
* Fixed some wording
* Fixed certain spaces
* Formatting consistency
* Minor wording changes
* Tabs to 2 spaces
* Corrected indenting
* Double braced conditionals
* Quoted variables within conditionals
* Fixed certain newlines and spaces
* Blacklist help text
* Formatting consistency
* Tabs to 2 spaces
* Corrected indenting
* Cronometer help text
* Formatting consistency
* Fixed certain newlines and spaces
* Corrected indenting
* Checkout warning alteration
* Add checkout help text
* Corrected help output
Simplified the command -v syntax, and added a sleep 3 timer to the first execution of the log rotation. The second execution was being issued while the first was still running, thus it would fail and you would have to issue the "Flush Logs" command a second time.
Since Pi-hole redirects ad domains to itself, accessing the script via de.ign.com is the same as pi.hole in this case. The fix should be as simple as adding a / before admin on this line.
* Provide remote hashes for comparison
* Use double braces for all conditions (for consistency)
* Suppress potential "cd" error output
* Provide "not applicable" output upon any hash request for FTL
While testing to make sure `pihole -v` would output `pihole-FTL version`, I noticed some options didn't work how I expected them to. For example, if I use `pihole -v -p`, I would expect to see the version output of Pi-hole Core. Instead, I'm informed that it's an invalid option.
I've had the following things in mind while rewriting this:
* I'm operating under the assumption that FTL is only installed if the Admin Console is (Line 113 exit 0)
* I have modified the help text to only output with `pihole -v --help`
* I have modified all output to be more similar to the output style of `grep` and `curl` (Ditching ":::")
Testing output:
```
w3k@MCT:~$ pihole -v
Pi-hole version is v3.0.1-14-ga928cd3 (Latest: v3.0.1)
Admin Console version is v3.0-9-g3760482 (Latest: v3.0.1)
FTL version is v2.6.2 (Latest: v2.6.2)
w3k@MCT:~$ pihole -v -c
Current Pi-hole version is v3.0.1-14-ga928cd3
Current Admin Console version is v3.0-9-g3760482
Current FTL version is v2.6.2
w3k@MCT:~$ pihole -v -l
Latest Pi-hole version is v3.0.1
Latest Admin Console version is v3.0.1
Latest FTL version is v2.6.2
w3k@MCT:~$ pihole -v -p --hash
Current Pi-hole hash is a928cd3
w3k@MCT:~$ pihole -v -a --hash
Current Admin Console hash is 3760482
w3k@MCT:~$ pihole -v --help
Usage: pihole -v [REPO | OPTION] [OPTION]
Show Pi-hole, Web Admin & FTL versions
<Shows all Repositories and Options>
w3k@MCT:~$ pihole -v -foo
Invalid Option!
```
* Disable `include-conf-enabled.pl`, as blindly enabling HTTPS (as Let's Encrypt does by having a file in that folder) creates Block Page inefficiencies
* Make Block page handle JS request rewrite, allowing users to better utilise their `lighttpd` service
* Make Block page handle debugging Pi-hole header
* Make Block page redirect users from `pi.hole` to `http://pi.hole/admin`
* An "About Pi-hole" link on the block page provides an ELI5 explanation to those not familiar with Pi-hole
* An email contact link on the block page provides users of your Pi-hole with a means to easily get in touch with you
* Browsing to your Pi-hole's address will show a simple "landing page", which can be replaced by adding "landing.php" within "/var/www/html"
* Users manually browsing to file/image based content (i.e: non HTML based content) on blocked sites will be greeted with a small "Blocked by Pi-hole" image
* Sites that are manually blacklisted will display a notice of this on the block page
* Sites that aren't directly blocked, but have a CNAME record, will show a notification on the block page (e.g: If raw.githubusercontent.com is not blocked, but github.map.fastly.net is)
* On the block page, "Back to Safety" now directs the user to "about:home" if Javascript is disabled
* Whitelisting is disabled for installs without a password, or if a client does not have Javascript
* Known issues:
* Admin Console needs a text field under "Web User Interface" where the admin can enter a preferred contact email when a site needs to be whitelisted, to be saved to setupVars.conf with the key "ADMIN_EMAIL"
* Admin Console needs a text field under "Networking" where the admin can enter their Pi-hole's externally contactable FQDN, allowing access to their landing page when browsing to mypi.duckdns.org, to be saved to setupVars.conf with the key "FQDN"
* I am not aware of expected output of `$_SERVER["VIRTUAL_HOST"]`, so I have assumed it should be filtered as if it's a domain
* Block page UI overhaul to replicate the style of the Admin Console
* Block page UI is now mobile friendly
* Users can safely customise text in order to make the block page more friendly for their household
Implement "Halt system" button, next to "Restart system" button, on
admin/settings page. Useful for doing clean shutdown before powering off.
(This affects 4 files, 3 for the web content, 1 for backend script.)
Gilbert Detillieux <gedetil> 2017-04-11