Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter allowed_hosts does not accept IP Addresses with subnets (xyz/subnet) #46

Open
mleiner opened this issue Apr 26, 2021 · 0 comments

Comments

@mleiner
Copy link

mleiner commented Apr 26, 2021

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 6
  • Ruby: unrelated
  • Distribution: any
  • Module version: latest

How to reproduce (e.g Puppet code you use)

nrpe::allowed_hosts:

  • '2001:1::/56'

What are you seeing

Error: Evaluation Error: Error while evaluating a Function Call, lambda:
parameter 'allowed_hosts' index 1 expects a Stdlib::Host = Variant[Stdlib::Fqdn = Pattern[/\A(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-][a-zA-Z0-9]).)([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-][A-Za-z0-9])\z/], Stdlib::Compat::Ip_address = Variant[Stdlib::Compat::Ipv4 = Pattern[/^(((0-9|[1-9]0-9|1[0-9]{2}(?!\d)|2[0-4]0-9|250-5)[.]){3}(0-9|[1-9]0-9|1[0-9]{2}(?!\d)|2[0-4]0-9|250-5))(/(((0-9|[1-9]0-9|1[0-9]{2}(?!\d)|2[0-4]0-9|250-5)[.]){3}(0-9|[1-9]0-9|1[0-9]{2}(?!\d)|2[0-4]0-9|250-5)|[0-9]+))?$/], Stdlib::Compat::Ipv6 = Pattern[/\s((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/]]] value, got String
parameter 'allowed_hosts' index 10 expects a Stdlib::Host = Variant[Stdlib::Fqdn = Pattern[/\A(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-][a-zA-Z0-9]).)([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-][A-Za-z0-9])\z/], Stdlib::Compat::Ip_address = Variant[Stdlib::Compat::Ipv4 = Pattern[/^(((0-9|[1-9]0-9|1[0-9]{2}(?!\d)|2[0-4]0-9|250-5)[.]){3}(0-9|[1-9]0-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}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/]]] value, got String...

What behaviour did you expect instead

nrpe.cfg containing allowed_hosts set to 2001:1::/56

Output log

Any additional information you'd like to impart

I have found out that both manifests.init.pp and templates/nrpe.cfg.epp contain Array[Stdlib::Host]

manifests/init.pp: Array[Stdlib::Host] $allowed_hosts = ['127.0.0.1'],
templates/nrpe.cfg.epp: Array[Stdlib::Host] $allowed_hosts,

This datatype does not allow the use of IP acdresses with subnets.

I temporarily changed these to Array[Variant[Stdlib::Host,Stdlib::IP::Address]], compilation of catalogs functions again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant