Last active
August 29, 2015 14:07
-
-
Save kostecky/f8814178b3367219544e to your computer and use it in GitHub Desktop.
nginx / unicorn rack middleware to get a client cert to the puppetmaster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def in_groups_of(n) | |
chars.each_slice(n).map(&:join).join("\n") | |
end | |
end | |
class SSL_Middleware | |
def initialize(app, options = {}) | |
@app = app | |
@options = options | |
end | |
def call(env) | |
env["SSL_CLIENT_CERT"] = "-----BEGIN CERTIFICATE-----\n%s\n-----END CERTIFICATE-----" % [env["HTTP_SSL_CLIENT_CERT"].in_groups_of(65)] | |
# continue processing | |
@app.call(env) | |
end | |
end | |
use SSL_Middleware |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Place this at the top of your /etc/puppet/config.ru to enable trusted facts in a nginx/unicorn configuration.
This will solve the issue of getting tons of "TrustedInformation expected a certificate, but none was given." in your puppet logs.