pi-hole icon indicating copy to clipboard operation
pi-hole copied to clipboard

local CNAME records delete wrong entry

Open ethanliu opened this issue 2 years ago • 4 comments

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.

ethanliu avatar Oct 20 '22 09:10 ethanliu

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

yubiuser avatar Oct 21 '22 10:10 yubiuser

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

yubiuser avatar Oct 21 '22 10:10 yubiuser

@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 avatar Oct 21 '22 12:10 yubiuser

@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.

ethanliu avatar Oct 22 '22 18:10 ethanliu

Fixed with https://github.com/pi-hole/pi-hole/releases/tag/v5.14

yubiuser avatar Nov 14 '22 19:11 yubiuser