Andrew Bogott has submitted this change and it was merged.

Change subject: Better handling for invalid cert names:
......................................................................


Better handling for invalid cert names:

- Accept foo.bar.eqiad.wmflabs entries.  Should support upcoming cert scheme.
- Clean up invalid requests.

Bug T95519

Change-Id: I6ea09a17d8222063f7fd6b0cd2b60292956bb89b
---
M modules/puppetmaster/files/puppetsigner.py
1 file changed, 3 insertions(+), 2 deletions(-)

Approvals:
  Andrew Bogott: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/puppetmaster/files/puppetsigner.py 
b/modules/puppetmaster/files/puppetsigner.py
index 5163c6c..b9bfa10 100755
--- a/modules/puppetmaster/files/puppetsigner.py
+++ b/modules/puppetmaster/files/puppetsigner.py
@@ -53,8 +53,9 @@
             hostname = host[0].strip('"')
 
         # Skip pathological hostnames -- possible attack vector.
-        if not re.match(r'^[a-zA-Z0-9_-]+\.eqiad\.wmflabs$', hostname):
-            sys.stderr.write('Invalid hostname %s' % hostname)
+        if not re.match(r'^[\.a-zA-Z0-9_-]+\.eqiad\.wmflabs$', hostname):
+            sys.stderr.write('Invalid hostname %s\n' % hostname)
+            subprocess.check_call(['/usr/bin/puppet', 'cert', 'clean', 
hostname])
             continue
 
         # Erase keys that don't correspond to ldap; sign those that do

-- 
To view, visit https://gerrit.wikimedia.org/r/208640
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6ea09a17d8222063f7fd6b0cd2b60292956bb89b
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Andrew Bogott <[email protected]>
Gerrit-Reviewer: Andrew Bogott <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to