Compare commits
26 Commits
v5.5
...
removebloc
Author | SHA1 | Date | |
---|---|---|---|
|
f27efec3e6 | ||
|
2f50da6ea5 | ||
|
603caa9239 | ||
|
ab27a3bd45 | ||
|
f3acc7c839 | ||
|
6f6b54ea05 | ||
|
3cad8e4c5b | ||
|
9535e2fd6d | ||
|
0ea7344c30 | ||
|
55dce14655 | ||
|
5bf35dc687 | ||
|
c5828df198 | ||
|
77e322afa6 | ||
|
541257849d | ||
|
80560d4a4a | ||
|
38bb4a4908 | ||
|
2b74b47b4a | ||
|
109340033e | ||
|
0f246b8df5 | ||
|
5b03160295 | ||
|
7b0513d1e6 | ||
|
466520366d | ||
|
9dbcbdbe66 | ||
|
a9b9718ffa | ||
|
fb073373d6 | ||
|
fd050693a2 |
10
.github/dependabot.yml
vendored
Normal file
10
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
day: saturday
|
||||||
|
time: "10:00"
|
||||||
|
open-pull-requests-limit: 10
|
||||||
|
target-branch: developement
|
40
.github/workflows/codeql-analysis.yml
vendored
Normal file
40
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
name: "CodeQL"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- development
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- development
|
||||||
|
schedule:
|
||||||
|
- cron: '32 11 * * 6'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
-
|
||||||
|
name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v1
|
||||||
|
with:
|
||||||
|
languages: 'python'
|
||||||
|
-
|
||||||
|
name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
-
|
||||||
|
name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v1
|
31
.github/workflows/test.yml
vendored
31
.github/workflows/test.yml
vendored
@@ -5,21 +5,44 @@ on:
|
|||||||
types: [opened, synchronize, reopened, ready_for_review]
|
types: [opened, synchronize, reopened, ready_for_review]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
smoke-test:
|
||||||
|
if: github.event.pull_request.draft == false
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Run Smoke Tests
|
||||||
|
run: |
|
||||||
|
# Ensure scripts in repository are executable
|
||||||
|
IFS=$'\n';
|
||||||
|
for f in $(find . -name '*.sh'); do if [[ ! -x $f ]]; then echo "$f is not executable" && FAIL=1; fi ;done
|
||||||
|
unset IFS;
|
||||||
|
# If FAIL is 1 then we fail.
|
||||||
|
[[ $FAIL == 1 ]] && exit 1 || echo "Smoke Tests Passed"
|
||||||
|
|
||||||
distro-test:
|
distro-test:
|
||||||
if: github.event.pull_request.draft == false
|
if: github.event.pull_request.draft == false
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: smoke-test
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
distro: [debian_9, debian_10, debian_11, ubuntu_16, ubuntu_18, ubuntu_20, ubuntu_21, centos_7, centos_8, fedora_32, fedora_33]
|
distro: [debian_9, debian_10, debian_11, ubuntu_16, ubuntu_18, ubuntu_20, ubuntu_21, centos_7, centos_8, fedora_32, fedora_33]
|
||||||
env:
|
env:
|
||||||
DISTRO: ${{matrix.distro}}
|
DISTRO: ${{matrix.distro}}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
-
|
||||||
- name: Set up Python 3.7
|
name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Set up Python 3.7
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: 3.7
|
python-version: 3.7
|
||||||
- name: Install dependencies
|
-
|
||||||
|
name: Install dependencies
|
||||||
run: pip install -r test/requirements.txt
|
run: pip install -r test/requirements.txt
|
||||||
- name: Test with tox
|
-
|
||||||
|
name: Test with tox
|
||||||
run: tox -c test/tox.${DISTRO}.ini
|
run: tox -c test/tox.${DISTRO}.ini
|
||||||
|
67
.gitignore
vendored
67
.gitignore
vendored
@@ -7,70 +7,5 @@ __pycache__
|
|||||||
.tox
|
.tox
|
||||||
.eggs
|
.eggs
|
||||||
*.egg-info
|
*.egg-info
|
||||||
|
.idea/
|
||||||
|
|
||||||
# Created by https://www.gitignore.io/api/jetbrains+iml
|
|
||||||
|
|
||||||
### JetBrains+iml ###
|
|
||||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
|
||||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
|
||||||
|
|
||||||
# All idea files, with exceptions
|
|
||||||
.idea
|
|
||||||
!.idea/codeStyles/*
|
|
||||||
!.idea/codeStyleSettings.xml
|
|
||||||
|
|
||||||
|
|
||||||
# Sensitive or high-churn files:
|
|
||||||
.idea/**/dataSources/
|
|
||||||
.idea/**/dataSources.ids
|
|
||||||
.idea/**/dataSources.xml
|
|
||||||
.idea/**/dataSources.local.xml
|
|
||||||
.idea/**/sqlDataSources.xml
|
|
||||||
.idea/**/dynamic.xml
|
|
||||||
.idea/**/uiDesigner.xml
|
|
||||||
|
|
||||||
# Gradle:
|
|
||||||
.idea/**/gradle.xml
|
|
||||||
.idea/**/libraries
|
|
||||||
|
|
||||||
# CMake
|
|
||||||
cmake-build-debug/
|
|
||||||
|
|
||||||
# Mongo Explorer plugin:
|
|
||||||
.idea/**/mongoSettings.xml
|
|
||||||
|
|
||||||
## File-based project format:
|
|
||||||
*.iws
|
|
||||||
|
|
||||||
## Plugin-specific files:
|
|
||||||
|
|
||||||
# IntelliJ
|
|
||||||
/out/
|
|
||||||
|
|
||||||
# mpeltonen/sbt-idea plugin
|
|
||||||
.idea_modules/
|
|
||||||
|
|
||||||
# JIRA plugin
|
|
||||||
atlassian-ide-plugin.xml
|
|
||||||
|
|
||||||
# Cursive Clojure plugin
|
|
||||||
.idea/replstate.xml
|
|
||||||
|
|
||||||
# Ruby plugin and RubyMine
|
|
||||||
/.rakeTasks
|
|
||||||
|
|
||||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
|
||||||
com_crashlytics_export_strings.xml
|
|
||||||
crashlytics.properties
|
|
||||||
crashlytics-build.properties
|
|
||||||
fabric.properties
|
|
||||||
|
|
||||||
### JetBrains+iml Patch ###
|
|
||||||
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
|
|
||||||
|
|
||||||
*.iml
|
*.iml
|
||||||
.idea/misc.xml
|
|
||||||
*.ipr
|
|
||||||
|
|
||||||
# End of https://www.gitignore.io/api/jetbrains+iml
|
|
||||||
|
25
.idea/codeStyleSettings.xml
generated
25
.idea/codeStyleSettings.xml
generated
@@ -1,25 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectCodeStyleSettingsManager">
|
|
||||||
<option name="PER_PROJECT_SETTINGS">
|
|
||||||
<value>
|
|
||||||
<option name="OTHER_INDENT_OPTIONS">
|
|
||||||
<value>
|
|
||||||
<option name="INDENT_SIZE" value="2" />
|
|
||||||
<option name="CONTINUATION_INDENT_SIZE" value="8" />
|
|
||||||
<option name="TAB_SIZE" value="2" />
|
|
||||||
<option name="USE_TAB_CHARACTER" value="false" />
|
|
||||||
<option name="SMART_TABS" value="false" />
|
|
||||||
<option name="LABEL_INDENT_SIZE" value="0" />
|
|
||||||
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
|
|
||||||
<option name="USE_RELATIVE_INDENTS" value="false" />
|
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
<MarkdownNavigatorCodeStyleSettings>
|
|
||||||
<option name="RIGHT_MARGIN" value="72" />
|
|
||||||
</MarkdownNavigatorCodeStyleSettings>
|
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
7
.idea/codeStyles/Project.xml
generated
7
.idea/codeStyles/Project.xml
generated
@@ -1,7 +0,0 @@
|
|||||||
<component name="ProjectCodeStyleConfiguration">
|
|
||||||
<code_scheme name="Project" version="173">
|
|
||||||
<MarkdownNavigatorCodeStyleSettings>
|
|
||||||
<option name="RIGHT_MARGIN" value="72" />
|
|
||||||
</MarkdownNavigatorCodeStyleSettings>
|
|
||||||
</code_scheme>
|
|
||||||
</component>
|
|
5
.idea/codeStyles/codeStyleConfig.xml
generated
5
.idea/codeStyles/codeStyleConfig.xml
generated
@@ -1,5 +0,0 @@
|
|||||||
<component name="ProjectCodeStyleConfiguration">
|
|
||||||
<state>
|
|
||||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
|
||||||
</state>
|
|
||||||
</component>
|
|
32
README.md
32
README.md
@@ -11,9 +11,9 @@
|
|||||||
</p>
|
</p>
|
||||||
<!-- markdownlint-enable MD033 -->
|
<!-- markdownlint-enable MD033 -->
|
||||||
|
|
||||||
The Pi-hole® is a [DNS sinkhole](https://en.wikipedia.org/wiki/DNS_Sinkhole) that protects your devices from unwanted content, without installing any client-side software.
|
The Pi-hole® is a [DNS sinkhole](https://en.wikipedia.org/wiki/DNS_Sinkhole) that protects your devices from unwanted content without installing any client-side software.
|
||||||
|
|
||||||
- **Easy-to-install**: our versatile installer walks you through the process, and takes less than ten minutes
|
- **Easy-to-install**: our versatile installer walks you through the process and takes less than ten minutes
|
||||||
- **Resolute**: content is blocked in _non-browser locations_, such as ad-laden mobile apps and smart TVs
|
- **Resolute**: content is blocked in _non-browser locations_, such as ad-laden mobile apps and smart TVs
|
||||||
- **Responsive**: seamlessly speeds up the feel of everyday browsing by caching DNS queries
|
- **Responsive**: seamlessly speeds up the feel of everyday browsing by caching DNS queries
|
||||||
- **Lightweight**: runs smoothly with [minimal hardware and software requirements](https://docs.pi-hole.net/main/prerequisites/)
|
- **Lightweight**: runs smoothly with [minimal hardware and software requirements](https://docs.pi-hole.net/main/prerequisites/)
|
||||||
@@ -22,7 +22,7 @@ The Pi-hole® is a [DNS sinkhole](https://en.wikipedia.org/wiki/DNS_Sinkhole) th
|
|||||||
- **Versatile**: can optionally function as a [DHCP server](https://discourse.pi-hole.net/t/how-do-i-use-pi-holes-built-in-dhcp-server-and-why-would-i-want-to/3026), ensuring *all* your devices are protected automatically
|
- **Versatile**: can optionally function as a [DHCP server](https://discourse.pi-hole.net/t/how-do-i-use-pi-holes-built-in-dhcp-server-and-why-would-i-want-to/3026), ensuring *all* your devices are protected automatically
|
||||||
- **Scalable**: [capable of handling hundreds of millions of queries](https://pi-hole.net/2017/05/24/how-much-traffic-can-pi-hole-handle/) when installed on server-grade hardware
|
- **Scalable**: [capable of handling hundreds of millions of queries](https://pi-hole.net/2017/05/24/how-much-traffic-can-pi-hole-handle/) when installed on server-grade hardware
|
||||||
- **Modern**: blocks ads over both IPv4 and IPv6
|
- **Modern**: blocks ads over both IPv4 and IPv6
|
||||||
- **Free**: open source software which helps ensure _you_ are the sole person in control of your privacy
|
- **Free**: open source software that helps ensure _you_ are the sole person in control of your privacy
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
@@ -57,21 +57,21 @@ Please refer to the [Pi-hole docker repo](https://github.com/pi-hole/docker-pi-h
|
|||||||
|
|
||||||
Once the installer has been run, you will need to [configure your router to have **DHCP clients use Pi-hole as their DNS server**](https://discourse.pi-hole.net/t/how-do-i-configure-my-devices-to-use-pi-hole-as-their-dns-server/245) which ensures that all devices connecting to your network will have content blocked without any further intervention.
|
Once the installer has been run, you will need to [configure your router to have **DHCP clients use Pi-hole as their DNS server**](https://discourse.pi-hole.net/t/how-do-i-configure-my-devices-to-use-pi-hole-as-their-dns-server/245) which ensures that all devices connecting to your network will have content blocked without any further intervention.
|
||||||
|
|
||||||
If your router does not support setting the DNS server, you can [use Pi-hole's built-in DHCP server](https://discourse.pi-hole.net/t/how-do-i-use-pi-holes-built-in-dhcp-server-and-why-would-i-want-to/3026); just be sure to disable DHCP on your router first (if it has that feature available).
|
If your router does not support setting the DNS server, you can [use Pi-hole's built-in DHCP server](https://discourse.pi-hole.net/t/how-do-i-use-pi-holes-built-in-dhcp-server-and-why-would-i-want-to/3026); be sure to disable DHCP on your router first (if it has that feature available).
|
||||||
|
|
||||||
As a last resort, you can always manually set each device to use Pi-hole as their DNS server.
|
As a last resort, you can manually set each device to use Pi-hole as their DNS server.
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
## Pi-hole is free, but powered by your support
|
## Pi-hole is free but powered by your support
|
||||||
|
|
||||||
There are many reoccurring costs involved with maintaining free, open source, and privacy-respecting software; expenses which [our volunteer developers](https://github.com/orgs/pi-hole/people) pitch in to cover out-of-pocket. This is just one example of how strongly we feel about our software, as well as the importance of keeping it maintained.
|
There are many reoccurring costs involved with maintaining free, open source, and privacy-respecting software; expenses which [our volunteer developers](https://github.com/orgs/pi-hole/people) pitch in to cover out-of-pocket. This is just one example of how strongly we feel about our software and the importance of keeping it maintained.
|
||||||
|
|
||||||
Make no mistake: **your support is absolutely vital to help keep us innovating!**
|
Make no mistake: **your support is absolutely vital to help keep us innovating!**
|
||||||
|
|
||||||
### [Donations](https://pi-hole.net/donate)
|
### [Donations](https://pi-hole.net/donate)
|
||||||
|
|
||||||
Sending a donation using our Sponsor Button is **extremely helpful** in offsetting a portion of our monthly expenses and rewarding our dedicated development team:
|
Donating using our Sponsor Button is **extremely helpful** in offsetting a portion of our monthly expenses:
|
||||||
|
|
||||||
### Alternative support
|
### Alternative support
|
||||||
|
|
||||||
@@ -83,13 +83,13 @@ If you'd rather not donate (_which is okay!_), there are other ways you can help
|
|||||||
- [Digital Ocean](https://www.digitalocean.com/?refcode=344d234950e1) _affiliate link_
|
- [Digital Ocean](https://www.digitalocean.com/?refcode=344d234950e1) _affiliate link_
|
||||||
- [Stickermule](https://www.stickermule.com/unlock?ref_id=9127301701&utm_medium=link&utm_source=invite) _earn a $10 credit after your first purchase_
|
- [Stickermule](https://www.stickermule.com/unlock?ref_id=9127301701&utm_medium=link&utm_source=invite) _earn a $10 credit after your first purchase_
|
||||||
- [Amazon US](http://www.amazon.com/exec/obidos/redirect-home/pihole09-20) _affiliate link_
|
- [Amazon US](http://www.amazon.com/exec/obidos/redirect-home/pihole09-20) _affiliate link_
|
||||||
- Spreading the word about our software, and how you have benefited from it
|
- Spreading the word about our software and how you have benefited from it
|
||||||
|
|
||||||
### Contributing via GitHub
|
### Contributing via GitHub
|
||||||
|
|
||||||
We welcome _everyone_ to contribute to issue reports, suggest new features, and create pull requests.
|
We welcome _everyone_ to contribute to issue reports, suggest new features, and create pull requests.
|
||||||
|
|
||||||
If you have something to add - anything from a typo through to a whole new feature, we're happy to check it out! Just make sure to fill out our template when submitting your request; the questions that it asks will help the volunteers quickly understand what you're aiming to achieve.
|
If you have something to add - anything from a typo through to a whole new feature, we're happy to check it out! Just make sure to fill out our template when submitting your request; the questions it asks will help the volunteers quickly understand what you're aiming to achieve.
|
||||||
|
|
||||||
You'll find that the [install script](https://github.com/pi-hole/pi-hole/blob/master/automated%20install/basic-install.sh) and the [debug script](https://github.com/pi-hole/pi-hole/blob/master/advanced/Scripts/piholeDebug.sh) have an abundance of comments, which will help you better understand how Pi-hole works. They're also a valuable resource to those who want to learn how to write scripts or code a program! We encourage anyone who likes to tinker to read through it and submit a pull request for us to review.
|
You'll find that the [install script](https://github.com/pi-hole/pi-hole/blob/master/automated%20install/basic-install.sh) and the [debug script](https://github.com/pi-hole/pi-hole/blob/master/advanced/Scripts/piholeDebug.sh) have an abundance of comments, which will help you better understand how Pi-hole works. They're also a valuable resource to those who want to learn how to write scripts or code a program! We encourage anyone who likes to tinker to read through it and submit a pull request for us to review.
|
||||||
|
|
||||||
@@ -97,9 +97,9 @@ You'll find that the [install script](https://github.com/pi-hole/pi-hole/blob/ma
|
|||||||
|
|
||||||
## Getting in touch with us
|
## Getting in touch with us
|
||||||
|
|
||||||
While we are primarily reachable on our [Discourse User Forum](https://discourse.pi-hole.net/), we can also be found on a variety of social media outlets.
|
While we are primarily reachable on our [Discourse User Forum](https://discourse.pi-hole.net/), we can also be found on various social media outlets.
|
||||||
|
|
||||||
**Please be sure to check the FAQ's** before starting a new discussion. Many user questions already have answers and can be solved without any additional assistance.
|
**Please be sure to check the FAQs** before starting a new discussion, as we do not have the spare time to reply to every request for assistance.
|
||||||
|
|
||||||
- [Frequently Asked Questions](https://discourse.pi-hole.net/c/faqs)
|
- [Frequently Asked Questions](https://discourse.pi-hole.net/c/faqs)
|
||||||
- [Feature Requests](https://discourse.pi-hole.net/c/feature-requests?order=votes)
|
- [Feature Requests](https://discourse.pi-hole.net/c/feature-requests?order=votes)
|
||||||
@@ -125,15 +125,15 @@ Some of the statistics you can integrate include:
|
|||||||
- Queries cached
|
- Queries cached
|
||||||
- Unique clients
|
- Unique clients
|
||||||
|
|
||||||
The API can be accessed via [`telnet`](https://github.com/pi-hole/FTL), the Web (`admin/api.php`) and Command Line (`pihole -c -j`). You can find out [more details over here](https://discourse.pi-hole.net/t/pi-hole-api/1863).
|
Access the API via [`telnet`](https://github.com/pi-hole/FTL), the Web (`admin/api.php`) and Command Line (`pihole -c -j`). You can find out [more details over here](https://discourse.pi-hole.net/t/pi-hole-api/1863).
|
||||||
|
|
||||||
### The Command Line Interface
|
### The Command Line Interface
|
||||||
|
|
||||||
The [pihole](https://docs.pi-hole.net/core/pihole-command/) command has all the functionality necessary to be able to fully administer the Pi-hole, without the need of the Web Interface. It's fast, user-friendly, and auditable by anyone with an understanding of `bash`.
|
The [pihole](https://docs.pi-hole.net/core/pihole-command/) command has all the functionality necessary to fully administer the Pi-hole, without the need of the Web Interface. It's fast, user-friendly, and auditable by anyone with an understanding of `bash`.
|
||||||
|
|
||||||
Some notable features include:
|
Some notable features include:
|
||||||
|
|
||||||
- [Whitelisting, Blacklisting and Regex](https://docs.pi-hole.net/core/pihole-command/#whitelisting-blacklisting-and-regex)
|
- [Whitelisting, Blacklisting, and Regex](https://docs.pi-hole.net/core/pihole-command/#whitelisting-blacklisting-and-regex)
|
||||||
- [Debugging utility](https://docs.pi-hole.net/core/pihole-command/#debugger)
|
- [Debugging utility](https://docs.pi-hole.net/core/pihole-command/#debugger)
|
||||||
- [Viewing the live log file](https://docs.pi-hole.net/core/pihole-command/#tail)
|
- [Viewing the live log file](https://docs.pi-hole.net/core/pihole-command/#tail)
|
||||||
- [Updating Ad Lists](https://docs.pi-hole.net/core/pihole-command/#gravity)
|
- [Updating Ad Lists](https://docs.pi-hole.net/core/pihole-command/#gravity)
|
||||||
@@ -149,7 +149,7 @@ This [optional dashboard](https://github.com/pi-hole/AdminLTE) allows you to vie
|
|||||||
|
|
||||||
Some notable features include:
|
Some notable features include:
|
||||||
|
|
||||||
- Mobile friendly interface
|
- Mobile-friendly interface
|
||||||
- Password protection
|
- Password protection
|
||||||
- Detailed graphs and doughnut charts
|
- Detailed graphs and doughnut charts
|
||||||
- Top lists of domains and clients
|
- Top lists of domains and clients
|
||||||
|
0
advanced/Scripts/database_migration/gravity-db.sh
Normal file → Executable file
0
advanced/Scripts/database_migration/gravity-db.sh
Normal file → Executable file
@@ -23,7 +23,7 @@ fi
|
|||||||
# have changed
|
# have changed
|
||||||
gravityDBfile="${GRAVITYDB}"
|
gravityDBfile="${GRAVITYDB}"
|
||||||
|
|
||||||
reload=false
|
noReloadRequested=false
|
||||||
addmode=true
|
addmode=true
|
||||||
verbose=true
|
verbose=true
|
||||||
wildcard=false
|
wildcard=false
|
||||||
@@ -35,6 +35,7 @@ typeId=""
|
|||||||
comment=""
|
comment=""
|
||||||
declare -i domaincount
|
declare -i domaincount
|
||||||
domaincount=0
|
domaincount=0
|
||||||
|
reload=false
|
||||||
|
|
||||||
colfile="/opt/pihole/COL_TABLE"
|
colfile="/opt/pihole/COL_TABLE"
|
||||||
source ${colfile}
|
source ${colfile}
|
||||||
@@ -242,13 +243,13 @@ Displaylist() {
|
|||||||
|
|
||||||
NukeList() {
|
NukeList() {
|
||||||
count=$(sqlite3 "${gravityDBfile}" "SELECT COUNT(1) FROM domainlist WHERE type = ${typeId};")
|
count=$(sqlite3 "${gravityDBfile}" "SELECT COUNT(1) FROM domainlist WHERE type = ${typeId};")
|
||||||
listname="$(GetListnameFromTypeId "${typeId}")"
|
listname="$(GetListnameFromTypeId "${typeId}")"
|
||||||
if [ "$count" -gt 0 ];then
|
if [ "$count" -gt 0 ];then
|
||||||
sqlite3 "${gravityDBfile}" "DELETE FROM domainlist WHERE type = ${typeId};"
|
sqlite3 "${gravityDBfile}" "DELETE FROM domainlist WHERE type = ${typeId};"
|
||||||
echo " ${TICK} Removed ${count} domain(s) from the ${listname}"
|
echo " ${TICK} Removed ${count} domain(s) from the ${listname}"
|
||||||
else
|
else
|
||||||
echo " ${INFO} ${listname} already empty. Nothing to do!"
|
echo " ${INFO} ${listname} already empty. Nothing to do!"
|
||||||
fi
|
fi
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,7 +269,7 @@ while (( "$#" )); do
|
|||||||
"--white-wild" | "white-wild" ) typeId=2; wildcard=true;;
|
"--white-wild" | "white-wild" ) typeId=2; wildcard=true;;
|
||||||
"--wild" | "wildcard" ) typeId=3; wildcard=true;;
|
"--wild" | "wildcard" ) typeId=3; wildcard=true;;
|
||||||
"--regex" | "regex" ) typeId=3;;
|
"--regex" | "regex" ) typeId=3;;
|
||||||
"-nr"| "--noreload" ) reload=false;;
|
"-nr"| "--noreload" ) noReloadRequested=true;;
|
||||||
"-d" | "--delmode" ) addmode=false;;
|
"-d" | "--delmode" ) addmode=false;;
|
||||||
"-q" | "--quiet" ) verbose=false;;
|
"-q" | "--quiet" ) verbose=false;;
|
||||||
"-h" | "--help" ) helpFunc;;
|
"-h" | "--help" ) helpFunc;;
|
||||||
@@ -294,6 +295,6 @@ if $web; then
|
|||||||
echo "DONE"
|
echo "DONE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${reload}" != false ]]; then
|
if [[ ${reload} == true && ${noReloadRequested} == false ]]; then
|
||||||
pihole restartdns reload-lists
|
pihole restartdns reload-lists
|
||||||
fi
|
fi
|
||||||
|
0
advanced/Scripts/piholeCheckout.sh
Normal file → Executable file
0
advanced/Scripts/piholeCheckout.sh
Normal file → Executable file
@@ -777,30 +777,14 @@ check_x_headers() {
|
|||||||
# server is operating correctly
|
# server is operating correctly
|
||||||
echo_current_diagnostic "Dashboard and block page"
|
echo_current_diagnostic "Dashboard and block page"
|
||||||
# Use curl -I to get the header and parse out just the X-Pi-hole one
|
# Use curl -I to get the header and parse out just the X-Pi-hole one
|
||||||
local block_page
|
|
||||||
block_page=$(curl -Is localhost | awk '/X-Pi-hole/' | tr -d '\r')
|
|
||||||
# Do it for the dashboard as well, as the header is different than above
|
|
||||||
local dashboard
|
local dashboard
|
||||||
dashboard=$(curl -Is localhost/admin/ | awk '/X-Pi-hole/' | tr -d '\r')
|
dashboard=$(curl -Is localhost/admin/ | awk '/X-Pi-hole/' | tr -d '\r')
|
||||||
# Store what the X-Header should be in variables for comparison later
|
# Store what the X-Header should be in variables for comparison later
|
||||||
local block_page_working
|
|
||||||
block_page_working="X-Pi-hole: A black hole for Internet advertisements."
|
|
||||||
local dashboard_working
|
local dashboard_working
|
||||||
dashboard_working="X-Pi-hole: The Pi-hole Web interface is working!"
|
dashboard_working="X-Pi-hole: The Pi-hole Web interface is working!"
|
||||||
local full_curl_output_block_page
|
|
||||||
full_curl_output_block_page="$(curl -Is localhost)"
|
|
||||||
local full_curl_output_dashboard
|
local full_curl_output_dashboard
|
||||||
full_curl_output_dashboard="$(curl -Is localhost/admin/)"
|
full_curl_output_dashboard="$(curl -Is localhost/admin/)"
|
||||||
# If the X-header found by curl matches what is should be,
|
|
||||||
if [[ $block_page == "$block_page_working" ]]; then
|
|
||||||
# display a success message
|
|
||||||
log_write "$TICK Block page X-Header: ${COL_GREEN}${block_page}${COL_NC}"
|
|
||||||
else
|
|
||||||
# Otherwise, show an error
|
|
||||||
log_write "$CROSS Block page X-Header: ${COL_RED}X-Header does not match or could not be retrieved.${COL_NC}"
|
|
||||||
log_write "${COL_RED}${full_curl_output_block_page}${COL_NC}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Same logic applies to the dashboard as above, if the X-Header matches what a working system should have,
|
# Same logic applies to the dashboard as above, if the X-Header matches what a working system should have,
|
||||||
if [[ $dashboard == "$dashboard_working" ]]; then
|
if [[ $dashboard == "$dashboard_working" ]]; then
|
||||||
# then we can show a success
|
# then we can show a success
|
||||||
@@ -1238,10 +1222,10 @@ show_messages() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
analyze_gravity_list() {
|
analyze_gravity_list() {
|
||||||
echo_current_diagnostic "Gravity List and Database"
|
echo_current_diagnostic "Gravity Database"
|
||||||
|
|
||||||
local gravity_permissions
|
local gravity_permissions
|
||||||
gravity_permissions=$(ls -ld "${PIHOLE_GRAVITY_DB_FILE}")
|
gravity_permissions=$(ls -lhd "${PIHOLE_GRAVITY_DB_FILE}")
|
||||||
log_write "${COL_GREEN}${gravity_permissions}${COL_NC}"
|
log_write "${COL_GREEN}${gravity_permissions}${COL_NC}"
|
||||||
|
|
||||||
show_db_entries "Info table" "SELECT property,value FROM info" "20 40"
|
show_db_entries "Info table" "SELECT property,value FROM info" "20 40"
|
||||||
@@ -1320,7 +1304,7 @@ analyze_pihole_log() {
|
|||||||
OLD_IFS="$IFS"
|
OLD_IFS="$IFS"
|
||||||
# Get the lines that are in the file(s) and store them in an array for parsing later
|
# Get the lines that are in the file(s) and store them in an array for parsing later
|
||||||
IFS=$'\r\n'
|
IFS=$'\r\n'
|
||||||
pihole_log_permissions=$(ls -ld "${PIHOLE_LOG}")
|
pihole_log_permissions=$(ls -lhd "${PIHOLE_LOG}")
|
||||||
log_write "${COL_GREEN}${pihole_log_permissions}${COL_NC}"
|
log_write "${COL_GREEN}${pihole_log_permissions}${COL_NC}"
|
||||||
mapfile -t pihole_log_head < <(head -n 20 ${PIHOLE_LOG})
|
mapfile -t pihole_log_head < <(head -n 20 ${PIHOLE_LOG})
|
||||||
log_write " ${COL_CYAN}-----head of $(basename ${PIHOLE_LOG})------${COL_NC}"
|
log_write " ${COL_CYAN}-----head of $(basename ${PIHOLE_LOG})------${COL_NC}"
|
||||||
|
@@ -1,28 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Pi-hole: A black hole for Internet advertisements
|
|
||||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
|
||||||
# Network-wide ad blocking via your own hardware.
|
|
||||||
#
|
|
||||||
# Provides an automated migration subroutine to convert Pi-hole v3.x wildcard domains to Pi-hole v4.x regex filters
|
|
||||||
#
|
|
||||||
# This file is copyright under the latest version of the EUPL.
|
|
||||||
# Please see LICENSE file for your rights under this license.
|
|
||||||
|
|
||||||
# regexFile set in gravity.sh
|
|
||||||
|
|
||||||
wildcardFile="/etc/dnsmasq.d/03-pihole-wildcard.conf"
|
|
||||||
|
|
||||||
convert_wildcard_to_regex() {
|
|
||||||
if [ ! -f "${wildcardFile}" ]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
local addrlines domains uniquedomains
|
|
||||||
# Obtain wildcard domains from old file
|
|
||||||
addrlines="$(grep -oE "/.*/" ${wildcardFile})"
|
|
||||||
# Strip "/" from domain names and convert "." to regex-compatible "\."
|
|
||||||
domains="$(sed 's/\///g;s/\./\\./g' <<< "${addrlines}")"
|
|
||||||
# Remove repeated domains (may have been inserted two times due to A and AAAA blocking)
|
|
||||||
uniquedomains="$(uniq <<< "${domains}")"
|
|
||||||
# Automatically generate regex filters and remove old wildcards file
|
|
||||||
awk '{print "(^|\\.)"$0"$"}' <<< "${uniquedomains}" >> "${regexFile:?}" && rm "${wildcardFile}"
|
|
||||||
}
|
|
@@ -11,15 +11,6 @@ $serverName = htmlspecialchars($_SERVER["SERVER_NAME"]);
|
|||||||
// Remove external ipv6 brackets if any
|
// Remove external ipv6 brackets if any
|
||||||
$serverName = preg_replace('/^\[(.*)\]$/', '${1}', $serverName);
|
$serverName = preg_replace('/^\[(.*)\]$/', '${1}', $serverName);
|
||||||
|
|
||||||
if (!is_file("/etc/pihole/setupVars.conf"))
|
|
||||||
die("[ERROR] File not found: <code>/etc/pihole/setupVars.conf</code>");
|
|
||||||
|
|
||||||
// Get values from setupVars.conf
|
|
||||||
$setupVars = parse_ini_file("/etc/pihole/setupVars.conf");
|
|
||||||
$svPasswd = !empty($setupVars["WEBPASSWORD"]);
|
|
||||||
$svEmail = (!empty($setupVars["ADMIN_EMAIL"]) && filter_var($setupVars["ADMIN_EMAIL"], FILTER_VALIDATE_EMAIL)) ? $setupVars["ADMIN_EMAIL"] : "";
|
|
||||||
unset($setupVars);
|
|
||||||
|
|
||||||
// Set landing page location, found within /var/www/html/
|
// Set landing page location, found within /var/www/html/
|
||||||
$landPage = "../landing.php";
|
$landPage = "../landing.php";
|
||||||
|
|
||||||
@@ -34,21 +25,6 @@ if (!empty($_SERVER["FQDN"])) {
|
|||||||
array_push($authorizedHosts, $_SERVER["VIRTUAL_HOST"]);
|
array_push($authorizedHosts, $_SERVER["VIRTUAL_HOST"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set which extension types render as Block Page (Including "" for index.ext)
|
|
||||||
$validExtTypes = array("asp", "htm", "html", "php", "rss", "xml", "");
|
|
||||||
|
|
||||||
// Get extension of current URL
|
|
||||||
$currentUrlExt = pathinfo($_SERVER["REQUEST_URI"], PATHINFO_EXTENSION);
|
|
||||||
|
|
||||||
// Set mobile friendly viewport
|
|
||||||
$viewPort = '<meta name="viewport" content="width=device-width, initial-scale=1">';
|
|
||||||
|
|
||||||
// Set response header
|
|
||||||
function setHeader($type = "x") {
|
|
||||||
header("X-Pi-hole: A black hole for Internet advertisements.");
|
|
||||||
if (isset($type) && $type === "js") header("Content-Type: application/javascript");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine block page type
|
// Determine block page type
|
||||||
if ($serverName === "pi.hole"
|
if ($serverName === "pi.hole"
|
||||||
|| (!empty($_SERVER["VIRTUAL_HOST"]) && $serverName === $_SERVER["VIRTUAL_HOST"])) {
|
|| (!empty($_SERVER["VIRTUAL_HOST"]) && $serverName === $_SERVER["VIRTUAL_HOST"])) {
|
||||||
@@ -71,325 +47,26 @@ if ($serverName === "pi.hole"
|
|||||||
<html lang='en'>
|
<html lang='en'>
|
||||||
<head>
|
<head>
|
||||||
<meta charset='utf-8'>
|
<meta charset='utf-8'>
|
||||||
$viewPort
|
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
||||||
<title>● $serverName</title>
|
<title>● $serverName</title>
|
||||||
<link rel='stylesheet' href='/pihole/blockingpage.css'>
|
<link rel='shortcut icon' href='admin/img/favicons/favicon.ico' type='image/x-icon'>
|
||||||
<link rel='shortcut icon' href='/admin/img/favicons/favicon.ico' type='image/x-icon'>
|
<style>
|
||||||
|
#splashpage { background: #222; color: rgba(255, 255, 255, 0.7); text-align: center; }
|
||||||
|
#splashpage img { margin: 5px; width: 256px; }
|
||||||
|
#splashpage b { color: inherit; }
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body id='splashpage'>
|
<body id='splashpage'>
|
||||||
<div id="pihole_card">
|
<img src='admin/img/logo.svg' alt='Pi-hole logo' width='256' height='377'>
|
||||||
<img src='/admin/img/logo.svg' alt='Pi-hole logo' id="pihole_logo_splash" />
|
<br>
|
||||||
<p>Pi-<strong>hole</strong>: Your black hole for Internet advertisements</p>
|
<p>Pi-<strong>hole</strong>: Your black hole for Internet advertisements</p>
|
||||||
<a href='/admin'>Did you mean to go to the admin panel?</a>
|
<a href='/admin'>Did you mean to go to the admin panel?</a>
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
EOT;
|
EOT;
|
||||||
exit($splashPage);
|
exit($splashPage);
|
||||||
} elseif ($currentUrlExt === "js") {
|
|
||||||
// Serve Pi-hole JavaScript for blocked domains requesting JS
|
|
||||||
exit(setHeader("js").'var x = "Pi-hole: A black hole for Internet advertisements."');
|
|
||||||
} elseif (strpos($_SERVER["REQUEST_URI"], "?") !== FALSE && isset($_SERVER["HTTP_REFERER"])) {
|
|
||||||
// Serve blank image upon receiving REQUEST_URI w/ query string & HTTP_REFERRER
|
|
||||||
// e.g: An iframe of a blocked domain
|
|
||||||
exit(setHeader().'<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8"><script>window.close();</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=">
|
|
||||||
</body>
|
|
||||||
</html>');
|
|
||||||
} elseif (!in_array($currentUrlExt, $validExtTypes) || substr_count($_SERVER["REQUEST_URI"], "?")) {
|
|
||||||
// Serve SVG upon receiving non $validExtTypes URL extension or query string
|
|
||||||
// e.g: Not an iframe of a blocked domain, such as when browsing to a file/query directly
|
|
||||||
// QoL addition: Allow the SVG to be clicked on in order to quickly show the full Block Page
|
|
||||||
$blockImg = '<a href="/">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="110" height="16">
|
|
||||||
<circle cx="8" cy="8" r="7" fill="none" stroke="rgba(152,2,2,.5)" stroke-width="2"/>
|
|
||||||
<path fill="rgba(152,2,2,.5)" d="M11.526 3.04l1.414 1.415-8.485 8.485-1.414-1.414z"/>
|
|
||||||
<text x="19.3" y="12" opacity=".3" style="font:11px Arial">
|
|
||||||
Blocked by Pi-hole
|
|
||||||
</text>
|
|
||||||
</svg>
|
|
||||||
</a>';
|
|
||||||
exit(setHeader()."<!doctype html>
|
|
||||||
<html lang='en'>
|
|
||||||
<head>
|
|
||||||
<meta charset='utf-8'>
|
|
||||||
$viewPort
|
|
||||||
</head>
|
|
||||||
<body>$blockImg</body>
|
|
||||||
</html>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start processing Block Page from here */
|
exit(header("HTTP/1.1 404 Not Found"));
|
||||||
|
|
||||||
// Define admin email address text based off $svEmail presence
|
|
||||||
$bpAskAdmin = !empty($svEmail) ? '<a href="mailto:'.$svEmail.'?subject=Site Blocked: '.$serverName.'"></a>' : "<span/>";
|
|
||||||
|
|
||||||
// Get possible non-standard location of FTL's database
|
|
||||||
$FTLsettings = parse_ini_file("/etc/pihole/pihole-FTL.conf");
|
|
||||||
if (isset($FTLsettings["GRAVITYDB"])) {
|
|
||||||
$gravityDBFile = $FTLsettings["GRAVITYDB"];
|
|
||||||
} else {
|
|
||||||
$gravityDBFile = "/etc/pihole/gravity.db";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Connect to gravity.db
|
|
||||||
try {
|
|
||||||
$db = new SQLite3($gravityDBFile, SQLITE3_OPEN_READONLY);
|
|
||||||
} catch (Exception $exception) {
|
|
||||||
die("[ERROR]: Failed to connect to gravity.db");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get all adlist addresses
|
|
||||||
$adlistResults = $db->query("SELECT address FROM vw_adlist");
|
|
||||||
$adlistsUrls = array();
|
|
||||||
while ($row = $adlistResults->fetchArray()) {
|
|
||||||
array_push($adlistsUrls, $row[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($adlistsUrls))
|
|
||||||
die("[ERROR]: There are no adlists enabled");
|
|
||||||
|
|
||||||
// Get total number of blocklists (Including Whitelist, Blacklist & Wildcard lists)
|
|
||||||
$adlistsCount = count($adlistsUrls) + 3;
|
|
||||||
|
|
||||||
// Set query timeout
|
|
||||||
ini_set("default_socket_timeout", 3);
|
|
||||||
|
|
||||||
// Logic for querying blocklists
|
|
||||||
function queryAds($serverName) {
|
|
||||||
// Determine the time it takes while querying adlists
|
|
||||||
$preQueryTime = microtime(true)-$_SERVER["REQUEST_TIME_FLOAT"];
|
|
||||||
$queryAdsURL = sprintf(
|
|
||||||
"http://127.0.0.1:%s/admin/scripts/pi-hole/php/queryads.php?domain=%s&bp",
|
|
||||||
$_SERVER["SERVER_PORT"],
|
|
||||||
$serverName
|
|
||||||
);
|
|
||||||
$queryAds = file($queryAdsURL, FILE_IGNORE_NEW_LINES);
|
|
||||||
$queryAds = array_values(array_filter(preg_replace("/data:\s+/", "", $queryAds)));
|
|
||||||
$queryTime = sprintf("%.0f", (microtime(true)-$_SERVER["REQUEST_TIME_FLOAT"]) - $preQueryTime);
|
|
||||||
|
|
||||||
// Exception Handling
|
|
||||||
try {
|
|
||||||
// Define Exceptions
|
|
||||||
if (strpos($queryAds[0], "No exact results") !== FALSE) {
|
|
||||||
// Return "none" into $queryAds array
|
|
||||||
return array("0" => "none");
|
|
||||||
} else if ($queryTime >= ini_get("default_socket_timeout")) {
|
|
||||||
// Connection Timeout
|
|
||||||
throw new Exception ("Connection timeout (".ini_get("default_socket_timeout")."s)");
|
|
||||||
} elseif (!strpos($queryAds[0], ".") !== false) {
|
|
||||||
// Unknown $queryAds output
|
|
||||||
throw new Exception ("Unhandled error message (<code>$queryAds[0]</code>)");
|
|
||||||
}
|
|
||||||
return $queryAds;
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// Return exception as array
|
|
||||||
return array("0" => "error", "1" => $e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get results of queryads.php exact search
|
|
||||||
$queryAds = queryAds($serverName);
|
|
||||||
|
|
||||||
// Pass error through to Block Page
|
|
||||||
if ($queryAds[0] === "error")
|
|
||||||
die("[ERROR]: Unable to parse results from <i>queryads.php</i>: <code>".$queryAds[1]."</code>");
|
|
||||||
|
|
||||||
// Count total number of matching blocklists
|
|
||||||
$featuredTotal = count($queryAds);
|
|
||||||
|
|
||||||
// Place results into key => value array
|
|
||||||
$queryResults = null;
|
|
||||||
foreach ($queryAds as $str) {
|
|
||||||
$value = explode(" ", $str);
|
|
||||||
@$queryResults[$value[0]] .= "$value[1]";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine if domain has been blacklisted, whitelisted, wildcarded or CNAME blocked
|
|
||||||
if (strpos($queryAds[0], "blacklist") !== FALSE) {
|
|
||||||
$notableFlagClass = "blacklist";
|
|
||||||
$adlistsUrls = array("π" => substr($queryAds[0], 2));
|
|
||||||
} elseif (strpos($queryAds[0], "whitelist") !== FALSE) {
|
|
||||||
$notableFlagClass = "noblock";
|
|
||||||
$adlistsUrls = array("π" => substr($queryAds[0], 2));
|
|
||||||
$wlInfo = "recentwl";
|
|
||||||
} elseif (strpos($queryAds[0], "wildcard") !== FALSE) {
|
|
||||||
$notableFlagClass = "wildcard";
|
|
||||||
$adlistsUrls = array("π" => substr($queryAds[0], 2));
|
|
||||||
} elseif ($queryAds[0] === "none") {
|
|
||||||
$featuredTotal = "0";
|
|
||||||
$notableFlagClass = "noblock";
|
|
||||||
|
|
||||||
// QoL addition: Determine appropriate info message if CNAME exists
|
|
||||||
// Suggests to the user that $serverName has a CNAME (alias) that may be blocked
|
|
||||||
$dnsRecord = dns_get_record("$serverName")[0];
|
|
||||||
if (array_key_exists("target", $dnsRecord)) {
|
|
||||||
$wlInfo = $dnsRecord['target'];
|
|
||||||
} else {
|
|
||||||
$wlInfo = "unknown";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set #bpOutput notification
|
|
||||||
$wlOutputClass = (isset($wlInfo) && $wlInfo === "recentwl") ? $wlInfo : "hidden";
|
|
||||||
$wlOutput = (isset($wlInfo) && $wlInfo !== "recentwl") ? "<a href='http://$wlInfo'>$wlInfo</a>" : "";
|
|
||||||
|
|
||||||
// Get Pi-hole Core version
|
|
||||||
$phVersion = exec("cd /etc/.pihole/ && git describe --long --tags");
|
|
||||||
|
|
||||||
// Print $execTime on development branches
|
|
||||||
// Testing for - is marginally faster than "git rev-parse --abbrev-ref HEAD"
|
|
||||||
if (explode("-", $phVersion)[1] != "0")
|
|
||||||
$execTime = microtime(true)-$_SERVER["REQUEST_TIME_FLOAT"];
|
|
||||||
|
|
||||||
// Please Note: Text is added via CSS to allow an admin to provide a localized
|
|
||||||
// language without the need to edit this file
|
|
||||||
|
|
||||||
setHeader();
|
|
||||||
?>
|
?>
|
||||||
<!doctype html>
|
|
||||||
<!-- Pi-hole: A black hole for Internet advertisements
|
|
||||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
|
||||||
* Network-wide ad blocking via your own hardware.
|
|
||||||
*
|
|
||||||
* This file is copyright under the latest version of the EUPL. -->
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<?=$viewPort ?>
|
|
||||||
<meta name="robots" content="noindex,nofollow">
|
|
||||||
<meta http-equiv="x-dns-prefetch-control" content="off">
|
|
||||||
<link rel="stylesheet" href="pihole/blockingpage.css">
|
|
||||||
<link rel="shortcut icon" href="admin/img/favicons/favicon.ico" type="image/x-icon">
|
|
||||||
<title>● <?=$serverName ?></title>
|
|
||||||
<script src="admin/scripts/vendor/jquery.min.js"></script>
|
|
||||||
<script>
|
|
||||||
window.onload = function () {
|
|
||||||
<?php
|
|
||||||
// Remove href fallback from "Back to safety" button
|
|
||||||
if ($featuredTotal > 0) {
|
|
||||||
echo '$("#bpBack").removeAttr("href");';
|
|
||||||
|
|
||||||
// Enable whitelisting if JS is available
|
|
||||||
echo '$("#bpWhitelist").prop("disabled", false);';
|
|
||||||
|
|
||||||
// Enable password input if necessary
|
|
||||||
if (!empty($svPasswd)) {
|
|
||||||
echo '$("#bpWLPassword").attr("placeholder", "Password");';
|
|
||||||
echo '$("#bpWLPassword").prop("disabled", false);';
|
|
||||||
}
|
|
||||||
// Otherwise hide the input
|
|
||||||
else {
|
|
||||||
echo '$("#bpWLPassword").hide();';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body id="blockpage"><div id="bpWrapper">
|
|
||||||
<header>
|
|
||||||
<h1 id="bpTitle">
|
|
||||||
<a class="title" href="/"><?php //Website Blocked ?></a>
|
|
||||||
</h1>
|
|
||||||
<div class="spc"></div>
|
|
||||||
|
|
||||||
<input id="bpAboutToggle" type="checkbox">
|
|
||||||
<div id="bpAbout">
|
|
||||||
<div class="aboutPH">
|
|
||||||
<div class="aboutImg"></div>
|
|
||||||
<p>Open Source Ad Blocker
|
|
||||||
<small>Designed for Raspberry Pi</small>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="aboutLink">
|
|
||||||
<a class="linkPH" href="https://docs.pi-hole.net/"><?php //About PH ?></a>
|
|
||||||
<?php if (!empty($svEmail)) echo '<a class="linkEmail" href="mailto:'.$svEmail.'"></a>'; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="bpAlt">
|
|
||||||
<label class="altBtn" for="bpAboutToggle"><?php //Why am I here? ?></label>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<main>
|
|
||||||
<div id="bpOutput" class="<?=$wlOutputClass ?>"><?=$wlOutput ?></div>
|
|
||||||
<div id="bpBlock">
|
|
||||||
<p class="blockMsg"><?=$serverName ?></p>
|
|
||||||
</div>
|
|
||||||
<?php if(isset($notableFlagClass)) { ?>
|
|
||||||
<div id="bpFlag">
|
|
||||||
<p class="flagMsg <?=$notableFlagClass ?>"></p>
|
|
||||||
</div>
|
|
||||||
<?php } ?>
|
|
||||||
<div id="bpHelpTxt"><?=$bpAskAdmin ?></div>
|
|
||||||
<div id="bpButtons" class="buttons">
|
|
||||||
<a id="bpBack" onclick="javascript:history.back()" href="about:home"></a>
|
|
||||||
<?php if ($featuredTotal > 0) echo '<label id="bpInfo" for="bpMoreToggle"></label>'; ?>
|
|
||||||
</div>
|
|
||||||
<input id="bpMoreToggle" type="checkbox">
|
|
||||||
<div id="bpMoreInfo">
|
|
||||||
<span id="bpFoundIn"><span><?=$featuredTotal ?></span><?=$adlistsCount ?></span>
|
|
||||||
<pre id='bpQueryOutput'><?php if ($featuredTotal > 0) foreach ($queryResults as $num => $value) { echo "<span>[$num]:</span>$adlistsUrls[$num]\n"; } ?></pre>
|
|
||||||
|
|
||||||
<form id="bpWLButtons" class="buttons">
|
|
||||||
<input id="bpWLDomain" type="text" value="<?=$serverName ?>" disabled>
|
|
||||||
<input id="bpWLPassword" type="password" placeholder="JavaScript disabled" disabled>
|
|
||||||
<button id="bpWhitelist" type="button" disabled></button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<footer><span><?=date("l g:i A, F dS"); ?>.</span> Pi-hole <?=$phVersion ?> (<?=gethostname()."/".$_SERVER["SERVER_ADDR"]; if (isset($execTime)) printf("/%.2fs", $execTime); ?>)</footer>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
function add() {
|
|
||||||
$("#bpOutput").removeClass("hidden error exception");
|
|
||||||
$("#bpOutput").addClass("add");
|
|
||||||
var domain = "<?=$serverName ?>";
|
|
||||||
var pw = $("#bpWLPassword");
|
|
||||||
if(domain.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
url: "/admin/scripts/pi-hole/php/add.php",
|
|
||||||
method: "post",
|
|
||||||
data: {"domain":domain, "list":"white", "pw":pw.val()},
|
|
||||||
success: function(response) {
|
|
||||||
if(response.indexOf("Pi-hole blocking") !== -1) {
|
|
||||||
setTimeout(function(){window.location.reload(1);}, 10000);
|
|
||||||
$("#bpOutput").removeClass("add");
|
|
||||||
$("#bpOutput").addClass("success");
|
|
||||||
$("#bpOutput").html("");
|
|
||||||
} else {
|
|
||||||
$("#bpOutput").removeClass("add");
|
|
||||||
$("#bpOutput").addClass("error");
|
|
||||||
$("#bpOutput").html(""+response+"");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(jqXHR, exception) {
|
|
||||||
$("#bpOutput").removeClass("add");
|
|
||||||
$("#bpOutput").addClass("exception");
|
|
||||||
$("#bpOutput").html("");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
<?php if ($featuredTotal > 0) { ?>
|
|
||||||
$(document).keypress(function(e) {
|
|
||||||
if(e.which === 13 && $("#bpWLPassword").is(":focus")) {
|
|
||||||
add();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$("#bpWhitelist").on("click", function() {
|
|
||||||
add();
|
|
||||||
});
|
|
||||||
<?php } ?>
|
|
||||||
</script>
|
|
||||||
</body></html>
|
|
||||||
|
@@ -34,27 +34,26 @@ export PATH+=':/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
|
|||||||
|
|
||||||
# List of supported DNS servers
|
# List of supported DNS servers
|
||||||
DNS_SERVERS=$(cat << EOM
|
DNS_SERVERS=$(cat << EOM
|
||||||
Google (ECS);8.8.8.8;8.8.4.4;2001:4860:4860:0:0:0:0:8888;2001:4860:4860:0:0:0:0:8844
|
Google (ECS, DNSSEC);8.8.8.8;8.8.4.4;2001:4860:4860:0:0:0:0:8888;2001:4860:4860:0:0:0:0:8844
|
||||||
OpenDNS (ECS, DNSSEC);208.67.222.222;208.67.220.220;2620:119:35::35;2620:119:53::53
|
OpenDNS (ECS, DNSSEC);208.67.222.222;208.67.220.220;2620:119:35::35;2620:119:53::53
|
||||||
Level3;4.2.2.1;4.2.2.2;;
|
Level3;4.2.2.1;4.2.2.2;;
|
||||||
Comodo;8.26.56.26;8.20.247.20;;
|
Comodo;8.26.56.26;8.20.247.20;;
|
||||||
DNS.WATCH;84.200.69.80;84.200.70.40;2001:1608:10:25:0:0:1c04:b12f;2001:1608:10:25:0:0:9249:d69b
|
DNS.WATCH (DNSSEC);84.200.69.80;84.200.70.40;2001:1608:10:25:0:0:1c04:b12f;2001:1608:10:25:0:0:9249:d69b
|
||||||
Quad9 (filtered, DNSSEC);9.9.9.9;149.112.112.112;2620:fe::fe;2620:fe::9
|
Quad9 (filtered, DNSSEC);9.9.9.9;149.112.112.112;2620:fe::fe;2620:fe::9
|
||||||
Quad9 (unfiltered, no DNSSEC);9.9.9.10;149.112.112.10;2620:fe::10;2620:fe::fe:10
|
Quad9 (unfiltered, no DNSSEC);9.9.9.10;149.112.112.10;2620:fe::10;2620:fe::fe:10
|
||||||
Quad9 (filtered + ECS);9.9.9.11;149.112.112.11;2620:fe::11;2620:fe::fe:11
|
Quad9 (filtered, ECS, DNSSEC);9.9.9.11;149.112.112.11;2620:fe::11;2620:fe::fe:11
|
||||||
Cloudflare;1.1.1.1;1.0.0.1;2606:4700:4700::1111;2606:4700:4700::1001
|
Cloudflare (DNSSEC);1.1.1.1;1.0.0.1;2606:4700:4700::1111;2606:4700:4700::1001
|
||||||
EOM
|
EOM
|
||||||
)
|
)
|
||||||
|
|
||||||
# Location for final installation log storage
|
# Location for final installation log storage
|
||||||
installLogLoc=/etc/pihole/install.log
|
installLogLoc="/etc/pihole/install.log"
|
||||||
# This is an important file as it contains information specific to the machine it's being installed on
|
# This is an important file as it contains information specific to the machine it's being installed on
|
||||||
setupVars=/etc/pihole/setupVars.conf
|
setupVars="/etc/pihole/setupVars.conf"
|
||||||
# Pi-hole uses lighttpd as a Web server, and this is the config file for it
|
# Pi-hole uses lighttpd as a Web server, and this is the config file for it
|
||||||
# shellcheck disable=SC2034
|
lighttpdConfig="/etc/lighttpd/lighttpd.conf"
|
||||||
lighttpdConfig=/etc/lighttpd/lighttpd.conf
|
|
||||||
# This is a file used for the colorized output
|
# This is a file used for the colorized output
|
||||||
coltable=/opt/pihole/COL_TABLE
|
coltable="/opt/pihole/COL_TABLE"
|
||||||
|
|
||||||
# Root of the web server
|
# Root of the web server
|
||||||
webroot="/var/www/html"
|
webroot="/var/www/html"
|
||||||
@@ -75,7 +74,7 @@ PI_HOLE_FILES=(chronometer list piholeDebug piholeLogFlush setupLCD update versi
|
|||||||
PI_HOLE_INSTALL_DIR="/opt/pihole"
|
PI_HOLE_INSTALL_DIR="/opt/pihole"
|
||||||
PI_HOLE_CONFIG_DIR="/etc/pihole"
|
PI_HOLE_CONFIG_DIR="/etc/pihole"
|
||||||
PI_HOLE_BIN_DIR="/usr/local/bin"
|
PI_HOLE_BIN_DIR="/usr/local/bin"
|
||||||
PI_HOLE_BLOCKPAGE_DIR="${webroot}/pihole"
|
PI_HOLE_404_DIR="${webroot}/pihole"
|
||||||
if [ -z "$useUpdateVars" ]; then
|
if [ -z "$useUpdateVars" ]; then
|
||||||
useUpdateVars=false
|
useUpdateVars=false
|
||||||
fi
|
fi
|
||||||
@@ -262,10 +261,10 @@ os_check() {
|
|||||||
|
|
||||||
# Compatibility
|
# Compatibility
|
||||||
package_manager_detect() {
|
package_manager_detect() {
|
||||||
# If apt-get is installed, then we know it's part of the Debian family
|
# First check to see if apt-get is installed.
|
||||||
if is_command apt-get ; then
|
if is_command apt-get ; then
|
||||||
# Set some global variables here
|
# Set some global variables here
|
||||||
# We don't set them earlier since the family might be Red Hat, so these values would be different
|
# We don't set them earlier since the installed package manager might be rpm, so these values would be different
|
||||||
PKG_MANAGER="apt-get"
|
PKG_MANAGER="apt-get"
|
||||||
# A variable to store the command used to update the package cache
|
# A variable to store the command used to update the package cache
|
||||||
UPDATE_PKG_CACHE="${PKG_MANAGER} update"
|
UPDATE_PKG_CACHE="${PKG_MANAGER} update"
|
||||||
@@ -273,66 +272,25 @@ if is_command apt-get ; then
|
|||||||
PKG_INSTALL=("${PKG_MANAGER}" -qq --no-install-recommends install)
|
PKG_INSTALL=("${PKG_MANAGER}" -qq --no-install-recommends install)
|
||||||
# grep -c will return 1 if there are no matches. This is an acceptable condition, so we OR TRUE to prevent set -e exiting the script.
|
# grep -c will return 1 if there are no matches. This is an acceptable condition, so we OR TRUE to prevent set -e exiting the script.
|
||||||
PKG_COUNT="${PKG_MANAGER} -s -o Debug::NoLocking=true upgrade | grep -c ^Inst || true"
|
PKG_COUNT="${PKG_MANAGER} -s -o Debug::NoLocking=true upgrade | grep -c ^Inst || true"
|
||||||
# Update package cache. This is required already here to assure apt-cache calls have package lists available.
|
# Update package cache
|
||||||
update_package_cache || exit 1
|
update_package_cache || exit 1
|
||||||
# Debian 7 doesn't have iproute2 so check if it's available first
|
|
||||||
if apt-cache show iproute2 > /dev/null 2>&1; then
|
|
||||||
iproute_pkg="iproute2"
|
|
||||||
# Otherwise, check if iproute is available
|
|
||||||
elif apt-cache show iproute > /dev/null 2>&1; then
|
|
||||||
iproute_pkg="iproute"
|
|
||||||
# Else print error and exit
|
|
||||||
else
|
|
||||||
printf " %b Aborting installation: iproute2 and iproute packages were not found in APT repository.\\n" "${CROSS}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
# Check for and determine version number (major and minor) of current php install
|
# Check for and determine version number (major and minor) of current php install
|
||||||
|
local phpVer="php"
|
||||||
if is_command php ; then
|
if is_command php ; then
|
||||||
printf " %b Existing PHP installation detected : PHP version %s\\n" "${INFO}" "$(php <<< "<?php echo PHP_VERSION ?>")"
|
printf " %b Existing PHP installation detected : PHP version %s\\n" "${INFO}" "$(php <<< "<?php echo PHP_VERSION ?>")"
|
||||||
printf -v phpInsMajor "%d" "$(php <<< "<?php echo PHP_MAJOR_VERSION ?>")"
|
printf -v phpInsMajor "%d" "$(php <<< "<?php echo PHP_MAJOR_VERSION ?>")"
|
||||||
printf -v phpInsMinor "%d" "$(php <<< "<?php echo PHP_MINOR_VERSION ?>")"
|
printf -v phpInsMinor "%d" "$(php <<< "<?php echo PHP_MINOR_VERSION ?>")"
|
||||||
# Is installed php version 7.0 or greater
|
|
||||||
if [ "${phpInsMajor}" -ge 7 ]; then
|
|
||||||
phpInsNewer=true
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
# Several other packages depend on the version of PHP. If PHP is not installed, or an insufficient version,
|
|
||||||
# those packages should fall back to the default (latest?)
|
|
||||||
if [[ "$phpInsNewer" != true ]]; then
|
|
||||||
# Prefer the php metapackage if it's there
|
|
||||||
if apt-cache show php > /dev/null 2>&1; then
|
|
||||||
phpVer="php"
|
|
||||||
# Else fall back on the php5 package if it's there
|
|
||||||
elif apt-cache show php5 > /dev/null 2>&1; then
|
|
||||||
phpVer="php5"
|
|
||||||
# Else print error and exit
|
|
||||||
else
|
|
||||||
printf " %b Aborting installation: No PHP packages were found in APT repository.\\n" "${CROSS}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# Else, PHP is already installed at a version beyond v7.0, so the additional packages
|
|
||||||
# should match version with the current PHP version.
|
|
||||||
phpVer="php$phpInsMajor.$phpInsMinor"
|
phpVer="php$phpInsMajor.$phpInsMinor"
|
||||||
fi
|
fi
|
||||||
# We also need the correct version for `php-sqlite` (which differs across distros)
|
|
||||||
if apt-cache show "${phpVer}-sqlite3" > /dev/null 2>&1; then
|
|
||||||
phpSqlite="sqlite3"
|
|
||||||
elif apt-cache show "${phpVer}-sqlite" > /dev/null 2>&1; then
|
|
||||||
phpSqlite="sqlite"
|
|
||||||
else
|
|
||||||
printf " %b Aborting installation: No SQLite PHP module was found in APT repository.\\n" "${CROSS}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
# Packages required to perfom the os_check (stored as an array)
|
# Packages required to perfom the os_check (stored as an array)
|
||||||
OS_CHECK_DEPS=(grep dnsutils)
|
OS_CHECK_DEPS=(grep dnsutils)
|
||||||
# Packages required to run this install script (stored as an array)
|
# Packages required to run this install script (stored as an array)
|
||||||
INSTALLER_DEPS=(git "${iproute_pkg}" whiptail ca-certificates)
|
INSTALLER_DEPS=(git iproute2 whiptail ca-certificates)
|
||||||
# Packages required to run Pi-hole (stored as an array)
|
# Packages required to run Pi-hole (stored as an array)
|
||||||
PIHOLE_DEPS=(cron curl iputils-ping lsof netcat psmisc sudo unzip idn2 sqlite3 libcap2-bin dns-root-data libcap2)
|
PIHOLE_DEPS=(cron curl iputils-ping lsof psmisc sudo unzip idn2 sqlite3 libcap2-bin dns-root-data libcap2)
|
||||||
# Packages required for the Web admin interface (stored as an array)
|
# Packages required for the Web admin interface (stored as an array)
|
||||||
# It's useful to separate this from Pi-hole, since the two repos are also setup separately
|
# It's useful to separate this from Pi-hole, since the two repos are also setup separately
|
||||||
PIHOLE_WEB_DEPS=(lighttpd "${phpVer}-common" "${phpVer}-cgi" "${phpVer}-${phpSqlite}" "${phpVer}-xml" "${phpVer}-intl")
|
PIHOLE_WEB_DEPS=(lighttpd "${phpVer}-common" "${phpVer}-cgi" "${phpVer}-sqlite3" "${phpVer}-xml" "${phpVer}-intl")
|
||||||
# Prior to PHP8.0, JSON functionality is provided as dedicated module, required by Pi-hole AdminLTE: https://www.php.net/manual/json.installation.php
|
# Prior to PHP8.0, JSON functionality is provided as dedicated module, required by Pi-hole AdminLTE: https://www.php.net/manual/json.installation.php
|
||||||
if [[ "${phpInsNewer}" != true || "${phpInsMajor}" -lt 8 ]]; then
|
if [[ "${phpInsNewer}" != true || "${phpInsMajor}" -lt 8 ]]; then
|
||||||
PIHOLE_WEB_DEPS+=("${phpVer}-json")
|
PIHOLE_WEB_DEPS+=("${phpVer}-json")
|
||||||
@@ -360,7 +318,7 @@ if is_command apt-get ; then
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# If apt-get is not found, check for rpm to see if it's a Red Hat family OS
|
# If apt-get is not found, check for rpm.
|
||||||
elif is_command rpm ; then
|
elif is_command rpm ; then
|
||||||
# Then check if dnf or yum is the package manager
|
# Then check if dnf or yum is the package manager
|
||||||
if is_command dnf ; then
|
if is_command dnf ; then
|
||||||
@@ -369,12 +327,12 @@ elif is_command rpm ; then
|
|||||||
PKG_MANAGER="yum"
|
PKG_MANAGER="yum"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# These variable names match the ones in the Debian family. See above for an explanation of what they are for.
|
# These variable names match the ones for apt-get. See above for an explanation of what they are for.
|
||||||
PKG_INSTALL=("${PKG_MANAGER}" install -y)
|
PKG_INSTALL=("${PKG_MANAGER}" install -y)
|
||||||
PKG_COUNT="${PKG_MANAGER} check-update | egrep '(.i686|.x86|.noarch|.arm|.src)' | wc -l"
|
PKG_COUNT="${PKG_MANAGER} check-update | egrep '(.i686|.x86|.noarch|.arm|.src)' | wc -l"
|
||||||
OS_CHECK_DEPS=(grep bind-utils)
|
OS_CHECK_DEPS=(grep bind-utils)
|
||||||
INSTALLER_DEPS=(git iproute newt procps-ng which chkconfig ca-certificates)
|
INSTALLER_DEPS=(git iproute newt procps-ng which chkconfig ca-certificates)
|
||||||
PIHOLE_DEPS=(cronie curl findutils nmap-ncat sudo unzip libidn2 psmisc sqlite libcap lsof)
|
PIHOLE_DEPS=(cronie curl findutils sudo unzip libidn2 psmisc sqlite libcap lsof)
|
||||||
PIHOLE_WEB_DEPS=(lighttpd lighttpd-fastcgi php-common php-cli php-pdo php-xml php-json php-intl)
|
PIHOLE_WEB_DEPS=(lighttpd lighttpd-fastcgi php-common php-cli php-pdo php-xml php-json php-intl)
|
||||||
LIGHTTPD_USER="lighttpd"
|
LIGHTTPD_USER="lighttpd"
|
||||||
LIGHTTPD_GROUP="lighttpd"
|
LIGHTTPD_GROUP="lighttpd"
|
||||||
@@ -382,8 +340,8 @@ elif is_command rpm ; then
|
|||||||
|
|
||||||
# If neither apt-get or yum/dnf package managers were found
|
# If neither apt-get or yum/dnf package managers were found
|
||||||
else
|
else
|
||||||
# it's not an OS we can support,
|
# we cannot install required packages
|
||||||
printf " %b OS distribution not supported\\n" "${CROSS}"
|
printf " %b No supported package manager found\\n" "${CROSS}"
|
||||||
# so exit the installer
|
# so exit the installer
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
@@ -556,7 +514,7 @@ update_repo() {
|
|||||||
git stash --all --quiet &> /dev/null || true # Okay for stash failure
|
git stash --all --quiet &> /dev/null || true # Okay for stash failure
|
||||||
git clean --quiet --force -d || true # Okay for already clean directory
|
git clean --quiet --force -d || true # Okay for already clean directory
|
||||||
# Pull the latest commits
|
# Pull the latest commits
|
||||||
git pull --quiet &> /dev/null || return $?
|
git pull --no-rebase --quiet &> /dev/null || return $?
|
||||||
# Check current branch. If it is master, then reset to the latest available tag.
|
# Check current branch. If it is master, then reset to the latest available tag.
|
||||||
# In case extra commits have been added after tagging/release (i.e in case of metadata updates/README.MD tweaks)
|
# In case extra commits have been added after tagging/release (i.e in case of metadata updates/README.MD tweaks)
|
||||||
curBranch=$(git rev-parse --abbrev-ref HEAD)
|
curBranch=$(git rev-parse --abbrev-ref HEAD)
|
||||||
@@ -758,9 +716,8 @@ testIPv6() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# A dialog for showing the user about IPv6 blocking
|
find_IPv6_information() {
|
||||||
useIPv6dialog() {
|
# Detects IPv6 address used for communication to WAN addresses.
|
||||||
# Determine the IPv6 address used for blocking
|
|
||||||
IPV6_ADDRESSES=($(ip -6 address | grep 'scope global' | awk '{print $2}'))
|
IPV6_ADDRESSES=($(ip -6 address | grep 'scope global' | awk '{print $2}'))
|
||||||
|
|
||||||
# For each address in the array above, determine the type of IPv6 address it is
|
# For each address in the array above, determine the type of IPv6 address it is
|
||||||
@@ -780,76 +737,34 @@ useIPv6dialog() {
|
|||||||
# set the IPv6 address to the ULA address
|
# set the IPv6 address to the ULA address
|
||||||
IPV6_ADDRESS="${ULA_ADDRESS}"
|
IPV6_ADDRESS="${ULA_ADDRESS}"
|
||||||
# Show this info to the user
|
# Show this info to the user
|
||||||
printf " %b Found IPv6 ULA address, using it for blocking IPv6 ads\\n" "${INFO}"
|
printf " %b Found IPv6 ULA address\\n" "${INFO}"
|
||||||
# Otherwise, if the GUA_ADDRESS has a value,
|
# Otherwise, if the GUA_ADDRESS has a value,
|
||||||
elif [[ ! -z "${GUA_ADDRESS}" ]]; then
|
elif [[ ! -z "${GUA_ADDRESS}" ]]; then
|
||||||
# Let the user know
|
# Let the user know
|
||||||
printf " %b Found IPv6 GUA address, using it for blocking IPv6 ads\\n" "${INFO}"
|
printf " %b Found IPv6 GUA address\\n" "${INFO}"
|
||||||
# And assign it to the global variable
|
# And assign it to the global variable
|
||||||
IPV6_ADDRESS="${GUA_ADDRESS}"
|
IPV6_ADDRESS="${GUA_ADDRESS}"
|
||||||
# If none of those work,
|
# If none of those work,
|
||||||
else
|
else
|
||||||
# explain that IPv6 blocking will not be used
|
printf " %b Unable to find IPv6 ULA/GUA address\\n" "${INFO}"
|
||||||
printf " %b Unable to find IPv6 ULA/GUA address, IPv6 adblocking will not be enabled\\n" "${INFO}"
|
|
||||||
# So set the variable to be empty
|
# So set the variable to be empty
|
||||||
IPV6_ADDRESS=""
|
IPV6_ADDRESS=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the IPV6_ADDRESS contains a value
|
|
||||||
if [[ ! -z "${IPV6_ADDRESS}" ]]; then
|
|
||||||
# Display that IPv6 is supported and will be used
|
|
||||||
whiptail --msgbox --backtitle "IPv6..." --title "IPv6 Supported" "$IPV6_ADDRESS will be used to block ads." "${r}" "${c}"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# A function to check if we should use IPv4 and/or IPv6 for blocking ads
|
# A function to collect IPv4 and IPv6 information of the device
|
||||||
use4andor6() {
|
collect_v4andv6_information() {
|
||||||
# Named local variables
|
find_IPv4_information
|
||||||
local useIPv4
|
# Echo the information to the user
|
||||||
local useIPv6
|
printf " %b IPv4 address: %s\\n" "${INFO}" "${IPV4_ADDRESS}"
|
||||||
# Let user choose IPv4 and/or IPv6 via a checklist
|
# if `dhcpcd` is used offer to set this as static IP for the device
|
||||||
cmd=(whiptail --separate-output --checklist "Select Protocols (press space to toggle selection)" "${r}" "${c}" 2)
|
if [[ -f "/etc/dhcpcd.conf" ]]; then
|
||||||
# In an array, show the options available:
|
|
||||||
# IPv4 (on by default)
|
|
||||||
options=(IPv4 "Block ads over IPv4" on
|
|
||||||
# or IPv6 (on by default if available)
|
|
||||||
IPv6 "Block ads over IPv6" on)
|
|
||||||
# In a variable, show the choices available; exit if Cancel is selected
|
|
||||||
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) || { printf " %bCancel was selected, exiting installer%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"; exit 1; }
|
|
||||||
# For each choice available,
|
|
||||||
for choice in ${choices}
|
|
||||||
do
|
|
||||||
# Set the values to true
|
|
||||||
case ${choice} in
|
|
||||||
IPv4 ) useIPv4=true;;
|
|
||||||
IPv6 ) useIPv6=true;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
# If IPv4 is to be used,
|
|
||||||
if [[ "${useIPv4}" ]]; then
|
|
||||||
# Run our function to get the information we need
|
|
||||||
find_IPv4_information
|
|
||||||
if [[ -f "/etc/dhcpcd.conf" ]]; then
|
|
||||||
# configure networking via dhcpcd
|
# configure networking via dhcpcd
|
||||||
getStaticIPv4Settings
|
getStaticIPv4Settings
|
||||||
setDHCPCD
|
setDHCPCD
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
# If IPv6 is to be used,
|
find_IPv6_information
|
||||||
if [[ "${useIPv6}" ]]; then
|
|
||||||
# Run our function to get this information
|
|
||||||
useIPv6dialog
|
|
||||||
fi
|
|
||||||
# Echo the information to the user
|
|
||||||
printf " %b IPv4 address: %s\\n" "${INFO}" "${IPV4_ADDRESS}"
|
|
||||||
printf " %b IPv6 address: %s\\n" "${INFO}" "${IPV6_ADDRESS}"
|
printf " %b IPv6 address: %s\\n" "${INFO}" "${IPV6_ADDRESS}"
|
||||||
# If neither protocol is selected,
|
|
||||||
if [[ ! "${useIPv4}" ]] && [[ ! "${useIPv6}" ]]; then
|
|
||||||
# Show an error in red
|
|
||||||
printf " %bError: Neither IPv4 or IPv6 selected%b\\n" "${COL_LIGHT_RED}" "${COL_NC}"
|
|
||||||
# and exit with an error
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getStaticIPv4Settings() {
|
getStaticIPv4Settings() {
|
||||||
@@ -1397,18 +1312,18 @@ installConfigs() {
|
|||||||
# make it and set the owners
|
# make it and set the owners
|
||||||
install -d -m 755 -o "${USER}" -g root /etc/lighttpd
|
install -d -m 755 -o "${USER}" -g root /etc/lighttpd
|
||||||
# Otherwise, if the config file already exists
|
# Otherwise, if the config file already exists
|
||||||
elif [[ -f "/etc/lighttpd/lighttpd.conf" ]]; then
|
elif [[ -f "${lighttpdConfig}" ]]; then
|
||||||
# back up the original
|
# back up the original
|
||||||
mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig
|
mv "${lighttpdConfig}"{,.orig}
|
||||||
fi
|
fi
|
||||||
# and copy in the config file Pi-hole needs
|
# and copy in the config file Pi-hole needs
|
||||||
install -D -m 644 -T ${PI_HOLE_LOCAL_REPO}/advanced/${LIGHTTPD_CFG} /etc/lighttpd/lighttpd.conf
|
install -D -m 644 -T ${PI_HOLE_LOCAL_REPO}/advanced/${LIGHTTPD_CFG} "${lighttpdConfig}"
|
||||||
# Make sure the external.conf file exists, as lighttpd v1.4.50 crashes without it
|
# Make sure the external.conf file exists, as lighttpd v1.4.50 crashes without it
|
||||||
touch /etc/lighttpd/external.conf
|
touch /etc/lighttpd/external.conf
|
||||||
chmod 644 /etc/lighttpd/external.conf
|
chmod 644 /etc/lighttpd/external.conf
|
||||||
# If there is a custom block page in the html/pihole directory, replace 404 handler in lighttpd config
|
# If there is a custom block page in the html/pihole directory, replace 404 handler in lighttpd config
|
||||||
if [[ -f "${PI_HOLE_BLOCKPAGE_DIR}/custom.php" ]]; then
|
if [[ -f "${PI_HOLE_BLOCKPAGE_DIR}/custom.php" ]]; then
|
||||||
sed -i 's/^\(server\.error-handler-404\s*=\s*\).*$/\1"pihole\/custom\.php"/' /etc/lighttpd/lighttpd.conf
|
sed -i 's/^\(server\.error-handler-404\s*=\s*\).*$/\1"pihole\/custom\.php"/' "${lighttpdConfig}"
|
||||||
fi
|
fi
|
||||||
# Make the directories if they do not exist and set the owners
|
# Make the directories if they do not exist and set the owners
|
||||||
mkdir -p /run/lighttpd
|
mkdir -p /run/lighttpd
|
||||||
@@ -1555,9 +1470,6 @@ disable_resolved_stublistener() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update_package_cache() {
|
update_package_cache() {
|
||||||
# Running apt-get update/upgrade with minimal output can cause some issues with
|
|
||||||
# requiring user input (e.g password for phpmyadmin see #218)
|
|
||||||
|
|
||||||
# Update package cache on apt based OSes. Do this every time since
|
# Update package cache on apt based OSes. Do this every time since
|
||||||
# it's quick and packages can be updated at any time.
|
# it's quick and packages can be updated at any time.
|
||||||
|
|
||||||
@@ -1622,6 +1534,8 @@ install_dependent_packages() {
|
|||||||
# If there's anything to install, install everything in the list.
|
# If there's anything to install, install everything in the list.
|
||||||
if [[ "${#installArray[@]}" -gt 0 ]]; then
|
if [[ "${#installArray[@]}" -gt 0 ]]; then
|
||||||
test_dpkg_lock
|
test_dpkg_lock
|
||||||
|
# Running apt-get install with minimal output can cause some issues with
|
||||||
|
# requiring user input (e.g password for phpmyadmin see #218)
|
||||||
printf " %b Processing %s install(s) for: %s, please wait...\\n" "${INFO}" "${PKG_MANAGER}" "${installArray[*]}"
|
printf " %b Processing %s install(s) for: %s, please wait...\\n" "${INFO}" "${PKG_MANAGER}" "${installArray[*]}"
|
||||||
printf '%*s\n' "$columns" '' | tr " " -;
|
printf '%*s\n' "$columns" '' | tr " " -;
|
||||||
"${PKG_INSTALL[@]}" "${installArray[@]}"
|
"${PKG_INSTALL[@]}" "${installArray[@]}"
|
||||||
@@ -1657,18 +1571,18 @@ install_dependent_packages() {
|
|||||||
|
|
||||||
# Install the Web interface dashboard
|
# Install the Web interface dashboard
|
||||||
installPiholeWeb() {
|
installPiholeWeb() {
|
||||||
printf "\\n %b Installing blocking page...\\n" "${INFO}"
|
printf "\\n %b Installing 404 page...\\n" "${INFO}"
|
||||||
|
|
||||||
local str="Creating directory for blocking page, and copying files"
|
local str="Creating directory for 404 page, and copying files"
|
||||||
printf " %b %s..." "${INFO}" "${str}"
|
printf " %b %s..." "${INFO}" "${str}"
|
||||||
# Install the directory,
|
# Install the directory
|
||||||
install -d -m 0755 ${PI_HOLE_BLOCKPAGE_DIR}
|
install -d -m 0755 ${PI_HOLE_404_DIR}
|
||||||
# and the blockpage
|
# and the 404 handler
|
||||||
install -D -m 644 ${PI_HOLE_LOCAL_REPO}/advanced/{index,blockingpage}.* ${PI_HOLE_BLOCKPAGE_DIR}/
|
install -D -m 644 ${PI_HOLE_LOCAL_REPO}/advanced/index.php ${PI_HOLE_404_DIR}/
|
||||||
|
|
||||||
# Remove superseded file
|
# Remove superseded file
|
||||||
if [[ -e "${PI_HOLE_BLOCKPAGE_DIR}/index.js" ]]; then
|
if [[ -e "${PI_HOLE_404_DIR}/index.js" ]]; then
|
||||||
rm "${PI_HOLE_BLOCKPAGE_DIR}/index.js"
|
rm "${PI_HOLE_404_DIR}/index.js"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||||
@@ -1800,7 +1714,7 @@ finalExports() {
|
|||||||
# If the setup variable file exists,
|
# If the setup variable file exists,
|
||||||
if [[ -e "${setupVars}" ]]; then
|
if [[ -e "${setupVars}" ]]; then
|
||||||
# update the variables in the file
|
# update the variables in the file
|
||||||
sed -i.update.bak '/PIHOLE_INTERFACE/d;/IPV4_ADDRESS/d;/IPV6_ADDRESS/d;/PIHOLE_DNS_1\b/d;/PIHOLE_DNS_2\b/d;/QUERY_LOGGING/d;/INSTALL_WEB_SERVER/d;/INSTALL_WEB_INTERFACE/d;/LIGHTTPD_ENABLED/d;/CACHE_SIZE/d;' "${setupVars}"
|
sed -i.update.bak '/PIHOLE_INTERFACE/d;/IPV4_ADDRESS/d;/IPV6_ADDRESS/d;/PIHOLE_DNS_1\b/d;/PIHOLE_DNS_2\b/d;/QUERY_LOGGING/d;/INSTALL_WEB_SERVER/d;/INSTALL_WEB_INTERFACE/d;/LIGHTTPD_ENABLED/d;/CACHE_SIZE/d;/DNS_FQDN_REQUIRED/d;/DNS_BOGUS_PRIV/d;' "${setupVars}"
|
||||||
fi
|
fi
|
||||||
# echo the information to the user
|
# echo the information to the user
|
||||||
{
|
{
|
||||||
@@ -1814,8 +1728,8 @@ finalExports() {
|
|||||||
echo "INSTALL_WEB_INTERFACE=${INSTALL_WEB_INTERFACE}"
|
echo "INSTALL_WEB_INTERFACE=${INSTALL_WEB_INTERFACE}"
|
||||||
echo "LIGHTTPD_ENABLED=${LIGHTTPD_ENABLED}"
|
echo "LIGHTTPD_ENABLED=${LIGHTTPD_ENABLED}"
|
||||||
echo "CACHE_SIZE=${CACHE_SIZE}"
|
echo "CACHE_SIZE=${CACHE_SIZE}"
|
||||||
echo "DNS_FQDN_REQUIRED=true"
|
echo "DNS_FQDN_REQUIRED=${DNS_FQDN_REQUIRED:-true}"
|
||||||
echo "DNS_BOGUS_PRIV=true"
|
echo "DNS_BOGUS_PRIV=${DNS_BOGUS_PRIV:-true}"
|
||||||
}>> "${setupVars}"
|
}>> "${setupVars}"
|
||||||
chmod 644 "${setupVars}"
|
chmod 644 "${setupVars}"
|
||||||
|
|
||||||
@@ -1863,27 +1777,6 @@ installLogrotate() {
|
|||||||
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# At some point in the future this list can be pruned, for now we'll need it to ensure updates don't break.
|
|
||||||
# Refactoring of install script has changed the name of a couple of variables. Sort them out here.
|
|
||||||
accountForRefactor() {
|
|
||||||
sed -i 's/piholeInterface/PIHOLE_INTERFACE/g' "${setupVars}"
|
|
||||||
sed -i 's/IPv4_address/IPV4_ADDRESS/g' "${setupVars}"
|
|
||||||
sed -i 's/IPv4addr/IPV4_ADDRESS/g' "${setupVars}"
|
|
||||||
sed -i 's/IPv6_address/IPV6_ADDRESS/g' "${setupVars}"
|
|
||||||
sed -i 's/piholeIPv6/IPV6_ADDRESS/g' "${setupVars}"
|
|
||||||
sed -i 's/piholeDNS1/PIHOLE_DNS_1/g' "${setupVars}"
|
|
||||||
sed -i 's/piholeDNS2/PIHOLE_DNS_2/g' "${setupVars}"
|
|
||||||
sed -i 's/^INSTALL_WEB=/INSTALL_WEB_INTERFACE=/' "${setupVars}"
|
|
||||||
# Add 'INSTALL_WEB_SERVER', if its not been applied already: https://github.com/pi-hole/pi-hole/pull/2115
|
|
||||||
if ! grep -q '^INSTALL_WEB_SERVER=' ${setupVars}; then
|
|
||||||
local webserver_installed=false
|
|
||||||
if grep -q '^INSTALL_WEB_INTERFACE=true' ${setupVars}; then
|
|
||||||
webserver_installed=true
|
|
||||||
fi
|
|
||||||
echo -e "INSTALL_WEB_SERVER=$webserver_installed" >> "${setupVars}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Install base files and web interface
|
# Install base files and web interface
|
||||||
installPihole() {
|
installPihole() {
|
||||||
# If the user wants to install the Web interface,
|
# If the user wants to install the Web interface,
|
||||||
@@ -1914,10 +1807,6 @@ installPihole() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# For updates and unattended install.
|
|
||||||
if [[ "${useUpdateVars}" == true ]]; then
|
|
||||||
accountForRefactor
|
|
||||||
fi
|
|
||||||
# Install base files and web interface
|
# Install base files and web interface
|
||||||
if ! installScripts; then
|
if ! installScripts; then
|
||||||
printf " %b Failure in dependent script copy function.\\n" "${CROSS}"
|
printf " %b Failure in dependent script copy function.\\n" "${CROSS}"
|
||||||
@@ -2002,7 +1891,7 @@ displayFinalMessage() {
|
|||||||
if [[ "${#1}" -gt 0 ]] ; then
|
if [[ "${#1}" -gt 0 ]] ; then
|
||||||
# set the password to the first argument.
|
# set the password to the first argument.
|
||||||
pwstring="$1"
|
pwstring="$1"
|
||||||
elif [[ $(grep 'WEBPASSWORD' -c /etc/pihole/setupVars.conf) -gt 0 ]]; then
|
elif [[ $(grep 'WEBPASSWORD' -c "${setupVars}") -gt 0 ]]; then
|
||||||
# Else if the password exists from previous setup, we'll load it later
|
# Else if the password exists from previous setup, we'll load it later
|
||||||
pwstring="unchanged"
|
pwstring="unchanged"
|
||||||
else
|
else
|
||||||
@@ -2139,7 +2028,7 @@ checkout_pull_branch() {
|
|||||||
# Data in the repositories is public anyway so we can make it readable by everyone (+r to keep executable permission if already set by git)
|
# Data in the repositories is public anyway so we can make it readable by everyone (+r to keep executable permission if already set by git)
|
||||||
chmod -R a+rX "${directory}"
|
chmod -R a+rX "${directory}"
|
||||||
|
|
||||||
git_pull=$(git pull || return 1)
|
git_pull=$(git pull --no-rebase || return 1)
|
||||||
|
|
||||||
if [[ "$git_pull" == *"up-to-date"* ]]; then
|
if [[ "$git_pull" == *"up-to-date"* ]]; then
|
||||||
printf " %b %s\\n" "${INFO}" "${git_pull}"
|
printf " %b %s\\n" "${INFO}" "${git_pull}"
|
||||||
@@ -2586,8 +2475,8 @@ main() {
|
|||||||
setDNS
|
setDNS
|
||||||
# Give the user a choice of blocklists to include in their install. Or not.
|
# Give the user a choice of blocklists to include in their install. Or not.
|
||||||
chooseBlocklists
|
chooseBlocklists
|
||||||
# Let the user decide if they want to block ads over IPv4 and/or IPv6
|
# find IPv4 and IPv6 information of the device
|
||||||
use4andor6
|
collect_v4andv6_information
|
||||||
# Let the user decide if they want the web interface to be installed automatically
|
# Let the user decide if they want the web interface to be installed automatically
|
||||||
setAdminFlag
|
setAdminFlag
|
||||||
# Let the user decide if they want query logging enabled...
|
# Let the user decide if they want query logging enabled...
|
||||||
@@ -2660,7 +2549,7 @@ main() {
|
|||||||
# Add password to web UI if there is none
|
# Add password to web UI if there is none
|
||||||
pw=""
|
pw=""
|
||||||
# If no password is set,
|
# If no password is set,
|
||||||
if [[ $(grep 'WEBPASSWORD' -c /etc/pihole/setupVars.conf) == 0 ]] ; then
|
if [[ $(grep 'WEBPASSWORD' -c "${setupVars}") == 0 ]] ; then
|
||||||
# generate a random password
|
# generate a random password
|
||||||
pw=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c 8)
|
pw=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c 8)
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
|
@@ -15,8 +15,6 @@ export LC_ALL=C
|
|||||||
|
|
||||||
coltable="/opt/pihole/COL_TABLE"
|
coltable="/opt/pihole/COL_TABLE"
|
||||||
source "${coltable}"
|
source "${coltable}"
|
||||||
regexconverter="/opt/pihole/wildcard_regex_converter.sh"
|
|
||||||
source "${regexconverter}"
|
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
source "/etc/.pihole/advanced/Scripts/database_migration/gravity-db.sh"
|
source "/etc/.pihole/advanced/Scripts/database_migration/gravity-db.sh"
|
||||||
|
|
||||||
|
@@ -11,18 +11,18 @@ from .conftest import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_supported_operating_system(Pihole):
|
def test_supported_package_manager(Pihole):
|
||||||
'''
|
'''
|
||||||
confirm installer exists on unsupported distribution
|
confirm installer exits when no supported package manager found
|
||||||
'''
|
'''
|
||||||
# break supported package managers to emulate an unsupported distribution
|
# break supported package managers
|
||||||
Pihole.run('rm -rf /usr/bin/apt-get')
|
Pihole.run('rm -rf /usr/bin/apt-get')
|
||||||
Pihole.run('rm -rf /usr/bin/rpm')
|
Pihole.run('rm -rf /usr/bin/rpm')
|
||||||
package_manager_detect = Pihole.run('''
|
package_manager_detect = Pihole.run('''
|
||||||
source /opt/pihole/basic-install.sh
|
source /opt/pihole/basic-install.sh
|
||||||
package_manager_detect
|
package_manager_detect
|
||||||
''')
|
''')
|
||||||
expected_stdout = cross_box + ' OS distribution not supported'
|
expected_stdout = cross_box + ' No supported package manager found'
|
||||||
assert expected_stdout in package_manager_detect.stdout
|
assert expected_stdout in package_manager_detect.stdout
|
||||||
# assert package_manager_detect.rc == 1
|
# assert package_manager_detect.rc == 1
|
||||||
|
|
||||||
@@ -112,9 +112,9 @@ def test_installPiholeWeb_fresh_install_no_errors(Pihole):
|
|||||||
source /opt/pihole/basic-install.sh
|
source /opt/pihole/basic-install.sh
|
||||||
installPiholeWeb
|
installPiholeWeb
|
||||||
''')
|
''')
|
||||||
expected_stdout = info_box + ' Installing blocking page...'
|
expected_stdout = info_box + ' Installing 404 page...'
|
||||||
assert expected_stdout in installWeb.stdout
|
assert expected_stdout in installWeb.stdout
|
||||||
expected_stdout = tick_box + (' Creating directory for blocking page, '
|
expected_stdout = tick_box + (' Creating directory for 404 page, '
|
||||||
'and copying files')
|
'and copying files')
|
||||||
assert expected_stdout in installWeb.stdout
|
assert expected_stdout in installWeb.stdout
|
||||||
expected_stdout = info_box + ' Backing up index.lighttpd.html'
|
expected_stdout = info_box + ' Backing up index.lighttpd.html'
|
||||||
@@ -126,7 +126,6 @@ def test_installPiholeWeb_fresh_install_no_errors(Pihole):
|
|||||||
assert expected_stdout in installWeb.stdout
|
assert expected_stdout in installWeb.stdout
|
||||||
web_directory = Pihole.run('ls -r /var/www/html/pihole').stdout
|
web_directory = Pihole.run('ls -r /var/www/html/pihole').stdout
|
||||||
assert 'index.php' in web_directory
|
assert 'index.php' in web_directory
|
||||||
assert 'blockingpage.css' in web_directory
|
|
||||||
|
|
||||||
|
|
||||||
def test_update_package_cache_success_no_errors(Pihole):
|
def test_update_package_cache_success_no_errors(Pihole):
|
||||||
@@ -421,10 +420,9 @@ def test_IPv6_only_link_local(Pihole):
|
|||||||
)
|
)
|
||||||
detectPlatform = Pihole.run('''
|
detectPlatform = Pihole.run('''
|
||||||
source /opt/pihole/basic-install.sh
|
source /opt/pihole/basic-install.sh
|
||||||
useIPv6dialog
|
find_IPv6_information
|
||||||
''')
|
''')
|
||||||
expected_stdout = ('Unable to find IPv6 ULA/GUA address, '
|
expected_stdout = ('Unable to find IPv6 ULA/GUA address')
|
||||||
'IPv6 adblocking will not be enabled')
|
|
||||||
assert expected_stdout in detectPlatform.stdout
|
assert expected_stdout in detectPlatform.stdout
|
||||||
|
|
||||||
|
|
||||||
@@ -445,9 +443,9 @@ def test_IPv6_only_ULA(Pihole):
|
|||||||
)
|
)
|
||||||
detectPlatform = Pihole.run('''
|
detectPlatform = Pihole.run('''
|
||||||
source /opt/pihole/basic-install.sh
|
source /opt/pihole/basic-install.sh
|
||||||
useIPv6dialog
|
find_IPv6_information
|
||||||
''')
|
''')
|
||||||
expected_stdout = 'Found IPv6 ULA address, using it for blocking IPv6 ads'
|
expected_stdout = 'Found IPv6 ULA address'
|
||||||
assert expected_stdout in detectPlatform.stdout
|
assert expected_stdout in detectPlatform.stdout
|
||||||
|
|
||||||
|
|
||||||
@@ -468,9 +466,9 @@ def test_IPv6_only_GUA(Pihole):
|
|||||||
)
|
)
|
||||||
detectPlatform = Pihole.run('''
|
detectPlatform = Pihole.run('''
|
||||||
source /opt/pihole/basic-install.sh
|
source /opt/pihole/basic-install.sh
|
||||||
useIPv6dialog
|
find_IPv6_information
|
||||||
''')
|
''')
|
||||||
expected_stdout = 'Found IPv6 GUA address, using it for blocking IPv6 ads'
|
expected_stdout = 'Found IPv6 GUA address'
|
||||||
assert expected_stdout in detectPlatform.stdout
|
assert expected_stdout in detectPlatform.stdout
|
||||||
|
|
||||||
|
|
||||||
@@ -492,9 +490,9 @@ def test_IPv6_GUA_ULA_test(Pihole):
|
|||||||
)
|
)
|
||||||
detectPlatform = Pihole.run('''
|
detectPlatform = Pihole.run('''
|
||||||
source /opt/pihole/basic-install.sh
|
source /opt/pihole/basic-install.sh
|
||||||
useIPv6dialog
|
find_IPv6_information
|
||||||
''')
|
''')
|
||||||
expected_stdout = 'Found IPv6 ULA address, using it for blocking IPv6 ads'
|
expected_stdout = 'Found IPv6 ULA address'
|
||||||
assert expected_stdout in detectPlatform.stdout
|
assert expected_stdout in detectPlatform.stdout
|
||||||
|
|
||||||
|
|
||||||
@@ -516,9 +514,9 @@ def test_IPv6_ULA_GUA_test(Pihole):
|
|||||||
)
|
)
|
||||||
detectPlatform = Pihole.run('''
|
detectPlatform = Pihole.run('''
|
||||||
source /opt/pihole/basic-install.sh
|
source /opt/pihole/basic-install.sh
|
||||||
useIPv6dialog
|
find_IPv6_information
|
||||||
''')
|
''')
|
||||||
expected_stdout = 'Found IPv6 ULA address, using it for blocking IPv6 ads'
|
expected_stdout = 'Found IPv6 ULA address'
|
||||||
assert expected_stdout in detectPlatform.stdout
|
assert expected_stdout in detectPlatform.stdout
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user