Skip to content

Commit 750902d

Browse files
committed
(PUP-11120) Load trusted_oid_mapping_file when showing a cert
Commit 68a10c6 allowed `puppet cert print` to translate custom oids into their respective long name. This functionality was lost during the move to `puppet ssl show` and this commit readds it. Prior to this commit, we would see: $ puppet ssl show | grep -A2 X509v3 X509v3 extensions: 1.3.6.1.4.1.34380.1.2.1.1: ..somevalue With this commit, the custom oid is translated to its long name: X509v3 extensions: Long name: ..somevalue
1 parent 48dd760 commit 750902d

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

lib/puppet/application/ssl.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ def main
117117
end
118118

119119
Puppet::SSL::Oids.register_puppet_oids
120+
Puppet::SSL::Oids.load_custom_oid_file(Puppet[:trusted_oid_mapping_file])
120121

121122
certname = Puppet[:certname]
122123
action = command_line.args.first
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
require 'spec_helper'
2+
3+
describe "puppet ssl", unless: Puppet::Util::Platform.jruby? do
4+
context "print" do
5+
it 'translates custom oids to their long name' do
6+
basedir = File.expand_path("#{__FILE__}/../../../fixtures/ssl")
7+
# registering custom oids changes global state, so shell out
8+
output =
9+
%x{puppet ssl show \
10+
--certname oid \
11+
--localcacert #{basedir}/ca.pem \
12+
--hostcrl #{basedir}/crl.pem \
13+
--hostprivkey #{basedir}/oid-key.pem \
14+
--hostcert #{basedir}/oid.pem \
15+
--trusted_oid_mapping_file #{basedir}/trusted_oid_mapping.yaml 2>&1
16+
}
17+
expect(output).to match(/Long name:/)
18+
end
19+
end
20+
end

0 commit comments

Comments
 (0)