-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #23211 - Token based PuppetCA autosigning
Removes old autosigning endpoints and adds new ones that take a incoming CSR from puppet, extract the token and forward it to foreman for verfication.
- Loading branch information
Julian Todt
committed
May 3, 2018
1 parent
8a4bd9c
commit f693783
Showing
10 changed files
with
173 additions
and
149 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module Proxy::PuppetCa | ||
module DependencyInjection | ||
include Proxy::DependencyInjection::Accessors | ||
def container_instance | ||
@container_instance ||= ::Proxy::Plugins.instance.find {|p| p[:name] == :puppetca }[:di_container] | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module ::Proxy::PuppetCa | ||
class PluginConfiguration | ||
def load_classes | ||
require 'puppetca/puppetca_certmanager' | ||
require 'puppetca/dependency_injection' | ||
require 'puppetca/puppetca_api' | ||
end | ||
|
||
def load_dependency_injection_wirings(container_instance, settings) | ||
container_instance.dependency :cert_manager, lambda { ::Proxy::PuppetCa::Certmanager.new } | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
require 'puppetca/plugin_configuration' | ||
require 'puppetca/puppetca_plugin' | ||
|
||
module Proxy::PuppetCa; end |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module Proxy::PuppetCa | ||
class CSR | ||
attr_reader :csr | ||
|
||
def initialize(raw_csr) | ||
@csr = OpenSSL::X509::Request.new(raw_csr) | ||
end | ||
|
||
def challenge_password | ||
attribute = custom_attributes.detect do |attr| | ||
['challengePassword', '1.2.840.113549.1.9.7'].include?(attr[:oid]) | ||
end | ||
attribute ? attribute[:value] : nil | ||
end | ||
|
||
def custom_attributes | ||
@csr.attributes.map do |attr| | ||
{ | ||
oid: attr.oid, | ||
value: attr.value.value.first.value | ||
} | ||
end | ||
end | ||
end | ||
end |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
require 'test_helper' | ||
require 'puppetca/puppetca_plugin' | ||
require 'puppetca/puppetca' | ||
|
||
class PuppetCAConfigTest < Test::Unit::TestCase | ||
def test_omitted_settings_have_default_values | ||
Proxy::PuppetCa::Plugin.load_test_settings({}) | ||
assert_equal '/var/lib/puppet/ssl', Proxy::PuppetCa::Plugin.settings.ssldir | ||
assert_equal '/etc/puppet/autosign.conf', Proxy::PuppetCa::Plugin.settings.autosignfile | ||
assert_equal false, Proxy::PuppetCa::Plugin.settings.sign_all | ||
end | ||
end |
Oops, something went wrong.