pi-hole / FTL

The Pi-hole FTL engine
https://pi-hole.net
Other
1.34k stars 187 forks source link

dns.hosts(0): invalid hostname #1920

Closed asdf4w3t5 closed 3 months ago

asdf4w3t5 commented 3 months ago

https://discourse.pi-hole.net/t/local-dns-settings-x-invalid-value/68985/4

image

seems the same

https://github.com/pi-hole/FTL/blob/development-v6/src/tools/gravity-parseList.c#L54

no hostnames work since the update of the most recent one.

It is unrelated to the forum thread, also this occurs with pre-existing domains and is very annoying since I have a lot of them. It is validating domains I have entered months ago and saying they are wrong. And not letting add new ones.

I have deleted all of them out of pihole and just added them to my hosts in my unbound server so I don't have to deal with the pihole and can test better

it looks like any domain that is asdasdasd.a <-- single character at TLD fails this testing is too greedy, Let people put in whatever they want or at least check a box to input whatever they want.. They already had to check "expert" to get here.

DL6ER commented 3 months ago

The forum post was about capital letters being rejected, we fixed this.

It is validating domains I have entered months ago and saying they are wrong

The issue you are reporting is about a TLD with a length of one whereas the minimum enforced length is 2:

https://github.com/pi-hole/FTL/blob/91d8738a7f32eacabb0e65c760a4d505295e0051/src/tools/gravity-parseList.c#L97-L101

following https://data.iana.org/TLD/tlds-alpha-by-domain.txt which does not list a single one-character TLD.

However, I do agree with you that users may define such TLDs locally so we should relax this as well. Nonetheless, I want to advise against using TLDs that are not defined in the wild for you private use. Imagine they get defined at some point in the future and suddenly some of your internal configurations become problematic. This threat is not hypothetical as we have seen more recently where a malicious party has registered fritz.box where this is the host name of a lot of popular routers out in the wild.

DL6ER commented 3 months ago

Also, looking at the title of this PR:

dns.hosts[0]: invalid hostname

will have shown you where to look. It means that the zeroth element was causing the validation issue.

asdf4w3t5 commented 3 months ago

The forum post was about capital letters being rejected, we fixed this.

yes that is how I was able to say it is unrelated

This issue did not occur until I updated yesterday. Last time I updated was a month ago or so

will have shown you where to look. It means that the zeroth element was causing the validation issue.

So I should have fixed it?

However, I do agree with you that users may define such TLDs locally so we should relax this as well. Nonetheless, I want to advise against using TLDs that are not defined in the wild for you private use. Imagine they get defined at some point in the future and suddenly some of your internal configurations become problematic. This threat is not hypothetical as we have seen more recently where a malicious party has registered fritz.box where this is the host name of a lot of popular routers out in the wild.

corporate infrastructure will probably never not have random domains with 1 letters

This threat is not hypothetical as we have seen more recently where a malicious party has registered fritz.box where this is the host name of a lot of popular routers out in the wild.

That's good they did that, routers should stop with having names at all.

I'd be glad if they actually made single letter TLDs but I doubt it and even more glad if they took away the period like it used to be and just have names. but I guarantee that one won't happen lol

DL6ER commented 3 months ago

So I should have fixed it?

No, I mean you could have found it more easily. We still agreed on that this is worth changing. The one-letter TLD validation has been merged and this won't happen again so I'll code this ticket.