pi-hole
pi-hole copied to clipboard
local CNAME records delete wrong entry
Versions
- Pi-hole version is v5.13 (Latest: v5.13)
- AdminLTE version is v5.16 (Latest: v5.16)
- FTL version is v5.18.2 (Latest: v5.18.2)
Platform
- Raspbian GNU/Linux 10 (buster)
- Platform: Raspberry Pi
Expected behavior
int the local CNAME records list, say we have the following cname records
aaa.section.test.local aaa-section.test.local bbb.section.test.local bbb-section.test.local
delete "aaa.section.test.local" should only delete this record only.
Actual behavior / bug
delete "aaa.section.test.local" or "bbb.section.test.local" actually delete all four records.
delete "aaa-section.test.local" only delete "aaa-section.test.local" as expect.
The issue is here:
https://github.com/pi-hole/pi-hole/blob/e773e3302ca66a6d918a40c8a8c6282f223d4906/advanced/Scripts/webpage.sh#L758
rockpi@rockpi-4b:~$ cat /etc/dnsmasq.d/05-pihole-custom-cname.conf
cname=aaa.section,q
cname=aaa-section,q
cname=bbb.section,q
cname=bbb-section,q
rockpi@rockpi-4b:~$ sudo sed -i "/cname=bbb.section,q$/Id" /etc/dnsmasq.d/05-pihole-custom-cname.conf
rockpi@rockpi-4b:~$ cat /etc/dnsmasq.d/05-pihole-custom-cname.conf
cname=aaa.section,q
cname=aaa-section,q
We need to escape the .
rockpi@rockpi-4b:~$ sudo sed -i "/^cname=bbb\.section,q$/Id" /etc/dnsmasq.d/05-pihole-custom-cname.conf
rockpi@rockpi-4b:~$ cat /etc/dnsmasq.d/05-pihole-custom-cname.conf
cname=bbb-section,q
@ethanliu
Thanks for the report. You discovered a real bug. PR https://github.com/pi-hole/pi-hole/pull/4990 should fix this.
Can you please try it with pihole checkout core escape_dot
.
You can go back on track anytime and before the next Pi-hole update with pihole checkout core master
@yubiuser Thank you for the quick response, I have test it with some common used characters in domain name and multi level subdomains, all works perfect.
Fixed with https://github.com/pi-hole/pi-hole/releases/tag/v5.14