-
-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to ignore unknown DHCP clients #1980
Conversation
Signed-off-by: DL6ER <dl6er@dl6er.de>
This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there: https://discourse.pi-hole.net/t/add-checkbox-to-block-dhcp-for-unknown-hosts/70485/5 |
…ave been made in between and add a test ensuring they remain in sync in the future Signed-off-by: DL6ER <dl6er@dl6er.de>
4bd3364
to
96da0d4
Compare
@@ -23,13 +23,12 @@ done | |||
rm -rf /etc/pihole /var/log/pihole /dev/shm/FTL-* | |||
|
|||
# Create necessary directories and files | |||
mkdir -p /home/pihole /etc/pihole /run/pihole /var/log/pihole | |||
mkdir -p /home/pihole /etc/pihole /run/pihole /var/log/pihole /etc/pihole/config_backups |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/etc/pihole/config_backups
was not created, causing:
2024-05-30 17:09:24.091 [1119/T1132] DEBUG_CONFIG: Copying /etc/pihole/pihole.toml -> /etc/pihole/config_backups/pihole.toml.1
2024-05-30 17:09:24.091 [1119/T1132] WARNING: copy_file(): Failed to open "/etc/pihole/config_backups/pihole.toml.1" for writing: Permission denied
2024-05-30 17:09:24.091 [1119/T1132] WARNING: Rotation /etc/pihole/pihole.toml -(COPY)> /etc/pihole/config_backups/pihole.toml.1 failed
2024-05-30 17:09:24.091 [1119/T1132] WARNING: chown_pihole(): Failed to change ownership of "/etc/pihole/config_backups/pihole.toml.1" to 1000:1000: Permission denied
during CI runs. It just looked like worth fixing
test/run.sh
Outdated
touch /var/log/pihole/HTTP_info.log /var/log/pihole/PH7.log /etc/pihole/dhcp.leases | ||
chown pihole:pihole /etc/pihole /run/pihole /var/log/pihole/pihole.log /var/log/pihole/FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port | ||
chown pihole:pihole /var/log/pihole/HTTP_info.log /var/log/pihole/PH7.log /etc/pihole/dhcp.leases | ||
touch /var/log/pihole/HTTP_info.log /etc/pihole/dhcp.leases |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed PH7.log
chown pihole:pihole /etc/pihole /run/pihole /var/log/pihole/pihole.log /var/log/pihole/FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port | ||
chown pihole:pihole /var/log/pihole/HTTP_info.log /var/log/pihole/PH7.log /etc/pihole/dhcp.leases | ||
touch /var/log/pihole/HTTP_info.log /etc/pihole/dhcp.leases | ||
chown -R pihole:pihole /etc/pihole /run/pihole /var/log/pihole |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplified chown
by recursively chown
ing the same directories which are also owned by pihole:pihole
on regular installs, ensures we cannot forget to set appropriate permissions if we add new files
test/run.sh
Outdated
echo -n "PH7.log: " | ||
curl_to_tricorder /var/log/pihole/PH7.log | ||
echo "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed PH7.log
here as well
#@test "Version, Tag, Branch, Hash, Date is reported" { | ||
# run bash -c 'echo ">version >quit" | nc -v 127.0.0.1 4711' | ||
# printf "%s\n" "${lines[@]}" | ||
# [[ ${lines[1]} == "version "* ]] | ||
# [[ ${lines[2]} == "tag "* ]] | ||
# [[ ${lines[3]} == "branch "* ]] | ||
# [[ ${lines[4]} == "hash "* ]] | ||
# [[ ${lines[5]} == "date "* ]] | ||
# [[ ${lines[6]} == "" ]] | ||
#} | ||
# | ||
#@test "DNS server port is reported over Telnet API" { | ||
# run bash -c 'echo ">dns-port >quit" | nc -v 127.0.0.1 4711' | ||
# printf "%s\n" "${lines[@]}" | ||
# [[ ${lines[1]} == "53" ]] | ||
# [[ ${lines[2]} == "" ]] | ||
#} | ||
# | ||
#@test "Maxlogage value is reported over Telnet API" { | ||
# run bash -c 'echo ">maxlogage >quit" | nc -v 127.0.0.1 4711' | ||
# printf "%s\n" "${lines[@]}" | ||
# [[ ${lines[1]} == "86400" ]] | ||
# [[ ${lines[2]} == "" ]] | ||
#} | ||
# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed old cruft
run bash -c 'grep -c "DEBUG_CONFIG: pihole.toml unchanged" /var/log/pihole/FTL.log' | ||
printf "%s\n" "${lines[@]}" | ||
[[ ${lines[0]} == "3" ]] | ||
[[ ${lines[0]} == "4" ]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As test/pihole.toml
is now in the expected format, there is no initial reformatting and the file stays unchanged one time more
Signed-off-by: DL6ER <dl6er@dl6er.de>
@rdwebdesign In the end, yes. But it'll be a separate PR and I haven't had the chance to do it myself, so far. Please go ahead :-) |
What does this implement/fix?
Add new
dhcp.ignoreUnknownClients
option which has been requested on Discourse. It works as follows:This PR also features a second commit updating forgotten changes into
test/pihole.toml
and adds a CI test to prevent forgetting to update this file in the future.Related issue or feature (if applicable): https://discourse.pi-hole.net/t/add-checkbox-to-block-dhcp-for-unknown-hosts/70485
Pull request in docs with documentation (if applicable): N/A
By submitting this pull request, I confirm the following:
git rebase
)Checklist:
developmental
branch.