Validation of alias host IP etc
phil.davis last edited by
I have just been looking at some code to better validate inputs when editing aliases. Then I noticed that I could put things like the following into the IP/FQDN rows of an alias and have it accepted:
The validation allows anything that passes the test of "is_hostname" - which seems reasonable - we want stuff like mycompany.com to go into an alias.
But 10.20.30.300 is also a valid hostname - obviously not an IPv4 address because of the "300". I think this was a problem with the IPv4 numbering convention vs. the DNS naming scheme. It can be ambiguous (e.g. 220.127.116.11 could be a host name and is also an IPv4 address, dodgy-looking IPv4 addresses still are valid host names…).
"random" I guess is also a valid host name (and I suppose would get the domain of pfSense added to it when being looked up to find the IP address - like random.mycompany.com).
So it is not really possible to do much effective validation of alias entries when people intended to enter an IPv4 address or an alias name, because mis-typing these things usually results in something that passes the "is_hostname" test, and so is accepted into the alias.
Is this is the way it is?
or am I missing something?
It would be nice to be able to do "better" validation of alias entry, but maybe not possible.
Edit: add - and I just entered 18.104.22.168-22.214.171.124.5 thinking to put in a dodgy IP range, but that is accepted because it is technically a valid host name!