Commit graph

274 commits

Author SHA1 Message Date
Adam Warner
4ac4bc5c18
Merge branch 'development' into fix/gravity_no_locallist 2021-07-04 00:48:09 +01:00
Christian König
4fb5157719 Squashed commits
Add simple grep function to pihole -t

Signed-off-by: Christian König <ckoenig@posteo.de>

Add help info

Signed-off-by: Christian König <ckoenig@posteo.de>

Improve help info

Signed-off-by: Christian König <ckoenig@posteo.de>

Fix details

Signed-off-by: Christian König <ckoenig@posteo.de>
2021-07-03 17:13:19 +02:00
DL6ER
aa88be335e
Acknowledge that IPV{4,6}_ADDRESS may not exist
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-04-16 11:44:54 +02:00
DL6ER
5df7ed2f32
Obtain FTL's PID from the PID file (#4103)
* Try to obtain FTL's PID from the PID file. If this fails, try to identify the main process using pgrep --oldest (instead of relying on pkill finding the right one by itself). This allows the script to work in even when FTL is running inside the memory checker valgrind.

* Rename FTL_PID -> FTL_PID_FILE

* Remove the pgrep fallback after discussions about that it should be more obvious to users if something strange happened to their PID file. Also, simplify the routine using a bashism in the end.

* Shorten if [[ regex ]]

* Use unset instead of emptying the PID variable

Signed-off-by: DL6ER <dl6er@dl6er.de>

Co-authored-by: Dan Schaper <dan.schaper@pi-hole.net>
2021-04-14 09:33:10 -07:00
Christian König
e7d937c412 Be more specific what pihole -d -a does
Signed-off-by: Christian König <ckoenig@posteo.de>
2020-11-15 20:31:47 +01:00
Adam Warner
bb1a6243d6
Merge pull request #3669 from pi-hole/release/v5.1.2
Release/v5.1.2 to development
2020-08-14 16:28:53 +01:00
Dan Schaper
548ad6375d
Merge pull request #3524 from pi-hole/fix/status_checking
Fix pihole status to not rely on a TCP port test
2020-07-28 07:24:34 -07:00
DL6ER
6ee6eea1fb
Use pkill instead of the somewhat fragile combination of kill + pidof. This solves some issues especially when there are many TCP workers floating around.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-21 21:13:40 +02:00
DL6ER
94cd7f59d4
Make verbose output the default.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-01 18:49:31 +02:00
DL6ER
6009e86947
Fix pihole status to not rely on a TCP port test. The current test can fail even when there is no error i case the max. number of TCP workers is reached.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-01 18:39:28 +02:00
Thomas L. Kjeldsen
852f6b95f5 Prevent "pihole disable $timeout" from messing up future state changes
Signed-off-by: Thomas L. Kjeldsen <tlk@closureconsulting.com>
2020-05-30 02:58:27 +02:00
Dan Schaper
c76435883b
Merge pull request #3360 from dnicolson/fix-github-capitalisation
Fix GitHub capitalisation
2020-05-13 16:56:36 -07:00
Dave Nicolson
ab753e88a2 Fix GitHub capitalisation
Signed-off-by: Dave Nicolson <david.nicolson@gmail.com>
2020-05-13 12:55:00 +02:00
Adam Warner
9e96ff37de
Fix merge conflicts
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2020-05-12 22:16:43 +01:00
yubiuser
d27a565d39 Apply suggestions from code review
Co-Authored-By: DL6ER <DL6ER@users.noreply.github.com>
Signed-off-by: Christian König <ckoenig@posteo.de>
2020-04-05 11:46:41 +02:00
Christian König
de42669bb7 fix typo in pihole help
Signed-off-by: Christian König <ckoenig@posteo.de>
2020-04-05 08:56:10 +02:00
Christian König
3095fd4dd6 add restart [options] to cli help
Signed-off-by: Christian König <ckoenig@posteo.de>
2020-04-05 08:49:35 +02:00
XhmikosR
7b8611ced0
Assorted typo fixes. (#3126)
* Assorted typo fixes.

Signed-off-by: XhmikosR <xhmikosr@gmail.com>

Co-authored-by: Dan Schaper <dan.schaper@pi-hole.net>
2020-03-08 16:53:14 -07:00
DL6ER
f10a151469
Fix pihole -t sed instructions.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-02-12 21:05:02 +01:00
DL6ER
a809624356
Update blocked strings for pihole -t.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-01-23 19:19:44 +01:00
DL6ER
69a909fc4c
On modification of lists, we should send real-time signal 0 instead of SIGHUP. This also preserves the DNS cache of not-blocked domains.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-12-11 21:47:46 +00:00
chrunchyjesus
476975540a
make some shebangs comply to posix standard 2019-11-05 22:33:00 +01:00
John Crisp
4f21f67775
Update pihole
Fix spelling typos
2019-10-06 15:09:14 +01:00
Adam Warner
61a40c1b43
merge devel into 4.3.2 And Resolve merge conflicts
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2019-09-22 01:16:44 +01:00
Adam Warner
79b8dac0fa
Remove readonly attribute of the PI_HOLE_BIN_DIR declaration in pihole
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2019-08-30 22:06:14 +01:00
Dan Schaper
03c65dd0e9
Convert hardcoded /usr/local/bin to variable
Update pihole script with full path to 'pihole'

Variable for webpage.sh 'pihole' call.

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2019-08-24 04:49:14 -07:00
DL6ER
aef7892de6
Add missing hyphens.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-08-22 13:57:01 +02:00
DL6ER
251c9fee98
Simplify restarting code for "pihole restartdns". This fixes #2869.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-08-14 21:14:55 +02:00
DL6ER
6e2e825a5f
Rename options "pihole --whiteregex" to "pihole --white-regex" for the sake of readability. The same applied for "whitewild" -> "white-wild"
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-08-05 21:10:52 +02:00
DL6ER
6f58d58cae
Add --whitewild to help texts and man pages.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-07-22 22:26:27 +02:00
DL6ER
40d0caa70b
Add undocumented --whitewild option that does the same --wild does for the whitelist.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-07-22 21:15:28 +02:00
DL6ER
96031214c6
Add support for whitelist regex filter management via CLI.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-07-22 19:36:11 +02:00
DL6ER
4947350ca5
Add arpflush to help and bash autocompletion
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-06-15 09:08:33 +02:00
DL6ER
c3023fe681
Add new "pihole arpflush" command to flush both the ARP cache as well as the network table in pihole-FTL.db
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-05-30 21:25:10 +02:00
DL6ER
d7ee44960e
Remove moving around of the gravity and blacklist files as we do not use them any longer
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-04-24 18:57:38 +02:00
DL6ER
6594a0a6e7
Fix detection of blocked query in pihole -t
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-04-24 18:53:20 +02:00
DL6ER
a4ba8d4b8f
Prevent double disabling/enabling by checking BLOCKING_ENABLED value in setupVars.conf
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-01-24 09:16:24 +01:00
Ludovic Rousseau
d5fbe1b629 Do not ask admin password just for help documentation
It is not a good idea to ask for an admin password just to get the
command documentation.
"pihole -h" should return the arguments documentation with no need to
enter a password.

Without the patch I get:
$ ./pihole -h
Password:

It is easy to reproduce by invalidating the sudo password using
"sudo -k" before running pihole again.

Signed-off-by: Ludovic Rousseau <ludovic.rousseau@free.fr>
2019-01-02 23:54:30 +01:00
Mcat12
3f59b51be1
Fix restartDNS returning code 1 even when it worked
If stdout was not a terminal (the `-t 1` check), `restartDNS` would
return code 1 in the success case. This caused the API to fail whenever
it tried to restart the DNS server.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-11-08 22:00:13 -05:00
jeremysherriff
d986da63a5 Pass gravity exit code back to caller to allow for cron error handling
Signed-off-by: jeremysherriff <jeremysherriff@gmail.com>
2018-10-19 19:10:37 +13:00
Mark Drobnak
c976bbcfd2
Fix checkout error due to readonly variable
Signed-off-by: Mark Drobnak <mark.drobnak@gmail.com>
2018-09-01 22:11:45 -04:00
DL6ER
f20e4ddf3b
Change message for unknown state to something more useful
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-30 22:28:15 +02:00
DL6ER
40656641b6
Merge branch 'development' into tweak/reload_on_enable_disable 2018-08-30 22:26:57 +02:00
DL6ER
0ebd68f17f
Review comments
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-14 09:55:16 +02:00
DL6ER
337cc5ca18
BLOCKING -> BLOCKING_ENABLED
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-13 17:22:10 +02:00
DL6ER
4e4d6b5d1f
Adjust "pihole status" command
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-13 15:02:00 +02:00
DL6ER
b011adc453
Use new setupVars BLOCKING variable to determine which file to update via gravity
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-13 14:19:59 +02:00
DL6ER
d8abc1d266
Storing BLOCKING=true/false in setupVars.conf
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-13 13:49:47 +02:00
WaLLy3K
d163e38380
Ensure regex-blocked lines are red
* Add `regex.list` to seds list

Signed-off-by: WaLLy3K <wally3k@pihole.net>
2018-08-13 14:56:38 +10:00
DL6ER
20b946eae5
Instead of changing the dnsmasq configuration, we replace gravity.list and black.list by empty files for disabling. When pihole-FTL receives SIGHUP, it will clear its cache and reload all configured lists. If the files are empty, blocking will be disabled as no content to be blocked will be imported.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-12 19:31:00 +02:00
DL6ER
c00357663b
Reload pihole-FTL instead of restart the entire service on "pihole enable/disable"
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-08-12 19:17:20 +02:00
WaLLy3K
a1bf9fad98
Fix colour tail for use with new blocking methods
Signed-off-by: WaLLy3K <wally3k@pi-hole.net>
2018-08-11 12:55:18 +10:00
Dan Schaper
dbc82cfb6a
Merge pull request #2236 from pi-hole/new/regex-lists
Use regex lists instead of wildcards for blocking
2018-07-14 06:10:44 -07:00
Mcat12
941a766aa3
Replace -wild and -regex with --wild and --regex
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-07-12 21:38:43 -04:00
Mcat12
c5bb404d6a
Emulate wildcard blacklisting via -wild and move regex to -regex
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-07-08 14:37:33 -04:00
Mcat12
4763969c8f
Move processWildcards to query.sh
Closes #2255

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-06-30 22:03:53 -04:00
Mcat12
0f4968d75c
Merge remote-tracking branch 'origin/development' into new/regex-lists 2018-06-29 23:12:34 -04:00
Mcat12
3077c22e4f
Change help strings from wildcard to regex blacklist
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-06-29 23:10:49 -04:00
DL6ER
a7c73036f0
pihole -t: Warn user if Pi-hole's logging is disabled
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-06-17 13:37:41 +02:00
Rob Gill
2255d05664
Remove scanlist(), now in query.sh
Signed-off-by: Rob Gill <rrobgill@protonmail.com>
2018-06-13 16:09:49 +10:00
Rob Gill
b1207949ac
Call query.sh to replace queryFunc()
Signed-off-by: Rob Gill <rrobgill@protonmail.com>
2018-06-13 15:49:52 +10:00
Rob Gill
40bc390c3b
Admin Console -> "Web Interface"
User facing --help text changes
Admin Console --> Web Interface
and additional branch option

Signed-Off-By: Rob Gill <rrobgill@protonmail.com>
2018-06-04 13:34:42 +10:00
RamSet
2f24e5ceb7 Minor correction for double instance of the word "found".
Signed-off-by: RamSet <RamSet@gmail.com>
2018-05-14 12:21:20 -06:00
Adam Warner
e49a9096a5
accidentally a 'shift'
Signed-off-by: Adam Warner <adamw@rner.email>
2018-04-15 18:46:35 +01:00
Adam Warner
33148ba832
Add help text to pihole command to document new flag
Signed-off-by: Adam Warner <adamw@rner.email>
2018-04-15 18:30:13 +01:00
Adam Warner
bca23dd896
Allow passing of --check-only to update script.
Don't run installer for updating web files, it's handled by getGitFiles.
I think this works...

Signed-off-by: Adam Warner <adamw@rner.email>
2018-04-15 18:25:35 +01:00
Adam Warner
310d33b8ee
Merge dev > FTLDNS fix merge conflicts
Signed-off-by: Adam Warner <adamw@rner.email>
2018-04-13 17:01:54 +01:00
Razvan Radu
7361d5d3ea Update pihole lolcahost probe for DNS status
Signed-off-by: Razvan Radu <ramset@gmail.com>
2018-04-05 11:14:39 -06:00
Adam Warner
0b87f489d5
Look for pihole-FTL, not dnsmasq!
Signed-off-by: Adam Warner <adamw@rner.email>
2018-03-03 15:59:56 +00:00
DL6ER
7ed45d26c2
Remove " " at some places where they shouldn't be
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-02-26 17:26:51 +01:00
DL6ER
e8ec0dc701
Use pihole-FTL resolver in pihole and gravity
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-02-25 09:34:04 +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
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
9631519eb1
Merge pull request #1752 from pi-hole/new/bashupdatechecker
Add bash / cron based update checker for Pi-hole
2017-11-08 20:38:40 -06:00
DL6ER
6ca47dc3b3
Add bash / cron based update checker for Pi-hole 2017-10-28 13:20:02 +02:00
Mcat12
8dba2a88e2 Move FTL re-parsing call after dnsmasq restart 2017-10-25 23:07:45 -04:00
DL6ER
b9ae01d819
Send SIGHUP to pihole-FTL when restarting/reloading dnsmasq
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-10-25 17:46:24 +02:00
WaLLy3K
645d8e0ebd Fix issue where wildcarding didn't restart dnsmasq
Signed off by WaLLy3K <wally3k@pi-hole.net>
2017-10-19 17:51:20 +11:00
WaLLy3K
80c40e6050 Prevent full stop being interpreted as regex
Signed off by WaLLy3K <wally3k@pi-hole.net>
2017-10-16 10:12:27 +11:00
WaLLy3K
3b300a4d6a Fix query option handling
Signed off by WaLLy3K <wally3k@pi-hole.net>
2017-10-13 11:42:49 +11:00
WaLLy3K
664d0ea023 Correctly retrieve IPv4/6 addresses for tailFunc()
* Add comments for readability
* Use `sed -E` for readability
* Move `date` into `sed`
* Use updated colour codes
2017-09-23 11:27:40 +10:00
Adam Warner
a0bd517380 Merge pull request #1694 from pi-hole/fix/qf-opt
Slow query fix & queryFunc optimisation
2017-09-21 20:05:42 +01:00
WaLLy3K
56990618e9 Prevent Block Page issue
* Block Page expects to see a full stop, otherwise it will throw an unhandled error
2017-09-18 01:12:19 +10:00
WaLLy3K
54a85d3a63 Fix invalid option case
* Ensure `pihole -q doubleclick.com asd` exits with error
2017-09-18 00:58:56 +10:00
WaLLy3K
c2d3e99ddd Slow query fix & queryFunc optimisation
* Validate modified code using Shellcheck & Strict Bash
* Added and/or elaborated more comments

* scanlist() should exit if /etc/pihole is not available
* Add `export LC_CTYPE=C` to prevent extreme grep slowdown
* Consider "domain.com#comment" an exact match
* Add specialised wildcard searching grep

* Optimise and simplify queryFunc() for readability
* Replace IDN `python` parsing with `idn2`, as `python` is not guaranteed to be available
* Use ${COL_BOLD} when printing filenames
2017-09-18 00:41:26 +10:00
WaLLy3K
4d39ab9753 Allow force-reload to be used when restarting DNS
* Remove duplicate coltable variable definition and source
* Minor comment modifications
* Add "$2" to restartdns
2017-09-14 16:39:25 +10:00
WaLLy3K
56b8c4bfdb Merge branch 'development' into tweak/gravity 2017-09-01 10:01:41 +10:00
WaLLy3K
15a5f425bf Replace nc with psuedo-device
* Also fix minor conditional style issue
2017-08-31 20:32:02 +10:00
WaLLy3K
3125d24ded Replace superseded netstat command
* Make colfile readonly, and use path of PI_HOLE_SCRIPT_DIR
* Rename piholeStatus function to statusFunc for function name consistency
* Replace superseded netstat command with nc
* Perform addn-hosts check using a single grep subshell
2017-08-31 17:39:41 +10:00
WaLLy3K
cc4ada99d8 Use SIGHUP instead of force-reload 2017-08-01 20:48:43 +10:00
Adam Warner
18b41adbf6 Merge branch 'development' into tweak/gravity 2017-07-29 17:14:39 +01:00
WaLLy3K
e0eb5eb2b1 Fix queryFunc if adlists URLs have been removed (#1618)
* Fix queryFunc if adlists URLs have been removed

* Allow for -adlists command line switch (where the "s" is a typo)
* Add error message when unable to find associated adlists URL

* Provide PR fix on current dev version

* Add blResult variable for white/black match

* Supporting Block Page queryFunc fixes

* Re-add unmerged lines
2017-07-25 23:07:06 +01:00
WaLLy3K
a2825be819 Add dnsmasq "force-reload" option
* Made use of $PI_HOLE_SCRIPT_DIR
* Fix #1610 & #1624
* Add "$2" to restartDNS options

Signed-off-by: WaLLy3K <wally3k@pi-hole.net>
2017-07-24 21:25:04 +10:00
Adam Warner
f2e9d585f7
* Add helptext for pihole checkout ftl
* Only attempt to install FTL if branch was found
* ~~corebranches~~ webbranches (web branches now actually listed)

Signed-off-by: Adam Warner <adamw@rner.email>
2017-07-16 13:33:00 +01:00
WaLLy3K
3a50b91722 User-friendly queryFunc() output (#1483)
* User-friendly queryFunc() output

* Silence grep errors
* Provide 'pihole -q -h' help output
* Rewrite option handling
* Loop through grep stdout to make query output user friendly
* Add -adlist option to show block list URL instead of internal file name
* Limit general searches to 10 matches per block list
* Add -all option to override 10 match limit
* Fixed 'pihole -h' wording

* Further query optimisations

* Optimised scanList() output by switching folder
* Re-added processWildcards() function
* Added "-bp" exact matching option for use with block page
* Standardised query output
* Separated wildcard search from blacklist/whitelist search
* Optimised sorting by sorting glob output and not scanList() output

* Fixed result skipping

* Add text for wildcard result on exact query

* Fix wildcard result output

* Multiple wildcard matches on exact query could cause unexpected output

* Remove unnecessary replacement

* Make grep only output matching text

* HOSTS format lists will also output the IP address
* That substitution was necessary

* Remove IP address from HOSTS format lists

* Filter unwanted content

* Add /dev/null to grep, to always print file name (even when searching only one block list)
* Use three seds to remove unwanted content from block lists

* Merge with development

* Simplify queryFunc code
2017-07-15 11:56:40 +01:00
WaLLy3K
3631d1349e Prevent Web Admin from printing restartdns colour codes (#1575)
* Prevent Web Admin from printing unnecessary msgs

* Make DNS restart behaviour consistent
2017-07-15 11:11:06 +01:00
WaLLy3K
209fbf82c4 Colourise tailFunc (#1550)
* Colourise tailFunc

* Strip month, day number and dnsmasq[PID]
* Blocked domains show as light red
* Queries show as standard colour
* Everything else as dark gray

* Change tailFunc highlighted lines

* Highlight Blocked/Blacklist/Wildcard lines as red
* Make DHCP lines default colour

* Make sure tailFunc doesn't match on domain names
2017-07-02 15:21:00 +02:00
Adam Warner
536585b846 Colourise Core Output Text (#1471)
* 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"
2017-06-21 21:49:05 +10:00
DL6ER
e4cc5b3847
Disable black.list on "pihole disable" 2017-06-17 14:49:02 +02:00
WaLLy3K
6823a62644 Add tricorderFunc back as usable function (#1515)
As per #1464
2017-06-03 19:13:40 +02:00