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

Allow IPv6 #490

Closed
bjvrielink opened this issue Jun 4, 2019 · 2 comments · Fixed by #514
Closed

Allow IPv6 #490

bjvrielink opened this issue Jun 4, 2019 · 2 comments · Fixed by #514

Comments

@bjvrielink
Copy link

In order to support listening on IPv6, all that is needed is to set bind_address: "::" in /etc/webhook.yaml.

Sounds easy, but the problem is that the colons need to be surrounded in quotation marks, and here's the problem: the way the $bind_address is copied into the $webhook_hash in webhook::config means that it loses the quotation marks and results in a webhook service that fails to start.

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.5.14
  • Ruby: ruby 2.4.5p335 (2018-10-18 revision 65137) [x86_64-linux]
  • Distribution: Centos7
  • Module version: 6.8.0

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

hiera:
r10k::webhook::config::bind_address: "::"
puppet:
class {'::r10k::webhook::config': }

What are you seeing

A webhook that fails to start

What behaviour did you expect instead

A webhook that starts and listens on both IPv4 and IPv6

Output log

/opt/puppetlabs/puppet/lib/ruby/2.4.0/psych.rb:377:in parse': (/etc/webhook.yaml): mapping values are not allowed in this context at line 4 column 16 (Psych::SyntaxError) from /opt/puppetlabs/puppet/lib/ruby/2.4.0/psych.rb:377:in parse_stream'
from /opt/puppetlabs/puppet/lib/ruby/2.4.0/psych.rb:325:in parse' from /opt/puppetlabs/puppet/lib/ruby/2.4.0/psych.rb:252:in load'
from /opt/puppetlabs/puppet/lib/ruby/2.4.0/psych.rb:473:in block in load_file' from /opt/puppetlabs/puppet/lib/ruby/2.4.0/psych.rb:472:in open'
from /opt/puppetlabs/puppet/lib/ruby/2.4.0/psych.rb:472:in load_file' from /usr/local/bin/webhook:28:in

'

Any additional information you'd like to impart

Please consider changing the default in params.pp from '0.0.0.0' to '::'

@bjvrielink
Copy link
Author

Found a workaround:
r10k::webhook::config::bind_address: "0:0:0:0:0:0:0:0"

The fact that "::" does not work lies in the Ruby code in templates/webhook.yaml.erb where it tries to convert anything starting with a colon into a Ruby symbol.
I think "when /^:[^:]/" may work, but there must be a more elegant solution?

@mcb30
Copy link
Contributor

mcb30 commented Mar 28, 2020

Using r10k::webhook::config::bind_address: "*" also works.

mcb30 added a commit to mcb30/puppet-r10k that referenced this issue Mar 28, 2020
The default bind_address is currently "0.0.0.0", which causes the
webhook to listen only for IPv4 connections.  Change the default to
"*" so that the webhook will listen for both IPv4 and IPv6
connections.

Fixes voxpupuli#490

Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
mcb30 added a commit to mcb30/puppet-r10k that referenced this issue Mar 29, 2020
The default bind_address is currently "0.0.0.0", which causes the
webhook to listen only for IPv4 connections.  Change the default to
"*" so that the webhook will listen for both IPv4 and IPv6
connections.

Fixes voxpupuli#490

Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants