Merge branch 'development' into new/FTL-binary

This commit is contained in:
DL6ER 2017-03-01 12:42:48 +01:00
commit 66b7d04b82
No known key found for this signature in database
GPG key ID: 00135ACBD90B28DD
22 changed files with 440 additions and 500 deletions

2
.gitattributes vendored
View file

@ -35,4 +35,4 @@ GitHub.Tests.Integration/Resources/* binary
# Catch all for anything we forgot. Add rules if you get CRLF -> LF warnings. # Catch all for anything we forgot. Add rules if you get CRLF -> LF warnings.
* text=auto * text eol=lf

View file

@ -1,25 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectCodeStyleSettingsManager"> <component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS"> <option name="PER_PROJECT_SETTINGS">
<value> <value>
<option name="OTHER_INDENT_OPTIONS"> <option name="OTHER_INDENT_OPTIONS">
<value> <value>
<option name="INDENT_SIZE" value="2" /> <option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="8" /> <option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="2" /> <option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="false" /> <option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" /> <option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" /> <option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" /> <option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" /> <option name="USE_RELATIVE_INDENTS" value="false" />
</value> </value>
</option>
<MarkdownNavigatorCodeStyleSettings>
<option name="RIGHT_MARGIN" value="72" />
</MarkdownNavigatorCodeStyleSettings>
</value>
</option> </option>
<MarkdownNavigatorCodeStyleSettings> <option name="USE_PER_PROJECT_SETTINGS" value="true" />
<option name="RIGHT_MARGIN" value="72" /> </component>
</MarkdownNavigatorCodeStyleSettings>
</value>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component>
</project> </project>

390
LICENSE
View file

@ -1,339 +1,167 @@
GNU GENERAL PUBLIC LICENSE Copyright (C) 2017 Pi-hole, LLC (https://pi-hole.net)
Version 2, June 1991 Pi-hole Core
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/> This software is licensed under the European Union Public License (EUPL)
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA The license is available in the 22 official languages of the EU. The English version is included here.
Everyone is permitted to copy and distribute verbatim copies Please see https://joinup.ec.europa.eu/community/eupl/og_page/eupl for official translations of the other languages.
of this license document, but changing it is not allowed.
Preamble This license applies to the whole project EXCEPT:
The licenses for most software are designed to take away your - any commits made to the master branch prior to the release of version 3.0
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not The licenses that existed prior to this change have remained intact.
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid -------------------------------------------------------------
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether European Union Public Licence
gratis or for a fee, you must give the recipients all the rights that V. 1.1
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and EUPL (C) the European Community 2007
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain This European Union Public Licence (the "EUPL") applies to the Work or Software (as defined below) which is provided under the terms of this Licence. Any use of the Work, other than as authorised under this Licence is prohibited (to the extent such use is covered by a right of the copyright holder of the Work).
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software The Original Work is provided under the terms of this Licence when the Licensor (as defined below) has placed the following notice immediately following the copyright notice for the Original Work:
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and Licensed under the EUPL V.1.1
modification follow.
GNU GENERAL PUBLIC LICENSE or has expressed by any other mean his willingness to license under the EUPL.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains 1. Definitions
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not In this Licence, the following terms have the following meaning:
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's - The Licence: this Licence.
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and - The Original Work or the Software: the software distributed and/or communicated by the Licensor under this Licence, available as Source Code and also as Executable Code as the case may be.
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion - Derivative Works: the works or software that could be created by the Licensee, based upon the Original Work or modifications thereof. This Licence does not define the extent of modification or dependence on the Original Work required in order to classify a work as a Derivative Work; this extent is determined by copyright law applicable in the country mentioned in Article 15.
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices - The Work: the Original Work and/or its Derivative Works.
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in - The Source Code: the human-readable form of the Work which is the most convenient for people to study and modify.
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively - The Executable Code: any code which has generally been compiled and which is meant to be interpreted by a computer as a program.
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If - The Licensor: the natural or legal person that distributes and/or communicates the Work under the Licence.
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest - Contributor(s): any natural or legal person who modifies the Work under the Licence, or otherwise contributes to the creation of a Derivative Work.
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program - The Licensee or "You": any natural or legal person who makes any usage of the Software under the terms of the Licence.
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it, - Distribution and/or Communication: any act of selling, giving, lending, renting, distributing, communicating, transmitting, or otherwise making available, on-line or off-line, copies of the Work or providing access to its essential functionalities at the disposal of any other natural or legal person.
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable 2. Scope of the rights granted by the Licence
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three The Licensor hereby grants You a world-wide, royalty-free, non-exclusive, sub-licensable licence to do the following, for the duration of copyright vested in the Original Work:
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer - use the Work in any circumstance and for all usage,
to distribute corresponding source code. (This alternative is - reproduce the Work,
allowed only for noncommercial distribution and only if you - modify the Original Work, and make Derivative Works based upon the Work,
received the program in object code or executable form with such - communicate to the public, including the right to make available or display the Work or copies thereof to the public and perform publicly, as the case may be, the Work,
an offer, in accord with Subsection b above.) - distribute the Work or copies thereof,
- lend and rent the Work or copies thereof,
- sub-license rights in the Work or copies thereof.
The source code for a work means the preferred form of the work for Those rights can be exercised on any media, supports and formats, whether now known or later invented, as far as the applicable law permits so.
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering In the countries where moral rights apply, the Licensor waives his right to exercise his moral right to the extent allowed by law in order to make effective the licence of the economic rights here above listed.
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program The Licensor grants to the Licensee royalty-free, non exclusive usage rights to any patents held by the Licensor, to the extent necessary to make use of the rights granted on the Work under this Licence.
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not 3. Communication of the Source Code
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the The Licensor may provide the Work either in its Source Code form, or as Executable Code. If the Work is provided as Executable Code, the Licensor provides in addition a machine-readable copy of the Source Code of the Work along with each copy of the Work that the Licensor distributes or indicates, in a notice following the copyright notice attached to the Work, a repository where the Source Code is easily and freely accessible for as long as the Licensor continues to distribute and/or communicate the Work.
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent 4. Limitations on copyright
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under Nothing in this Licence is intended to deprive the Licensee of the benefits from any exception or limitation to the exclusive rights of the rights owners in the Original Work or Software, of the exhaustion of those rights or of other applicable limitations thereto.
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any 5. Obligations of the Licensee
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to The grant of the rights mentioned above is subject to some restrictions and obligations imposed on the Licensee. Those obligations are the following:
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in Attribution right: the Licensee shall keep intact all copyright, patent or trademarks notices and all notices that refer to the Licence and to the disclaimer of warranties. The Licensee must include a copy of such notices and a copy of the Licence with every copy of the Work he/she distributes and/or communicates. The Licensee must cause any Derivative Work to carry prominent notices stating that the Work has been modified and the date of modification.
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions Copyleft clause: If the Licensee distributes and/or communicates copies of the Original Works or Derivative Works based upon the Original Work, this Distribution and/or Communication will be done under the terms of this Licence or of a later version of this Licence unless the Original Work is expressly distributed only under this version of the Licence. The Licensee (becoming Licensor) cannot offer or impose any additional terms or conditions on the Work or Derivative Work that alter or restrict the terms of the Licence.
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program Compatibility clause: If the Licensee Distributes and/or Communicates Derivative Works or copies thereof based upon both the Original Work and another work licensed under a Compatible Licence, this Distribution and/or Communication can be done under the terms of this Compatible Licence. For the sake of this clause, "Compatible Licence" refers to the licences listed in the appendix attached to this Licence. Should the Licensees obligations under the Compatible Licence conflict with his/her obligations under this Licence, the obligations of the Compatible Licence shall prevail.
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free Provision of Source Code: When distributing and/or communicating copies of the Work, the Licensee will provide a machine-readable copy of the Source Code or indicate a repository where this Source will be easily and freely available for as long as the Licensee continues to distribute and/or communicate the Work.
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY Legal Protection: This Licence does not grant permission to use the trade names, trademarks, service marks, or names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the copyright notice.
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 6. Chain of Authorship
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING The original Licensor warrants that the copyright in the Original Work granted hereunder is owned by him/her or licensed to him/her and that he/she has the power and authority to grant the Licence.
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS Each Contributor warrants that the copyright in the modifications he/she brings to the Work are owned by him/her or licensed to him/her and that he/she has the power and authority to grant the Licence.
How to Apply These Terms to Your New Programs Each time You accept the Licence, the original Licensor and subsequent Contributors grant You a licence to their contributions to the Work, under the terms of this Licence.
If you develop a new program, and you want it to be of the greatest 7. Disclaimer of Warranty
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest The Work is a work in progress, which is continuously improved by numerous contributors. It is not a finished work and may therefore contain defects or "bugs" inherent to this type of software development.
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{description} For the above reason, the Work is provided under the Licence on an "as is" basis and without warranties of any kind concerning the Work, including without limitation merchantability, fitness for a particular purpose, absence of defects or errors, accuracy, non-infringement of intellectual property rights other than copyright as stated in Article 6 of this Licence.
Copyright (C) {year} {fullname}
This program is free software; you can redistribute it and/or modify This disclaimer of warranty is an essential part of the Licence and a condition for the grant of any rights to the Work.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, 8. Disclaimer of Liability
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along Except in the cases of wilful misconduct or damages directly caused to natural persons, the Licensor will in no event be liable for any direct or indirect, material or moral, damages of any kind, arising out of the Licence or of the use of the Work, including without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, loss of data or any commercial damage, even if the Licensor has been advised of the possibility of such damage. However, the Licensor will be liable under statutory product liability laws as far such laws apply to the Work.
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail. 9. Additional agreements
If the program is interactive, make it output a short notice like this While distributing the Original Work or Derivative Works, You may choose to conclude an additional agreement to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or services consistent with this Licence. However, in accepting such obligations, You may act only on your own behalf and on your sole responsibility, not on behalf of the original Licensor or any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against such Contributor by the fact You have accepted any such warranty or additional liability.
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author 10. Acceptance of the Licence
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate The provisions of this Licence can be accepted by clicking on an icon "I agree" placed under the bottom of a window displaying the text of this Licence or by affirming consent in any other similar way, in accordance with the rules of applicable law. Clicking on that icon indicates your clear and irrevocable acceptance of this Licence and all of its terms and conditions.
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your Similarly, you irrevocably accept this Licence and all of its terms and conditions by exercising any rights granted to You by Article 2 of this Licence, such as the use of the Work, the creation by You of a Derivative Work or the Distribution and/or Communication by You of the Work or copies thereof.
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program 11. Information to the public
`Gnomovision' (which makes passes at compilers) written by James Hacker.
{signature of Ty Coon}, 1 April 1989 In case of any Distribution and/or Communication of the Work by means of electronic communication by You (for example, by offering to download the Work from a remote location) the distribution channel or media (for example, a website) must at least provide to the public the information requested by the applicable law regarding the Licensor, the Licence and the way it may be accessible, concluded, stored and reproduced by the Licensee.
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into 12. Termination of the Licence
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the The Licence and the rights granted hereunder will terminate automatically upon any breach by the Licensee of the terms of the Licence.
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. Such a termination will not terminate the licences of any person who has received the Work from the Licensee under the Licence, provided such persons remain in full compliance with the Licence.
13. Miscellaneous
Without prejudice of Article 9 above, the Licence represents the complete agreement between the Parties as to the Work licensed hereunder.
If any provision of the Licence is invalid or unenforceable under applicable law, this will not affect the validity or enforceability of the Licence as a whole. Such provision will be construed and/or reformed so as necessary to make it valid and enforceable.
The European Commission may publish other linguistic versions and/or new versions of this Licence, so far this is required and reasonable, without reducing the scope of the rights granted by the Licence. New versions of the Licence will be published with a unique version number.
All linguistic versions of this Licence, approved by the European Commission, have identical value. Parties can take advantage of the linguistic version of their choice.
14. Jurisdiction
Any litigation resulting from the interpretation of this License, arising between the European Commission, as a Licensor, and any Licensee, will be subject to the jurisdiction of the Court of Justice of the European Communities, as laid down in article 238 of the Treaty establishing the European Community.
Any litigation arising between Parties, other than the European Commission, and resulting from the interpretation of this License, will be subject to the exclusive jurisdiction of the competent court where the Licensor resides or conducts its primary business.
15. Applicable Law
This Licence shall be governed by the law of the European Union country where the Licensor resides or has his registered office.
This licence shall be governed by the Belgian law if:
- a litigation arises between the European Commission, as a Licensor, and any Licensee;
- the Licensor, other than the European Commission, has no residence or registered office inside a European Union country.
===
Appendix
"Compatible Licences" according to article 5 EUPL are:
- GNU General Public License (GNU GPL) v. 2
- Open Software License (OSL) v. 2.1, v. 3.0
- Common Public License v. 1.0
- Eclipse Public License v. 1.0
- Cecill v. 2.0

View file

@ -139,6 +139,7 @@ You can view [real-time stats](https://discourse.pi-hole.net/t/how-do-i-view-my-
## Pi-hole Projects ## Pi-hole Projects
- [An ad blocking Magic Mirror](https://zonksec.com/blog/magic-mirror-dns-filtering/#dnssoftware)
- [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)
- [Get LED alerts for each blocked ad](http://thetimmy.silvernight.org/pages/endisbutton/) - [Get LED alerts for each blocked ad](http://thetimmy.silvernight.org/pages/endisbutton/)
- [Pi-hole on Ubuntu 14.04 on VirtualBox](http://hbalagtas.blogspot.com/2016/02/adblocking-with-pi-hole-and-ubuntu-1404.html) - [Pi-hole on Ubuntu 14.04 on VirtualBox](http://hbalagtas.blogspot.com/2016/02/adblocking-with-pi-hole-and-ubuntu-1404.html)
@ -154,6 +155,7 @@ You can view [real-time stats](https://discourse.pi-hole.net/t/how-do-i-view-my-
- [Windows Tray Stat Application](https://github.com/goldbattle/copernicus) - [Windows Tray Stat Application](https://github.com/goldbattle/copernicus)
- [Let your blink1 device blink when Pi-hole filters ads](https://gist.github.com/elpatron68/ec0b4c582e5abf604885ac1e068d233f) - [Let your blink1 device blink when Pi-hole filters ads](https://gist.github.com/elpatron68/ec0b4c582e5abf604885ac1e068d233f)
- [Pi-Hole Prometheus exporter](https://github.com/nlamirault/pihole_exporter) : a [Prometheus](https://prometheus.io/) exporter for Pi-Hole - [Pi-Hole Prometheus exporter](https://github.com/nlamirault/pihole_exporter) : a [Prometheus](https://prometheus.io/) exporter for Pi-Hole
- [Pi-hole Droid - open source Android client](https://github.com/friimaind/pi-hole-droid)
## Coverage ## Coverage

View file

@ -14,7 +14,7 @@
https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
# Other lists we consider safe: # Other lists we consider safe:
http://mirror1.malwaredomains.com/files/justdomains https://mirror1.malwaredomains.com/files/justdomains
http://sysctl.org/cameleon/hosts http://sysctl.org/cameleon/hosts
https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist
https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt
@ -25,7 +25,7 @@ https://hosts-file.net/ad_servers.txt
# Mahakala list. Has been known to block legitimate domains including the entire .com range. # Mahakala list. Has been known to block legitimate domains including the entire .com range.
# Warning: Due to the sheer size of this list, the web admin console will be unresponsive. # Warning: Due to the sheer size of this list, the web admin console will be unresponsive.
#http://adblock.mahakala.is/ #https://adblock.mahakala.is/
# ADZHOSTS list. Has been known to block legitimate domains # ADZHOSTS list. Has been known to block legitimate domains
#http://pilotfiber.dl.sourceforge.net/project/adzhosts/HOSTS.txt #http://pilotfiber.dl.sourceforge.net/project/adzhosts/HOSTS.txt

View file

@ -32,8 +32,6 @@ no-resolv
server=@DNS1@ server=@DNS1@
server=@DNS2@ server=@DNS2@
interface=@INT@
cache-size=10000 cache-size=10000
log-queries log-queries

View file

@ -1,14 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Pi-hole: A black hole for Internet advertisements # Pi-hole: A black hole for Internet advertisements
# (c) 2015, 2016 by Jacob Salmela # (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your Raspberry Pi # Network-wide ad blocking via your own hardware.
# http://pi-hole.net #
# Calculates stats and displays to an LCD # Calculates stats and displays to an LCD
# #
# Pi-hole is free software: you can redistribute it and/or modify # This file is copyright under the latest version of the EUPL.
# it under the terms of the GNU General Public License as published by # Please see LICENSE file for your rights under this license.
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#Functions############################################################################################################## #Functions##############################################################################################################

View file

@ -1,14 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Pi-hole: A black hole for Internet advertisements # Pi-hole: A black hole for Internet advertisements
# (c) 2015, 2016 by Jacob Salmela # (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your Raspberry Pi # Network-wide ad blocking via your own hardware.
# http://pi-hole.net #
# Whitelists and blacklists domains # Whitelists and blacklists domains
# #
# Pi-hole is free software: you can redistribute it and/or modify # This file is copyright under the latest version of the EUPL.
# it under the terms of the GNU General Public License as published by # Please see LICENSE file for your rights under this license.
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#globals #globals
basename=pihole basename=pihole

View file

@ -1,14 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Pi-hole: A black hole for Internet advertisements # Pi-hole: A black hole for Internet advertisements
# (c) 2015, 2016 by Jacob Salmela # (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your Raspberry Pi # Network-wide ad blocking via your own hardware.
# http://pi-hole.net #
# Generates pihole_debug.log to be used for troubleshooting. # Generates pihole_debug.log to be used for troubleshooting.
# #
# Pi-hole is free software: you can redistribute it and/or modify # This file is copyright under the latest version of the EUPL.
# it under the terms of the GNU General Public License as published by # Please see LICENSE file for your rights under this license.
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
set -o pipefail set -o pipefail
@ -26,7 +26,6 @@ ADLISTFILE="/etc/pihole/adlists.list"
PIHOLELOG="/var/log/pihole.log" PIHOLELOG="/var/log/pihole.log"
WHITELISTMATCHES="/tmp/whitelistmatches.list" WHITELISTMATCHES="/tmp/whitelistmatches.list"
IPV6_READY=false
TIMEOUT=60 TIMEOUT=60
# Header info and introduction # Header info and introduction
cat << EOM cat << EOM
@ -180,72 +179,69 @@ processor_check() {
ipv6_check() { ipv6_check() {
# Check if system is IPv6 enabled, for use in other functions # Check if system is IPv6 enabled, for use in other functions
if [[ $IPv6_address ]]; then if [[ $IPV6_ADDRESS ]]; then
ls /proc/net/if_inet6 &>/dev/null && IPV6_READY=true ls /proc/net/if_inet6 &>/dev/null
return 0 return 0
else else
return 1 return 1
fi fi
} }
ip_check() { ip_check() {
header_write "IP Address Information" local protocol=${1}
# Get the current interface for Internet traffic local gravity=${2}
# Check if IPv6 enabled
local IPv6_interface
local IPv4_interface
ipv6_check && IPv6_interface=${piholeInterface:-$(ip -6 r | grep default | cut -d ' ' -f 5)}
# If declared in setupVars.conf use it, otherwise defer to default
# http://stackoverflow.com/questions/2013547/assigning-default-values-to-shell-variables-with-a-single-command-in-bash
IPv4_interface=${piholeInterface:-$(ip r | grep default | cut -d ' ' -f 5)}
if [[ IPV6_READY ]]; then
local IPv6_addr_list="$(ip a | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "inet6") print $(i+1) }')" \
&& (log_write "${IPv6_addr_list}" && echo "::: IPv6 addresses located") \
|| log_echo "No IPv6 addresses found."
local IPv6_def_gateway=$(ip -6 r | grep default | cut -d ' ' -f 3)
if [[ $? = 0 ]] && [[ -n ${IPv6_def_gateway} ]]; then
echo -n "::: Pinging default IPv6 gateway: "
local IPv6_def_gateway_check="$(ping6 -q -W 3 -c 3 -n "${IPv6_def_gateway}" -I "${IPv6_interface}"| tail -n3)" \
&& echo "Gateway Responded." \
|| echo "Gateway did not respond."
block_parse "${IPv6_def_gateway_check}"
echo -n "::: Pinging Internet via IPv6: "
local IPv6_inet_check=$(ping6 -q -W 3 -c 3 -n 2001:4860:4860::8888 -I "${IPv6_interface}"| tail -n3) \
&& echo "Query responded." \
|| echo "Query did not respond."
block_parse "${IPv6_inet_check}"
else
log_echo="No IPv6 Gateway Detected"
fi
local IPv4_addr_list="$(ip a | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "inet") print $(i+1) }')" \
&& (block_parse "${IPv4_addr_list}" && echo "::: IPv4 addresses located")\
|| log_echo "No IPv4 addresses found."
local IPv4_def_gateway=$(ip r | grep default | cut -d ' ' -f 3)
if [[ $? = 0 ]]; then
echo -n "::: Pinging default IPv4 gateway: "
local IPv4_def_gateway_check="$(ping -q -w 3 -c 3 -n "${IPv4_def_gateway}" -I "${IPv4_interface}" | tail -n3)" \
&& echo "Gateway responded." \
|| echo "Gateway did not respond."
block_parse "${IPv4_def_gateway_check}"
echo -n "::: Pinging Internet via IPv4: "
local IPv4_inet_check="$(ping -q -w 5 -c 3 -n 8.8.8.8 -I "${IPv4_interface}" | tail -n3)" \
&& echo "Query responded." \
|| echo "Query did not respond."
block_parse "${IPv4_inet_check}"
fi
local ip_addr_list="$(ip -${protocol} addr show dev ${PIHOLE_INTERFACE} | awk -F ' ' '{ for(i=1;i<=NF;i++) if ($i ~ '/^inet/') print $(i+1) }')"
if [[ -n ${ip_addr_list} ]]; then
log_write "IPv${protocol} on ${PIHOLE_INTERFACE}"
log_write "Gravity configured for: ${2:-NOT CONFIGURED}"
log_write "----"
log_write "${ip_addr_list}"
echo "::: IPv${protocol} addresses located on ${PIHOLE_INTERFACE}"
ip_ping_check ${protocol}
return $(( 0 + $? ))
else
log_echo "No IPv${protocol} found on ${PIHOLE_INTERFACE}"
return 1
fi fi
} }
ip_ping_check() {
local protocol=${1}
local cmd
if [[ ${protocol} == "6" ]]; then
cmd="ping6"
g_addr="2001:4860:4860::8888"
else
cmd="ping"
g_addr="8.8.8.8"
fi
local ip_def_gateway=$(ip -${protocol} route | grep default | cut -d ' ' -f 3)
if [[ -n ${ip_def_gateway} ]]; then
echo -n "::: Pinging default IPv${protocol} gateway: "
if ! ping_gateway="$(${cmd} -q -W 3 -c 3 -n ${ip_def_gateway} -I ${PIHOLE_INTERFACE} | tail -n 3)"; then
echo "Gateway did not respond."
return 1
else
echo "Gateway responded."
log_write "${ping_gateway}"
fi
echo -n "::: Pinging Internet via IPv${protocol}: "
if ! ping_inet="$(${cmd} -q -W 3 -c 3 -n ${g_addr} -I ${PIHOLE_INTERFACE} | tail -n 3)"; then
echo "Query did not respond."
return 1
else
echo "Query responded."
log_write "${ping_inet}"
fi
else
log_echo " No gateway detected."
fi
return 0
}
port_check() { port_check() {
local lsof_value local lsof_value
@ -336,11 +332,17 @@ debugLighttpd() {
} }
countdown() { countdown() {
local tuvix
tuvix=${TIMEOUT} tuvix=${TIMEOUT}
printf "::: Logging will automatically teminate in ${TIMEOUT} seconds\n" printf "::: Logging will automatically teminate in %s seconds\n" "${TIMEOUT}"
while [ $tuvix -ge 1 ] while [ $tuvix -ge 1 ]
do do
printf ":::\t${tuvix} seconds left. \r" printf ":::\t%s seconds left. " "${tuvix}"
if [[ -z "${WEBCALL}" ]]; then
printf "\r"
else
printf "\n"
fi
sleep 5 sleep 5
tuvix=$(( tuvix - 5 )) tuvix=$(( tuvix - 5 ))
done done
@ -356,7 +358,8 @@ distro_check || echo "Distro Check soft fail"
# Gather processor type # Gather processor type
processor_check || echo "Processor Check soft fail" processor_check || echo "Processor Check soft fail"
ip_check ip_check 6 ${IPV6_ADDRESS}
ip_check 4 ${IPV4_ADDRESS}
daemon_check lighttpd http daemon_check lighttpd http
daemon_check dnsmasq domain daemon_check dnsmasq domain
@ -411,20 +414,24 @@ finalWork() {
local tricorder local tricorder
echo "::: Finshed debugging!" echo "::: Finshed debugging!"
echo "::: The debug log can be uploaded to tricorder.pi-hole.net for sharing with developers only." echo "::: The debug log can be uploaded to tricorder.pi-hole.net for sharing with developers only."
read -r -p "::: Would you like to upload the log? [y/N] " response if [[ "${AUTOMATED}" ]]; then
case ${response} in echo "::: Debug script running in automated mode, uploading log to tricorder..."
[yY][eE][sS]|[yY]) tricorder=$(cat /var/log/pihole_debug.log | nc tricorder.pi-hole.net 9999)
tricorder=$(cat /var/log/pihole_debug.log | nc tricorder.pi-hole.net 9999) else
;; read -r -p "::: Would you like to upload the log? [y/N] " response
*) case ${response} in
echo "::: Log will NOT be uploaded to tricorder." [yY][eE][sS]|[yY])
;; tricorder=$(cat /var/log/pihole_debug.log | nc tricorder.pi-hole.net 9999)
esac ;;
*)
echo "::: Log will NOT be uploaded to tricorder."
;;
esac
fi
# Check if tricorder.pi-hole.net is reachable and provide token. # Check if tricorder.pi-hole.net is reachable and provide token.
if [ -n "${tricorder}" ]; then if [ -n "${tricorder}" ]; then
echo "::: Your debug token is : ${tricorder}" echo "::: ---=== Your debug token is : ${tricorder} Please make a note of it. ===---"
echo "::: Please contact the Pi-hole team with your token for assistance." echo "::: Contact the Pi-hole team with your token for assistance."
echo "::: Thank you." echo "::: Thank you."
else else
echo "::: There was an error uploading your debug log." echo "::: There was an error uploading your debug log."

View file

@ -1,14 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Pi-hole: A black hole for Internet advertisements # Pi-hole: A black hole for Internet advertisements
# (c) 2015, 2016 by Jacob Salmela # (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your Raspberry Pi # Network-wide ad blocking via your own hardware.
# http://pi-hole.net #
# Flushes /var/log/pihole.log # Flushes /var/log/pihole.log
# #
# Pi-hole is free software: you can redistribute it and/or modify # This file is copyright under the latest version of the EUPL.
# it under the terms of the GNU General Public License as published by # Please see LICENSE file for your rights under this license.
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
echo -n "::: Flushing /var/log/pihole.log ..." echo -n "::: Flushing /var/log/pihole.log ..."
# Test if logrotate is available on this system # Test if logrotate is available on this system

View file

@ -1,14 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Pi-hole: A black hole for Internet advertisements # Pi-hole: A black hole for Internet advertisements
# (c) 2015 by Jacob Salmela # (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your Raspberry Pi # Network-wide ad blocking via your own hardware.
# http://pi-hole.net #
# Automatically configures the Pi to use the 2.8 LCD screen to display stats on it (also works over ssh) # Automatically configures the Pi to use the 2.8 LCD screen to display stats on it (also works over ssh)
# #
# Pi-hole is free software: you can redistribute it and/or modify # This file is copyright under the latest version of the EUPL.
# it under the terms of the GNU General Public License as published by # Please see LICENSE file for your rights under this license.
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
############ FUNCTIONS ########### ############ FUNCTIONS ###########

View file

@ -1,16 +1,16 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Pi-hole: A black hole for Internet advertisements # Pi-hole: A black hole for Internet advertisements
# (c) 2015, 2016 by Jacob Salmela # (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your Raspberry Pi # Network-wide ad blocking via your own hardware.
# http://pi-hole.net #
# Check Pi-hole core and admin pages versions and determine what # Check Pi-hole core and admin pages versions and determine what
# upgrade (if any) is required. Automatically updates and reinstalls # upgrade (if any) is required. Automatically updates and reinstalls
# application if update is detected. # application if update is detected.
# #
# Pi-hole is free software: you can redistribute it and/or modify # This file is copyright under the latest version of the EUPL.
# it under the terms of the GNU General Public License as published by # Please see LICENSE file for your rights under this license.
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Variables # Variables

View file

@ -1,14 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Pi-hole: A black hole for Internet advertisements # Pi-hole: A black hole for Internet advertisements
# (c) 2015, 2016 by Jacob Salmela # (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your Raspberry Pi # Network-wide ad blocking via your own hardware.
# http://pi-hole.net #
# shows version numbers # shows version numbers
# #
# Pi-hole is free software: you can redistribute it and/or modify # This file is copyright under the latest version of the EUPL.
# it under the terms of the GNU General Public License as published by # Please see LICENSE file for your rights under this license.
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Flags: # Flags:
latest=false latest=false

View file

@ -1,13 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Pi-hole: A black hole for Internet advertisements # Pi-hole: A black hole for Internet advertisements
# Network-wide ad blocking via your Raspberry Pi # (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# http://pi-hole.net # Network-wide ad blocking via your own hardware.
#
# Web interface settings # Web interface settings
# #
# Pi-hole is free software: you can redistribute it and/or modify # This file is copyright under the latest version of the EUPL.
# it under the terms of the GNU General Public License as published by # Please see LICENSE file for your rights under this license.
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
readonly setupVars="/etc/pihole/setupVars.conf" readonly setupVars="/etc/pihole/setupVars.conf"
readonly dnsmasqconfig="/etc/dnsmasq.d/01-pihole.conf" readonly dnsmasqconfig="/etc/dnsmasq.d/01-pihole.conf"
@ -27,6 +27,11 @@ helpFunc() {
::: -f, fahrenheit Set Fahrenheit temperature unit ::: -f, fahrenheit Set Fahrenheit temperature unit
::: -k, kelvin Set Kelvin temperature unit ::: -k, kelvin Set Kelvin temperature unit
::: -h, --help Show this help dialog ::: -h, --help Show this help dialog
::: -i, interface Setup interface listening behavior of dnsmasq
::: pihole -a -i local : Listen on all interfaces, but allow only queries from
::: devices that are at most one hop away (local devices)
::: pihole -a -i single : Listen only on one interface (see PIHOLE_INTERFACE)
::: pihole -a -i all : Listen on all interfaces, permit all origins
EOM EOM
exit 0 exit 0
} }
@ -127,6 +132,29 @@ trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE3
" >> "${dnsmasqconfig}" " >> "${dnsmasqconfig}"
fi fi
delete_dnsmasq_setting "host-record"
if [ ! -z "${HOSTRECORD+x}" ]; then
add_dnsmasq_setting "host-record" "${HOSTRECORD}"
fi
# Setup interface listening behavior of dnsmasq
delete_dnsmasq_setting "interface"
delete_dnsmasq_setting "local-service"
if [[ "${DNSMASQ_LISTENING}" == "all" ]]; then
# Listen on all interfaces, permit all origins
# Leave a comment in 01-pihole.conf
add_dnsmasq_setting "# Listening on all interfaces"
add_dnsmasq_setting "except-interface" "nonexisting"
elif [[ "${DNSMASQ_LISTENING}" == "single" ]]; then
# Listen only on one interface
add_dnsmasq_setting "interface" "${PIHOLE_INTERFACE}"
else
# Listen only on all interfaces, but only local subnets
add_dnsmasq_setting "local-service"
fi
} }
SetDNSServers(){ SetDNSServers(){
@ -313,6 +341,7 @@ ResolutionSettings() {
elif [[ "${typ}" == "clients" ]]; then elif [[ "${typ}" == "clients" ]]; then
change_setting "API_GET_CLIENT_HOSTNAME" "${state}" change_setting "API_GET_CLIENT_HOSTNAME" "${state}"
fi fi
} }
AddDHCPStaticAddress() { AddDHCPStaticAddress() {
@ -331,6 +360,7 @@ AddDHCPStaticAddress() {
# Full info given # Full info given
echo "dhcp-host=${mac},${ip},${host}" >> "${dhcpstaticconfig}" echo "dhcp-host=${mac},${ip},${host}" >> "${dhcpstaticconfig}"
fi fi
} }
RemoveDHCPStaticAddress() { RemoveDHCPStaticAddress() {
@ -340,6 +370,48 @@ RemoveDHCPStaticAddress() {
} }
SetHostRecord(){
if [ -n "${args[3]}" ]; then
change_setting "HOSTRECORD" "${args[2]},${args[3]}"
echo "Setting host record for ${args[2]} -> ${args[3]}"
else
change_setting "HOSTRECORD" ""
echo "Removing host record"
fi
ProcessDNSSettings
# Restart dnsmasq to load new configuration
RestartDNS
}
SetListeningMode(){
source "${setupVars}"
if [[ "${args[2]}" == "all" ]] ; then
echo "Listening on all interfaces, permiting all origins, hope you have a firewall!"
change_setting "DNSMASQ_LISTENING" "all"
elif [[ "${args[2]}" == "single" ]] ; then
echo "Listening only on interface ${PIHOLE_INTERFACE}"
change_setting "DNSMASQ_LISTENING" "single"
else
echo "Listening on all interfaces, permitting only origins that are at most one hop away (local devices)"
change_setting "DNSMASQ_LISTENING" "local"
fi
# Don't restart DNS server yet because other settings
# will be applied afterwards if "-web" is set
if [[ "${args[3]}" != "-web" ]]; then
ProcessDNSSettings
# Restart dnsmasq to load new configuration
RestartDNS
fi
}
main() { main() {
args=("$@") args=("$@")
@ -363,6 +435,8 @@ main() {
"resolve" ) ResolutionSettings;; "resolve" ) ResolutionSettings;;
"addstaticdhcp" ) AddDHCPStaticAddress;; "addstaticdhcp" ) AddDHCPStaticAddress;;
"removestaticdhcp" ) RemoveDHCPStaticAddress;; "removestaticdhcp" ) RemoveDHCPStaticAddress;;
"hostrecord" ) SetHostRecord;;
"-i" | "interface" ) SetListeningMode;;
* ) helpFunc;; * ) helpFunc;;
esac esac

View file

@ -1,13 +1,13 @@
# Pi-hole: A black hole for Internet advertisements # Pi-hole: A black hole for Internet advertisements
# (c) 2015, 2016 by Jacob Salmela # (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your Raspberry Pi # Network-wide ad blocking via your own hardware.
# http://pi-hole.net #
# lighttpd config for Pi-hole # lighttpd config for Pi-hole
# #
# Pi-hole is free software: you can redistribute it and/or modify # This file is copyright under the latest version of the EUPL.
# it under the terms of the GNU General Public License as published by # Please see LICENSE file for your rights under this license.
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
############################################################################### ###############################################################################
# FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL/UPDATE PROCEDURE. # # FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL/UPDATE PROCEDURE. #
@ -70,5 +70,12 @@ $HTTP["url"] =~ "^(?!/admin)/.*" {
setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." ) setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." )
} }
# Entering just "pi.hole" into a browser redirects to "pi.hole/admin/"
$HTTP["host"] == "pi.hole" {
$HTTP["url"] == "/" {
url.redirect = ( "" => "/admin/" )
}
}
# Add user chosen options held in external file # Add user chosen options held in external file
include_shell "cat external.conf 2>/dev/null" include_shell "cat external.conf 2>/dev/null"

View file

@ -1,13 +1,13 @@
# Pi-hole: A black hole for Internet advertisements # Pi-hole: A black hole for Internet advertisements
# (c) 2015, 2016 by Jacob Salmela # (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your Raspberry Pi # Network-wide ad blocking via your own hardware.
# http://pi-hole.net #
# lighttpd config for Pi-hole # lighttpd config for Pi-hole
# #
# Pi-hole is free software: you can redistribute it and/or modify # This file is copyright under the latest version of the EUPL.
# it under the terms of the GNU General Public License as published by # Please see LICENSE file for your rights under this license.
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
############################################################################### ###############################################################################
# FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL/UPDATE PROCEDURE. # # FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL/UPDATE PROCEDURE. #
@ -87,5 +87,12 @@ $HTTP["url"] =~ "^(?!/admin)/.*" {
setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." ) setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." )
} }
# Entering just "pi.hole" into a browser redirects to "pi.hole/admin/"
$HTTP["host"] == "pi.hole" {
$HTTP["url"] == "/" {
url.redirect = ( "" => "/admin/" )
}
}
# Add user chosen options held in external file # Add user chosen options held in external file
include_shell "cat external.conf 2>/dev/null" include_shell "cat external.conf 2>/dev/null"

View file

@ -1,13 +1,13 @@
# Pi-hole: A black hole for Internet advertisements # Pi-hole: A black hole for Internet advertisements
# (c) 2015, 2016 by Jacob Salmela # (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your Raspberry Pi # Network-wide ad blocking via your own hardware.
# http://pi-hole.net #
# Updates ad sources every week # Updates ad sources every week
# #
# Pi-hole is free software: you can redistribute it and/or modify # This file is copyright under the latest version of the EUPL.
# it under the terms of the GNU General Public License as published by # Please see LICENSE file for your rights under this license.
# the Free Software Foundation, either version 2 of the License, or #
# (at your option) any later version. #
# #
# This file is under source-control of the Pi-hole installation and update # This file is under source-control of the Pi-hole installation and update
# scripts, any changes made to this file will be overwritten when the softare # scripts, any changes made to this file will be overwritten when the softare

View file

@ -1,11 +1,9 @@
# Pi-hole: A black hole for Internet advertisements # Pi-hole: A black hole for Internet advertisements
# (c) 2015, 2016 by Jacob Salmela # (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your Raspberry Pi # Network-wide ad blocking via your own hardware.
# http://pi-hole.net #
# Allows the WebUI to use Pi-hole commands # Allows the WebUI to use Pi-hole commands
# #
# Pi-hole is free software: you can redistribute it and/or modify # This file is copyright under the latest version of the EUPL.
# it under the terms of the GNU General Public License as published by # Please see LICENSE file for your rights under this license.
# the Free Software Foundation, either version 2 of the License, or #
# (at your option) any later version.

View file

@ -1,14 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Pi-hole: A black hole for Internet advertisements # Pi-hole: A black hole for Internet advertisements
# (c) 2015, 2016 by Jacob Salmela # (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your Raspberry Pi # Network-wide ad blocking via your own hardware.
# http://pi-hole.net #
# Installs Pi-hole # Installs Pi-hole
# #
# Pi-hole is free software: you can redistribute it and/or modify # This file is copyright under the latest version of the EUPL.
# it under the terms of the GNU General Public License as published by # Please see LICENSE file for your rights under this license.
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# pi-hole.net/donate # pi-hole.net/donate
# #
@ -451,6 +451,7 @@ setDNS() {
Level3 "" Level3 ""
Norton "" Norton ""
Comodo "" Comodo ""
DNSWatch ""
Custom "") Custom "")
DNSchoices=$(whiptail --separate-output --menu "Select Upstream DNS Provider. To use your own, select Custom." ${r} ${c} 6 \ DNSchoices=$(whiptail --separate-output --menu "Select Upstream DNS Provider. To use your own, select Custom." ${r} ${c} 6 \
"${DNSChooseOptions[@]}" 2>&1 >/dev/tty) || \ "${DNSChooseOptions[@]}" 2>&1 >/dev/tty) || \
@ -481,6 +482,11 @@ setDNS() {
PIHOLE_DNS_1="8.26.56.26" PIHOLE_DNS_1="8.26.56.26"
PIHOLE_DNS_2="8.20.247.20" PIHOLE_DNS_2="8.20.247.20"
;; ;;
DNSWatch)
echo "::: Using DNS.WATCH servers."
PIHOLE_DNS_1="84.200.69.80"
PIHOLE_DNS_2="84.200.70.40"
;;
Custom) Custom)
until [[ ${DNSSettingsCorrect} = True ]]; do until [[ ${DNSSettingsCorrect} = True ]]; do
strInvalid="Invalid" strInvalid="Invalid"
@ -602,7 +608,6 @@ version_check_dnsmasq() {
echo -n "::: Copying 01-pihole.conf to /etc/dnsmasq.d/01-pihole.conf..." echo -n "::: Copying 01-pihole.conf to /etc/dnsmasq.d/01-pihole.conf..."
cp ${dnsmasq_pihole_01_snippet} ${dnsmasq_pihole_01_location} cp ${dnsmasq_pihole_01_snippet} ${dnsmasq_pihole_01_location}
echo " done." echo " done."
sed -i "s/@INT@/$PIHOLE_INTERFACE/" ${dnsmasq_pihole_01_location}
if [[ "${PIHOLE_DNS_1}" != "" ]]; then if [[ "${PIHOLE_DNS_1}" != "" ]]; then
sed -i "s/@DNS1@/$PIHOLE_DNS_1/" ${dnsmasq_pihole_01_location} sed -i "s/@DNS1@/$PIHOLE_DNS_1/" ${dnsmasq_pihole_01_location}
else else
@ -958,7 +963,7 @@ finalExports() {
# Update variables in setupVars.conf file # Update variables in setupVars.conf file
if [ -e "${setupVars}" ]; then if [ -e "${setupVars}" ]; then
sed -i.update.bak '/PIHOLE_INTERFACE/d;/IPV4_ADDRESS/d;/IPV6_ADDRESS/d;/PIHOLE_DNS_1/d;/PIHOLE_DNS_2/d;/QUERY_LOGGING/d;' "${setupVars}" sed -i.update.bak '/PIHOLE_INTERFACE/d;/IPV4_ADDRESS/d;/IPV6_ADDRESS/d;/PIHOLE_DNS_1/d;/PIHOLE_DNS_2/d;/QUERY_LOGGING/d;/INSTALL_WEB/d;' "${setupVars}"
fi fi
{ {
echo "PIHOLE_INTERFACE=${PIHOLE_INTERFACE}" echo "PIHOLE_INTERFACE=${PIHOLE_INTERFACE}"

View file

@ -1,14 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Pi-hole: A black hole for Internet advertisements # Pi-hole: A black hole for Internet advertisements
# (c) 2015, 2016 by Jacob Salmela # (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your Raspberry Pi # Network-wide ad blocking via your own hardware.
# http://pi-hole.net #
# Completely uninstalls Pi-hole # Completely uninstalls Pi-hole
# #
# Pi-hole is free software: you can redistribute it and/or modify # This file is copyright under the latest version of the EUPL.
# it under the terms of the GNU General Public License as published by # Please see LICENSE file for your rights under this license.
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Must be root to uninstall # Must be root to uninstall
if [[ ${EUID} -eq 0 ]]; then if [[ ${EUID} -eq 0 ]]; then
@ -164,7 +164,7 @@ removeNoPurge() {
echo ":::" echo ":::"
printf "::: Finished removing PiHole from your system. Sorry to see you go!\n" printf "::: Finished removing PiHole from your system. Sorry to see you go!\n"
printf "::: Reach out to us at https://github.com/pi-hole/pi-hole/issues if you need help\n" printf "::: Reach out to us at https://github.com/pi-hole/pi-hole/issues if you need help\n"
printf "::: Reinstall by simpling running\n:::\n:::\tcurl -L https://install.pi-hole.net | bash\n:::\n::: at any time!\n:::\n" printf "::: Reinstall by simpling running\n:::\n:::\tcurl -sSL https://install.pi-hole.net | bash\n:::\n::: at any time!\n:::\n"
printf "::: PLEASE RESET YOUR DNS ON YOUR ROUTER/CLIENTS TO RESTORE INTERNET CONNECTIVITY!\n" printf "::: PLEASE RESET YOUR DNS ON YOUR ROUTER/CLIENTS TO RESTORE INTERNET CONNECTIVITY!\n"
} }

View file

@ -1,14 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Pi-hole: A black hole for Internet advertisements # Pi-hole: A black hole for Internet advertisements
# (c) 2015 by Jacob Salmela # (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your Raspberry Pi # Network-wide ad blocking via your own hardware.
# http://pi-hole.net #
# Compiles a list of ad-serving domains by downloading them from multiple sources # Compiles a list of ad-serving domains by downloading them from multiple sources
# #
# Pi-hole is free software: you can redistribute it and/or modify # This file is copyright under the latest version of the EUPL.
# it under the terms of the GNU General Public License as published by # Please see LICENSE file for your rights under this license.
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Run this script as root or under sudo # Run this script as root or under sudo
echo ":::" echo ":::"

38
pihole
View file

@ -1,14 +1,14 @@
#!/bin/bash #!/bin/bash
# Pi-hole: A black hole for Internet advertisements # Pi-hole: A black hole for Internet advertisements
# (c) 2015, 2016 by Jacob Salmela # (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your Raspberry Pi # Network-wide ad blocking via your own hardware.
# http://pi-hole.net #
# Controller for all pihole scripts and functions. # Controller for all pihole scripts and functions.
# #
# Pi-hole is free software: you can redistribute it and/or modify # This file is copyright under the latest version of the EUPL.
# it under the terms of the GNU General Public License as published by # Please see LICENSE file for your rights under this license.
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
PI_HOLE_SCRIPT_DIR="/opt/pihole" PI_HOLE_SCRIPT_DIR="/opt/pihole"
readonly wildcardlist="/etc/dnsmasq.d/03-pihole-wildcard.conf" readonly wildcardlist="/etc/dnsmasq.d/03-pihole-wildcard.conf"
@ -45,7 +45,19 @@ wildcardFunc() {
} }
debugFunc() { debugFunc() {
"${PI_HOLE_SCRIPT_DIR}"/piholeDebug.sh local automated
local web
# Pull off the `debug` leaving passed call augmentation flags in $1
shift
if [[ "$@" == *"-a"* ]]; then
automated="true"
fi
if [[ "$@" == *"-w"* ]]; then
web="true"
fi
AUTOMATED=${automated:-} WEBCALL=${web:-} "${PI_HOLE_SCRIPT_DIR}"/piholeDebug.sh
exit 0 exit 0
} }
@ -278,6 +290,8 @@ helpFunc() {
::: -b, blacklist Blacklist domain(s) (exact match) ::: -b, blacklist Blacklist domain(s) (exact match)
::: -wild, wildcard Blacklist whole domain(s) (wildcard) ::: -wild, wildcard Blacklist whole domain(s) (wildcard)
::: -d, debug Start a debugging session ::: -d, debug Start a debugging session
::: Automated debugging can be enabled with `-a`.
::: 'pihole -d -a'
::: -f, flush Flush the 'pihole.log' file ::: -f, flush Flush the 'pihole.log' file
::: -t, tail Output the last lines of the 'pihole.log' file. Lines are appended as the file grows ::: -t, tail Output the last lines of the 'pihole.log' file. Lines are appended as the file grows
::: -up, updatePihole Update Pi-hole components ::: -up, updatePihole Update Pi-hole components
@ -287,15 +301,15 @@ helpFunc() {
::: -h, help Show this help dialog ::: -h, help Show this help dialog
::: -v, version Show installed versions of Pi-Hole and Web-Admin ::: -v, version Show installed versions of Pi-Hole and Web-Admin
::: -q, query Query the adlists for a specific domain ::: -q, query Query the adlists for a specific domain
::: Use 'pihole -q domain -exact' if you want to see exact matches only ::: 'pihole -q domain -exact' shows exact matches only
::: -l, logging Enable or Disable logging (pass 'on' or 'off') ::: -l, logging Enable or Disable logging (pass 'on' or 'off')
::: -a, admin Admin webpage options ::: -a, admin Admin webpage options
::: uninstall Uninstall Pi-Hole from your system :(! ::: uninstall Uninstall Pi-Hole from your system :(!
::: status Is Pi-Hole Enabled or Disabled ::: status Is Pi-Hole Enabled or Disabled
::: enable Enable Pi-Hole DNS Blocking ::: enable Enable Pi-Hole DNS Blocking
::: disable Disable Pi-Hole DNS Blocking ::: disable Disable Pi-Hole DNS Blocking
::: Blocking can also be disabled only temporarily, e.g., ::: Blocking can also be disabled only temporarily, e.g.,
::: 'pihole disable 5m' - will disable blocking for 5 minutes ::: 'pihole disable 5m' - will disable blocking for 5 minutes
::: restartdns Restart dnsmasq ::: restartdns Restart dnsmasq
EOM EOM
exit 0 exit 0
@ -310,7 +324,7 @@ case "${1}" in
"-w" | "whitelist" ) whitelistFunc "$@";; "-w" | "whitelist" ) whitelistFunc "$@";;
"-b" | "blacklist" ) blacklistFunc "$@";; "-b" | "blacklist" ) blacklistFunc "$@";;
"-wild" | "wildcard" ) wildcardFunc "$@";; "-wild" | "wildcard" ) wildcardFunc "$@";;
"-d" | "debug" ) debugFunc;; "-d" | "debug" ) debugFunc "$@";;
"-f" | "flush" ) flushFunc;; "-f" | "flush" ) flushFunc;;
"-up" | "updatePihole" ) updatePiholeFunc;; "-up" | "updatePihole" ) updatePiholeFunc;;
"-r" | "reconfigure" ) reconfigurePiholeFunc;; "-r" | "reconfigure" ) reconfigurePiholeFunc;;