Page MenuHomePhabricator

role::puppetmaster::standalone has no firewall rule for port 8140
Closed, ResolvedPublic

Description

When applied together with a role that enables base::firewall, role::puppetmaster::standalone's puppetmaster is unreachable because it has no firewall rule to access it (port 8140).

There are two obstacles that make for example a simple ferm::service { 'puppetmaster-frontend': proto => 'tcp', port => 8140, srange => '$DOMAIN_NETWORKS', } not enough:

  1. role::labs::puppetmaster includes role::puppetmaster::standalone with the (Apache) restriction $allow_from => flatten([$labs_instance_range, '208.80.154.14', '208.80.155.119', '208.80.153.74', $horizon_host_ip, $labs_metal]) (and in general $allow_from can contain wildcard domain names as well), so restricting srange too narrowly is not an option and automatically converting $allow_from is not possible.
  2. role::labs::puppetmaster has its own ferm rules (saddr (${labs_vms} ${labs_metal} ${monitoring} ${horizon_host_ip}) proto tcp dport 8140 ACCEPT; and saddr (${labs_vms} ${labs_metal} ${monitoring} ${horizon_host_ip}) proto tcp dport 8100 ACCEPT;), so "restricting" srange too broadly is no option either.

Probably the manifests need to be reorganized so that the roles do not depend on each other, i. e. move the $use_enc bits to the class puppetmaster and then instantiate puppetmaster and not role::puppetmaster::standalone in role::puppetmaster::labs, or truly combine role::puppetmaster::standalone and role::puppetmaster::labs into one role.

Event Timeline

I would need more investigation/information. These are my findings until now:

  • I can't find the role::labs::puppetmaster puppet role. Where do it lives?
  • If I deploy a standalone puppet master in Cloud VPS, set a proxy, I see packets reaching the webserver in 8140 (no profile::base::firewall)

More testing. I see that a patch like this just works, but the reporter @scfc seems to suggest this doesn't work:

diff --git a/modules/role/manifests/puppetmaster/standalone.pp b/modules/role/manifests/puppetmaster/standalone.pp
index a59726673c..77fcdd97b2 100644
--- a/modules/role/manifests/puppetmaster/standalone.pp
+++ b/modules/role/manifests/puppetmaster/standalone.pp
@@ -72,4 +72,10 @@ class role::puppetmaster::standalone(
     class { 'puppetmaster::gitsync':
         run_every_minutes => $git_sync_minutes,
     }
+
+    ferm::service { 'puppetmaster-frontend':
+       proto => 'tcp',
+       port => 8140,
+       srange => '$DOMAIN_NETWORKS',
+    }
 }

With this patch, in a role::puppetmaster::standalone machine, my testing was:

  • I added ::base::firewall. Rules are loaded, I see proper iptables rules and packets reach tcp/8140
  • I then deleted ::base::firewall. My expectation was some error from puppet because using ferm::service but no loading ::base::firewall (hey, no ferm installed) but it seems just to work.

Change 394101 had a related patch set uploaded (by Arturo Borrero Gonzalez; owner: Arturo Borrero Gonzalez):
[operations/puppet@production] role::puppetmaster::standalone: add ferm rules to allow connecting to tcp/8140

https://gerrit.wikimedia.org/r/394101

Change 394101 merged by Arturo Borrero Gonzalez:
[operations/puppet@production] role::puppetmaster::standalone: add ferm rules to allow connecting to tcp/8140

https://gerrit.wikimedia.org/r/394101