nsot icon indicating copy to clipboard operation
nsot copied to clipboard

Hostname Validation Bug

Open coxley opened this issue 9 years ago • 5 comments

Appears #149 has a bug in hostname validation, at least something that might be unexpected.

This -is- configurable but I think it's unexpected as some people encode locations/environments in their FQDN. Maybe default to accepted dot? What do you think?

coxley avatar Feb 25 '16 03:02 coxley

I think the sane default is to only accept a hostname fragment.

I would prefer we:

  • Highlight this fact the config and install documentation
  • Use the error case "invalid name" to start a FAQ/user guide

jathanism avatar Feb 25 '16 16:02 jathanism

+1 to allowing FQDN

As an example, my devices are named by site so the first label in the DNS name (eg: pe1) appears in every site. We operate a large MPLS L2VPN network so these devices would all be considered as part of the same "network" in nsot.

I don't think it would be too onerous to support both, or ditch the restriction entirely (looking forwards to nuts who don't use the DNS).

dowlingw avatar Apr 05 '16 01:04 dowlingw

Whoops, ignore me - didn't fully understand the previous comment - can someone point me in the right direction for the configuration option? :)

dowlingw avatar Apr 05 '16 01:04 dowlingw

Hey @dowlingw :)

If I understand correctly, you have devices like:

  • pe1.site1.example.com
  • pe1.site2.example.com
  • etc...

If so then yeah, it's relevant to this ticket. It's possible but just not default. In nsot.conf.py, the parameter you want to tweak is DEVICE_NAME.

# Current default
DEVICE_NAME = re.compile(r"^([A-Za-z0-9][A-Za-z0-9\-]{0,61}[A-Za-z0-9]|[A-Za-z0-9])$")

# What I think you want
DEVICE_NAME = re.compile(r"^([A-Za-z0-9][A-Za-z0-9\-\.]{0,61}[A-Za-z0-9]|[A-Za-z0-9])$")

See: https://regex101.com/r/vO1xJ6/1

coxley avatar Apr 09 '16 21:04 coxley

Addressing this will fix #264

jathanism avatar Aug 25 '17 15:08 jathanism